Closed
Description
auto-reduced (treereduce-rust):
impl Foo { fn main() {
let S { ref Self } = RAW_SLICE_TOO_LONG;
;
} }
original:
struct Baz { q: Option<Foo> }
//~^ ERROR recursive types `Baz` and `Foo` have infinite size
struct Foo { q: Option<Baz> }
impl Foo { fn main() {
let s = S { f1: 123 };
let S { ref Self } = RAW_SLICE_TOO_LONG; //~ ERROR unused variable
let points = vec![Point { x: 1, y: 2 }];
let _: i32 = points.iter().map(|Point { x, y }| y).sum(); //~ ERROR unused variable
match (s.0, 0) {
TEST2 => println!("matched"),
//~^ ERROR behave unpredictably
_ => panic!("didn't match")
};
} }
fn main() {}
Version information
rustc 1.84.0-nightly (3fee0f12e 2024-11-20)
binary: rustc
commit-hash: 3fee0f12e4f595948f8f54f57c8b7a7a58127124
commit-date: 2024-11-20
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3
Possibly related line of code:
rust/compiler/rustc_resolve/src/late.rs
Lines 3939 to 3951 in 3fee0f1
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error: expected identifier, found keyword `Self`
--> /tmp/icemaker_global_tempdir.MevH4NlT2UPr/rustc_testrunner_tmpdir_reporting.rUbmgP8E1aau/mvce.rs:8:17
|
8 | let S { ref Self } = RAW_SLICE_TOO_LONG;
| ^^^^ expected identifier, found keyword
error: internal compiler error: unexpected `SelfCtor` in pattern, expected identifier
--> /tmp/icemaker_global_tempdir.MevH4NlT2UPr/rustc_testrunner_tmpdir_reporting.rUbmgP8E1aau/mvce.rs:8:17
|
8 | let S { ref Self } = RAW_SLICE_TOO_LONG;
| ^^^^
thread 'rustc' panicked at compiler/rustc_resolve/src/late.rs:3945:30:
Box<dyn Any>
stack backtrace:
0: 0x70dca9e75eca - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h462aecd04ea9579e
1: 0x70dcaa623362 - core::fmt::write::h90ee43f9ea3cba58
2: 0x70dcaba7d091 - std::io::Write::write_fmt::hedeb5e5db4a69c5c
3: 0x70dca9e75d22 - std::sys::backtrace::BacktraceLock::print::h4cd84f50718730a5
4: 0x70dca9e781fa - std::panicking::default_hook::{{closure}}::hd4c3e895ac68f35a
5: 0x70dca9e78060 - std::panicking::default_hook::h63638a03e198d592
6: 0x70dca8efbc25 - std[2244cad2f80807fb]::panicking::update_hook::<alloc[cbefbba4106c24e6]::boxed::Box<rustc_driver_impl[a02cca374e721ba2]::install_ice_hook::{closure#0}>>::{closure#0}
7: 0x70dca9e788d8 - std::panicking::rust_panic_with_hook::hb612322ec5da5d64
8: 0x70dca8f362a1 - std[2244cad2f80807fb]::panicking::begin_panic::<rustc_errors[f9771b9e181d5533]::ExplicitBug>::{closure#0}
9: 0x70dca8f29266 - std[2244cad2f80807fb]::sys::backtrace::__rust_end_short_backtrace::<std[2244cad2f80807fb]::panicking::begin_panic<rustc_errors[f9771b9e181d5533]::ExplicitBug>::{closure#0}, !>
10: 0x70dca8f24839 - std[2244cad2f80807fb]::panicking::begin_panic::<rustc_errors[f9771b9e181d5533]::ExplicitBug>
11: 0x70dca8f401d1 - <rustc_errors[f9771b9e181d5533]::diagnostic::BugAbort as rustc_errors[f9771b9e181d5533]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x70dca9a0ebf4 - <rustc_errors[f9771b9e181d5533]::DiagCtxtHandle>::span_bug::<rustc_span[17c8ace98e68264b]::span_encoding::Span, &str>
13: 0x70dcab3da5cf - <rustc_ast[cb4a9f145e050deb]::ast::Pat>::walk::<<rustc_resolve[da9d6586afcb5ccb]::late::LateResolutionVisitor>::resolve_pattern_inner::{closure#0}>
14: 0x70dcab3d945a - <rustc_ast[cb4a9f145e050deb]::ast::Pat>::walk::<<rustc_resolve[da9d6586afcb5ccb]::late::LateResolutionVisitor>::resolve_pattern_inner::{closure#0}>
15: 0x70dcab3e7cf2 - <rustc_resolve[da9d6586afcb5ccb]::late::LateResolutionVisitor>::resolve_block
16: 0x70dcab3e1be9 - <rustc_resolve[da9d6586afcb5ccb]::late::LateResolutionVisitor as rustc_ast[cb4a9f145e050deb]::visit::Visitor>::visit_fn
17: 0x70dcab40d3a7 - <rustc_resolve[da9d6586afcb5ccb]::late::LateResolutionVisitor as rustc_ast[cb4a9f145e050deb]::visit::Visitor>::visit_item
18: 0x70dcab9a3ff8 - <rustc_resolve[da9d6586afcb5ccb]::Resolver>::resolve_crate::{closure#0}
19: 0x70dcab99e4bf - <rustc_resolve[da9d6586afcb5ccb]::Resolver>::resolve_crate
20: 0x70dcaaa9f94f - rustc_interface[c2b60ea3c5f8ab84]::passes::resolver_for_lowering_raw
21: 0x70dcaaa9ea4d - rustc_query_impl[6938d1d3b9759c59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6938d1d3b9759c59]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>
22: 0x70dcaaa9ea25 - <rustc_query_impl[6938d1d3b9759c59]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[f62530bb87197118]::ops::function::FnOnce<(rustc_middle[65a7c84fae00e80e]::ty::context::TyCtxt, ())>>::call_once
23: 0x70dcab5e9b24 - rustc_query_system[37669824fe84eed8]::query::plumbing::try_execute_query::<rustc_query_impl[6938d1d3b9759c59]::DynamicConfig<rustc_query_system[37669824fe84eed8]::query::caches::SingleCache<rustc_middle[65a7c84fae00e80e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[6938d1d3b9759c59]::plumbing::QueryCtxt, false>
24: 0x70dcab5e97e0 - rustc_query_impl[6938d1d3b9759c59]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
25: 0x70dcab50ff9e - rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler::<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}
26: 0x70dcab5401e0 - std[2244cad2f80807fb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_with_globals<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_pool_with_globals<rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>
27: 0x70dcab53fefd - <<std[2244cad2f80807fb]::thread::Builder>::spawn_unchecked_<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_with_globals<rustc_interface[c2b60ea3c5f8ab84]::util::run_in_thread_pool_with_globals<rustc_interface[c2b60ea3c5f8ab84]::interface::run_compiler<core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>, rustc_driver_impl[a02cca374e721ba2]::run_compiler::{closure#0}>::{closure#1}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f62530bb87197118]::result::Result<(), rustc_span[17c8ace98e68264b]::ErrorGuaranteed>>::{closure#1} as core[f62530bb87197118]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
28: 0x70dcab53f6b9 - std::sys::pal::unix::thread::Thread::new::thread_start::hbfb59c93227878ea
29: 0x70dcacd9c39d - <unknown>
30: 0x70dcace2149c - <unknown>
31: 0x0 - <unknown>
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: rustc 1.84.0-nightly (3fee0f12e 2024-11-20) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 2 previous errors