Description
rustc-ice-2024-12-26T04_38_07-1636589.txt
I have a rustc crash for you.
You will notice that I reference a concrete type that is not defined. I just did that to make it more minimal; I still get the crash even if I define it, ie. with struct Something { }
. Similarly, this still works (ie. crashes) if I define a main()
.
With the benefit of hindsight and after reducing it, I understand why this input is not valid Rust, and do not need help debugging the actual thing I was trying to do. In fact, it's quite impressive that the compiler gets so far as to show meaningful error messages before crashing. I just figured you'd, you know, want to know about the crash.
Good luck!
Code
trait Trait {
async fn method<'a>();
}
impl<'a> Trait for Something {
async fn method<'a>() { }
}
Meta
rustc --version --verbose
:
rustc 1.85.0-nightly (7c002ff9a 2024-12-25)
binary: rustc
commit-hash: 7c002ff9a70cb84fd1a91bc7b4a0f988cfc36fca
commit-date: 2024-12-25
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.6
Error output
Compiling cloakroom v0.1.0 (/home/irenes/Projects/cloakroom-reduced)
error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
--> src/main.rs:6:19
|
5 | impl<'a> Trait for Something {
| -- first declared here
6 | async fn method<'a>() { }
| ^^ lifetime `'a` already in scope
error[E0412]: cannot find type `Something` in this scope
--> src/main.rs:5:20
|
5 | impl<'a> Trait for Something {
| ^^^^^^^^^ not found in this scope
error[E0601]: `main` function not found in crate `cloakroom`
--> src/main.rs:7:2
|
7 | }
| ^ consider adding a `main` function to `src/main.rs`
error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:901:36: cannot convert `'a/#1` to a region vid
thread 'rustc' panicked at compiler/rustc_borrowck/src/universal_regions.rs:901:36:
Box<dyn Any>
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
5: rustc_middle::util::bug::bug_fmt
6: <rustc_borrowck::universal_regions::UniversalRegionIndices>::to_region_vid.cold
7: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_type_ir::fold::RegionFolder<rustc_middle::ty::context::TyCtxt>>
8: <rustc_middle::ty::Ty as rustc_type_ir::fold::TypeSuperFoldable<rustc_middle::ty::context::TyCtxt>>::try_super_fold_with::<rustc_type_ir::fold::RegionFolder<rustc_middle::ty::context::TyCtxt>>
9: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_type_ir::fold::RegionFolder<rustc_middle::ty::context::TyCtxt>>
10: rustc_borrowck::do_mir_borrowck
[... omitted 1 frame ...]
11: rustc_middle::query::plumbing::query_get_at::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>>
12: rustc_hir_analysis::collect::type_of::type_of_opaque
[... omitted 1 frame ...]
13: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>>
14: rustc_hir_analysis::collect::type_of::type_of
[... omitted 1 frame ...]
15: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>>
16: rustc_hir_analysis::check::check::check_item_type
17: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
18: rustc_middle::query::plumbing::query_ensure_error_guaranteed::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, ()>
19: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
[... omitted 1 frame ...]
20: rustc_hir_analysis::check_crate
21: rustc_interface::passes::run_required_analyses
22: rustc_interface::passes::analysis
[... omitted 1 frame ...]
23: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
24: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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: please make sure that you have updated to the latest nightly
note: please attach the file at `[redacted]/rustc-ice-2024-12-26T04_38_07-1636589.txt` to your bug report
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
<!-- Failed to upload "rustc-ice-2024-12-26T04_38_07-1636589.txt" -->
<!-- Failed to upload "rustc-ice-2024-12-26T04_38_07-1636589.txt" -->
[rustc-ice-2024-12-26T04_38_07-1636589.txt](https://github.com/user-attachments/files/18249603/rustc-ice-2024-12-26T04_38_07-1636589.txt)
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at src/main.rs:5:1: 5:29>::method`
#1 [type_of_opaque] computing type of opaque `<impl at src/main.rs:5:1: 5:29>::method::{opaque#0}`
#2 [type_of] computing type of `<impl at src/main.rs:5:1: 5:29>::method::{opaque#0}`
#3 [check_well_formed] checking that `<impl at src/main.rs:5:1: 5:29>::method::{opaque#0}` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in top-level module
#5 [analysis] running analysis passes on this crate[rustc-ice-2024-12-26T04_38_07-1636589.txt](https://github.com/user-attachments/files/18249606/rustc-ice-2024-12-26T04_38_07-1636589.txt)
end of query stack
Some errors have detailed explanations: E0412, E0496, E0601.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `cloakroom` (bin "cloakroom") due to 3 previous errors
The above output was with RUST_BACKTRACE=1, but I get almost the same thing without it; I'm unable to identify which portion of this is the "backtrace" and which is the "error output" so I have put it all together, above. Hope that's okay.