Repository: rust
Issue: ICE: The Rust Compiler Panicked After I Removed A Windows SDK
Labels: I-crash,A-LLVM,I-ICE,T-compiler,O-windows-msvc,C-bug,S-needs-repro

The Rust compiler worked fine on my Windows desktop computer for a while (starting with the version 1.78). One day after I removed a Windows 10 SDK from Visual Studio Installer, the rustc is never able to compile any bevy example. I tried adding one Windows 10 SDK back to my system(I cannot remember the exact version I uninstalled), the result is still failure.

My operating system is Windows 10 Professional 22H2. The only Windows SDK left on my computer is Windows 11 SDK(10.0.22621.0)

Below are the error messages I get after I tried "cargo run --example breakout" on latest trunk code of bevy code(or any other branch).

====================================================================================

```

thread 'rustc' panicked at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9\compiler\rustc_middle\src\hir\mod.rs:188:33:
index out of bounds: the len is 11223 but the index is 2660552760
stack backtrace:
Compiling lewton v0.10.2
0: 0x7ffbb9453b3d - std::backtrace_rs::backtrace::dbghelp64::trace
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src....\backtrace\src\backtrace\dbghelp64.rs:91
1: 0x7ffbb9453b3d - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src....\backtrace\src\backtrace\mod.rs:66
2: 0x7ffbb9453b3d - std::sys_common::backtrace::_print_fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:68
3: 0x7ffbb9453b3d - std::sys_common::backtrace::_print::impl$0::fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:44
4: 0x7ffbb9484779 - core::fmt::rt::Argument::fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\fmt\rt.rs:165
5: 0x7ffbb9484779 - core::fmt::write
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\fmt\mod.rs:1168
6: 0x7ffbb944a391 - std::io::Write::write_fmtstd::sys::pal::windows::stdio::Stderr
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\io\mod.rs:1835
7: 0x7ffbb9453916 - std::sys_common::backtrace::print
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:34
8: 0x7ffbb9456af8 - std::panicking::default_hook::closure$1
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:271
9: 0x7ffbb94567a6 - std::panicking::default_hook
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:298
Compiling fnv v1.0.7
10: 0x7ffbb550a39c - memchr
11: 0x7ffbb9457127 - alloc::boxed::impl$50::call
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\alloc\src\boxed.rs:2077
12: 0x7ffbb9457127 - std::panicking::rust_panic_with_hook
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:799
13: 0x7ffbb9456fb7 - std::panicking::begin_panic_handler::closure$0
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:664
14: 0x7ffbb94544af - std::sys_common::backtrace::__rust_end_short_backtracestd::panicking::begin_panic_handler::closure_env$0,never$
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:171
15: 0x7ffbb9456c68 - std::panicking::begin_panic_handler
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:652
16: 0x7ffbb94ad124 - core::panicking::panic_fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\panicking.rs:72
17: 0x7ffbb94ad35e - core::panicking::panic_bounds_check
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\panicking.rs:274
18: 0x7ffbb41c7019 - <tracing_subscriber[9cea76178f68bf35]::registry::sharded::Registry as core[788d601b121ab5d5]::default::Default>::default
19: 0x7ffbb4be185a - rustc_query_impl[f16a2bc9f261c9b3]::plumbing::query_key_hash_verify_all
20: 0x7ffbb4b2a264 - rustc_ty_utils[8ea27dfdeb4a5d12]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
21: 0x7ffbb4be2c43 - rustc_query_impl[f16a2bc9f261c9b3]::plumbing::query_key_hash_verify_all
22: 0x7ffbb538441c - <rustc_middle[1c821902dd0c6a84]::hir::map::Map>::attrs
23: 0x7ffbb49f59d0 - <pulldown_cmark[abc25a02e03f5439]::parse::Parser as core[788d601b121ab5d5]::iter::traits::iterator::Iterator>::next
24: 0x7ffbb49e5067 - <pulldown_cmark[abc25a02e03f5439]::parse::Parser as core[788d601b121ab5d5]::iter::traits::iterator::Iterator>::next
25: 0x7ffbb4a02295 - <rustc_passes[26ec330937c00dd5]::check_attr::CheckAttrVisitor as rustc_hir[14dff18277ee88c]::intravisit::Visitor>::visit_impl_item
26: 0x7ffbb4a024cd - rustc_passes[26ec330937c00dd5]::check_attr::check_mod_attrs
27: 0x7ffbb3db3efa - <dyn std[4f3d19e5cfafb1ab]::io::Write as nu_ansi_term[383177f773185f1f]::write::AnyWrite>::write_str
28: 0x7ffbb3d43f78 - rustc_ty_utils[8ea27dfdeb4a5d12]::ty::adt_sized_constraint
Compiling vec_map v0.8.2
29: 0x7ffbb3dc74b1 - rustc_query_impl[f16a2bc9f261c9b3]::query_system
30: 0x7ffbb41d01af - rustc_interface[910c478ad43be9b7]::passes::analysis
31: 0x7ffbb3db5aaa - <dyn std[4f3d19e5cfafb1ab]::io::Write as nu_ansi_term[383177f773185f1f]::write::AnyWrite>::write_str
32: 0x7ffbb3d2ca01 - rustc_ty_utils[8ea27dfdeb4a5d12]::ty::adt_sized_constraint
33: 0x7ffbb3dbe577 - rustc_query_impl[f16a2bc9f261c9b3]::query_system
34: 0x7ffbb143653d - _wpgmptr
35: 0x7ffbb1433806 - _wpgmptr
36: 0x7ffbb143b3a9 - _wpgmptr
37: 0x7ffbb946832d - alloc::boxed::impl$48::call_once
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\alloc\src\boxed.rs:2063
38: 0x7ffbb946832d - alloc::boxed::impl$48::call_once
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\alloc\src\boxed.rs:2063
39: 0x7ffbb946832d - std::sys::pal::windows::thread::impl$0::new::thread_start
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys\pal\windows\thread.rs:52
40: 0x7ffbfbc47374 - BaseThreadInitThunk
41: 0x7ffbfd05cc91 - RtlUserThreadStart

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.80.0 (https://github.com/rust-lang/rust/commit/051478957371ee0084a7c0913941d2a8c4757bb9 2024-07-21) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
panicked at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9\compiler\rustc_hir\src\definitions.rs:81:26:
thread panicked while processing panic. aborting.
thread 'rustc' panicked at /rust/deps\indexmap-2.2.6\src\map\core.rs:37:15:
index out of bounds: the len is 3584 but the index is 9007199254744067
stack backtrace:
0: 0x7ffbb9453b3d - std::backtrace_rs::backtrace::dbghelp64::trace
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src....\backtrace\src\backtrace\dbghelp64.rs:91
1: 0x7ffbb9453b3d - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src....\backtrace\src\backtrace\mod.rs:66
2: 0x7ffbb9453b3d - std::sys_common::backtrace::_print_fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:68
3: 0x7ffbb9453b3d - std::sys_common::backtrace::_print::impl$0::fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:44
4: 0x7ffbb9484779 - core::fmt::rt::Argument::fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\fmt\rt.rs:165
5: 0x7ffbb9484779 - core::fmt::write
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\fmt\mod.rs:1168
6: 0x7ffbb944a391 - std::io::Write::write_fmtstd::sys::pal::windows::stdio::Stderr
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\io\mod.rs:1835
7: 0x7ffbb9453916 - std::sys_common::backtrace::print
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:34
8: 0x7ffbb9456af8 - std::panicking::default_hook::closure$1
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:271
9: 0x7ffbb94567a6 - std::panicking::default_hook
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:298
Compiling fontdb v0.16.2
10: 0x7ffbb550a39c - memchr
11: 0x7ffbb9457127 - alloc::boxed::impl$50::call
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\alloc\src\boxed.rs:2077
12: 0x7ffbb9457127 - std::panicking::rust_panic_with_hook
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:799
13: 0x7ffbb9456fb7 - std::panicking::begin_panic_handler::closure$0
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:664
14: 0x7ffbb94544af - std::sys_common::backtrace::__rust_end_short_backtracestd::panicking::begin_panic_handler::closure_env$0,never$
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys_common\backtrace.rs:171
15: 0x7ffbb9456c68 - std::panicking::begin_panic_handler
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\panicking.rs:652
16: 0x7ffbb94ad124 - core::panicking::panic_fmt
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\panicking.rs:72
17: 0x7ffbb94ad35e - core::panicking::panic_bounds_check
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\core\src\panicking.rs:274
18: 0x7ffbb490dc72 - <rustc_ast_lowering[a0da7e0c932a075]::LoweringContext>::lower_generic_param
19: 0x7ffbb49bb699 - <rustc_resolve[8978f99e429eaae2]::Resolver>::into_outputs
20: 0x7ffbb49b2b80 - <rustc_resolve[8978f99e429eaae2]::Resolver>::into_outputs
21: 0x7ffbb490f6f3 - <rustc_ast_lowering[a0da7e0c932a075]::LoweringContext>::lower_generic_param
22: 0x7ffbb4965d57 - <rustc_resolve[8978f99e429eaae2]::late::LateResolutionVisitor as rustc_ast[552c7cfc53262d22]::visit::Visitor>::visit_fn
23: 0x7ffbb4913e6e - <rustc_ast_lowering[a0da7e0c932a075]::LoweringContext>::lower_generic_param
24: 0x7ffbb4949640 - <rustc_resolve[8978f99e429eaae2]::late::LateResolutionVisitor as rustc_ast[552c7cfc53262d22]::visit::Visitor>::visit_item
25: 0x7ffbb4913efe - <rustc_ast_lowering[a0da7e0c932a075]::LoweringContext>::lower_generic_param
26: 0x7ffbb494a25e - <rustc_resolve[8978f99e429eaae2]::late::LateResolutionVisitor as rustc_ast[552c7cfc53262d22]::visit::Visitor>::visit_item
27: 0x7ffbb4913efe - <rustc_ast_lowering[a0da7e0c932a075]::LoweringContext>::lower_generic_param
28: 0x7ffbb494a25e - <rustc_resolve[8978f99e429eaae2]::late::LateResolutionVisitor as rustc_ast[552c7cfc53262d22]::visit::Visitor>::visit_item
29: 0x7ffbb4913efe - <rustc_ast_lowering[a0da7e0c932a075]::LoweringContext>::lower_generic_param
30: 0x7ffbb494a25e - <rustc_resolve[8978f99e429eaae2]::late::LateResolutionVisitor as rustc_ast[552c7cfc53262d22]::visit::Visitor>::visit_item
31: 0x7ffbb4998a86 - <rustc_resolve[8978f99e429eaae2]::Resolver>::into_outputs
32: 0x7ffbb3cdd7e4 - <rustc_resolve[8978f99e429eaae2]::Resolver>::resolve_crate
33: 0x7ffbb41cdb16 - rustc_interface[910c478ad43be9b7]::passes::resolver_for_lowering_raw
34: 0x7ffbb3db5531 - <dyn std[4f3d19e5cfafb1ab]::io::Write as nu_ansi_term[383177f773185f1f]::write::AnyWrite>::write_str
35: 0x7ffbb3da034d - <dyn std[4f3d19e5cfafb1ab]::io::Write as nu_ansi_term[383177f773185f1f]::write::AnyWrite>::write_str
36: 0x7ffbb3d29a14 - rustc_ty_utils[8ea27dfdeb4a5d12]::ty::adt_sized_constraint
37: 0x7ffbb3dbce36 - rustc_query_impl[f16a2bc9f261c9b3]::query_system
38: 0x7ffbb40ce1c0 - <rustc_middle[1c821902dd0c6a84]::ty::context::TyCtxt>::resolver_for_lowering
39: 0x7ffbb14363d5 - _wpgmptr
40: 0x7ffbb1433806 - _wpgmptr
41: 0x7ffbb143b3a9 - _wpgmptr
42: 0x7ffbb946832d - alloc::boxed::impl$48::call_once
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\alloc\src\boxed.rs:2063
43: 0x7ffbb946832d - alloc::boxed::impl$48::call_once
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\alloc\src\boxed.rs:2063
44: 0x7ffbb946832d - std::sys::pal::windows::thread::impl$0::new::thread_start
at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library\std\src\sys\pal\windows\thread.rs:52
45: 0x7ffbfbc47374 - BaseThreadInitThunk
46: 0x7ffbfd05cc91 - RtlUserThreadStart

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.80.0 (https://github.com/rust-lang/rust/commit/051478957371ee0084a7c0913941d2a8c4757bb9 2024-07-21) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack

```