Skip to content

ICE: unexpected rib kind: ConstGeneric in late.rs #109143

Closed
@langston-barrett

Description

@langston-barrett

This is a fuzzed test case, found with tree-splicer and minimized with treereduce.

I wasn't able to find any similar issues: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AI-ICE+unexpected+rib+kind

Code

struct Bar<const N: &(for<'a> S<'a>)>;

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

error: internal compiler error: compiler/rustc_resolve/src/late.rs:1483:41: unexpected rib kind: ConstGeneric
Backtrace

error[E0637]: `&` without an explicit lifetime name cannot be used here
 --> ice.rs:1:21
  |
1 | struct Bar<const N: &(for<'a> S<'a>)>;
  |                     ^ explicit lifetime name needed here

error: internal compiler error: compiler/rustc_resolve/src/late.rs:1483:41: unexpected rib kind: ConstGeneric
 --> ice.rs:1:33
  |
1 | struct Bar<const N: &(for<'a> S<'a>)>;
  |                                 ^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/compiler/rustc_errors/src/lib.rs:995:33
stack backtrace:
   0:     0x7f256460451a - std::backtrace_rs::backtrace::libunwind::trace::h1ac6254167c780d9
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f256460451a - std::backtrace_rs::backtrace::trace_unsynchronized::hec2af85915e24f36
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f256460451a - std::sys_common::backtrace::_print_fmt::h58a4e3535fcce206
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f256460451a - <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:     0x7f2564667c5e - core::fmt::write::h2e851dc027730d81
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f25645f7375 - std::io::Write::write_fmt::hca00074de9f85084
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/io/mod.rs:1684:15
   6:     0x7f25646042e5 - std::sys_common::backtrace::_print::h870053c845cddf24
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f25646042e5 - std::sys_common::backtrace::print::hb56add862f96c5fd
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f256460705f - std::panicking::default_hook::{{closure}}::h636d4ba3ff8fdc46
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:271:22
   9:     0x7f2564606d9b - std::panicking::default_hook::hf29b58145ee6e43c
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:290:9
  10:     0x7f25679470c5 - <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:     0x7f256460789d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7342d57f33f6634f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:2002:9
  12:     0x7f256460789d - std::panicking::rust_panic_with_hook::hbf9ef936d990c16f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:696:13
  13:     0x7f25683be2d1 - std[1337fb43929788f1]::panicking::begin_panic::<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>::{closure#0}
  14:     0x7f25683be186 - std[1337fb43929788f1]::sys_common::backtrace::__rust_end_short_backtrace::<std[1337fb43929788f1]::panicking::begin_panic<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>::{closure#0}, !>
  15:     0x7f25683f7ea6 - std[1337fb43929788f1]::panicking::begin_panic::<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>
  16:     0x7f25683bc0c6 - std[1337fb43929788f1]::panic::panic_any::<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>
  17:     0x7f25683bab99 - <rustc_errors[9dbe0d28acf3471b]::HandlerInner>::span_bug::<rustc_span[18b84908941c7cdf]::span_encoding::Span, &alloc[b7ae3602ac956de8]::string::String>
  18:     0x7f25683ba9c0 - <rustc_errors[9dbe0d28acf3471b]::Handler>::span_bug::<rustc_span[18b84908941c7cdf]::span_encoding::Span, &alloc[b7ae3602ac956de8]::string::String>
  19:     0x7f25683b673b - rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt::<rustc_span[18b84908941c7cdf]::span_encoding::Span>::{closure#0}
  20:     0x7f25683b678a - rustc_middle[eaae5d2a0b8f0144]::ty::context::tls::with_opt::<rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt<rustc_span[18b84908941c7cdf]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f25683b6336 - rustc_middle[eaae5d2a0b8f0144]::ty::context::tls::with_context_opt::<rustc_middle[eaae5d2a0b8f0144]::ty::context::tls::with_opt<rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt<rustc_span[18b84908941c7cdf]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f25683b62d6 - rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt::<rustc_span[18b84908941c7cdf]::span_encoding::Span>
  23:     0x7f25683b6294 - rustc_middle[eaae5d2a0b8f0144]::util::bug::span_bug_fmt::<rustc_span[18b84908941c7cdf]::span_encoding::Span>
  24:     0x7f256620c24f - <core[2011dc7817943e09]::iter::adapters::rev::Rev<core[2011dc7817943e09]::slice::iter::Iter<rustc_resolve[d14f6814014285f]::late::LifetimeRib>> as core[2011dc7817943e09]::iter::traits::iterator::Iterator>::try_fold::<(), core[2011dc7817943e09]::iter::traits::iterator::Iterator::find_map::check<&rustc_resolve[d14f6814014285f]::late::LifetimeRib, rustc_resolve[d14f6814014285f]::late::LifetimeUseSet, <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor>::resolve_lifetime::{closure#0}>::{closure#0}, core[2011dc7817943e09]::ops::control_flow::ControlFlow<rustc_resolve[d14f6814014285f]::late::LifetimeUseSet>>
  25:     0x7f256620a6f5 - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_lifetime
  26:     0x7f2566207419 - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_path
  27:     0x7f2566aa4d3c - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_poly_trait_ref
  28:     0x7f2566201fb0 - rustc_ast[648a34948e2edeac]::visit::walk_ty::<rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor>
  29:     0x7f2566203895 - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_ty
  30:     0x7f256620544e - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_ty
  31:     0x7f2566203895 - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_ty
  32:     0x7f2566a4f823 - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor>::visit_generic_params
  33:     0x7f2566a48ac9 - rustc_ast[648a34948e2edeac]::visit::walk_item::<rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor>
  34:     0x7f2566a37dc7 - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor>::resolve_item
  35:     0x7f2566a32ad1 - <rustc_resolve[d14f6814014285f]::late::LateResolutionVisitor as rustc_ast[648a34948e2edeac]::visit::Visitor>::visit_item
  36:     0x7f2566a3293d - <rustc_resolve[d14f6814014285f]::Resolver>::late_resolve_crate
  37:     0x7f2566a31e3e - <rustc_session[a360c2d099171c08]::session::Session>::time::<(), <rustc_resolve[d14f6814014285f]::Resolver>::resolve_crate::{closure#0}>
  38:     0x7f2566a2f3f8 - rustc_interface[ceda1fd77ec39e1b]::passes::resolver_for_lowering
  39:     0x7f256714db8f - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query::<rustc_query_impl[eb95ff51c492efdd]::queries::resolver_for_lowering, rustc_query_impl[eb95ff51c492efdd]::plumbing::QueryCtxt>
  40:     0x7f256714d890 - <rustc_query_impl[eb95ff51c492efdd]::Queries as rustc_middle[eaae5d2a0b8f0144]::ty::query::QueryEngine>::resolver_for_lowering
  41:     0x7f2566f7e1f4 - <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>)>>
  42:     0x7f2566b7de32 - rustc_span[18b84908941c7cdf]::with_source_map::<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_interface[ceda1fd77ec39e1b]::interfa
ce::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  43:     0x7f2566b7516c - 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>>
  44:     0x7f2566b74b9a - <<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}
  45:     0x7f2564611793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7e0474dd3b8659fa
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  46:     0x7f2564611793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heb8c41cf543a5c11
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  47:     0x7f2564611793 - std::sys::unix::thread::Thread::new::thread_start::hc791abe67253fe06
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7f25644ddd40 - start_thread
  49:     0x7f25643fa03f - __GI___clone
  50:                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: rustc 1.70.0-nightly (22f247c6f 2023-03-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

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

For more information about this error, try `rustc --explain E0637`.

Metadata

Metadata

Assignees

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

No branches or pull requests

Issue actions