Skip to content

ICE: panicked at 'compiler/rustc_resolve/src/macros.rs:892:21: inconsistent resolution for a macro' #78325

Closed
@chengniansun

Description

@chengniansun

Code

core::panic!();
macro_rules! define_other_core {
    ( ) => {
        extern crate std as core;
    };
}
define_other_core!();

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (7bade6ef7 2020-10-23)
binary: rustc
commit-hash: 7bade6ef730cff83f3591479a98916920f66decd
commit-date: 2020-10-23
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: macros that expand to items must be delimited with braces or followed by a semicolon
 --> reduced_mutant.rs:1:1
  |
1 | core::panic!();
  | ^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `!` or `::`, found `(`
 --> reduced_mutant.rs:1:1
  |
1 | core::panic!();
  | ^^^^^^^^^^^^^^^
  | |
  | expected one of `!` or `::`
  | in this macro invocation
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
 --> reduced_mutant.rs:4:9
  |
4 |         extern crate std as core;
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^
...
7 | define_other_core!();
  | --------------------- in this macro invocation
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'compiler/rustc_resolve/src/macros.rs:892:21: inconsistent resolution for a macro', /rustc/7bade6ef730cff83f3591479a98916920f66decd/compiler/rustc_middle/src/util/bug.rs:34: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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (7bade6ef7 2020-10-23) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 3 previous errors
Backtrace

error: macros that expand to items must be delimited with braces or followed by a semicolon
 --> reduced_mutant.rs:1:1
  |
1 | core::panic!();
  | ^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `!` or `::`, found `(`
 --> reduced_mutant.rs:1:1
  |
1 | core::panic!();
  | ^^^^^^^^^^^^^^^
  | |
  | expected one of `!` or `::`
  | in this macro invocation
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
 --> reduced_mutant.rs:4:9
  |
4 |         extern crate std as core;
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^
...
7 | define_other_core!();
  | --------------------- in this macro invocation
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'compiler/rustc_resolve/src/macros.rs:892:21: inconsistent resolution for a macro', /rustc/7bade6ef730cff83f3591479a98916920f66decd/compiler/rustc_middle/src/util/bug.rs:34:26
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   2: rustc_middle::ty::context::tls::with_opt::{{closure}}
   3: rustc_middle::ty::context::tls::with_opt
   4: rustc_middle::util::bug::opt_span_bug_fmt
   5: rustc_middle::util::bug::span_bug_fmt
   6: rustc_resolve::macros::<impl rustc_resolve::Resolver>::finalize_macro_resolutions::{{closure}}
   7: rustc_resolve::Resolver::resolve_crate
   8: rustc_interface::passes::configure_and_expand_inner
   9: rustc_interface::passes::configure_and_expand::{{closure}}
  10: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  11: rustc_interface::queries::Queries::expansion
  12: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  13: rustc_span::with_source_map
  14: rustc_interface::interface::create_compiler_and_run
  15: scoped_tls::ScopedKey<T>::set
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (7bade6ef7 2020-10-23) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 3 previous errors

NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions