Skip to content

ICE: inconsistent resolution for a macro #6255

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

Closed
matthiaskrgr opened this issue Oct 27, 2020 · 1 comment · Fixed by #6260
Closed

ICE: inconsistent resolution for a macro #6255

matthiaskrgr opened this issue Oct 27, 2020 · 1 comment · Fixed by #6260
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

Code

code from ./src/test/ui/macros/issue-78325-inconsistent-resolution.rs

macro_rules! define_other_core {
    ( ) => {
        extern crate std as core;
        //~^ ERROR macro-expanded `extern crate` items cannot shadow names passed with `--extern`
    };
}

fn main() {
    core::panic!();
}

define_other_core!();

clippy 0.0.212 (ffa2e7a 2020-10-24)

Error output

error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
  --> ./src/test/ui/macros/issue-78325-inconsistent-resolution.rs:3:9
   |
3  |         extern crate std as core;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
...
12 | 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/ffa2e7ae8fbf9badc035740db949b9dae271c29f/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-clippy/issues/new

note: Clippy version: clippy 0.0.212 (ffa2e7a 2020-10-24)

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

Backtrace

error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
--> ./src/test/ui/macros/issue-78325-inconsistent-resolution.rs:3:9
 |
3  |         extern crate std as core;
 |         ^^^^^^^^^^^^^^^^^^^^^^^^^
...
12 | 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/ffa2e7ae8fbf9badc035740db949b9dae271c29f/compiler/rustc_middle/src/util/bug.rs:34:26
stack backtrace:
 0:     0x7feef36dfa20 - std::backtrace_rs::backtrace::libunwind::trace::h303a626d53553a64
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
 1:     0x7feef36dfa20 - std::backtrace_rs::backtrace::trace_unsynchronized::h6abb882733c3f18c
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7feef36dfa20 - std::sys_common::backtrace::_print_fmt::h57829321f1d9217a
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:67:5
 3:     0x7feef36dfa20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h400b66a054640aac
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:46:22
 4:     0x7feef374ee9c - core::fmt::write::h1857a60b204f1b6a
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/core/src/fmt/mod.rs:1076:17
 5:     0x7feef36d1642 - std::io::Write::write_fmt::h6453b28c8b27c6ea
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/io/mod.rs:1516:15
 6:     0x7feef36e49d5 - std::sys_common::backtrace::_print::h15cc4b3923cc9bc0
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:49:5
 7:     0x7feef36e49d5 - std::sys_common::backtrace::print::h953c7be178c0674d
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:36:9
 8:     0x7feef36e49d5 - std::panicking::default_hook::{{closure}}::h635d667f571198f0
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:208:50
 9:     0x7feef36e4678 - std::panicking::default_hook::h3bc2efb48060abaa
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:227:9
10:     0x55e96bc0e491 - clippy_driver::report_clippy_ice::h76ee1ad508e689ae
11:     0x7feef36e5216 - std::panicking::rust_panic_with_hook::h887eb0c89f46b8b2
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:581:17
12:     0x7feef4d7997b - std::panicking::begin_panic::{{closure}}::hb657156772fa8b9a
13:     0x7feef4d7983c - std::sys_common::backtrace::__rust_end_short_backtrace::h4588e5843e10abe9
14:     0x7feef4d798e0 - std::panicking::begin_panic::hd64eac5cb71b9d63
15:     0x7feef4dcb23d - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h5a34d8d2d571ae38
16:     0x7feef4dcb0ee - rustc_middle::ty::context::tls::with_opt::{{closure}}::hbbfc03c4096489df
17:     0x7feef4dcb05f - rustc_middle::ty::context::tls::with_opt::h5b1032e14003a23c
18:     0x7feef4dcb189 - rustc_middle::util::bug::opt_span_bug_fmt::hcc47d648f36a640d
19:     0x7feef4dcb143 - rustc_middle::util::bug::span_bug_fmt::hf90edff983ff5989
20:     0x7feef4e43ab3 - rustc_resolve::macros::<impl rustc_resolve::Resolver>::finalize_macro_resolutions::{{closure}}::h4c09398ec40c230a
21:     0x7feef4e4f528 - rustc_resolve::Resolver::resolve_crate::h560f3cbeb6c0e20b
22:     0x7feef41ed147 - rustc_interface::passes::configure_and_expand_inner::h246e5f9cb7da99d5
23:     0x7feef41b75f5 - rustc_interface::passes::configure_and_expand::{{closure}}::h5275f520a461aac1
24:     0x7feef419b74f - rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new::h3e3420be26fe1a14
25:     0x7feef41ea5d6 - rustc_interface::passes::configure_and_expand::ha882a48bb5edcb36
26:     0x7feef421c77b - rustc_interface::queries::Queries::expansion::h5a91dce74685e0cf
27:     0x7feef3fc7f16 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h6eb07f11eba80bd6
28:     0x7feef3f8f2a2 - rustc_span::with_source_map::h3820d41b3a036910
29:     0x7feef3fc99c2 - rustc_interface::interface::create_compiler_and_run::h08ad396f4e7721e0
30:     0x7feef3fb1d5a - scoped_tls::ScopedKey<T>::set::hd425a36fbe06985e
31:     0x7feef3fce9b5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h23925571219dbc63
32:     0x7feef3f4c3ce - core::ops::function::FnOnce::call_once{{vtable.shim}}::h43b61b9af30b3669
33:     0x7feef36f421a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h88864ee659ddb161
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
34:     0x7feef36f421a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h9f03cbdc7ab33431
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
35:     0x7feef36f421a - std::sys::unix::thread::Thread::new::thread_start::h5979dd5560a11418
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys/unix/thread.rs:89:17
36:     0x7feef35d93e9 - start_thread
37:     0x7feef33c1293 - __GI___clone
38:                0x0 - <unknown>

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-clippy/issues/new

note: Clippy version: clippy 0.0.212 (ffa2e7a 2020-10-24)

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

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 27, 2020
@ebroto
Copy link
Member

ebroto commented Oct 28, 2020

This one seems to affect the Resolver. It does not reproduce with the current master/nightly (playground)

matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Oct 28, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Oct 28, 2020
bors added a commit that referenced this issue Oct 30, 2020
add a couple of ICE testcases

Fixes #6250
Fixes #6251
Fixes #6252
Fixes #6255
Fixes #6256

changelog: none
@bors bors closed this as completed in abd64d7 Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants