Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wangbo15 opened this issue Dec 1, 2024 · 4 comments · Fixed by #135000
Closed

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

wangbo15 opened this issue Dec 1, 2024 · 4 comments · Fixed by #135000
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wangbo15
Copy link

wangbo15 commented Dec 1, 2024

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)

@wangbo15 wangbo15 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 1, 2024
@cyrgani
Copy link
Contributor

cyrgani commented Dec 1, 2024

Reduced:

impl<'static> Foo { async fn foo() {} }

@cyrgani
Copy link
Contributor

cyrgani commented Dec 1, 2024

Likely the same as #131295.

@jieyouxu jieyouxu added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Dec 2, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Dec 2, 2024

Agreed, looks like same root cause. Closing as duplicate of #131295.

@jieyouxu jieyouxu closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 2, 2024
@jieyouxu
Copy link
Member

Probably not the same as the original example reported in #131295, reopening for re-triage.
@rustbot label +needs-triage

@jieyouxu jieyouxu reopened this Dec 26, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 26, 2024
@bors bors closed this as completed in 92dbfcc Jan 2, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Rollup merge of rust-lang#135000 - compiler-errors:opaque-captures-dupe, r=lqd

Fix ICE when opaque captures a duplicated/invalid lifetime

See description on test.

Fixes rust-lang#132766
Fixes rust-lang#133693
Fixes rust-lang#134780
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 3, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants