Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: import.imported_module.get().is_none() #126376

Closed
matthiaskrgr opened this issue Jun 13, 2024 · 2 comments · Fixed by #126568
Closed

ICE: import.imported_module.get().is_none() #126376

matthiaskrgr opened this issue Jun 13, 2024 · 2 comments · Fixed by #126568
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 13, 2024

auto-reduced (treereduce-rust):

mod a {
    pub mod b {
        pub mod c {
            pub trait D {}
        }
    }
}

use a::*;

use e as b;

use b::c::D as e;

fn e() {}

original:

// https://github.com/rust-lang/rust/issues/125013

mod a {
  pub mod b {
    pub mod c {
      pub trait D {}
    }
  }
}

use a::*;

use e as b;
//~^ ERROR: unresolved import `e`
use b::c::D as e;
//~^ ERROR: cannot determine resolution for the import
//~| ERROR: cannot determine resolution for the import

fn e() { }

Version information

rustc 1.81.0-nightly (c25ac9d6c 2024-06-12)
binary: rustc
commit-hash: c25ac9d6cc285e57e1176dc2da6848b9d0163810
commit-date: 2024-06-12
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

thread 'rustc' panicked at compiler/rustc_resolve/src/imports.rs:938:21:
assertion failed: import.imported_module.get().is_none()
stack backtrace:
   0:     0x7be9c715fae5 - std::backtrace_rs::backtrace::libunwind::trace::h6be50cef0e090531
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7be9c715fae5 - std::backtrace_rs::backtrace::trace_unsynchronized::h84167074cb4f1713
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7be9c715fae5 - std::sys_common::backtrace::_print_fmt::hb5cf039fd1f30b07
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7be9c715fae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h01adaba1565f117f
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7be9c71b077b - core::fmt::rt::Argument::fmt::h2910e36f4e21d32d
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/core/src/fmt/rt.rs:165:63
   5:     0x7be9c71b077b - core::fmt::write::h6d9d2f7ff8571b34
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/core/src/fmt/mod.rs:1168:21
   6:     0x7be9c71546bf - std::io::Write::write_fmt::hd882c0f914f56bf0
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/io/mod.rs:1835:15
   7:     0x7be9c715f8be - std::sys_common::backtrace::_print::hcc6c907dafd9aacb
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7be9c715f8be - std::sys_common::backtrace::print::h2c716a051c9b24be
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7be9c71622f9 - std::panicking::default_hook::{{closure}}::he8ad829f77bd4e23
  10:     0x7be9c716209c - std::panicking::default_hook::heb22a1402d2cff23
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/panicking.rs:292:9
  11:     0x7be9c38b2c9f - std[5c07af62f3786d14]::panicking::update_hook::<alloc[eebcfc85002bd7db]::boxed::Box<rustc_driver_impl[2b4723ede88f52b1]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7be9c7162bff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd8f0fcaec26c179e
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/alloc/src/boxed.rs:2076:9
  13:     0x7be9c7162bff - std::panicking::rust_panic_with_hook::hc9dbad8884217847
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/panicking.rs:801:13
  14:     0x7be9c71627f3 - std::panicking::begin_panic_handler::{{closure}}::hfdfb6c5ae8fe81a3
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/panicking.rs:660:13
  15:     0x7be9c715ffa9 - std::sys_common::backtrace::__rust_end_short_backtrace::h3b8888258ec03db5
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7be9c71624d4 - rust_begin_unwind
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/panicking.rs:658:5
  17:     0x7be9c71acd33 - core::panicking::panic_fmt::hefa4f153e9514c42
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/core/src/panicking.rs:74:14
  18:     0x7be9c71acdbc - core::panicking::panic::hb461493118d69f37
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/core/src/panicking.rs:148:5
  19:     0x7be9c5d213c7 - <rustc_resolve[b14fb066e2167f99]::Resolver>::resolve_crate::{closure#0}
  20:     0x7be9c5d12cc0 - <rustc_resolve[b14fb066e2167f99]::Resolver>::resolve_crate
  21:     0x7be9c50f555a - rustc_interface[8465b2f8b714accd]::passes::resolver_for_lowering_raw
  22:     0x7be9c50f47cd - rustc_query_impl[860f4585269295fe]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[860f4585269295fe]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f645b954b6a941ee]::query::erase::Erased<[u8; 16usize]>>
  23:     0x7be9c50f47b1 - <rustc_query_impl[860f4585269295fe]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[207868f0da9fe1eb]::ops::function::FnOnce<(rustc_middle[f645b954b6a941ee]::ty::context::TyCtxt, ())>>::call_once
  24:     0x7be9c59f4e1d - rustc_query_system[88bb5c8529314a04]::query::plumbing::try_execute_query::<rustc_query_impl[860f4585269295fe]::DynamicConfig<rustc_query_system[88bb5c8529314a04]::query::caches::SingleCache<rustc_middle[f645b954b6a941ee]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[860f4585269295fe]::plumbing::QueryCtxt, false>
  25:     0x7be9c59f4abd - rustc_query_impl[860f4585269295fe]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7be9c58d0782 - rustc_interface[8465b2f8b714accd]::interface::run_compiler::<core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>, rustc_driver_impl[2b4723ede88f52b1]::run_compiler::{closure#0}>::{closure#1}
  27:     0x7be9c58ef649 - std[5c07af62f3786d14]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8465b2f8b714accd]::util::run_in_thread_with_globals<rustc_interface[8465b2f8b714accd]::util::run_in_thread_pool_with_globals<rustc_interface[8465b2f8b714accd]::interface::run_compiler<core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>, rustc_driver_impl[2b4723ede88f52b1]::run_compiler::{closure#0}>::{closure#1}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>
  28:     0x7be9c58ef3fa - <<std[5c07af62f3786d14]::thread::Builder>::spawn_unchecked_<rustc_interface[8465b2f8b714accd]::util::run_in_thread_with_globals<rustc_interface[8465b2f8b714accd]::util::run_in_thread_pool_with_globals<rustc_interface[8465b2f8b714accd]::interface::run_compiler<core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>, rustc_driver_impl[2b4723ede88f52b1]::run_compiler::{closure#0}>::{closure#1}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[207868f0da9fe1eb]::result::Result<(), rustc_span[9012e0e35e67507c]::ErrorGuaranteed>>::{closure#2} as core[207868f0da9fe1eb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7be9c716ca7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd64233370b4bbb13
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/alloc/src/boxed.rs:2062:9
  30:     0x7be9c716ca7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8b9a0bf226b4eb10
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/alloc/src/boxed.rs:2062:9
  31:     0x7be9c716ca7b - std::sys::pal::unix::thread::Thread::new::thread_start::h25e4cee516ffa27e
                               at /rustc/c25ac9d6cc285e57e1176dc2da6848b9d0163810/library/std/src/sys/pal/unix/thread.rs:108:17
  32:     0x7be9c6f05ded - <unknown>
  33:     0x7be9c6f890dc - <unknown>
  34:                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: please make sure that you have updated to the latest nightly

note: rustc 1.81.0-nightly (c25ac9d6c 2024-06-12) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jun 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 13, 2024
@lqd
Copy link
Member

lqd commented Jun 13, 2024

cc @bvanjoi as this looks 99% like #125013 and you fixed that one recently ^^

@bvanjoi
Copy link
Contributor

bvanjoi commented Jun 13, 2024

@rustbot claim. I will investigate it in my spare time.

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Jun 17, 2024
@bors bors closed this as completed in ba26af3 Jun 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 17, 2024
Rollup merge of rust-lang#126568 - bvanjoi:fix-126376, r=petrochenkov

mark undetermined if target binding in current ns is not got

Fixes rust-lang#126376
Fixes rust-lang#126389

Add a branch to handle more cases...

r? `@petrochenkov`
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants