Closed
Description
Steps to replicate:
- Create two files
a.rs
andb.rs
in the same directory with the following content:
// a.rs
pub struct ProjectileCreated;
pub struct NotificationChannel<E>(std::marker::PhantomData<E>);
macro_rules! define_trigger_system {
($(( $field:ident, $ty:ident, $channel:ident )),* $(,)?) => {
#[macro_export]
macro_rules! all_trigger_fields {
($submacro:ident) => { $submacro!($( ( $field, $ty, $channel ) ),*) }
}
}
}
define_trigger_system!(
( projectile_created, ProjectileCreated, NotificationChannel ),
);
// b.rs
extern crate a;
use a::*;
macro_rules! make_event_subscription {
($(( $field:ident, $ty:ident, $channel:ident)),*) => {
pub struct EventSubscription (
$($channel<a::$ty>::ReaderId),*
);
}
}
all_trigger_fields!(make_event_subscription);
- Compile both files
$ rustc a.rs --crate-type=lib
$ rustc b.rs --extern a=liba.rlib --crate-type=lib
- Observe the following error
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: DistinctSources(DistinctSources { begin: (Real("b.rs"), BytePos(0)), end: (Macros("::a::all_trigger_fields"), BytePos(6695205)) })', src/librustc_errors/emitter.rs:2106:17
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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.42.0-nightly (c2d141df5 2020-01-24) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib
error: aborting due to previous error
I note that the (Macros("::a::all_trigger_fields"), BytePos(6695205))
looks quite suspicious, since there are fewer than 6695205 bytes in the source text.
This issue has been assigned to @MichaelBurge via this comment.
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) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.