Skip to content

ICE: type bounds can make associated constant generic #98432

Closed
@CAD97

Description

@CAD97

Code

[playground]

struct Struct<T>(T);

impl<T> Struct<T> {
    const CONST: fn() = || {
        struct _Obligation where T:;
    };
}

Meta

Version: 1.63.0-nightly (2022-06-22 10f4ce3) on playground.

Error output

thread 'rustc' panicked at 'no label after fn', compiler/rustc_span/src/source_map.rs:972:18

error: internal compiler error: unexpected panic

note: 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.63.0-nightly (10f4ce324 2022-06-22) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
Backtrace

stack backtrace:
   0:     0x7f26125b401d - std::backtrace_rs::backtrace::libunwind::trace::he44753678207c7f4
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f26125b401d - std::backtrace_rs::backtrace::trace_unsynchronized::ha3fe523f49a1d4e5
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f26125b401d - std::sys_common::backtrace::_print_fmt::hf899edb1f192b7fa
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f26125b401d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0199fe70dd45742d
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f261260fddc - core::fmt::write::h3f0846bc4e0acf09
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/core/src/fmt/mod.rs:1197:17
   5:     0x7f26125a5691 - std::io::Write::write_fmt::h4371049b6e95ea26
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/io/mod.rs:1672:15
   6:     0x7f26125b6ce5 - std::sys_common::backtrace::_print::h6f2f42144e3e5cb8
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f26125b6ce5 - std::sys_common::backtrace::print::h23ba1d7f42c94056
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f26125b6ce5 - std::panicking::default_hook::{{closure}}::hcae1e24d5d7d8c79
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/panicking.rs:295:22
   9:     0x7f26125b6a06 - std::panicking::default_hook::ha2187de538432fd8
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/panicking.rs:314:9
  10:     0x7f2612d900d4 - rustc_driver[2f1d12529a05ac61]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f26125b73ba - std::panicking::rust_panic_with_hook::h77347ec53f2c6955
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/panicking.rs:702:17
  12:     0x7f26125b71f7 - std::panicking::begin_panic_handler::{{closure}}::h0ab43448795a6014
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/panicking.rs:588:13
  13:     0x7f26125b44d4 - std::sys_common::backtrace::__rust_end_short_backtrace::h6c4226fc484288f9
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f26125b6f29 - rust_begin_unwind
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/panicking.rs:584:5
  15:     0x7f261257c0f3 - core::panicking::panic_fmt::h70fdc55ae72e6168
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/core/src/panicking.rs:142:14
  16:     0x7f261260ca41 - core::panicking::panic_display::h12d1de667ed31b98
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/core/src/panicking.rs:72:5
  17:     0x7f261260c9eb - core::panicking::panic_str::hae4cdc3de34c7e83
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/core/src/panicking.rs:56:5
  18:     0x7f261257bf66 - core::option::expect_failed::h139709f28106e221
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/core/src/option.rs:1874:5
  19:     0x7f261406ee69 - <rustc_span[4bf114c845b707f0]::source_map::SourceMap>::generate_fn_name_span
  20:     0x7f261323dee8 - <rustc_resolve[27b5f90c9579c051]::Resolver>::into_struct_error
  21:     0x7f261323ae1f - <rustc_resolve[27b5f90c9579c051]::Resolver>::report_error
  22:     0x7f26144f8296 - <rustc_resolve[27b5f90c9579c051]::Resolver>::resolve_path_with_ribs
  23:     0x7f26144c3589 - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor>::smart_resolve_path_fragment
  24:     0x7f26144aa41a - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor as rustc_ast[2eb19ebc001c8b3]::visit::Visitor>::visit_ty
  25:     0x7f26144b1dc3 - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor as rustc_ast[2eb19ebc001c8b3]::visit::Visitor>::visit_where_predicate
  26:     0x7f26144d4561 - rustc_ast[2eb19ebc001c8b3]::visit::walk_item::<rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor>
  27:     0x7f26144b8a83 - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor>::resolve_item
  28:     0x7f26144a9370 - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor as rustc_ast[2eb19ebc001c8b3]::visit::Visitor>::visit_item
  29:     0x7f26144a9b5b - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor as rustc_ast[2eb19ebc001c8b3]::visit::Visitor>::visit_block
  30:     0x7f26144c7954 - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor>::resolve_expr
  31:     0x7f26144aee71 - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor as rustc_ast[2eb19ebc001c8b3]::visit::Visitor>::visit_fn
  32:     0x7f26144d09d1 - rustc_ast[2eb19ebc001c8b3]::visit::walk_expr::<rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor>
  33:     0x7f26144c7bba - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor>::resolve_expr
  34:     0x7f26144b749b - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor>::resolve_item
  35:     0x7f26144a9370 - <rustc_resolve[27b5f90c9579c051]::late::LateResolutionVisitor as rustc_ast[2eb19ebc001c8b3]::visit::Visitor>::visit_item
  36:     0x7f26152a75dc - <rustc_resolve[27b5f90c9579c051]::Resolver>::late_resolve_crate
  37:     0x7f261528e7da - <rustc_session[9ab7afc502081b05]::session::Session>::time::<(), <rustc_resolve[27b5f90c9579c051]::Resolver>::resolve_crate::{closure#0}>
  38:     0x7f2614f9478a - rustc_interface[28bf8cb733072c18]::passes::configure_and_expand
  39:     0x7f2614fbeb73 - <rustc_interface[28bf8cb733072c18]::queries::Queries>::expansion
  40:     0x7f2614f6716a - <rustc_interface[28bf8cb733072c18]::interface::Compiler>::enter::<rustc_driver[2f1d12529a05ac61]::run_compiler::{closure#1}::{closure#2}, core[5cb722eed20f8a74]::result::Result<core[5cb722eed20f8a74]::option::Option<rustc_interface[28bf8cb733072c18]::queries::Linker>, rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>>
  41:     0x7f2614f6075f - rustc_span[4bf114c845b707f0]::with_source_map::<core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>, rustc_interface[28bf8cb733072c18]::interface::create_compiler_and_run<core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>, rustc_driver[2f1d12529a05ac61]::run_compiler::{closure#1}>::{closure#1}>
  42:     0x7f2614f680f2 - <scoped_tls[5fe745a1f08cc2]::ScopedKey<rustc_span[4bf114c845b707f0]::SessionGlobals>>::set::<rustc_interface[28bf8cb733072c18]::interface::run_compiler<core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>, rustc_driver[2f1d12529a05ac61]::run_compiler::{closure#1}>::{closure#0}, core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>>
  43:     0x7f2614f7d6af - std[bca6335a70f9392d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[28bf8cb733072c18]::util::run_in_thread_pool_with_globals<rustc_interface[28bf8cb733072c18]::interface::run_compiler<core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>, rustc_driver[2f1d12529a05ac61]::run_compiler::{closure#1}>::{closure#0}, core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>>::{closure#0}, core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>>
  44:     0x7f2614f7d7e9 - <<std[bca6335a70f9392d]::thread::Builder>::spawn_unchecked_<rustc_interface[28bf8cb733072c18]::util::run_in_thread_pool_with_globals<rustc_interface[28bf8cb733072c18]::interface::run_compiler<core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>, rustc_driver[2f1d12529a05ac61]::run_compiler::{closure#1}>::{closure#0}, core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>>::{closure#0}, core[5cb722eed20f8a74]::result::Result<(), rustc_errors[9f41cbea1692ed9d]::ErrorGuaranteed>>::{closure#1} as core[5cb722eed20f8a74]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f26125c12f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2b55da6f20bbfb52
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/alloc/src/boxed.rs:1951:9
  46:     0x7f26125c12f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h24277973b6c4316e
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/alloc/src/boxed.rs:1951:9
  47:     0x7f26125c12f3 - std::sys::unix::thread::Thread::new::thread_start::hfcf4b31102242b93
                               at /rustc/10f4ce324baf7cfb7ce2b2096662b82b79204944/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7f26124e7609 - start_thread
  49:     0x7f261240a133 - clone
  50:                0x0 - <unknown>

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.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.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