rust-lang/rust

ICE `assertion failed: import.imported_module.get().is_none()` `--edition=2021`

matthiaskrgr opened this issue · 4 comments

Code

rustc --edition=2021 file.rs

#[std( = )]
extern crate blah as std;
use std::arch;

Meta

rustc --version --verbose:

binary: rustc
commit-hash: 22f247c6f3ed388cb702d01c2ff27da658a8b353
commit-date: 2023-03-13
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

error[E0463]: can't find crate for `blah`
 --> treereduce.out:2:1
  |
2 | extern crate blah as std;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
 --> treereduce.out:2:1
  |
2 | extern crate blah as std;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace

thread 'rustc' panicked at 'assertion failed: import.imported_module.get().is_none()', compiler/rustc_resolve/src/imports.rs:745:21
stack backtrace:
   0:     0x7fa2bbab151a - std::backtrace_rs::backtrace::libunwind::trace::h1ac6254167c780d9
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fa2bbab151a - std::backtrace_rs::backtrace::trace_unsynchronized::hec2af85915e24f36
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa2bbab151a - std::sys_common::backtrace::_print_fmt::h58a4e3535fcce206
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fa2bbab151a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5107e13758b8321c
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fa2bbb14c5e - core::fmt::write::h2e851dc027730d81
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/fmt/mod.rs:1232:17
   5:     0x7fa2bbaa4375 - std::io::Write::write_fmt::hca00074de9f85084
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/io/mod.rs:1684:15
   6:     0x7fa2bbab12e5 - std::sys_common::backtrace::_print::h870053c845cddf24
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fa2bbab12e5 - std::sys_common::backtrace::print::hb56add862f96c5fd
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fa2bbab405f - std::panicking::default_hook::{{closure}}::h636d4ba3ff8fdc46
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:271:22
   9:     0x7fa2bbab3d9b - std::panicking::default_hook::hf29b58145ee6e43c
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:290:9
  10:     0x7fa2ba8580c5 - <rustc_driver_impl[74350ec99973fded]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[2011dc7817943e09]::ops::function::FnOnce<(&core[2011dc7817943e09]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fa2bbab489d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7342d57f33f6634f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:2002:9
  12:     0x7fa2bbab489d - std::panicking::rust_panic_with_hook::hbf9ef936d990c16f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:696:13
  13:     0x7fa2bbab45d2 - std::panicking::begin_panic_handler::{{closure}}::h6be6433dcb901f4b
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:581:13
  14:     0x7fa2bbab1986 - std::sys_common::backtrace::__rust_end_short_backtrace::h802b6104a4d80829
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7fa2bbab4322 - rust_begin_unwind
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:579:5
  16:     0x7fa2bbb10fb3 - core::panicking::panic_fmt::hf7a8a88b9669732e
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/panicking.rs:64:14
  17:     0x7fa2bbb1104d - core::panicking::panic::h23010f9a5cb8b3d2
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/panicking.rs:114:5
  18:     0x7fa2b99a6883 - <rustc_resolve[d14f6814014285f]::Resolver>::finalize_import
  19:     0x7fa2b99a4531 - <rustc_resolve[d14f6814014285f]::Resolver>::finalize_imports
  20:     0x7fa2b9942d1e - <rustc_session[a360c2d099171c08]::session::Session>::time::<(), <rustc_resolve[d14f6814014285f]::Resolver>::resolve_crate::{closure#0}>
  21:     0x7fa2b99403f8 - rustc_interface[ceda1fd77ec39e1b]::passes::resolver_for_lowering
  22:     0x7fa2ba05eb8f - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query::<rustc_query_impl[eb95ff51c492efdd]::queries::resolver_for_lowering, rustc_query_impl[eb95ff51c492efdd]::plumbing::QueryCtxt>
  23:     0x7fa2ba05e890 - <rustc_query_impl[eb95ff51c492efdd]::Queries as rustc_middle[eaae5d2a0b8f0144]::ty::query::QueryEngine>::resolver_for_lowering
  24:     0x7fa2b9e8f1f4 - <rustc_middle[eaae5d2a0b8f0144]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[75b47a18491287a9]::steal::Steal<(rustc_middle[eaae5d2a0b8f0144]::ty::ResolverAstLowering, alloc[b7ae3602ac956de8]::rc::Rc<rustc_ast[648a34948e2edeac]::ast::Crate>)>>
  25:     0x7fa2b9a8ee32 - rustc_span[18b84908941c7cdf]::with_source_map::<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  26:     0x7fa2b9a8616c - std[1337fb43929788f1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ceda1fd77ec39e1b]::util::run_in_thread_pool_with_globals<rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>
  27:     0x7fa2b9a85b9a - <<std[1337fb43929788f1]::thread::Builder>::spawn_unchecked_<rustc_interface[ceda1fd77ec39e1b]::util::run_in_thread_pool_with_globals<rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#1} as core[2011dc7817943e09]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x7fa2bbabe793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7e0474dd3b8659fa
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  29:     0x7fa2bbabe793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heb8c41cf543a5c11
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  30:     0x7fa2bbabe793 - std::sys::unix::thread::Thread::new::thread_start::hc791abe67253fe06
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys/unix/thread.rs:108:17
  31:     0x7fa2b7460bb5 - <unknown>
  32:     0x7fa2b74e2d90 - <unknown>
  33:                0x0 - <unknown>

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.70.0-nightly (22f247c6f 2023-03-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.

@rustbot label +S-bug-has-mcve

I'm having trouble understanding this ICE. Could someone point me in the right direction? Thanks for your help!

@rustbot release-assignment

I'm finding this quite hard. For anyone else:

finding bors merge commits
found 7 bors merge commits in the specified range
  commit[0] 2021-12-01: Auto merge of #91433 - matthiaskrgr:rollup-118ql06, r=matthiaskrgr
  commit[1] 2021-12-01: Auto merge of #90446 - cjgillot:late-elided, r=jackh726
  commit[2] 2021-12-02: Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa
  commit[3] 2021-12-02: Auto merge of #91291 - GuillaumeGomez:const-deref-method, r=camelid
  commit[4] 2021-12-02: Auto merge of #91354 - fee1-dead:const_env, r=spastorino
  commit[5] 2021-12-02: Auto merge of #91455 - matthiaskrgr:rollup-gix2hy6, r=matthiaskrgr
  commit[6] 2021-12-02: Auto merge of #91318 - eggyal:reduce-boilerplate-around-infallible-folders, r=jackh726
ERROR: no CI builds available between 48a5999fceeea84a8971634355287faa349909d4 and acbe4443cc4c9695c0b74a7b64b60333c990a400 within last 167 days

I suspect #91313 is responsible.