Skip to content

ICE: inconsistent resolution for an import #124490

@matthiaskrgr

Description

@matthiaskrgr
Member

auto-reduced (treereduce-rust):

use io::{self as std};
use std::collections::{self as io};

original:

use std::collections::{self as io};
use io::{self as std};

Version information

rustc 1.80.0-nightly (91d5e4af8 2024-04-28)
binary: rustc
commit-hash: 91d5e4af8674bde06096bac1e7ac04af0e94c691
commit-date: 2024-04-28
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zunstable-options --edition=2024

Program output

error: internal compiler error: compiler/rustc_resolve/src/imports.rs:884:25: inconsistent resolution for an import
 --> /tmp/icemaker_global_tempdir.7N3g3X1DaYFn/rustc_testrunner_tmpdir_reporting.hyRGLJm0FCJ6/mvce.rs:2:24
  |
2 | use std::collections::{self as io};
  |                        ^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_resolve/src/imports.rs:884:25:
Box<dyn Any>
stack backtrace:
   0:     0x7b6b0a636035 - std::backtrace_rs::backtrace::libunwind::trace::ha90ea7a57c64b8ab
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7b6b0a636035 - std::backtrace_rs::backtrace::trace_unsynchronized::ha58e55f622939b6e
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7b6b0a636035 - std::sys_common::backtrace::_print_fmt::h687007ed504e7e64
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7b6b0a636035 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hecfae54cdc6fec81
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7b6b0a68529b - core::fmt::rt::Argument::fmt::h1cf6305de42401ed
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/core/src/fmt/rt.rs:165:63
   5:     0x7b6b0a68529b - core::fmt::write::hb74fc275648248fb
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/core/src/fmt/mod.rs:1157:21
   6:     0x7b6b0a62abdf - std::io::Write::write_fmt::h5209ffd8e6502f0c
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/io/mod.rs:1832:15
   7:     0x7b6b0a635e0e - std::sys_common::backtrace::_print::h168707047d27c84e
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7b6b0a635e0e - std::sys_common::backtrace::print::h2942d174d6b0e46d
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7b6b0a638779 - std::panicking::default_hook::{{closure}}::h4215c46ca923b014
  10:     0x7b6b0a6384bd - std::panicking::default_hook::h887f937d01fa1b64
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/panicking.rs:298:9
  11:     0x7b6b06e40a1c - std[aaff33ccdb7ea7e2]::panicking::update_hook::<alloc[d1c3a5de2ae3927d]::boxed::Box<rustc_driver_impl[d0a4257edbfecd8c]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7b6b0a638e76 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfe27c2dc23f9f057
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/alloc/src/boxed.rs:2036:9
  13:     0x7b6b0a638e76 - std::panicking::rust_panic_with_hook::h6ef218c13552449b
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/panicking.rs:799:13
  14:     0x7b6b06e70374 - std[aaff33ccdb7ea7e2]::panicking::begin_panic::<rustc_errors[6ff9940fea39db99]::ExplicitBug>::{closure#0}
  15:     0x7b6b06e6cff6 - std[aaff33ccdb7ea7e2]::sys_common::backtrace::__rust_end_short_backtrace::<std[aaff33ccdb7ea7e2]::panicking::begin_panic<rustc_errors[6ff9940fea39db99]::ExplicitBug>::{closure#0}, !>
  16:     0x7b6b06e6ccd6 - std[aaff33ccdb7ea7e2]::panicking::begin_panic::<rustc_errors[6ff9940fea39db99]::ExplicitBug>
  17:     0x7b6b06e79181 - <rustc_errors[6ff9940fea39db99]::diagnostic::BugAbort as rustc_errors[6ff9940fea39db99]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7b6b076ede48 - <rustc_errors[6ff9940fea39db99]::DiagCtxt>::span_bug::<rustc_span[6a84a2dd20c85103]::span_encoding::Span, alloc[d1c3a5de2ae3927d]::string::String>
  19:     0x7b6b0770a73d - rustc_middle[783a1d49f02736b7]::util::bug::opt_span_bug_fmt::<rustc_span[6a84a2dd20c85103]::span_encoding::Span>::{closure#0}
  20:     0x7b6b0770a76a - rustc_middle[783a1d49f02736b7]::ty::context::tls::with_opt::<rustc_middle[783a1d49f02736b7]::util::bug::opt_span_bug_fmt<rustc_span[6a84a2dd20c85103]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7b6b07704c8b - rustc_middle[783a1d49f02736b7]::ty::context::tls::with_context_opt::<rustc_middle[783a1d49f02736b7]::ty::context::tls::with_opt<rustc_middle[783a1d49f02736b7]::util::bug::opt_span_bug_fmt<rustc_span[6a84a2dd20c85103]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7b6b05906ec7 - rustc_middle[783a1d49f02736b7]::util::bug::span_bug_fmt::<rustc_span[6a84a2dd20c85103]::span_encoding::Span>
  23:     0x7b6b0923d880 - <rustc_resolve[956dd1017de6f360]::Resolver>::resolve_crate::{closure#0}
  24:     0x7b6b09234c9c - <rustc_resolve[956dd1017de6f360]::Resolver>::resolve_crate
  25:     0x7b6b0881032b - rustc_interface[3360209938edb6a7]::passes::resolver_for_lowering_raw
  26:     0x7b6b0880f567 - rustc_query_impl[77a161a94332e7e1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77a161a94332e7e1]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 16usize]>>
  27:     0x7b6b0880f555 - <rustc_query_impl[77a161a94332e7e1]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[8db7010e98043ac]::ops::function::FnOnce<(rustc_middle[783a1d49f02736b7]::ty::context::TyCtxt, ())>>::call_once
  28:     0x7b6b09002e85 - rustc_query_system[61cd216fcfa07925]::query::plumbing::try_execute_query::<rustc_query_impl[77a161a94332e7e1]::DynamicConfig<rustc_query_system[61cd216fcfa07925]::query::caches::SingleCache<rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[77a161a94332e7e1]::plumbing::QueryCtxt, false>
  29:     0x7b6b09002a01 - rustc_query_impl[77a161a94332e7e1]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7b6b08ea30be - rustc_interface[3360209938edb6a7]::interface::run_compiler::<core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>, rustc_driver_impl[d0a4257edbfecd8c]::run_compiler::{closure#0}>::{closure#1}
  31:     0x7b6b08e727c9 - std[aaff33ccdb7ea7e2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3360209938edb6a7]::util::run_in_thread_with_globals<rustc_interface[3360209938edb6a7]::util::run_in_thread_pool_with_globals<rustc_interface[3360209938edb6a7]::interface::run_compiler<core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>, rustc_driver_impl[d0a4257edbfecd8c]::run_compiler::{closure#0}>::{closure#1}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>
  32:     0x7b6b08e72576 - <<std[aaff33ccdb7ea7e2]::thread::Builder>::spawn_unchecked_<rustc_interface[3360209938edb6a7]::util::run_in_thread_with_globals<rustc_interface[3360209938edb6a7]::util::run_in_thread_pool_with_globals<rustc_interface[3360209938edb6a7]::interface::run_compiler<core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>, rustc_driver_impl[d0a4257edbfecd8c]::run_compiler::{closure#0}>::{closure#1}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#2} as core[8db7010e98043ac]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7b6b0a642cab - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1c1c6804813d5e77
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/alloc/src/boxed.rs:2022:9
  34:     0x7b6b0a642cab - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3d84aa3b40a67b8f
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/alloc/src/boxed.rs:2022:9
  35:     0x7b6b0a642cab - std::sys::pal::unix::thread::Thread::new::thread_start::h60cefba2ee6cce64
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys/pal/unix/thread.rs:108:17
  36:     0x7b6b0a3e155a - <unknown>
  37:     0x7b6b0a45ea3c - <unknown>
  38:                0x0 - <unknown>

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.80.0-nightly (91d5e4af8 2024-04-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options -Z dump-mir-dir=dir

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


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 Apr 28, 2024
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Apr 28, 2024
matthiaskrgr

matthiaskrgr commented on Apr 28, 2024

@matthiaskrgr
MemberAuthor

also crashes with just --edition=2021

added
A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Apr 28, 2024
matthiaskrgr

matthiaskrgr commented on Apr 28, 2024

@matthiaskrgr
MemberAuthor

Regression in nightly-2023-07-01

commit[0] 2023-06-29: Auto merge of #112682 - spastorino:new-rpitit-21, r=compiler-errors
commit[1] 2023-06-30: Auto merge of #113116 - nnethercote:codegen-opts, r=oli-obk
commit[2] 2023-06-30: Auto merge of #113162 - matthiaskrgr:rollup-fct3wj7, r=matthiaskrgr
commit[3] 2023-06-30: Auto merge of #113188 - matthiaskrgr:rollup-j3abaks, r=matthiaskrgr
commit[4] 2023-06-30: Auto merge of #106619 - agausmann:avr-object-file, r=nagisa
commit[5] 2023-06-30: Auto merge of #109524 - bzEq:aix-embed-llvmbc, r=nagisa
commit[6] 2023-06-30: Auto merge of #113200 - ferrocene:pa-fix-mir-opt-bless, r=oli-obk

I suspect this is #112086

Noratrieb

Noratrieb commented on Apr 28, 2024

@Noratrieb
Member
use std::collections as x;
use x as std;

slightly more minimal (ordering is irrelevant)

bvanjoi

bvanjoi commented on Apr 29, 2024

@bvanjoi
Contributor

more reduced:

mod a {
    pub mod b {
        pub mod c {}
    } 
}

use a::*;

use b::c;
use c as b;

fn main() {}
added
S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.
on May 9, 2024
added a commit that references this issue on May 29, 2024

Auto merge of rust-lang#124840 - bvanjoi:fix-124490, r=<try>

6425815
added a commit that references this issue on Jun 4, 2024

Rollup merge of rust-lang#124840 - bvanjoi:fix-124490, r=petrochenkov

d8b288c

11 remaining items

Loading
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

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @matthiaskrgr@bvanjoi@jieyouxu@rustbot@Noratrieb

      Issue actions

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