Skip to content

regression: ICE: expr in place where literal is expected (builtin attr parsing) #140612

New issue

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

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

Already on GitHub? Sign in to your account

Closed
jieyouxu opened this issue May 3, 2025 · 7 comments
Closed
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@jieyouxu
Copy link
Member

jieyouxu commented May 3, 2025

Tip

This is not a duplicate of #140219, this one is delayed at compiler/rustc_attr_parsing/src/parser.rs:498:34 and was found via crater, that is known to impact user macros. This is extracted from #137687 (comment).

Crater results

Crater #139827:

  • https://crater-reports.s3.amazonaws.com/beta-1.87-2/beta-2025-04-13/gh/0x4C656F.levi.rs/log.txt

    ICE backtrace
    [INFO] [stdout] note: no errors encountered even though delayed bugs were created
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stdout] note: those delayed bugs will now be shown as internal compiler errors
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stdout] error: internal compiler error: expr in place where literal is expected (builtin attr parsing)
    [INFO] [stdout]   --> src/errors.rs:5:37
    [INFO] [stdout]    |
    [INFO] [stdout] 5  |         #[error("({} {})  ", $code, $text)]
    [INFO] [stdout]    |                                     ^^^^^
    [INFO] [stdout] ...
    [INFO] [stdout] 52 | define_exception!(UnauthorizedException, 401, "Unauthorized".to_string());
    [INFO] [stdout]    | ------------------------------------------------------------------------- in this macro invocation
    [INFO] [stdout]    |
    [INFO] [stdout] note: delayed at compiler/rustc_attr_parsing/src/parser.rs:498:34
    [INFO] [stdout]          0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
    [INFO] [stdout]          1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
    [INFO] [stdout]          2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
    [INFO] [stdout]          3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
    [INFO] [stdout]          4: <rustc_attr_parsing::parser::MetaItemListParserContext>::next
    [INFO] [stdout]          5: <rustc_ast_lowering::LoweringContext>::lower_attrs_vec
    [INFO] [stdout]          6: <rustc_ast_lowering::item::ItemLowerer>::lower_node
    [INFO] [stdout]          7: rustc_ast_lowering::lower_to_hir
    [INFO] [stdout]          8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]          9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         10: rustc_query_impl::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::opt_hir_owner_nodes::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]         12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<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>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         13: rustc_query_impl::query_impl::opt_hir_owner_nodes::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         14: <rustc_middle::ty::context::TyCtxt>::expect_hir_owner_nodes
    [INFO] [stdout]         15: rustc_middle::hir::map::hir_crate_items
    [INFO] [stdout]         16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]         17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         18: rustc_query_impl::query_impl::hir_crate_items::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         19: rustc_interface::proc_macro_decls::proc_macro_decls_static
    [INFO] [stdout]         20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::proc_macro_decls_static::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 4]>>
    [INFO] [stdout]         21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 4]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         22: rustc_query_impl::query_impl::proc_macro_decls_static::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         23: rustc_interface::passes::run_required_analyses
    [INFO] [stdout]         24: rustc_interface::passes::analysis
    [INFO] [stdout]         25: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
    [INFO] [stdout]         26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         27: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         28: 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}
    [INFO] [stdout]         29: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
    [INFO] [stdout]         30: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
    [INFO] [stdout]         31: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    [INFO] [stdout]         32: std::sys::pal::unix::thread::Thread::new::thread_start
    [INFO] [stdout]         33: <unknown>
    [INFO] [stdout]         34: clone
    
    [... trimmed ...]
    
    [INFO] [stderr] 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
    [INFO] [stderr] 
    [INFO] [stderr] note: rustc 1.87.0-beta.4 (a5948295b 2025-04-12) running on x86_64-unknown-linux-gnu
    [INFO] [stderr] 
    [INFO] [stderr] note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2
    [INFO] [stderr] 
    [INFO] [stderr] note: some of the compiler flags provided by cargo are hidden
    [INFO] [stderr] 
    [INFO] [stderr] query stack during panic:
    [INFO] [stderr] end of query stack
    [INFO] [stderr] error: could not compile `levi` (lib); 1 warning emitted
    
  • https://crater-reports.s3.amazonaws.com/beta-1.87-2/beta-2025-04-13/gh/Hywan.weld/log.txt

    ICE backtrace
    [INFO] [stdout] note: no errors encountered even though delayed bugs were created
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stdout] note: those delayed bugs will now be shown as internal compiler errors
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stdout] error: internal compiler error: expr in place where literal is expected (builtin attr parsing)
    [INFO] [stdout]   --> crates/linker/src/linker.rs:19:1
    [INFO] [stdout]    |
    [INFO] [stdout] 19 | / error! {
    [INFO] [stdout] 20 | |     #[doc = "Linker errors."]
    [INFO] [stdout] 21 | |     pub enum Error {
    [INFO] [stdout] 22 | |         #[code = E002]
    [INFO] [stdout] ...  |
    [INFO] [stdout] 37 | | }
    [INFO] [stdout]    | |_^
    [INFO] [stdout]    |
    [INFO] [stdout] note: delayed at compiler/rustc_attr_parsing/src/parser.rs:498:34
    [INFO] [stdout]          0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
    [INFO] [stdout]          1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
    [INFO] [stdout]          2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
    [INFO] [stdout]          3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
    [INFO] [stdout]          4: <rustc_attr_parsing::parser::MetaItemListParserContext>::next
    [INFO] [stdout]          5: <rustc_ast_lowering::LoweringContext>::lower_attrs_vec
    [INFO] [stdout]          6: <rustc_ast_lowering::LoweringContext>::lower_attrs
    [INFO] [stdout]          7: <core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_ast::ast::Variant>, <rustc_ast_lowering::LoweringContext>::lower_item_kind::{closure#6}::{closure#0}> as core::iter::traits::iterator::Iterator>::next
    [INFO] [stdout]          8: <rustc_ast_lowering::LoweringContext>::lower_item_kind
    [INFO] [stdout]          9: <rustc_ast_lowering::item::ItemLowerer>::lower_node
    [INFO] [stdout]         10: rustc_ast_lowering::lower_to_hir
    [INFO] [stdout]         11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]         12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         13: rustc_query_impl::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::opt_hir_owner_nodes::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]         15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<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>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         16: rustc_query_impl::query_impl::opt_hir_owner_nodes::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         17: <rustc_middle::ty::context::TyCtxt>::expect_hir_owner_nodes
    [INFO] [stdout]         18: rustc_middle::hir::map::hir_crate_items
    [INFO] [stdout]         19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]         20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         21: rustc_query_impl::query_impl::hir_crate_items::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         22: rustc_interface::proc_macro_decls::proc_macro_decls_static
    [INFO] [stdout]         23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::proc_macro_decls_static::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 4]>>
    [INFO] [stdout]         24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 4]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         25: rustc_query_impl::query_impl::proc_macro_decls_static::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         26: rustc_interface::passes::run_required_analyses
    [INFO] [stdout]         27: rustc_interface::passes::analysis
    [INFO] [stdout]         28: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
    [INFO] [stdout]         29: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         30: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         31: 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}
    [INFO] [stdout]         32: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
    [INFO] [stdout]         33: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
    [INFO] [stdout]         34: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    [INFO] [stdout]         35: std::sys::pal::unix::thread::Thread::new::thread_start
    [INFO] [stdout]         36: <unknown>
    [INFO] [stdout]         37: clone
    [INFO] [stdout]   --> crates/linker/src/linker.rs:19:1
    [INFO] [stdout]    |
    [INFO] [stdout] 19 | / error! {
    [INFO] [stdout] 20 | |     #[doc = "Linker errors."]
    [INFO] [stdout] 21 | |     pub enum Error {
    [INFO] [stdout] 22 | |         #[code = E002]
    [INFO] [stdout] ...  |
    [INFO] [stdout] 37 | | }
    [INFO] [stdout]    | |_^
    [INFO] [stdout]    = note: this error: internal compiler error originates in the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stderr] 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
    [INFO] [stderr] 
    [INFO] [stderr] note: rustc 1.87.0-beta.4 (a5948295b 2025-04-12) running on x86_64-unknown-linux-gnu
    [INFO] [stderr] 
    [INFO] [stderr] note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2
    [INFO] [stderr] 
    [INFO] [stderr] note: some of the compiler flags provided by cargo are hidden
    [INFO] [stderr] 
    [INFO] [stderr] query stack during panic:
    [INFO] [stderr] end of query stack
    [INFO] [stderr] error: could not compile `weld-linker` (lib)
    
  • https://crater-reports.s3.amazonaws.com/beta-1.87-2/beta-2025-04-13/gh/oberien.rebo/log.txt

    ICE backtrace
    [INFO] [stdout] note: no errors encountered even though delayed bugs were created
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stdout] note: those delayed bugs will now be shown as internal compiler errors
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stdout] error: internal compiler error: expr in place where literal is expected (builtin attr parsing)
    [INFO] [stdout]    --> rebo/src/lexer/token.rs:58:38
    [INFO] [stdout]     |
    [INFO] [stdout] 58  |               #[display(fmt = $fmt $(, $fmtarg)*)]
    [INFO] [stdout]     |                                        ^^^^^^^
    [INFO] [stdout] ...
    [INFO] [stdout] 102 | / gen_tokens! {
    [INFO] [stdout] 103 | |     // primitives
    [INFO] [stdout] 104 | |     Ident<'i>, TokenIdent, "ident", {ident: &'i str,}, (fmt = "{}", ident), (Copy, Eq, Hash);
    [INFO] [stdout] 105 | |     DqString, TokenDqString, "double-quoted string", {string: String,}, (fmt = "{:?}", string), (Eq, Hash);
    [INFO] [stdout] ...   |
    [INFO] [stdout] 171 | |     Eof, TokenEof, "EOF", {}, (fmt = "EOF");
    [INFO] [stdout] 172 | | }
    [INFO] [stdout]     | |_- in this macro invocation
    [INFO] [stdout]     |
    [INFO] [stdout] note: delayed at compiler/rustc_attr_parsing/src/parser.rs:498:34
    [INFO] [stdout]          0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
    [INFO] [stdout]          1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
    [INFO] [stdout]          2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
    [INFO] [stdout]          3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
    [INFO] [stdout]          4: <rustc_attr_parsing::parser::MetaItemListParserContext>::next
    [INFO] [stdout]          5: <rustc_ast_lowering::LoweringContext>::lower_attrs_vec
    [INFO] [stdout]          6: <rustc_ast_lowering::item::ItemLowerer>::lower_node
    [INFO] [stdout]          7: rustc_ast_lowering::lower_to_hir
    [INFO] [stdout]          8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]          9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         10: rustc_query_impl::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::opt_hir_owner_nodes::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]         12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<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>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         13: rustc_query_impl::query_impl::opt_hir_owner_nodes::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         14: <rustc_middle::ty::context::TyCtxt>::expect_hir_owner_nodes
    [INFO] [stdout]         15: rustc_middle::hir::map::hir_crate_items
    [INFO] [stdout]         16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
    [INFO] [stdout]         17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         18: rustc_query_impl::query_impl::hir_crate_items::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         19: rustc_interface::proc_macro_decls::proc_macro_decls_static
    [INFO] [stdout]         20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::proc_macro_decls_static::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 4]>>
    [INFO] [stdout]         21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 4]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         22: rustc_query_impl::query_impl::proc_macro_decls_static::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         23: rustc_interface::passes::run_required_analyses
    [INFO] [stdout]         24: rustc_interface::passes::analysis
    [INFO] [stdout]         25: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
    [INFO] [stdout]         26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    [INFO] [stdout]         27: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
    [INFO] [stdout]         28: 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}
    [INFO] [stdout]         29: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
    [INFO] [stdout]         30: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
    [INFO] [stdout]         31: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    [INFO] [stdout]         32: std::sys::pal::unix::thread::Thread::new::thread_start
    [INFO] [stdout]         33: <unknown>
    [INFO] [stdout]         34: clone
    [INFO] [stdout]    --> rebo/src/lexer/token.rs:58:38
    [INFO] [stdout]     |
    [INFO] [stdout] 58  |               #[display(fmt = $fmt $(, $fmtarg)*)]
    [INFO] [stdout]     |                                        ^^^^^^^
    [INFO] [stdout] ...
    [INFO] [stdout] 102 | / gen_tokens! {
    [INFO] [stdout] 103 | |     // primitives
    [INFO] [stdout] 104 | |     Ident<'i>, TokenIdent, "ident", {ident: &'i str,}, (fmt = "{}", ident), (Copy, Eq, Hash);
    [INFO] [stdout] 105 | |     DqString, TokenDqString, "double-quoted string", {string: String,}, (fmt = "{:?}", string), (Eq, Hash);
    [INFO] [stdout] ...   |
    [INFO] [stdout] 171 | |     Eof, TokenEof, "EOF", {}, (fmt = "EOF");
    [INFO] [stdout] 172 | | }
    [INFO] [stdout]     | |_- in this macro invocation
    [INFO] [stdout]     = note: this error: internal compiler error originates in the macro `gen_tokens` (in Nightly builds, run with -Z macro-backtrace for more info)
    [INFO] [stdout] 
    [INFO] [stdout] 
    [INFO] [stderr] 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
    [INFO] [stderr] 
    [INFO] [stderr] note: rustc 1.87.0-beta.4 (a5948295b 2025-04-12) running on x86_64-unknown-linux-gnu
    [INFO] [stderr] 
    [INFO] [stderr] note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2
    [INFO] [stderr] 
    [INFO] [stderr] note: some of the compiler flags provided by cargo are hidden
    [INFO] [stderr] 
    [INFO] [stderr] query stack during panic:
    [INFO] [stderr] end of query stack
    [INFO] [stderr] error: could not compile `rebo` (lib)
    

