Closed
Description
I tried this code:
macro_rules! breakme {
($config:stmt; $($tokens:literal)*) => {
#[cfg($config)]
$($tokens)*
};
}
fn main() {
macro_rules! unix {
() => {
not(unix)
};
}
breakme!(unix!(); "test");
}
I didn't actually expect it to work ( yet ), but it shouldn't have panicked.
Meta
Build using the Nightly version: 1.44.0-nightly
(2020-03-30 2113659479a82ea69633)
Backtrace
thread 'rustc' panicked at 'non-eager expansion without a parent scope', src/librustc_resolve/macros.rs:223:37
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1069
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1439
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:515
12: rust_begin_unwind
at src/libstd/panicking.rs:419
13: core::panicking::panic_fmt
at src/libcore/panicking.rs:111
14: core::option::expect_failed
at src/libcore/option.rs:1260
15: rustc_resolve::macros::<impl rustc_expand::base::Resolver for rustc_resolve::Resolver>::resolve_macro_invocation
16: rustc_expand::expand::MacroExpander::fully_expand_fragment
17: rustc_expand::expand::MacroExpander::expand_crate
18: rustc_session::utils::<impl rustc_session::session::Session>::time
19: rustc_interface::passes::configure_and_expand_inner
20: rustc_interface::passes::configure_and_expand::{{closure}}
21: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
22: rustc_interface::passes::configure_and_expand
23: rustc_interface::queries::Queries::expansion
24: rustc_interface::interface::run_compiler_in_existing_thread_pool
25: scoped_tls::ScopedKey<T>::set
26: rustc_ast::attr::with_globals
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Helping to "clean up" bugs with minimal examples and bisectionsMedium priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
petrochenkov commentedon Mar 31, 2020
Likely a duplicate of #55414.
spastorino commentedon Apr 1, 2020
This was discussed briefly on Zulip.
Removing
I-nominated
, prioritizing asP-medium
.@rustbot ping cleanup
Would be nice if we figure out if this is a dupe or not.
rustbot commentedon Apr 1, 2020
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good
"Cleanup ICE-breaking candidate". In case it's useful, here are some
instructions for tackling these sorts of bugs. Maybe take a look?
Thanks! <3
cc @AminArria @chrissimpkins @contrun @DutchGhost @elshize @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @imtsuki @jakevossen5 @kanru @KarlK90 @LeSeulArtichaut @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke
woshilapin commentedon Apr 5, 2020
I'm not sure how exactly to prove that this is the same bug but, at the very least, I've compiled both on
rustc 1.42.0 (b8cedc004 2020-03-09)
and they both produce the exact same stack backtrace. It seems the bug is both present onstable
andnightly
.Stack backtrace
stack backtrace: 0: ::fmt 1: core::fmt::write 2: std::io::Write::write_fmt 3: std::panicking::default_hook::{{closure}} 4: std::panicking::default_hook 5: rustc_driver::report_ice 6: std::panicking::rust_panic_with_hook 7: rust_begin_unwind 8: core::panicking::panic_fmt 9: core::option::expect_failed 10: rustc_resolve::macros::::resolve_macro_invocation 11: rustc_expand::expand::MacroExpander::fully_expand_fragment 12: rustc_expand::expand::MacroExpander::expand_crate 13: rustc_session::utils::::time 14: rustc_interface::passes::configure_and_expand_inner 15: rustc_interface::passes::configure_and_expand::{{closure}} 16: rustc_data_structures::box_region::PinnedGenerator::new 17: rustc_interface::passes::configure_and_expand 18: rustc_interface::queries::Queries::expansion 19: rustc_interface::interface::run_compiler_in_existing_thread_pool 20: scoped_tls::ScopedKey::set 21: syntax::with_globalsHowever, the following thing is a difference between both bugs.
No compiler message
In the case of #55414, the compiler doesn't show any message (except than
rustc
panic). However, for #70624, the following compiler message is displayed beforerustc
panics.pickfire commentedon May 7, 2020
I got the same error message with
doc
and building on top of another macro.https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=8026a63548ffa4560b31207d69a4dd67
Error log
petrochenkov commentedon May 7, 2020
Closing as a duplicate of #55414.
pickfire commentedon May 7, 2020
@petrochenkov But that have a different error.
petrochenkov commentedon May 7, 2020
Which one?
I only see the "non-eager expansion without a parent scope" one, which is a known issue with known reasons.