Skip to content

ICE: no errors encountered even though delay_span_bug issued. With impl Fn and GAT #100672

Closed
@zirconium-n

Description

Code

#![feature(generic_associated_types)]

trait Bar<'a> {
    type Ref<'b>
    where
        'a: 'b;
    fn uwu(f: impl Fn(Self::Ref<'_>));
}

impl<'a> Bar<'a> for () {
    type Ref<'b> = () where 'a: 'b;
    fn uwu(f: impl Fn(())) {}
}

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (86c6ebee8 2022-08-16)

Error output

   Compiling playground v0.0.1 (/playground)
warning: unused variable: `f`
  --> src/lib.rs:12:12
   |
12 |     fn uwu(f: impl Fn(())) {}
   |            ^ help: if this is intentional, prefix it with an underscore: `_f`
   |
   = note: `#[warn(unused_variables)]` on by default

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: failed region resolution while normalizing ParamEnv { caller_bounds: [Binder(ProjectionPredicate(ProjectionTy { substs: [impl Fn(()), (<() as Bar<'a>>::Ref<'_>,)], item_def_id: DefId(2:3527 ~ core[d628]::ops::function::FnOnce::Output) }, Ty(())), [Region(BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_))]), Binder(TraitPredicate(<impl Fn(()) as std::ops::Fn<(<() as Bar<'a>>::Ref<'_>,)>>, polarity:Positive), [Region(BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_))]), Binder(TraitPredicate(<impl Fn(()) as std::ops::FnMut<(<() as Bar<'a>>::Ref<'_>,)>>, polarity:Positive), [Region(BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_))]), Binder(TraitPredicate(<impl Fn(()) as std::ops::FnOnce<(<() as Bar<'a>>::Ref<'_>,)>>, polarity:Positive), [Region(BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_))]), Binder(TraitPredicate(<impl Fn(()) as std::marker::Sized>, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }: [ConcreteFailure(RelateRegionParamBound(src/lib.rs:12:5: 12:27 (#0)), RePlaceholder(Placeholder { universe: U1, name: BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_) }), ReEarlyBound(0, 'a)), ConcreteFailure(RelateRegionParamBound(src/lib.rs:12:5: 12:27 (#0)), RePlaceholder(Placeholder { universe: U2, name: BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_) }), ReEarlyBound(0, 'a)), ConcreteFailure(RelateRegionParamBound(src/lib.rs:12:5: 12:27 (#0)), RePlaceholder(Placeholder { universe: U3, name: BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_) }), ReEarlyBound(0, 'a)), ConcreteFailure(RelateRegionParamBound(src/lib.rs:12:5: 12:27 (#0)), RePlaceholder(Placeholder { universe: U4, name: BrNamed(DefId(0:15 ~ playground[e047]::Bar::uwu::'_), '_) }), ReEarlyBound(0, 'a))]
  --> src/lib.rs:12:5
   |
12 |     fn uwu(f: impl Fn(())) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:246:22

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1426:13
stack backtrace:
   0:     0x7f40617d16d0 - std::backtrace_rs::backtrace::libunwind::trace::h328903891f1ac962
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f40617d16d0 - std::backtrace_rs::backtrace::trace_unsynchronized::h9cae1c2b6b95e283
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f40617d16d0 - std::sys_common::backtrace::_print_fmt::h66058888c3f62113
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f40617d16d0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbd5c004e9efb9ba2
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f406182c76e - core::fmt::write::h8f3478ef5df05a9d
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f40617c25d5 - std::io::Write::write_fmt::habe0caeb57ead591
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/io/mod.rs:1672:15
   6:     0x7f40617d4393 - std::sys_common::backtrace::_print::h287226fc48c2ff2f
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f40617d4393 - std::sys_common::backtrace::print::h780c6aa9646c0456
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f40617d4393 - std::panicking::default_hook::{{closure}}::hac00efbd46ee1160
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/panicking.rs:295:22
   9:     0x7f40617d407f - std::panicking::default_hook::hd5470e8f0b27a6bd
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/panicking.rs:314:9
  10:     0x7f4064009a44 - rustc_driver[18fce8fcccec4a33]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f40617d4bcd - std::panicking::rust_panic_with_hook::h5ec17662a20c0edd
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/panicking.rs:702:17
  12:     0x7f40650cd241 - std[5fd532954ff53d47]::panicking::begin_panic::<rustc_errors[5aa25185040b39a]::ExplicitBug>::{closure#0}
  13:     0x7f40650cd1f6 - std[5fd532954ff53d47]::sys_common::backtrace::__rust_end_short_backtrace::<std[5fd532954ff53d47]::panicking::begin_panic<rustc_errors[5aa25185040b39a]::ExplicitBug>::{closure#0}, !>
  14:     0x7f40650c7ca6 - std[5fd532954ff53d47]::panicking::begin_panic::<rustc_errors[5aa25185040b39a]::ExplicitBug>
  15:     0x7f40650ca286 - std[5fd532954ff53d47]::panic::panic_any::<rustc_errors[5aa25185040b39a]::ExplicitBug>
  16:     0x7f4063b31970 - <rustc_errors[5aa25185040b39a]::HandlerInner as core[d628f3806372268a]::ops::drop::Drop>::drop
  17:     0x7f4063843408 - core[d628f3806372268a]::ptr::drop_in_place::<rustc_session[c8f4ed044bfefb6c]::parse::ParseSess>
  18:     0x7f406382b233 - <alloc[2c946ccec12a76bb]::rc::Rc<rustc_session[c8f4ed044bfefb6c]::session::Session> as core[d628f3806372268a]::ops::drop::Drop>::drop
  19:     0x7f406382a78d - core[d628f3806372268a]::ptr::drop_in_place::<rustc_interface[4a84693f72592b98]::interface::Compiler>
  20:     0x7f4063829c39 - rustc_span[593a361d701c283c]::with_source_map::<core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>, rustc_interface[4a84693f72592b98]::interface::create_compiler_and_run<core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>, rustc_driver[18fce8fcccec4a33]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f4063829462 - rustc_interface[4a84693f72592b98]::interface::create_compiler_and_run::<core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>, rustc_driver[18fce8fcccec4a33]::run_compiler::{closure#1}>
  22:     0x7f4063828001 - <scoped_tls[ec94400a14ecf1fb]::ScopedKey<rustc_span[593a361d701c283c]::SessionGlobals>>::set::<rustc_interface[4a84693f72592b98]::interface::run_compiler<core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>, rustc_driver[18fce8fcccec4a33]::run_compiler::{closure#1}>::{closure#0}, core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>>
  23:     0x7f4063827cef - std[5fd532954ff53d47]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4a84693f72592b98]::util::run_in_thread_pool_with_globals<rustc_interface[4a84693f72592b98]::interface::run_compiler<core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>, rustc_driver[18fce8fcccec4a33]::run_compiler::{closure#1}>::{closure#0}, core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>>::{closure#0}, core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>>
  24:     0x7f4063e35719 - <<std[5fd532954ff53d47]::thread::Builder>::spawn_unchecked_<rustc_interface[4a84693f72592b98]::util::run_in_thread_pool_with_globals<rustc_interface[4a84693f72592b98]::interface::run_compiler<core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>, rustc_driver[18fce8fcccec4a33]::run_compiler::{closure#1}>::{closure#0}, core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>>::{closure#0}, core[d628f3806372268a]::result::Result<(), rustc_errors[5aa25185040b39a]::ErrorGuaranteed>>::{closure#1} as core[d628f3806372268a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f40617de9c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4fe4faa13dc6a27b
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/alloc/src/boxed.rs:1935:9
  26:     0x7f40617de9c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h17b55ecd9f8a7fb6
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/alloc/src/boxed.rs:1935:9
  27:     0x7f40617de9c3 - std::sys::unix::thread::Thread::new::thread_start::ha9824217d895d25c
                               at /rustc/86c6ebee8fa0a5ad1e18e375113b06bd2849b634/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f40616b2609 - start_thread
  29:     0x7f40615d5133 - clone
  30:                0x0 - <unknown>

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.65.0-nightly (86c6ebee8 2022-08-16) 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
warning: `playground` (lib) generated 1 warning
error: could not compile `playground`; 1 warning emitted

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)C-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsI-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