Version it worked on

It most recently worked on: 1.86.0

Version with regression

rustc 1.87.0-beta.4 (a594829 2025-04-12) in crater #139827.


@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

@jieyouxu jieyouxu added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 3, 2025
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-untriaged Untriaged performance or correctness regression. labels May 3, 2025
@jieyouxu
Copy link
Member Author

jieyouxu commented May 3, 2025

@theemathas's MCVE from #137687 (comment) reproduced here:


Minimized from the levi repo (from the crater results):

src/lib.rs:

macro_rules! call_macro {
    ($text:expr) => {
        #[derive(bar::Bar)]
        #[arg($text)]
        pub struct Foo;
    };
}

call_macro!(1 + 1);

bar/src/lib.rs

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_derive(Bar, attributes(arg))]
pub fn derive_bar(_: proc_macro::TokenStream) -> proc_macro::TokenStream {
    TokenStream::new()
}

Zip of all files required for reproduction: repro.zip

@jieyouxu
Copy link
Member Author

jieyouxu commented May 3, 2025

@fmease's remark on #137687 (comment) edited to clarify which issue it refers to:


Nota bene: ICE #137687 != the 3 ICEs from the crater regression (this issue #140612)! ICE #137687 triggers the delayed_span_bugs found in compiler/rustc_attr_parsing/src/parser.rs:359:24 and compiler/rustc_attr_parsing/src/context.rs:336:43 while this ICE #140612 and MCVE trigger a different one, namely compiler/rustc_attr_parsing/src/parser.rs:498:34.

