Skip to content

[ICE] Unresolved HRTB lifetime in APIT #96954

Description

@jackh726

This ICEs on nightly, but only errors in stable or beta: fn test_argument_position(x: impl for<'a> Tr<'a, Assoc = impl Copy + 'a>) {}

playground

Code

trait Tr<'a> {
	type Assoc;
}
fn test_argument_position(x: impl for<'a> Tr<'a, Assoc = impl Copy + 'a>)  {}
fn main() {}
Backtrace

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

error: internal compiler error: Could not resolve lifetime(HirId { owner: DefId(0:6 ~ playground[24bf]::test_argument_position), local_id: 9 }: 'a) in scope Binder {
                                    lifetimes: {},
                                    next_early_index: 2,
                                    track_lifetime_uses: true,
                                    opaque_type_parent: false,
                                    scope_type: Normal,
                                    hir_id: HirId {
                                        owner: DefId(0:6 ~ playground[24bf]::test_argument_position),
                                        local_id: 11,
                                    },
                                    s: TraitRefBoundary {
                                        s: Binder {
                                            lifetimes: {},
                                            next_early_index: 2,
                                            track_lifetime_uses: false,
                                            opaque_type_parent: true,
                                            scope_type: Normal,
                                            hir_id: HirId {
                                                owner: DefId(0:6 ~ playground[24bf]::test_argument_position),
                                                local_id: 0,
                                            },
                                            s: Root,
                                            allow_late_bound: true,
                                        },
                                    },
                                    allow_late_bound: true,
                                }
 --> src/main.rs:5:70
  |
5 | fn test_argument_position(x: impl for<'a> Tr<'a, Assoc = impl Copy + 'a>)  {}
  |                                                                      ^^
  |
  = note: delayed at compiler/rustc_resolve/src/late/lifetimes.rs:2316:27

error: internal compiler error: unelided lifetime in signature
 --> src/main.rs:5:70
  |
5 | fn test_argument_position(x: impl for<'a> Tr<'a, Assoc = impl Copy + 'a>)  {}
  |                                                                      ^^
  |
  = note: delayed at compiler/rustc_typeck/src/astconv/mod.rs:250:30

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1369:13
stack backtrace:
   0:     0x7f076b75be7d - std::backtrace_rs::backtrace::libunwind::trace::h85cc47332f2b05a9
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f076b75be7d - std::backtrace_rs::backtrace::trace_unsynchronized::h822c2fc2b1a1a752
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f076b75be7d - std::sys_common::backtrace::_print_fmt::h678c9b8abf6c5083
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f076b75be7d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2fb21895faf729c2
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f076b7b7afc - core::fmt::write::h6dc4a63f2d3360d8
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/core/src/fmt/mod.rs:1196:17
   5:     0x7f076b74d561 - std::io::Write::write_fmt::h8fe2d520dd3fbf2e
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/io/mod.rs:1654:15
   6:     0x7f076b75eb95 - std::sys_common::backtrace::_print::h6c3478d5fa62e7d8
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f076b75eb95 - std::sys_common::backtrace::print::hd6d4473e0c0113a9
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f076b75eb95 - std::panicking::default_hook::{{closure}}::h4dec78d051eecf7c
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/panicking.rs:295:22
   9:     0x7f076b75e809 - std::panicking::default_hook::hc13b58dcc91e88ba
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/panicking.rs:314:9
  10:     0x7f076bf20b21 - rustc_driver[d4386f1a79afc323]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f076b75f366 - std::panicking::rust_panic_with_hook::h3dd403ae323eac6a
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/panicking.rs:702:17
  12:     0x7f076d08c921 - std[d9fedb1e1dbc9663]::panicking::begin_panic::<rustc_errors[b91ec0213766c8bc]::ExplicitBug>::{closure#0}
  13:     0x7f076d08b716 - std[d9fedb1e1dbc9663]::sys_common::backtrace::__rust_end_short_backtrace::<std[d9fedb1e1dbc9663]::panicking::begin_panic<rustc_errors[b91ec0213766c8bc]::ExplicitBug>::{closure#0}, !>
  14:     0x7f076d09d786 - std[d9fedb1e1dbc9663]::panicking::begin_panic::<rustc_errors[b91ec0213766c8bc]::ExplicitBug>
  15:     0x7f076d0a1816 - std[d9fedb1e1dbc9663]::panic::panic_any::<rustc_errors[b91ec0213766c8bc]::ExplicitBug>
  16:     0x7f076e85adcb - <rustc_errors[b91ec0213766c8bc]::HandlerInner as core[9ba3ef39911e8828]::ops::drop::Drop>::drop
  17:     0x7f076dfb2bb8 - core[9ba3ef39911e8828]::ptr::drop_in_place::<rustc_session[93b3d23ec172418c]::parse::ParseSess>
  18:     0x7f076dfb4ec3 - <alloc[4e51958440f9dea6]::rc::Rc<rustc_session[93b3d23ec172418c]::session::Session> as core[9ba3ef39911e8828]::ops::drop::Drop>::drop
  19:     0x7f076dfb197d - core[9ba3ef39911e8828]::ptr::drop_in_place::<rustc_interface[50aa842067ddf2a9]::interface::Compiler>
  20:     0x7f076dfb1124 - rustc_span[5ada1bf86533b524]::with_source_map::<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_interface[50aa842067ddf2a9]::interface::create_compiler_and_run<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f076df89824 - rustc_interface[50aa842067ddf2a9]::interface::create_compiler_and_run::<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>
  22:     0x7f076df870d2 - <scoped_tls[48edcdfa9356486f]::ScopedKey<rustc_span[5ada1bf86533b524]::SessionGlobals>>::set::<rustc_interface[50aa842067ddf2a9]::interface::run_compiler<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>
  23:     0x7f076df9e1ef - std[d9fedb1e1dbc9663]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[50aa842067ddf2a9]::util::run_in_thread_pool_with_globals<rustc_interface[50aa842067ddf2a9]::interface::run_compiler<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>
  24:     0x7f076df9e329 - <<std[d9fedb1e1dbc9663]::thread::Builder>::spawn_unchecked_<rustc_interface[50aa842067ddf2a9]::util::run_in_thread_pool_with_globals<rustc_interface[50aa842067ddf2a9]::interface::run_compiler<core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>, rustc_driver[d4386f1a79afc323]::run_compiler::{closure#1}>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>::{closure#0}, core[9ba3ef39911e8828]::result::Result<(), rustc_errors[b91ec0213766c8bc]::ErrorGuaranteed>>::{closure#1} as core[9ba3ef39911e8828]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f076b769273 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8e61158325523155
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/alloc/src/boxed.rs:1872:9
  26:     0x7f076b769273 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha439966d612c01d5
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/alloc/src/boxed.rs:1872:9
  27:     0x7f076b769273 - std::sys::unix::thread::Thread::new::thread_start::hf215f8619fb489d4
                               at /rustc/ecd44958e0a21110d09862ee080d95a4ca6c52f8/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f076b699609 - start_thread
  29:     0x7f076b5b2163 - 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.62.0-nightly (ecd44958e 2022-05-10) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions