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: unexpected unresolved segments #109146

Closed
matthiaskrgr opened this issue Mar 14, 2023 · 5 comments · Fixed by #109348
Closed

ICE: unexpected unresolved segments #109146

matthiaskrgr opened this issue Mar 14, 2023 · 5 comments · Fixed by #109348
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

extern crate alloc as b;

mod foo {

    mod bar {

        pub(in b::string::String::newy) extern crate alloc as e;
    }
}

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 'unexpected unresolved segments', /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/compiler/rustc_hir/src/def.rs:482:25
stack backtrace:
   0:     0x7f28ececd51a - std::backtrace_rs::backtrace::libunwind::trace::h1ac6254167c780d9
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f28ececd51a - std::backtrace_rs::backtrace::trace_unsynchronized::hec2af85915e24f36
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f28ececd51a - std::sys_common::backtrace::_print_fmt::h58a4e3535fcce206
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f28ececd51a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5107e13758b8321c
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f28ecf30c5e - core::fmt::write::h2e851dc027730d81
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f28ecec0375 - std::io::Write::write_fmt::hca00074de9f85084
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/io/mod.rs:1684:15
   6:     0x7f28ececd2e5 - std::sys_common::backtrace::_print::h870053c845cddf24
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f28ececd2e5 - std::sys_common::backtrace::print::hb56add862f96c5fd
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f28eced005f - std::panicking::default_hook::{{closure}}::h636d4ba3ff8fdc46
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:271:22
   9:     0x7f28ececfd9b - std::panicking::default_hook::hf29b58145ee6e43c
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:290:9
  10:     0x7f28ebc580c5 - <rustc_driver_impl[74350ec99973fded]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[2011dc7817943e09]::ops::function::FnOnce<(&core[2011dc7817943e09]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f28eced089d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7342d57f33f6634f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:2002:9
  12:     0x7f28eced089d - std::panicking::rust_panic_with_hook::hbf9ef936d990c16f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:696:13
  13:     0x7f28eced0619 - std::panicking::begin_panic_handler::{{closure}}::h6be6433dcb901f4b
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:583:13
  14:     0x7f28ececd986 - std::sys_common::backtrace::__rust_end_short_backtrace::h802b6104a4d80829
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f28eced0322 - rust_begin_unwind
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:579:5
  16:     0x7f28ecf2cfb3 - core::panicking::panic_fmt::hf7a8a88b9669732e
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/panicking.rs:64:14
  17:     0x7f28ecf2d121 - core::panicking::panic_display::ha14ecfa86c697326
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/panicking.rs:147:5
  18:     0x7f28ecf2d0cb - core::panicking::panic_str::h0f5ad79b66e15d80
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/panicking.rs:131:5
  19:     0x7f28ecf2cd36 - core::option::expect_failed::h6e9ae5a1d735f1ff
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/option.rs:2091:5
  20:     0x7f28ea904f96 - <rustc_resolve[d14f6814014285f]::build_reduced_graph::BuildReducedGraphVisitor>::resolve_visibility
  21:     0x7f28ea9017fe - <rustc_resolve[d14f6814014285f]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_item
  22:     0x7f28ea9056c5 - rustc_ast[648a34948e2edeac]::visit::walk_item::<rustc_resolve[d14f6814014285f]::build_reduced_graph::BuildReducedGraphVisitor>
  23:     0x7f28ea901acd - <rustc_resolve[d14f6814014285f]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_item
  24:     0x7f28ea9056c5 - rustc_ast[648a34948e2edeac]::visit::walk_item::<rustc_resolve[d14f6814014285f]::build_reduced_graph::BuildReducedGraphVisitor>
  25:     0x7f28ea901acd - <rustc_resolve[d14f6814014285f]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_item
  26:     0x7f28ea8ff76e - <rustc_resolve[d14f6814014285f]::Resolver as rustc_expand[fc967681d49b502a]::base::ResolverExpand>::visit_ast_fragment_with_placeholders
  27:     0x7f28ea8f7be2 - <rustc_expand[fc967681d49b502a]::expand::MacroExpander>::fully_expand_fragment
  28:     0x7f28ead9e527 - <rustc_expand[fc967681d49b502a]::expand::MacroExpander>::expand_crate
  29:     0x7f28ead9d983 - <rustc_session[a360c2d099171c08]::session::Session>::time::<rustc_ast[648a34948e2edeac]::ast::Crate, rustc_interface[ceda1fd77ec39e1b]::passes::configure_and_expand::{closure#1}>
  30:     0x7f28ead4022b - rustc_interface[ceda1fd77ec39e1b]::passes::resolver_for_lowering
  31:     0x7f28eb45eb8f - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query::<rustc_query_impl[eb95ff51c492efdd]::queries::resolver_for_lowering, rustc_query_impl[eb95ff51c492efdd]::plumbing::QueryCtxt>
  32:     0x7f28eb45e890 - <rustc_query_impl[eb95ff51c492efdd]::Queries as rustc_middle[eaae5d2a0b8f0144]::ty::query::QueryEngine>::resolver_for_lowering
  33:     0x7f28eb28f1f4 - <rustc_middle[eaae5d2a0b8f0144]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[75b47a18491287a9]::steal::Steal<(rustc_middle[eaae5d2a0b8f0144]::ty::ResolverAstLowering, alloc[b7ae3602ac956de8]::rc::Rc<rustc_ast[648a34948e2edeac]::ast::Crate>)>>
  34:     0x7f28eae8ee32 - rustc_span[18b84908941c7cdf]::with_source_map::<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  35:     0x7f28eae8616c - std[1337fb43929788f1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ceda1fd77ec39e1b]::util::run_in_thread_pool_with_globals<rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>
  36:     0x7f28eae85b9a - <<std[1337fb43929788f1]::thread::Builder>::spawn_unchecked_<rustc_interface[ceda1fd77ec39e1b]::util::run_in_thread_pool_with_globals<rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#1} as core[2011dc7817943e09]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f28eceda793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7e0474dd3b8659fa
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  38:     0x7f28eceda793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heb8c41cf543a5c11
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  39:     0x7f28eceda793 - std::sys::unix::thread::Thread::new::thread_start::hc791abe67253fe06
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys/unix/thread.rs:108:17
  40:     0x7f28e8867bb5 - <unknown>
  41:     0x7f28e88e9d90 - <unknown>
  42:                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 (22f247c6f 2023-03-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering] 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 Mar 14, 2023
@langston-barrett
Copy link

@matthiaskrgr
Copy link
Member Author

searched nightlies: from nightly-2022-10-05 to nightly-2023-03-16
regressed nightly: nightly-2022-10-12
searched commit range: a6b7274...db0597f
regressed commit: db0597f

@albertlarsan68
Copy link
Member

Newer version of cargo-bisect-rustc can bisect through rollups

@matthiaskrgr
Copy link
Member Author

The one that is not released yet? 😄
Thx, will install git then.. :)

@langston-barrett
Copy link

@rustbot label +S-bug-has-mcve

@rustbot rustbot added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Mar 17, 2023
@bors bors closed this as completed in 28b6607 Aug 5, 2023
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Aug 8, 2023
Resolve visibility paths as modules not as types.

Asking for a resolution with `opt_ns = Some(TypeNS)` allows path resolution to look for type-relative paths, leaving unresolved segments behind. However, for visibility paths we really need to look for a module, so we need to pass `opt_ns = None`.

Fixes rust-lang/rust#109146

r? `@petrochenkov`
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-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

4 participants