This is relevant/important because PR #124141 unintentionally fixed these crater regressions (#140612) and ICE on master but not ICE #137687 (of which we don't know if it's likely to be hit by real users and thus worth hotfixing on beta). For that, subscribe to draft PR #140584.

@jieyouxu jieyouxu added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 3, 2025
@jieyouxu jieyouxu added this to the 1.87.0 milestone May 3, 2025
@jieyouxu
Copy link
Member Author

jieyouxu commented May 3, 2025

cc @cuviper can you double-check if I milestoned this crater regression pulled out from #137687 correctly?

@jieyouxu
Copy link
Member Author

jieyouxu commented May 3, 2025

Discussed in #t-compiler/prioritization/alerts > #140612 regression: ICE: expr in place where literal is exp…, this regresses user macros and seems reasonably easy to hit, so

@rustbot label: -I-prioritize +P-critical

@rustbot rustbot added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 3, 2025
@jieyouxu
Copy link
Member Author

jieyouxu commented May 3, 2025

To make it easier to follow, there's a beta-targeting fix in #140601. Assigning fmease since they already have an open PR (thanks!).

@cuviper
Copy link
Member

cuviper commented May 4, 2025

cc @cuviper can you double-check if I milestoned this crater regression pulled out from #137687 correctly?

Looks fine, and I made it a sub-issue of the crater run too.

bors added a commit to rust-lang-ci/rust that referenced this issue May 9, 2025
…olated_BETA, r=nnethercote

[beta] [also fit for beta rollup] [HOTFIX] Don't delay a bug on malformed meta items involving interpolated tokens

Directly fixes rust-lang#140612.

<details><summary>Outdated Information</summary>

Directly fixes the 3 crater regressions reported in rust-lang#137687 (comment) (NB: The containing issue rust-lang#137687 is in fact *not* an instance of these regressions, see rust-lang#137687 (comment)).

</details>

**Why is this a separate PR for `beta`**? Well, the crater regressions were already fixed on master albeit unintentionally so, namely by PR rust-lang#124141 which we **certainly** don't want to backport! So this is simply a hotfix. PR rust-lang#140584 will then provide the regression test for master, too, so it doesn't get 'lost'.

[`@]T-release,` if/once accepted by T-compiler, this PR will be fit for beta rollup and can be cherry-picked.

<details><summary>Slightly Outdated & Irrelevant Information</summary>

FYI, we may also want to (separately) backport PR rust-lang#140584 to [fix] rust-lang#137687 (which, again, is not an instance of the crater regressions) but it's unclear if it's really necessary (since it's fuzzer-generated and I don't know of any real users who are impacted).

</details>

cc `@jdonszelmann`
r? fmease
@fmease
Copy link
Member

fmease commented May 10, 2025

Stable fix/backport in #140859. Closing as completed.

@fmease fmease closed this as completed May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
4 participants