Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
chengniansun opened this issue Oct 24, 2020 · 4 comments · Fixed by #78327
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name resolution C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

chengniansun commented Oct 24, 2020

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

@chengniansun chengniansun added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 24, 2020
@jonas-schievink jonas-schievink added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name resolution I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 24, 2020
@camelid camelid added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Oct 24, 2020
@camelid
Copy link
Member

camelid commented Oct 24, 2020

Seems to have regressed in Rust 1.33 based on testing in Godbolt.

@jyn514
Copy link
Member

jyn514 commented Oct 24, 2020

With only the errors relevant to the ICE: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=21f63dc46337785eef6deb705f4604dc

error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
  --> src/main.rs:3:9
   |
3  |         extern crate std as core;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
...
11 | 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 'src/librustc_resolve/macros.rs:891:21: inconsistent resolution for a macro', /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/src/librustc_middle/util/bug.rs:34:26

@petrochenkov petrochenkov self-assigned this Oct 24, 2020
@petrochenkov
Copy link
Contributor

I'll fix this.

@petrochenkov
Copy link
Contributor

Fixed in #78327.

@bors bors closed this as completed in 58ae889 Oct 25, 2020
@JohnTitor JohnTitor removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name resolution C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants