Repository navigation
[ICE]: Macro captures a list meta item with $m:meta and passes it directly to #[derive] causes must not be empty and have no suggestion #161472
Copy link
Copy link
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-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) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Description
Code
extern crate core;
macro_rules! m { ($m:meta) => { #[derive($m)] pub struct S; }; }
m!(a(::b::c));Not reproducible using the playground
Discovered while adding regression tests for issue: #53048
PR: #161412
Meta
rustc 1.100.0-nightly
Error output
thread 'rustc' (96729) panicked at compiler/rustc_errors/src/diagnostic.rs:1041:17:
Span `/checkout/tests/ui/macros/meta-item-global-path-fail-issue-53048.rs:9:5: 9:5 (#0)` must not be empty and have no suggestion
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: <core::iter::adapters::map::Map<core::array::iter::IntoIter<alloc::string::String, 1>, <rustc_errors::diagnostic::Diag<()>>::span_suggestions_with_style<rustc_error_messages::DiagMessage, core::array::iter::IntoIter<alloc::string::String, 1>>::{closure#0}> as core::iter::traits::iterator::Iterator>::fold::<(), core::iter::traits::iterator::Iterator::for_each::call<rustc_errors::Substitution, <alloc::vec::Vec<rustc_errors::Substitution>>::extend_trusted<core::iter::adapters::map::Map<core::array::iter::IntoIter<alloc::string::String, 1>, <rustc_errors::diagnostic::Diag<()>>::span_suggestions_with_style<rustc_error_messages::DiagMessage, core::array::iter::IntoIter<alloc::string::String, 1>>::{closure#0}>>::{closure#0}>::{closure#0}>
3: <alloc::vec::Vec<rustc_errors::Substitution> as alloc::vec::spec_from_iter::SpecFromIter<rustc_errors::Substitution, core::iter::adapters::map::Map<core::array::iter::IntoIter<alloc::string::String, 1>, <rustc_errors::diagnostic::Diag>::span_suggestions_with_style<rustc_error_messages::DiagMessage, core::array::iter::IntoIter<alloc::string::String, 1>>::{closure#0}>>>::from_iter
4: <rustc_errors::diagnostic::Diag>::span_suggestions_with_style::<rustc_error_messages::DiagMessage, core::array::iter::IntoIter<alloc::string::String, 1>>
5: <rustc_builtin_macros::diagnostics::DerivePathArgsList as rustc_errors::diagnostic::Diagnostic>::into_diag
6: rustc_builtin_macros::derive::report_path_args
7: <core::iter::adapters::map::Map<core::iter::adapters::map::Map<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rustc_ast::ast::MetaItemInner>, <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}::{closure#0}>, <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}::{closure#1}>, <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}::{closure#2}> as core::iter::traits::iterator::Iterator>::next
8: <alloc::vec::Vec<rustc_expand::base::DeriveResolution> as alloc::vec::spec_from_iter::SpecFromIter<rustc_expand::base::DeriveResolution, core::iter::adapters::map::Map<core::iter::adapters::map::Map<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rustc_ast::ast::MetaItemInner>, <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}::{closure#0}>, <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}::{closure#1}>, <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}::{closure#2}>>>::from_iter
9: <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}
10: <rustc_resolve::Resolver as rustc_expand::base::ResolverExpand>::resolve_derives
11: <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand
12: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
13: <rustc_expand::expand::MacroExpander>::expand_crate
14: <rustc_session::session::Session>::time::<rustc_ast::ast::Crate, rustc_interface::passes::configure_and_expand::{closure#1}>
15: rustc_interface::passes::resolver_for_lowering_raw
[... omitted 2 frames ...]
16: <rustc_middle::ty::context::TyCtxt>::resolver_for_lowering
17: std::panicking::catch_unwind::<core::option::Option<rustc_interface::queries::Linker>, core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}::{closure#0}>>
18: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
19: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}>
20: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
21: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}::{closure#0}>>
22: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
23: rustc_span::create_session_globals_then::<(), 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#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.100.0-nightly (70a12f98c 2026-08-20) running on aarch64-unknown-linux-gnu
note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-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) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Activity
KevinA-cpu commentedon Aug 21, 2026
@rustbot label +requires-debug-assertions +S-has-mcve +A-diagnostics +A-suggestion-diagnostics +A-macros +A-attributes
bb1yd commentedon Aug 22, 2026
@rustbot claim
Rollup merge of rust-lang#162246 - bb1yd:fix-incorrect-meta-span, r=n…
Rollup merge of rust-lang#162246 - bb1yd:fix-incorrect-meta-span, r=n…
Rollup merge of rust-lang#162246 - bb1yd:fix-incorrect-meta-span, r=n…
Rollup merge of rust-lang#162246 - bb1yd:fix-incorrect-meta-span, r=n…
Rollup merge of rust-lang#162246 - bb1yd:fix-incorrect-meta-span, r=n…
Rollup merge of rust-lang#162246 - bb1yd:fix-incorrect-meta-span, r=n…
Rollup merge of rust-lang#162246 - bb1yd:fix-incorrect-meta-span, r=n…
Unrolled build for #162246 in rollup 162310
Rollup merge of #162246 - bb1yd:fix-incorrect-meta-span, r=nnethercote
Rollup merge of #162246 - bb1yd:fix-incorrect-meta-span, r=nnethercote