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: unreachable compiler/rustc_resolve/src/lib.rs #109343

Closed
matthiaskrgr opened this issue Mar 19, 2023 · 2 comments · Fixed by #109602
Closed

ICE: unreachable compiler/rustc_resolve/src/lib.rs #109343

matthiaskrgr opened this issue Mar 19, 2023 · 2 comments · Fixed by #109602
Assignees
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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.

Comments

@matthiaskrgr
Copy link
Member

Code

#![crate_type = "lib"]
extern crate f;

pub use inner::f;

/// [mod@std::env] [g]
pub use f as g;

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (13afbdaa0 2023-03-17)
binary: rustc
commit-hash: 13afbdaa0655dda23d7129e59ac48f1ec88b2084
commit-date: 2023-03-17
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 `f`
 --> treereduce.out:2:1
  |
2 | extern crate f;
  | ^^^^^^^^^^^^^^^ can't find crate

error[E0432]: unresolved import `inner`
 --> treereduce.out:4:9
  |
4 | pub use inner::f;
  |         ^^^^^ maybe a missing crate `inner`?
  |
  = help: consider adding `extern crate inner` to use the `inner` crate
Backtrace

thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:1866:67
stack backtrace:
   0:     0x7f5dcdf6739a - std::backtrace_rs::backtrace::libunwind::trace::h84d2711f38e4d049
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f5dcdf6739a - std::backtrace_rs::backtrace::trace_unsynchronized::h07f6ebc5344709db
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5dcdf6739a - std::sys_common::backtrace::_print_fmt::h05a29271ab24b307
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f5dcdf6739a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2badcaa62266c6d2
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f5dcdfca9be - core::fmt::write::h029bd029dcf67de1
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f5dcdf5a225 - std::io::Write::write_fmt::h80e1934b9bd451b8
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/io/mod.rs:1684:15
   6:     0x7f5dcdf67165 - std::sys_common::backtrace::_print::hd15e10f9274c89b0
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f5dcdf67165 - std::sys_common::backtrace::print::h170965e4e66b5ee4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f5dcdf69edf - std::panicking::default_hook::{{closure}}::h0164004bb09e0366
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:271:22
   9:     0x7f5dcdf69c1b - std::panicking::default_hook::h5e2940911ec5582f
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:290:9
  10:     0x7f5dd11f2415 - rustc_driver_impl[bad2ed848d64dbdc]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f5dcdf6a71d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0f3cc38fa49d6ba4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:2002:9
  12:     0x7f5dcdf6a71d - std::panicking::rust_panic_with_hook::h591d1df500c4db69
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:696:13
  13:     0x7f5dcdf6a452 - std::panicking::begin_panic_handler::{{closure}}::h88c33edc8ad15aaa
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:581:13
  14:     0x7f5dcdf67806 - std::sys_common::backtrace::__rust_end_short_backtrace::h8c0d0dd7ca5cd1b1
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f5dcdf6a1a2 - rust_begin_unwind
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:579:5
  16:     0x7f5dcdfc6d13 - core::panicking::panic_fmt::h4294102993ea4dab
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/panicking.rs:64:14
  17:     0x7f5dcdfc6dad - core::panicking::panic::h54e8b1f0022d1156
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/panicking.rs:114:5
  18:     0x7f5dd02b113e - <rustc_resolve[5ebb54ab859eb9b4]::Resolver>::resolve_rustdoc_path
  19:     0x7f5dd02af398 - <rustc_resolve[5ebb54ab859eb9b4]::late::LateResolutionVisitor>::resolve_and_cache_rustdoc_path
  20:     0x7f5dd02ab418 - <rustc_resolve[5ebb54ab859eb9b4]::late::LateResolutionVisitor>::resolve_doc_links
  21:     0x7f5dd0299f6c - <rustc_resolve[5ebb54ab859eb9b4]::late::LateResolutionVisitor>::resolve_item
  22:     0x7f5dd0299dd1 - <rustc_resolve[5ebb54ab859eb9b4]::late::LateResolutionVisitor as rustc_ast[7cb81b241be71e9a]::visit::Visitor>::visit_item
  23:     0x7f5dd0299c3d - <rustc_resolve[5ebb54ab859eb9b4]::Resolver>::late_resolve_crate
  24:     0x7f5dd02957ac - <rustc_session[8656a7a78cf578e4]::session::Session>::time::<(), <rustc_resolve[5ebb54ab859eb9b4]::Resolver>::resolve_crate::{closure#0}>
  25:     0x7f5dd028ec32 - rustc_interface[dde792dfc5bb5edd]::passes::resolver_for_lowering
  26:     0x7f5dd09f3cff - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::resolver_for_lowering, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  27:     0x7f5dd09f3a00 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::resolver_for_lowering
  28:     0x7f5dd0868f24 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[8426954b093953dd]::steal::Steal<(rustc_middle[eaf6378de1cdbfa8]::ty::ResolverAstLowering, alloc[c5857ad37805d36e]::rc::Rc<rustc_ast[7cb81b241be71e9a]::ast::Crate>)>>
  29:     0x7f5dd03f845c - <rustc_interface[dde792dfc5bb5edd]::interface::Compiler>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}, core[9847d4a2e8a02df2]::result::Result<core[9847d4a2e8a02df2]::option::Option<rustc_interface[dde792dfc5bb5edd]::queries::Linker>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  30:     0x7f5dd03f6630 - rustc_span[4d522547309d7b79]::with_source_map::<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  31:     0x7f5dd03f5bd9 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  32:     0x7f5dd0ae6afa - <<std[b4247acdb72724ff]::thread::Builder>::spawn_unchecked_<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#1} as core[9847d4a2e8a02df2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7f5dcdf745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51bca2043facf7d3
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  34:     0x7f5dcdf745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h365da710d54db7ab
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  35:     0x7f5dcdf745f3 - std::sys::unix::thread::Thread::new::thread_start::hb322f3a535acf0fe
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
  36:     0x7f5dcdcffbb5 - <unknown>
  37:     0x7f5dcdd81d90 - <unknown>
  38:                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 (13afbdaa0 2023-03-17) 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

Some errors have detailed explanations: E0432, E0463.
For more information about an error, try `rustc --explain E0432`.

@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 Mar 19, 2023
@matthiaskrgr
Copy link
Member Author

searched nightlies: from nightly-2023-02-10 to nightly-2023-03-18
regressed nightly: nightly-2023-02-12
searched commit range: 2773383...585f3ee
regressed commit: 5b45024

cc @petrochenkov

@bvanjoi
Copy link
Contributor

bvanjoi commented Mar 20, 2023

@petrochenkov Could you assign it to me, I am willing to try to solve the problem

@jyn514 jyn514 added the A-resolve Area: Path resolution label Mar 25, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Apr 7, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 15, 2023
…henkov

fix(resolve): continue when resolved of signle_import is dummy

close rust-lang#109343

In rust-lang#109343, `f` in `pub use f as g` points to:

|namespace| binding|
|-|-|
|type| `external crate f`|
|value| `None` |
|macro| `None` |

When resolve `value_ns` during `resolve_doc_links`, the value of the binding of single_import `pub use f as g` goes to `pub use inner::f`, and since it does not satisfy [!self.is_accessible_from(binding.vis, single_import.parent_scope.module)](https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/ident.rs#L971) and returns `Err(Undetermined)`, which eventually goes to `PathResult::Indeterminate => unreachable!`.

This PR adds the `dummy` field to `Import::Single`, which is used to skip import statements that failed resolution.

r?`@petrochenkov`
@bors bors closed this as completed in 92f5dea May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Path resolution C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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.
Projects
None yet
5 participants