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: inconsistent resolution for an import #113953

Closed
matthiaskrgr opened this issue Jul 22, 2023 · 4 comments · Fixed by #113980
Closed

ICE: inconsistent resolution for an import #113953

matthiaskrgr opened this issue Jul 22, 2023 · 4 comments · Fixed by #113980
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

need --edition=2021

use std;
use u8 as imported_u8;
pub use bar as u8;

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (0308df23e 2023-07-21)
binary: rustc
commit-hash: 0308df23e621e783e31a27ca5beaa01b9df60d4a
commit-date: 2023-07-21
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

<output>
Backtrace

error: internal compiler error: compiler/rustc_resolve/src/imports.rs:994:33: inconsistent resolution for an import
 --> treereduce.out:2:5
  |
2 | use u8 as imported_u8;
  |     ^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/compiler/rustc_errors/src/lib.rs:1007:33
stack backtrace:
   0:     0x7f0aa4d62fc1 - std::backtrace_rs::backtrace::libunwind::trace::h8f154b6a796326e2
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f0aa4d62fc1 - std::backtrace_rs::backtrace::trace_unsynchronized::hb8abeaf7dfb1c24b
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0aa4d62fc1 - std::sys_common::backtrace::_print_fmt::h3f47e60290db41a5
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f0aa4d62fc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4552f2dd442a589d
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0aa4dc949c - core::fmt::rt::Argument::fmt::h78a6be6446bd82bd
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/fmt/rt.rs:138:9
   5:     0x7f0aa4dc949c - core::fmt::write::hd14ae211f7dd66b2
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f0aa4d557ae - std::io::Write::write_fmt::hdc8c0b5c45666412
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/io/mod.rs:1714:15
   7:     0x7f0aa4d62dd5 - std::sys_common::backtrace::_print::h381fcf6b91d9d880
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0aa4d62dd5 - std::sys_common::backtrace::print::hcfe75c5be0f60777
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f0aa4d65e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::hfe5fad22482c9f6d
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:278:22
  10:     0x7f0aa4d65ac3 - std::panicking::panic_hook_with_disk_dump::hc822f132c197763d
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:312:9
  11:     0x7f0aa7f928b9 - rustc_driver_impl[fead4037fc65a3e4]::install_ice_hook::{closure#0}
  12:     0x7f0aa4d666d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h549a9102e6ec42b3
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2021:9
  13:     0x7f0aa4d666d0 - std::panicking::rust_panic_with_hook::h8adf1e4a5b603f89
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:733:13
  14:     0x7f0aa89d6041 - std[bbbc53192af03470]::panicking::begin_panic::<rustc_errors[5f83c55a23d0ef58]::ExplicitBug>::{closure#0}
  15:     0x7f0aa89d5f76 - std[bbbc53192af03470]::sys_common::backtrace::__rust_end_short_backtrace::<std[bbbc53192af03470]::panicking::begin_panic<rustc_errors[5f83c55a23d0ef58]::ExplicitBug>::{closure#0}, !>
  16:     0x7f0aa89dbd36 - std[bbbc53192af03470]::panicking::begin_panic::<rustc_errors[5f83c55a23d0ef58]::ExplicitBug>
  17:     0x7f0aa89cd1ce - <rustc_errors[5f83c55a23d0ef58]::HandlerInner>::span_bug::<rustc_span[a321f1cb1523dd0b]::span_encoding::Span, alloc[c920ce942076dd6e]::string::String>
  18:     0x7f0aa89cce3f - <rustc_errors[5f83c55a23d0ef58]::Handler>::span_bug::<rustc_span[a321f1cb1523dd0b]::span_encoding::Span, alloc[c920ce942076dd6e]::string::String>
  19:     0x7f0aa89cfb0d - rustc_middle[2e38e64f479fe5b8]::util::bug::opt_span_bug_fmt::<rustc_span[a321f1cb1523dd0b]::span_encoding::Span>::{closure#0}
  20:     0x7f0aa89cfb3a - rustc_middle[2e38e64f479fe5b8]::ty::context::tls::with_opt::<rustc_middle[2e38e64f479fe5b8]::util::bug::opt_span_bug_fmt<rustc_span[a321f1cb1523dd0b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f0aa89cf678 - rustc_middle[2e38e64f479fe5b8]::ty::context::tls::with_context_opt::<rustc_middle[2e38e64f479fe5b8]::ty::context::tls::with_opt<rustc_middle[2e38e64f479fe5b8]::util::bug::opt_span_bug_fmt<rustc_span[a321f1cb1523dd0b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f0aa89ceec4 - rustc_middle[2e38e64f479fe5b8]::util::bug::span_bug_fmt::<rustc_span[a321f1cb1523dd0b]::span_encoding::Span>
  23:     0x7f0aa703fc1d - <rustc_resolve[ae303a5d6effbad4]::Resolver>::finalize_import::{closure#1}
  24:     0x7f0aa703b3cb - <rustc_resolve[ae303a5d6effbad4]::Resolver>::finalize_import
  25:     0x7f0aa7039c32 - <rustc_resolve[ae303a5d6effbad4]::Resolver>::finalize_imports
  26:     0x7f0aa7015ac1 - <rustc_session[15d76b916424491d]::session::Session>::time::<(), <rustc_resolve[ae303a5d6effbad4]::Resolver>::resolve_crate::{closure#0}>
  27:     0x7f0aa700ef3a - rustc_interface[c9554cd0b74ea93d]::passes::resolver_for_lowering
  28:     0x7f0aa747c88a - rustc_query_impl[89227dfa721c8c03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[89227dfa721c8c03]::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7f0aa747c879 - <rustc_query_impl[89227dfa721c8c03]::query_impl::resolver_for_lowering::dynamic_query::{closure#2} as core[d7f3879bb305828b]::ops::function::FnOnce<(rustc_middle[2e38e64f479fe5b8]::ty::context::TyCtxt, ())>>::call_once
  30:     0x7f0aa73e70cc - rustc_query_system[c0a52eceb1a71305]::query::plumbing::try_execute_query::<rustc_query_impl[89227dfa721c8c03]::DynamicConfig<rustc_query_system[c0a52eceb1a71305]::query::caches::SingleCache<rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[89227dfa721c8c03]::plumbing::QueryCtxt, false>
  31:     0x7f0aa78ee835 - rustc_query_impl[89227dfa721c8c03]::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f0aa71d38a3 - <rustc_middle[2e38e64f479fe5b8]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[4d0670106038e5ac]::steal::Steal<(rustc_middle[2e38e64f479fe5b8]::ty::ResolverAstLowering, alloc[c920ce942076dd6e]::rc::Rc<rustc_ast[b395cbd05340d0a6]::ast::Crate>)>>
  33:     0x7f0aa71d2c9a - <rustc_interface[c9554cd0b74ea93d]::interface::Compiler>::enter::<rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}::{closure#2}, core[d7f3879bb305828b]::result::Result<core[d7f3879bb305828b]::option::Option<rustc_interface[c9554cd0b74ea93d]::queries::Linker>, rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
  34:     0x7f0aa71cff64 - std[bbbc53192af03470]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c9554cd0b74ea93d]::util::run_in_thread_pool_with_globals<rustc_interface[c9554cd0b74ea93d]::interface::run_compiler<core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>, rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}>::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
  35:     0x7f0aa71cf68e - <<std[bbbc53192af03470]::thread::Builder>::spawn_unchecked_<rustc_interface[c9554cd0b74ea93d]::util::run_in_thread_pool_with_globals<rustc_interface[c9554cd0b74ea93d]::interface::run_compiler<core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>, rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}>::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#1} as core[d7f3879bb305828b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7f0aa4d70dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5a713c95dff49eb9
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2007:9
  37:     0x7f0aa4d70dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6c2630f276b49e94
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2007:9
  38:     0x7f0aa4d70dc5 - std::sys::unix::thread::Thread::new::thread_start::he7c79aaf88d71e7c
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys/unix/thread.rs:108:17
  39:     0x7f0aa4b0244b - <unknown>
  40:     0x7f0aa4b85e40 - <unknown>
  41:                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 attach the file at `/tmp/im/rustc-ice-2023-07-22T09:14:40.068017531Z-3912339.txt` to your bug report

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

@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 Jul 22, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 22, 2023
@matthiaskrgr matthiaskrgr added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Jul 22, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 22, 2023
@matthiaskrgr
Copy link
Member Author

Crashes on 1.72.0-beta.2 but not on 1.71.0

@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-07-01
Regression in 97279e9
Regression in rust-lang-ci@ad537d4
#112086 cc @petrochenkov

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 22, 2023
@bvanjoi
Copy link
Contributor

bvanjoi commented Jul 23, 2023

reduced:

// edition: 2021
use u8 as imported_u8;
use bar as u8;

fn main() {}

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 24, 2023
@bors bors closed this as completed in 5b1dc9d Jul 25, 2023
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) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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