Skip to content

ICE inconsistent resolution for an import #109153

@matthiaskrgr

Description

@matthiaskrgr
Member

Code

use foo::*;

mod foo {
    pub mod bar {
        pub mod bar {
            pub mod bar {}
        }
    }
}

use bar::bar;
use bar::*;

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (22f247c6f 2023-03-13)
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

<output>
Backtrace

thread 'rustc' panicked at 'compiler/rustc_resolve/src/imports.rs:704:25: inconsistent resolution for an import', /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/compiler/rustc_middle/src/util/bug.rs:36:26
stack backtrace:
   0:     0x7f57eb2c259a - std::backtrace_rs::backtrace::libunwind::trace::h595f06c70adcc478
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f57eb2c259a - std::backtrace_rs::backtrace::trace_unsynchronized::h177a0149c76cdde9
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f57eb2c259a - std::sys_common::backtrace::_print_fmt::hc0701fd2c3530c58
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f57eb2c259a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4cd115d8750fd6c
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f57eb32439e - core::fmt::write::h93e2f5923c7eca08
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/fmt/mod.rs:1213:17
   5:     0x7f57eb2b2be5 - std::io::Write::write_fmt::h8162dbb45f0b9e62
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/io/mod.rs:1682:15
   6:     0x7f57eb2c2365 - std::sys_common::backtrace::_print::h1835ef8a8f9066da
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f57eb2c2365 - std::sys_common::backtrace::print::hcb5e6388b9235f41
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f57eb2c512f - std::panicking::default_hook::{{closure}}::h9c084969ccf9a722
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:267:22
   9:     0x7f57eb2c4e6b - std::panicking::default_hook::h68fa2ba3c3c6c12f
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:286:9
  10:     0x7f57ea0b56e4 - <rustc_driver[f4ad927b3c57833d]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[d16e85342ea223d9]::ops::function::FnOnce<(&core[d16e85342ea223d9]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f57eb2c596a - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4e6ced11e07d8b24
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/alloc/src/boxed.rs:2002:9
  12:     0x7f57eb2c596a - std::panicking::rust_panic_with_hook::h8d5c434518ef298c
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:692:13
  13:     0x7f57eaaf07f2 - std[3da461b304582a2c]::panicking::begin_panic::<alloc[5b05b59796bdfb5c]::string::String>::{closure#0}
  14:     0x7f57eaaf032a - std[3da461b304582a2c]::sys_common::backtrace::__rust_end_short_backtrace::<std[3da461b304582a2c]::panicking::begin_panic<alloc[5b05b59796bdfb5c]::string::String>::{closure#0}, !>
  15:     0x7f57eaab8351 - std[3da461b304582a2c]::panicking::begin_panic::<alloc[5b05b59796bdfb5c]::string::String>
  16:     0x7f57eaa9f85d - rustc_middle[eb7209f5870e9fb7]::util::bug::opt_span_bug_fmt::<rustc_span[4bb3e3ecb57f95d5]::span_encoding::Span>::{closure#0}
  17:     0x7f57eaa9f8da - rustc_middle[eb7209f5870e9fb7]::ty::context::tls::with_opt::<rustc_middle[eb7209f5870e9fb7]::util::bug::opt_span_bug_fmt<rustc_span[4bb3e3ecb57f95d5]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  18:     0x7f57eaa9f0c6 - rustc_middle[eb7209f5870e9fb7]::ty::context::tls::with_context_opt::<rustc_middle[eb7209f5870e9fb7]::ty::context::tls::with_opt<rustc_middle[eb7209f5870e9fb7]::util::bug::opt_span_bug_fmt<rustc_span[4bb3e3ecb57f95d5]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  19:     0x7f57eaa9f086 - rustc_middle[eb7209f5870e9fb7]::util::bug::opt_span_bug_fmt::<rustc_span[4bb3e3ecb57f95d5]::span_encoding::Span>
  20:     0x7f57eaa9f044 - rustc_middle[eb7209f5870e9fb7]::util::bug::span_bug_fmt::<rustc_span[4bb3e3ecb57f95d5]::span_encoding::Span>
  21:     0x7f57e92fbd37 - <rustc_resolve[b9ffdbb06ddc059e]::imports::ImportResolver>::finalize_import
  22:     0x7f57e92f9bfd - <rustc_resolve[b9ffdbb06ddc059e]::imports::ImportResolver>::finalize_imports
  23:     0x7f57e92a2132 - <rustc_session[b580c712976fc965]::session::Session>::time::<(), <rustc_resolve[b9ffdbb06ddc059e]::Resolver>::resolve_crate::{closure#0}>
  24:     0x7f57e92a05b1 - rustc_interface[3781616314f5d936]::passes::configure_and_expand
  25:     0x7f57e929fac6 - <rustc_interface[3781616314f5d936]::queries::Queries>::expansion
  26:     0x7f57e929a719 - <rustc_interface[3781616314f5d936]::queries::Queries>::global_ctxt
  27:     0x7f57e929320d - rustc_span[4bb3e3ecb57f95d5]::with_source_map::<core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>, rustc_interface[3781616314f5d936]::interface::run_compiler<core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>, rustc_driver[f4ad927b3c57833d]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  28:     0x7f57e928bce4 - <scoped_tls[1a6b834cb64348ef]::ScopedKey<rustc_span[4bb3e3ecb57f95d5]::SessionGlobals>>::set::<rustc_interface[3781616314f5d936]::interface::run_compiler<core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>, rustc_driver[f4ad927b3c57833d]::run_compiler::{closure#1}>::{closure#0}, core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>>
  29:     0x7f57e928b3e2 - std[3da461b304582a2c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3781616314f5d936]::util::run_in_thread_pool_with_globals<rustc_interface[3781616314f5d936]::interface::run_compiler<core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>, rustc_driver[f4ad927b3c57833d]::run_compiler::{closure#1}>::{closure#0}, core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>>
  30:     0x7f57e928b18a - <<std[3da461b304582a2c]::thread::Builder>::spawn_unchecked_<rustc_interface[3781616314f5d936]::util::run_in_thread_pool_with_globals<rustc_interface[3781616314f5d936]::interface::run_compiler<core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>, rustc_driver[f4ad927b3c57833d]::run_compiler::{closure#1}>::{closure#0}, core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d16e85342ea223d9]::result::Result<(), rustc_errors[41d09747e2f98dea]::ErrorGuaranteed>>::{closure#1} as core[d16e85342ea223d9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f57eb2cf823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1c0f3664d7ced314
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/alloc/src/boxed.rs:1988:9
  32:     0x7f57eb2cf823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h67647c21c6c4968a
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/alloc/src/boxed.rs:1988:9
  33:     0x7f57eb2cf823 - std::sys::unix::thread::Thread::new::thread_start::h355d348ba593a22c
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7f57e6c67bb5 - <unknown>
  35:     0x7f57e6ce9d90 - <unknown>
  36:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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.68.0 (2c8cc3432 2023-03-06) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Activity

added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
C-bugCategory: This is a bug.
on Mar 14, 2023
matthiaskrgr

matthiaskrgr commented on Mar 16, 2023

@matthiaskrgr
MemberAuthor
********************************************************************************
Regression in nightly-2018-11-20
********************************************************************************

fetching https://static.rust-lang.org/dist/2018-11-19/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2018-11-19: 40 B / 40 B [============================================================================================] 100.00 % 528.10 KB/s converted 2018-11-19 to 13c9439925797cd7a65c917d047c07a500d9bfe6
fetching https://static.rust-lang.org/dist/2018-11-20/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2018-11-20: 40 B / 40 B [============================================================================================] 100.00 % 549.84 KB/s converted 2018-11-20 to 5aff30734b0e1056b1003459fbb27af199f51822
looking for regression commit between 2018-11-19 and 2018-11-20
opening existing repository at "rust.git"
Found origin remote under name `origin`
refreshing repository at "rust.git"
fetching (via local git) commits from 13c9439925797cd7a65c917d047c07a500d9bfe6 to 5aff30734b0e1056b1003459fbb27af199f51822
opening existing repository at "rust.git"
Found origin remote under name `origin`
refreshing repository at "rust.git"
looking up first commit
looking up second commit
checking that commits are by bors and thus have ci artifacts...
finding bors merge commits
found 6 bors merge commits in the specified range
  commit[0] 2018-11-18UTC: Auto merge of #56017 - alexcrichton:debug-test, r=alexcrichton
  commit[1] 2018-11-18UTC: Auto merge of #55672 - RalfJung:miri-extern-types, r=eddyb
  commit[2] 2018-11-19UTC: Auto merge of #56042 - petrochenkov:nuni, r=petrochenkov
  commit[3] 2018-11-19UTC: Auto merge of #56051 - pietroalbini:rollup, r=pietroalbini
  commit[4] 2018-11-19UTC: Auto merge of #56060 - nrc:save-path-fallback, r=zackmdavis
  commit[5] 2018-11-19UTC: Auto merge of #55971 - SergioBenitez:skip-non-semantic, r=alexcrichton
ERROR: no CI builds available between 13c9439925797cd7a65c917d047c07a500d9bfe6 and 5aff30734b0e1056b1003459fbb27af199f51822 within last 167 days
langston-barrett

langston-barrett commented on Mar 17, 2023

@langston-barrett
Contributor

@rustbot label +S-bug-has-mcve

added
S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
on Mar 17, 2023
Ezrashaw

Ezrashaw commented on Mar 18, 2023

@Ezrashaw
Contributor

What is the expected output here? Can this actually compile, and if so, what bar does use bar::*; refer to?

added a commit that references this issue on Jun 14, 2023
98f6e96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @matthiaskrgr@langston-barrett@Ezrashaw@rustbot@rust-lang-glacier-bot

      Issue actions

        ICE `inconsistent resolution for an import` · Issue #109153 · rust-lang/rust