Closed
Description
The objective was to be able to feature some macro which would yield a $self:ident
parameter with the def-site of a there-defined macro
macro so as to mock the suggested $self
parameter on macros.
Code
#![feature(decl_macro, trace_macros)]
// trace_macros!(true); /* to debug: the expansion works successfully */
module::recurse! { 1 1 1 }
pub mod module {
pub(super) use private::recurse;
mod private {
macro __helper__ ([$dol:tt] $exported_name:ident) {
macro_rules! $exported_name {(
$dol(1 $dol($rest:tt)*)?
) => (
$dol(
// the idea is for this to have def-site hygiene here
// vvvv
self::$exported_name! { $dol($rest)* }
)?
)} pub(crate) use $exported_name;
}
__helper__! { [$] recurse }
}
}
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (fe1bf8e05 2021-02-23)
binary: rustc
commit-hash: fe1bf8e05c39bdcc73fc09e246b7209444e389bc
commit-date: 2021-02-23
host: x86_64-apple-darwin
release: 1.52.0-nightly
LLVM version: 11.0.1
Error output
error: internal compiler error: expansion entered force mode without producing any errors
--> src/lib.rs:29:1
|
29 | outer::recurse! { 1 1 1 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: delayed at compiler/rustc_expand/src/expand.rs:447:34
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1012:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: 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: rustc 1.52.0-nightly (fe1bf8e05 2021-02-23) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
Backtrace
stack backtrace:
…
5: 0x1020a36a8 - rustc_driver::report_ice::hcdbc085c8141570d
…
10: 0x1093532ab - std::panicking::begin_panic_fmt::hba7ec5d426758edb
11: 0x10600ee16 - rustc_errors::HandlerInner::flush_delayed::h161e3beabf00546a
12: 0x10600b10b - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hde0ac14a81f422db
13: 0x1020ab07d - core::ptr::drop_in_place<rustc_session::parse::ParseSess>::h0cb46aa2558b566b
14: 0x1020afda8 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h5a4e1115e34fca86
15: 0x102110835 - core::ptr::drop_in_place<rustc_interface::interface::Compiler>::hbf9fc4b317f8829b
16: 0x10210cd08 - rustc_span::with_source_map::hdc8b53d5836d0f69
17: 0x1020ba394 - rustc_interface::interface::create_compiler_and_run::h2e5f4f156384205a
18: 0x1020b2db9 - scoped_tls::ScopedKey<T>::set::hb5d8ea6cc29ec656
19: 0x1020b4101 - std::sys_common::backtrace::__rust_begin_short_backtrace::h316820ab0a243dd5
20: 0x1020d85e9 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h0dcd073e2532982e
21: 0x1092d897d - std::sys::unix::thread::Thread::new::thread_start::h4da435b3f287e7dd
22: 0x7fff20323950 - __pthread_start
cc @Aaron1011
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(decl_macro)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.