Skip to content

ICE in missing lifetime diagnostic #96525

Closed
@sciguy16

Description

@sciguy16

Code

struct Struct<'a>(&'a str);

async fn foo() -> Struct {
    todo!()
}

fn main() {
    foo();
}

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (69a5d2481 2022-04-27)
binary: rustc
commit-hash: 69a5d2481e856a5a18885390b8cf6950b9ff8dd3
commit-date: 2022-04-27
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

Expected rustc +stable test.rs --edition 2021

error[E0726]: implicit elided lifetime not allowed here
 --> test.rs:3:19
  |
3 | async fn foo() -> Struct {
  |                   ^^^^^^- help: indicate the anonymous lifetime: `<'_>`
  |
  = note: assuming a `'static` lifetime...

error: aborting due to previous error

Error output RUST_BACKTRACE=1 rustc +nightly-2022-04-27 test.rs --edition 2021

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

error: internal compiler error: expected 'implicit elided lifetime not allowed' error
 --> test.rs:3:19
  |
3 | async fn foo() -> Struct {
  |                   ^^^^^^
  |
  = note: delayed at compiler/rustc_ast_lowering/src/lib.rs:2428:22

error: internal compiler error: implicit lifetime not allowed here
 --> test.rs:3:19
  |
3 | async fn foo() -> Struct {
  |                   ^^^^^^
  |
  = note: delayed at compiler/rustc_ast_lowering/src/path.rs:302:22

error: internal compiler error: unelided lifetime in signature
 --> test.rs:3:19
  |
3 | async fn foo() -> Struct {
  |                   ^^^^^^
  |
  = note: delayed at compiler/rustc_typeck/src/astconv/mod.rs:250:30
Backtrace

warning: unused implementer of `Future` that must be used
 --> test.rs:8:5
  |
8 |     foo();
  |     ^^^^^^
  |
  = note: `#[warn(unused_must_use)]` on by default
  = note: futures do nothing unless you `.await` or poll them

warning: 1 warning emitted

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

error: internal compiler error: expected 'implicit elided lifetime not allowed' error
 --> test.rs:3:19
  |
3 | async fn foo() -> Struct {
  |                   ^^^^^^
  |
  = note: delayed at compiler/rustc_ast_lowering/src/lib.rs:2428:22

error: internal compiler error: implicit lifetime not allowed here
 --> test.rs:3:19
  |
3 | async fn foo() -> Struct {
  |                   ^^^^^^
  |
  = note: delayed at compiler/rustc_ast_lowering/src/path.rs:302:22

error: internal compiler error: unelided lifetime in signature
 --> test.rs:3:19
  |
3 | async fn foo() -> Struct {
  |                   ^^^^^^
  |
  = 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:1347:13
stack backtrace:
   0:     0x7fea3469dfcd - std::backtrace_rs::backtrace::libunwind::trace::h008bfa4d47668920
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fea3469dfcd - std::backtrace_rs::backtrace::trace_unsynchronized::h27b8baa167def365
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fea3469dfcd - std::sys_common::backtrace::_print_fmt::h14cfba2b17ab0c8e
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fea3469dfcd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcc0f07ba1953872c
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fea346f9d4c - core::fmt::write::heefc9b0106ff4b26
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fea3468f6c1 - std::io::Write::write_fmt::h17f586ea6872643e
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/io/mod.rs:1655:15
   6:     0x7fea346a0ce5 - std::sys_common::backtrace::_print::h1d24983408f9dcb5
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fea346a0ce5 - std::sys_common::backtrace::print::h3dfa044f75ad3854
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fea346a0ce5 - std::panicking::default_hook::{{closure}}::h0d1e2fd3193b7c66
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/panicking.rs:295:22
   9:     0x7fea346a0959 - std::panicking::default_hook::ha7798f571e103017
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/panicking.rs:314:9
  10:     0x7fea34ece721 - rustc_driver[24333cd5cdbff7]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fea346a14b6 - std::panicking::rust_panic_with_hook::hd4ae5780d84eaeb3
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/panicking.rs:702:17
  12:     0x7fea360182d1 - std[e3663ace07a47676]::panicking::begin_panic::<rustc_errors[444e5733760837c]::ExplicitBug>::{closure#0}
  13:     0x7fea36017116 - std[e3663ace07a47676]::sys_common::backtrace::__rust_end_short_backtrace::<std[e3663ace07a47676]::panicking::begin_panic<rustc_errors[444e5733760837c]::ExplicitBug>::{closure#0}, !>
  14:     0x7fea360300cf - std[e3663ace07a47676]::panicking::begin_panic::<rustc_errors[444e5733760837c]::ExplicitBug>
  15:     0x7fea3602d1a6 - std[e3663ace07a47676]::panic::panic_any::<rustc_errors[444e5733760837c]::ExplicitBug>
  16:     0x7fea378072e7 - <rustc_errors[444e5733760837c]::HandlerInner as core[373cc1b435eedd77]::ops::drop::Drop>::drop
  17:     0x7fea36f3d998 - core[373cc1b435eedd77]::ptr::drop_in_place::<rustc_session[41205b1570925eb3]::parse::ParseSess>
  18:     0x7fea36f40333 - <alloc[3a33fef0fcfbda16]::rc::Rc<rustc_session[41205b1570925eb3]::session::Session> as core[373cc1b435eedd77]::ops::drop::Drop>::drop
  19:     0x7fea36f3d01d - core[373cc1b435eedd77]::ptr::drop_in_place::<rustc_interface[e01f10fbcfbe47c5]::interface::Compiler>
  20:     0x7fea36f3c914 - rustc_span[ae3b8a4be6f596eb]::with_source_map::<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_interface[e01f10fbcfbe47c5]::interface::create_compiler_and_run<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7fea36f27234 - rustc_interface[e01f10fbcfbe47c5]::interface::create_compiler_and_run::<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>
  22:     0x7fea36f10292 - <scoped_tls[8d6377a96f770454]::ScopedKey<rustc_span[ae3b8a4be6f596eb]::SessionGlobals>>::set::<rustc_interface[e01f10fbcfbe47c5]::interface::run_compiler<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>
  23:     0x7fea36f370af - std[e3663ace07a47676]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e01f10fbcfbe47c5]::util::run_in_thread_pool_with_globals<rustc_interface[e01f10fbcfbe47c5]::interface::run_compiler<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>
  24:     0x7fea36f296a9 - <<std[e3663ace07a47676]::thread::Builder>::spawn_unchecked_<rustc_interface[e01f10fbcfbe47c5]::util::run_in_thread_pool_with_globals<rustc_interface[e01f10fbcfbe47c5]::interface::run_compiler<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>::{closure#1} as core[373cc1b435eedd77]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7fea346ab403 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haef26bcd4f755601
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/alloc/src/boxed.rs:1866:9
  26:     0x7fea346ab403 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3a96fd989239d901
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/alloc/src/boxed.rs:1866:9
  27:     0x7fea346ab403 - std::sys::unix::thread::Thread::new::thread_start::h13804fa7b9eb440b
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7fea344835c2 - start_thread
  29:     0x7fea34508584 - __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 (69a5d2481 2022-04-27) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    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