Skip to content

ICE: Rustc Crashes on Lifetime Parameter in Async Fn #133693

Closed
@wangbo15

Description

@wangbo15

Code

#![allow(dead_code)]
struct Foo<'static>(&'static u32);
impl<'static> Foo<'static>
{ async fn foo() {} }
fn main(){}

Meta

rustc --version --verbose:

rustc 1.85.0-nightly (7442931d4 2024-11-30)
binary: rustc
commit-hash: 7442931d49b199ad0a1cc0f8ca54e327b5139b66
commit-date: 2024-11-30
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.4

Error output

$ rustc --edition=2021 test.rs 
error[E0262]: invalid lifetime parameter name: `'static`
 --> test.rs:2:12
  |
2 | struct Foo<'static>(&'static u32);
  |            ^^^^^^^ 'static is a reserved lifetime name

error[E0262]: invalid lifetime parameter name: `'static`
 --> test.rs:3:6
  |
3 | impl<'static> Foo<'static>
  |      ^^^^^^^ 'static is a reserved lifetime name

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:899:36: cannot convert `'static/#0` to a region vid
Backtrace

thread 'rustc' panicked at compiler/rustc_borrowck/src/universal_regions.rs:899:36:
Box<dyn Any>
stack backtrace:
   0:     0x7f57d8dd00da - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h41650409cfcaa385
   1:     0x7f57d9479c26 - core::fmt::write::h124e50a41a614f35
   2:     0x7f57da4752d1 - std::io::Write::write_fmt::h152c770d77d8200b
   3:     0x7f57d8dcff32 - std::sys::backtrace::BacktraceLock::print::hb77a071b09f7b2d4
   4:     0x7f57d8dd243a - std::panicking::default_hook::{{closure}}::h2289b310e8f70172
   5:     0x7f57d8dd2283 - std::panicking::default_hook::h6b36901e2a542246
   6:     0x7f57d7f45618 - std[562fec4e669516d]::panicking::update_hook::<alloc[86f54b6de7847bb5]::boxed::Box<rustc_driver_impl[754960437973ebe]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7f57d8dd2bf8 - std::panicking::rust_panic_with_hook::hd7b2147b933d3e5b
   8:     0x7f57d7f7ae21 - std[562fec4e669516d]::panicking::begin_panic::<rustc_errors[35a85695d11d5811]::ExplicitBug>::{closure#0}
   9:     0x7f57d7f6fce6 - std[562fec4e669516d]::sys::backtrace::__rust_end_short_backtrace::<std[562fec4e669516d]::panicking::begin_panic<rustc_errors[35a85695d11d5811]::ExplicitBug>::{closure#0}, !>
  10:     0x7f57d7f6fcd3 - std[562fec4e669516d]::panicking::begin_panic::<rustc_errors[35a85695d11d5811]::ExplicitBug>
  11:     0x7f57d7f84e61 - <rustc_errors[35a85695d11d5811]::diagnostic::BugAbort as rustc_errors[35a85695d11d5811]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f57d8574d33 - rustc_middle[6e6d053ab00ffe47]::util::bug::opt_span_bug_fmt::<rustc_span[218a417b0d7920e2]::span_encoding::Span>::{closure#0}
  13:     0x7f57d855d1da - rustc_middle[6e6d053ab00ffe47]::ty::context::tls::with_opt::<rustc_middle[6e6d053ab00ffe47]::util::bug::opt_span_bug_fmt<rustc_span[218a417b0d7920e2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f57d855d06b - rustc_middle[6e6d053ab00ffe47]::ty::context::tls::with_context_opt::<rustc_middle[6e6d053ab00ffe47]::ty::context::tls::with_opt<rustc_middle[6e6d053ab00ffe47]::util::bug::opt_span_bug_fmt<rustc_span[218a417b0d7920e2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f57d6812340 - rustc_middle[6e6d053ab00ffe47]::util::bug::bug_fmt
  16:     0x7f57daa84f60 - <rustc_borrowck[4000f49d4f35c9a9]::universal_regions::UniversalRegionIndices>::to_region_vid.cold
  17:     0x7f57d94bdb85 - <&rustc_middle[6e6d053ab00ffe47]::ty::list::RawList<(), rustc_middle[6e6d053ab00ffe47]::ty::generic_args::GenericArg> as rustc_type_ir[555f37532e32cbd7]::fold::TypeFoldable<rustc_middle[6e6d053ab00ffe47]::ty::context::TyCtxt>>::try_fold_with::<rustc_type_ir[555f37532e32cbd7]::fold::RegionFolder<rustc_middle[6e6d053ab00ffe47]::ty::context::TyCtxt>>
  18:     0x7f57d94bf744 - <rustc_middle[6e6d053ab00ffe47]::ty::Ty as rustc_type_ir[555f37532e32cbd7]::fold::TypeSuperFoldable<rustc_middle[6e6d053ab00ffe47]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_type_ir[555f37532e32cbd7]::fold::RegionFolder<rustc_middle[6e6d053ab00ffe47]::ty::context::TyCtxt>>
  19:     0x7f57d94bedf0 - <&rustc_middle[6e6d053ab00ffe47]::ty::list::RawList<(), rustc_middle[6e6d053ab00ffe47]::ty::Ty> as rustc_type_ir[555f37532e32cbd7]::fold::TypeFoldable<rustc_middle[6e6d053ab00ffe47]::ty::context::TyCtxt>>::try_fold_with::<rustc_type_ir[555f37532e32cbd7]::fold::RegionFolder<rustc_middle[6e6d053ab00ffe47]::ty::context::TyCtxt>>
  20:     0x7f57da5bf2aa - rustc_borrowck[4000f49d4f35c9a9]::do_mir_borrowck
[rustc-ice-2024-12-01T05_05_25-7073.txt](https://github.com/user-attachments/files/17967887/rustc-ice-2024-12-01T05_05_25-7073.txt)

Metadata

Metadata

Assignees

No one assigned

    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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions