Closed as not planned
Description
Code
The code is rather long and complicated, and I unfortunately don't have the time or will to attempt reduction as of now, so I committed it as-is to this file.
My conjecture takes some setup, so bear with me. My code involves meta-macros, or macros that create other macros. While debugging said meta-macro, I had an expanded version of it already in the source file, so something clashed there.
To encounter the ICE I simply ran cargo test
Meta
rustc --version --verbose
:
rustc 1.41.1 (f3e1a954d 2020-02-24)
binary: rustc
commit-hash: f3e1a954d2ead4e2fc197c7da7d71e6c61bad196
commit-date: 2020-02-24
host: x86_64-pc-windows-msvc
release: 1.41.1
LLVM version: 9.0
Error output
>cargo t
Blocking waiting for file lock on build directory
Compiling tagged-box v0.1.1 (G:\LocalFileServer\Programming\Rust\tagged-box)
error: a macro named `__expand_tuple` has already been exported
--> src\tagged_box_macro.rs:571:9
|
571 | / macro_rules! __expand_tuple {
572 | | $( $finished )*
573 | | }
| |_________^ `__expand_tuple` already exported
...
577 | / generate_tuple_expansion! {
578 | | ($, others)
579 | | (0, a), (1, b), (2, c), (3, d),
580 | | (4, e), (5, f), (6, g), (7, h),
... |
586 | | (28, cc), (29, dd), (30, ee), (31, ff)
587 | | }
| |_- in this macro invocation
|
note: previous macro export is now shadowed
--> src\tagged_box_macro.rs:591:1
|
591 | / macro_rules! __expand_tuple {
592 | | ($variant:path) => {
593 | | $variant()
594 | | };
... |
797 | | };
798 | | }
| |_^
error: aborting due to previous error
error: could not compile `tagged-box`.
warning: build failed, waiting for other jobs to finish...
error: a macro named `__expand_tuple` has already been exported
--> src\tagged_box_macro.rs:571:9
|
571 | / macro_rules! __expand_tuple {
572 | | $( $finished )*
573 | | }
| |_________^ `__expand_tuple` already exported
...
577 | / generate_tuple_expansion! {
578 | | ($, others)
579 | | (0, a), (1, b), (2, c), (3, d),
580 | | (4, e), (5, f), (6, g), (7, h),
... |
586 | | (28, cc), (29, dd), (30, ee), (31, ff)
587 | | }
| |_- in this macro invocation
|
note: previous macro export is now shadowed
--> src\tagged_box_macro.rs:591:1
|
591 | / macro_rules! __expand_tuple {
592 | | ($variant:path) => {
593 | | $variant()
594 | | };
... |
797 | | };
798 | | }
| |_^
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:904:68
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
904 | $crate::__expand_tuple!($enum::$variant, tuple, $($ty),*)
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:826:78
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
826 | let variant = $crate::__expand_tuple!($enum::$variant, tuple, $($ty),*);
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:991:68
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
991 | $crate::__expand_tuple!($enum::$variant, tuple, $( $ty ),*)
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:1108:111
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
1108 | let variant = core::mem::ManuallyDrop::new($crate::__expand_tuple!($enum::$variant, tuple, $($ty),*));
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
thread 'rustc' panicked at 'src\librustc_resolve\macros.rs:742: inconsistent resolution for a macro', src\librustc\util\bug.rs:37:26
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.41.1 (f3e1a954d 2020-02-24) running on x86_64-pc-windows-msvc
note: compiler flags: -C debuginfo=2 -C incremental
note: some of the compiler flags provided by cargo are hidden
Backtrace
>cargo t
Compiling tagged-box v0.1.1 (G:\LocalFileServer\Programming\Rust\tagged-box)
error: a macro named `__expand_tuple` has already been exported
--> src\tagged_box_macro.rs:571:9
|
571 | / macro_rules! __expand_tuple {
572 | | $( $finished )*
573 | | }
| |_________^ `__expand_tuple` already exported
...
577 | / generate_tuple_expansion! {
578 | | ($, others)
579 | | (0, a), (1, b), (2, c), (3, d),
580 | | (4, e), (5, f), (6, g), (7, h),
... |
586 | | (28, cc), (29, dd), (30, ee), (31, ff)
587 | | }
| |_- in this macro invocation
|
note: previous macro export is now shadowed
--> src\tagged_box_macro.rs:591:1
|
591 | / macro_rules! __expand_tuple {
592 | | ($variant:path) => {
593 | | $variant()
594 | | };
... |
797 | | };
798 | | }
| |_^
error: aborting due to previous error
error: could not compile `tagged-box`.
warning: build failed, waiting for other jobs to finish...
error: a macro named `__expand_tuple` has already been exported
--> src\tagged_box_macro.rs:571:9
|
571 | / macro_rules! __expand_tuple {
572 | | $( $finished )*
573 | | }
| |_________^ `__expand_tuple` already exported
...
577 | / generate_tuple_expansion! {
578 | | ($, others)
579 | | (0, a), (1, b), (2, c), (3, d),
580 | | (4, e), (5, f), (6, g), (7, h),
... |
586 | | (28, cc), (29, dd), (30, ee), (31, ff)
587 | | }
| |_- in this macro invocation
|
note: previous macro export is now shadowed
--> src\tagged_box_macro.rs:591:1
|
591 | / macro_rules! __expand_tuple {
592 | | ($variant:path) => {
593 | | $variant()
594 | | };
... |
797 | | };
798 | | }
| |_^
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:904:68
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
904 | $crate::__expand_tuple!($enum::$variant, tuple, $($ty),*)
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:826:78
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
826 | let variant = $crate::__expand_tuple!($enum::$variant, tuple, $($ty),*);
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:991:68
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
991 | $crate::__expand_tuple!($enum::$variant, tuple, $( $ty ),*)
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unexpected end of macro invocation
--> src\tagged_box_macro.rs:1108:111
|
571 | macro_rules! __expand_tuple {
| --------------------------- when calling this macro
...
1108 | let variant = core::mem::ManuallyDrop::new($crate::__expand_tuple!($enum::$variant, tuple, $($ty),*));
| ^ missing tokens in macro arguments
error: unknown macro variable `tagged`
--> src\tagged_box_macro.rs:545:98
|
545 | let $tuple = $dollar crate::TaggedBox::into_inner::<$dollar variant>($dollar tagged);
| __________________________________________________________________________________________________^
546 | | $dollar variant($( $access )* $dollar $tuple . $field)
547 | | }};
548 | | ]
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: unknown macro variable `tuple`
--> src\tagged_box_macro.rs:516:39
|
516 | @inner ($dollar, $others, tuple)
| _______________________________________^
517 | | [
518 | | // ($variant:path) => {
519 | | // $variant()
... |
577 | | generate_tuple_expansion! {
578 | | ($, others)
| |_____^ unknown macro variable
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
error: expected expression, found `.`
--> src\tagged_box_macro.rs:550:44
|
550 | [ $( $access )* $dollar $tuple . $field, ]
| ^ expected expression
...
1517 | / tagged_box! {
1518 | | #[derive(Debug, Clone, PartialEq, Eq)]
1519 | | struct Container, enum Item {
1520 | | Unit,
... |
1528 | | }
1529 | | }
| |_________- in this macro invocation
thread 'rustc' panicked at 'src\librustc_resolve\macros.rs:742: inconsistent resolution for a macro', src\librustc\util\bug.rs:37:26
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: <std::io::IoSliceMut as core::fmt::Debug>::fmt
3: std::panicking::take_hook
4: std::panicking::take_hook
5: rustc_driver::report_ice
6: std::panicking::rust_panic_with_hook
7: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as syntax::visit::Visitor>::visit_ty
8: <rustc_resolve::late::PathSource as core::fmt::Debug>::fmt
9: <rustc_resolve::late::PathSource as core::fmt::Debug>::fmt
10: <rustc_resolve::late::PathSource as core::fmt::Debug>::fmt
11: <rustc_resolve::late::PathSource as core::fmt::Debug>::fmt
12: <rustc_resolve::late::PathSource as core::fmt::Debug>::fmt
13: rustc_resolve::macros::<impl rustc_resolve::Resolver>::resolve_macro_path
14: rustc_resolve::Resolver::resolve_crate
15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::compile
16: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::compile
17: rustc_interface::queries::Queries::expansion
18: rustc_driver::pretty::print_after_hir_lowering
19: <syntax_pos::symbol::SymbolStr as core::fmt::Display>::fmt
20: <chalk_engine::stack::StackIndex as core::convert::From<usize>>::from
21: <rustc_driver::Compilation as core::fmt::Debug>::fmt
22: <chalk_engine::stack::StackIndex as core::convert::From<usize>>::from
23: _rust_maybe_catch_panic
24: rustc_driver::pretty::print_after_hir_lowering
25: ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
26: std::sys::windows::thread::Thread::new
27: BaseThreadInitThunk
28: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.41.1 (f3e1a954d 2020-02-24) running on x86_64-pc-windows-msvc
note: compiler flags: -C debuginfo=2 -C incremental
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: aborting due to 17 previous errors
error: could not compile `tagged-box`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.