-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
see #149692 for prev case
auto-reduced (treereduce-rust):
//@compile-flags: --edition=2024
macro_rules! x {
($ty:item) => {};
}
x! {
trait MyTrait {
async fn bar(&abc self);
}
impl MyTrait for ()
fn main() {}
fn foo() -> impl async Fn() { }
}original:
//@ edition: 2021
macro_rules! x {
($ty:item) => {}
}
x! {
//@ edition:2021
trait MyTrait {
async fn bar(&abc self);
//~^ ERROR expected identifier, found keyword `self`
//~| ERROR expected one of `:`, `@`, or `|`, found keyword `self`
}
impl MyTrait for () {
async fn bar(&self) {}
}
fn main() {}
fn foo() -> impl async Fn() { }
//~^ ERROR `async` trait bounds are unstable
}
fn main(_c: impl FnMut() -> T) {}Version information
rustc 1.94.0-nightly (defdb83d4 2026-01-17)
binary: rustc
commit-hash: defdb83d4bde9406ec4b37dd3dd572c1d70a14ca
commit-date: 2026-01-17
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Possibly related line of code:
rust/compiler/rustc_parse/src/parser/diagnostics.rs
Lines 2261 to 2273 in defdb83
| // If we find a pattern followed by an identifier, it could be an (incorrect) | |
| // C-style parameter declaration. | |
| if self.check_ident() | |
| && self.look_ahead(1, |t| *t == token::Comma || *t == token::CloseParen) | |
| { | |
| // `fn foo(String s) {}` | |
| let ident = self.parse_ident().unwrap(); | |
| let span = pat.span.with_hi(ident.span.hi()); | |
| err.span_suggestion( | |
| span, | |
| "declare the type after the parameter binding", | |
| "<identifier>: <type>", |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024
Program output
thread 'rustc' (796355) panicked at /rustc-dev/defdb83d4bde9406ec4b37dd3dd572c1d70a14ca/compiler/rustc_parse/src/parser/diagnostics.rs:2267:44:
called `Result::unwrap()` on an `Err` value: Some(DiagInner { level: Error, messages: [(FluentIdentifier("parse_expected_identifier_found_keyword_str", None), NoStyle)], code: None, lint_id: None, span: MultiSpan { primary_spans: [/tmp/icemaker_global_tempdir.kifsbI1txcVD/rustc_testrunner_tmpdir_reporting.6LYBMeUXY8XE/mvce.rs:10:23: 10:27 (#0)], span_labels: [(/tmp/icemaker_global_tempdir.kifsbI1txcVD/rustc_testrunner_tmpdir_reporting.6LYBMeUXY8XE/mvce.rs:10:23: 10:27 (#0), Translated("expected identifier, found keyword"))] }, children: [], suggestions: Enabled([]), args: {"token": Str("self")}, reserved_args: {}, sort_span: /tmp/icemaker_global_tempdir.kifsbI1txcVD/rustc_testrunner_tmpdir_reporting.6LYBMeUXY8XE/mvce.rs:10:23: 10:27 (#0), is_lint: None, long_ty_path: None, emitted_at: DiagLocation { file: "/rustc-dev/defdb83d4bde9406ec4b37dd3dd572c1d70a14ca/compiler/rustc_parse/src/parser/diagnostics.rs", line: 376, col: 34 } })
stack backtrace:
0: 0x7f80da241003 - <<std[51f25addf6667380]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[5126a227517a4cf5]::fmt::Display>::fmt
1: 0x7f80da80e2c8 - core[5126a227517a4cf5]::fmt::write
2: 0x7f80da2579f6 - <std[51f25addf6667380]::sys::stdio::unix::Stderr as std[51f25addf6667380]::io::Write>::write_fmt
3: 0x7f80da217078 - std[51f25addf6667380]::panicking::default_hook::{closure#0}
4: 0x7f80da234733 - std[51f25addf6667380]::panicking::default_hook
5: 0x7f80d9208e2a - std[51f25addf6667380]::panicking::update_hook::<alloc[38134d33c6c92a63]::boxed::Box<rustc_driver_impl[1d73b4288d20d386]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f80da234a12 - std[51f25addf6667380]::panicking::panic_with_hook
7: 0x7f80da217138 - std[51f25addf6667380]::panicking::panic_handler::{closure#0}
8: 0x7f80da20b679 - std[51f25addf6667380]::sys::backtrace::__rust_end_short_backtrace::<std[51f25addf6667380]::panicking::panic_handler::{closure#0}, !>
9: 0x7f80da218c0d - __rustc[52d9cece14eac652]::rust_begin_unwind
10: 0x7f80d763bd7c - core[5126a227517a4cf5]::panicking::panic_fmt
11: 0x7f80d6bbe272 - core[5126a227517a4cf5]::result::unwrap_failed
12: 0x7f80daa4f7b8 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_param_general::{closure#0}
13: 0x7f80daa44870 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_fn_params
14: 0x7f80daa78482 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_fn
15: 0x7f80db2fb296 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_item_kind
16: 0x7f80db2f7737 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_item_common
17: 0x7f80daab2de8 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_assoc_item
18: 0x7f80db2eb96a - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_item_trait
19: 0x7f80db2fb6f9 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_item_kind
20: 0x7f80db2f7737 - <rustc_parse[e87bf106090b7c1a]::parser::Parser>::parse_item_common
21: 0x7f80dbe0c78c - <rustc_expand[f87a94d765ddf3ed]::expand::MacroExpander>::fully_expand_fragment
22: 0x7f80dbe041d2 - <rustc_expand[f87a94d765ddf3ed]::expand::MacroExpander>::expand_crate
23: 0x7f80dafcebf4 - rustc_interface[e7b4096e17a3c877]::passes::configure_and_expand
24: 0x7f80db99d0d5 - rustc_interface[e7b4096e17a3c877]::passes::resolver_for_lowering_raw
25: 0x7f80db99ce4d - rustc_query_impl[89c6b20ee6d2544b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[89c6b20ee6d2544b]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e5f0e31661f7e7f1]::query::erase::Erased<[u8; 16usize]>>
26: 0x7f80db99ce2f - <rustc_query_impl[89c6b20ee6d2544b]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[5126a227517a4cf5]::ops::function::FnOnce<(rustc_middle[e5f0e31661f7e7f1]::ty::context::TyCtxt, ())>>::call_once
27: 0x7f80db98279c - rustc_query_system[8ffed1da27509f09]::query::plumbing::try_execute_query::<rustc_query_impl[89c6b20ee6d2544b]::DynamicConfig<rustc_query_system[8ffed1da27509f09]::query::caches::SingleCache<rustc_middle[e5f0e31661f7e7f1]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[89c6b20ee6d2544b]::plumbing::QueryCtxt, false>
28: 0x7f80db982304 - rustc_query_impl[89c6b20ee6d2544b]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
29: 0x7f80dbb8dc38 - <rustc_interface[e7b4096e17a3c877]::passes::create_and_enter_global_ctxt<core[5126a227517a4cf5]::option::Option<rustc_interface[e7b4096e17a3c877]::queries::Linker>, rustc_driver_impl[1d73b4288d20d386]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[5126a227517a4cf5]::ops::function::FnOnce<(&rustc_session[971580cc16053ea2]::session::Session, rustc_middle[e5f0e31661f7e7f1]::ty::context::CurrentGcx, alloc[38134d33c6c92a63]::sync::Arc<rustc_data_structures[7382e954ae46016d]::jobserver::Proxy>, &std[51f25addf6667380]::sync::once_lock::OnceLock<rustc_middle[e5f0e31661f7e7f1]::ty::context::GlobalCtxt>, &rustc_data_structures[7382e954ae46016d]::sync::worker_local::WorkerLocal<rustc_middle[e5f0e31661f7e7f1]::arena::Arena>, &rustc_data_structures[7382e954ae46016d]::sync::worker_local::WorkerLocal<rustc_hir[dbd870516aefb0ef]::Arena>, rustc_driver_impl[1d73b4288d20d386]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
30: 0x7f80db9b70f4 - rustc_interface[e7b4096e17a3c877]::interface::run_compiler::<(), rustc_driver_impl[1d73b4288d20d386]::run_compiler::{closure#0}>::{closure#1}
31: 0x7f80db940fba - std[51f25addf6667380]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e7b4096e17a3c877]::util::run_in_thread_with_globals<rustc_interface[e7b4096e17a3c877]::util::run_in_thread_pool_with_globals<rustc_interface[e7b4096e17a3c877]::interface::run_compiler<(), rustc_driver_impl[1d73b4288d20d386]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
32: 0x7f80db940d7e - <std[51f25addf6667380]::thread::lifecycle::spawn_unchecked<rustc_interface[e7b4096e17a3c877]::util::run_in_thread_with_globals<rustc_interface[e7b4096e17a3c877]::util::run_in_thread_pool_with_globals<rustc_interface[e7b4096e17a3c877]::interface::run_compiler<(), rustc_driver_impl[1d73b4288d20d386]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[5126a227517a4cf5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
33: 0x7f80db942b42 - <std[51f25addf6667380]::sys::thread::unix::Thread>::new::thread_start
34: 0x7f80d529698b - <unknown>
35: 0x7f80d531a9cc - <unknown>
36: 0x0 - <unknown>
error: 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: please make sure that you have updated to the latest nightly
note: rustc 1.94.0-nightly (defdb83d4 2026-01-17) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z dump-mir-dir=dir
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.