-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)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.
Description
auto-reduced (treereduce-rust):
#[crate_type = concat!("my", "crate")]
macro_rules! foo {
() => {
32
};
}
fn main() {}
original:
//~^ ERROR malformed
#[crate_type = concat!("my", "crate")] //~ ERROR cannot find macro `foo` in this scope
macro_rules! foo {
() => { 32 }
}
fn main() {}
Version information
rustc 1.91.0-nightly (269d5b56b 2025-08-27)
binary: rustc
commit-hash: 269d5b56bcfdf2be82213e72ef9a2e4c592a8c6b
commit-date: 2025-08-27
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
warning: unused macro definition: `foo`
--> /tmp/icemaker_global_tempdir.C8L3MqGBk9J6/rustc_testrunner_tmpdir_reporting.t3XP8hMccBjq/mvce.rs:3:14
|
3 | macro_rules! foo {
| ^^^
|
= note: `#[warn(unused_macros)]` (part of `#[warn(unused)]`) on by default
warning: crate-level attribute should be an inner attribute
--> /tmp/icemaker_global_tempdir.C8L3MqGBk9J6/rustc_testrunner_tmpdir_reporting.t3XP8hMccBjq/mvce.rs:1:1
|
1 | #[crate_type = concat!("my", "crate")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` (part of `#[warn(unused)]`) on by default
help: add a `!`
|
1 | #![crate_type = concat!("my", "crate")]
| +
warning: 2 warnings emitted
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: expr in place where literal is expected (builtin attr parsing)
--> /tmp/icemaker_global_tempdir.C8L3MqGBk9J6/rustc_testrunner_tmpdir_reporting.t3XP8hMccBjq/mvce.rs:1:1
|
1 | #[crate_type = concat!("my", "crate")]
| ^^^^^^^^^^^^^^
|
note: delayed at /rustc-dev/269d5b56bcfdf2be82213e72ef9a2e4c592a8c6b/compiler/rustc_attr_parsing/src/interface.rs:355:43
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
4: <rustc_resolve::def_collector::DefCollector as rustc_ast::visit::Visitor>::visit_item
5: <rustc_resolve::def_collector::DefCollector as rustc_ast::visit::Visitor>::visit_crate
6: <rustc_resolve::Resolver as rustc_expand::base::ResolverExpand>::visit_ast_fragment_with_placeholders
7: <rustc_expand::expand::MacroExpander>::collect_invocations
8: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
9: <rustc_expand::expand::MacroExpander>::expand_crate
10: rustc_interface::passes::configure_and_expand
11: rustc_interface::passes::resolver_for_lowering_raw
12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
13: <rustc_query_impl::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
15: rustc_query_impl::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
16: 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}
17: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
18: 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}, ()>
19: <<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}
20: std::sys::pal::unix::thread::Thread::new::thread_start
21: <unknown>
22: <unknown>
--> /tmp/icemaker_global_tempdir.C8L3MqGBk9J6/rustc_testrunner_tmpdir_reporting.t3XP8hMccBjq/mvce.rs:1:1
|
1 | #[crate_type = concat!("my", "crate")]
| ^^^^^^^^^^^^^^
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.91.0-nightly (269d5b56b 2025-08-27) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)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.