Skip to content
New issue

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

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

Already on GitHub? # to your account

ICE: Missing span for DefIndex(3) in compiler/rustc_metadata/src/rmeta/decoder.rs:749 #80074

Closed
dima74 opened this issue Dec 16, 2020 · 2 comments · Fixed by #98602
Closed

ICE: Missing span for DefIndex(3) in compiler/rustc_metadata/src/rmeta/decoder.rs:749 #80074

dima74 opened this issue Dec 16, 2020 · 2 comments · Fixed by #98602
Assignees
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. 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.

Comments

@dima74
Copy link
Contributor

dima74 commented Dec 16, 2020

Code

After cargo new test-project:

  • lib.rs:
macro_rules! foo_ { () => {}; }
use foo_ as foo;
  • main.rs:
#[macro_use]
extern crate test_project;

fn main() {
    foo!();
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (f76ecd066 2020-12-15)
binary: rustc
commit-hash: f76ecd0668fcdb289456cdc72a39ad15467cc454
commit-date: 2020-12-15
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Reproducible on stable 1.48 as well

Error output

   Compiling test-project v0.1.0
warning: unused macro definition
 --> src/lib.rs:1:1
  |
1 | macro_rules! foo_ { () => {}; }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_macros)]` on by default

warning: unused import: `foo_ as foo`
 --> src/lib.rs:2:5
  |
2 | use foo_ as foo;
  |     ^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: 2 warnings emitted

thread 'rustc' panicked at 'Missing span for DefIndex(3)', compiler/rustc_metadata/src/rmeta/decoder.rs:749:32
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.50.0-nightly (f76ecd066 2020-12-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `test-project`
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/f76ecd0668fcdb289456cdc72a39ad15467cc454/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/f76ecd0668fcdb289456cdc72a39ad15467cc454/library/std/src/panicking.rs:435:5
   2: rustc_metadata::rmeta::decoder::<impl rustc_metadata::creader::CrateMetadataRef>::get_span::{{closure}}
   3: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_metadata::creader::CStore>::load_macro_untracked
   4: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_macro_by_def_id
   5: rustc_resolve::macros::<impl rustc_resolve::Resolver>::resolve_macro_path
   6: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::resolve_macro_invocation
   7: rustc_expand::expand::MacroExpander::fully_expand_fragment
   8: rustc_expand::expand::MacroExpander::expand_crate
   9: rustc_session::utils::<impl rustc_session::session::Session>::time
  10: rustc_interface::passes::configure_and_expand_inner
  11: rustc_interface::passes::configure_and_expand::{{closure}}
  12: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  13: rustc_interface::passes::configure_and_expand
  14: rustc_interface::queries::Queries::expansion
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: scoped_tls::ScopedKey<T>::set

@dima74 dima74 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 Dec 16, 2020
fanninpm added a commit to fanninpm/glacier that referenced this issue Dec 17, 2020
fanninpm added a commit to fanninpm/glacier that referenced this issue Dec 19, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Dec 20, 2020
@durka
Copy link
Contributor

durka commented Dec 27, 2020

Things that make the ICE go away:

  1. Add #[macro_export] to the lib crate (compiles successfully)
  2. Change the edition to 2015 when compiling the lib crate (errors on the use)

N.B. Changing from foo!() to foo_!() in the bin crate produces a different ICE.

@Alexendoo
Copy link
Member

No longer ICEs since #88019

@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 31, 2021
@TaKO8Ki TaKO8Ki self-assigned this Jun 28, 2022
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Jun 28, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 28, 2022
…ue-80074, r=Mark-Simulacrum

Add regression test for rust-lang#80074

closes rust-lang#80074
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 28, 2022
…askrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#98548 (rustdoc-json: Allow Typedef to be different in sanity assert)
 - rust-lang#98560 (Add regression test for rust-lang#85907)
 - rust-lang#98564 (Remove references to `./tmp` in-tree)
 - rust-lang#98602 (Add regression test for rust-lang#80074)
 - rust-lang#98606 (:arrow_up: rust-analyzer)
 - rust-lang#98609 (Fix ICE for associated constant generics)
 - rust-lang#98611 (Fix glob import ICE in rustdoc JSON format)
 - rust-lang#98617 (Remove feature `const_option` from std)
 - rust-lang#98619 (Fix mir-opt wg name)
 - rust-lang#98621 (llvm-wrapper: adapt for removal of the ASanGlobalsMetadataAnalysis LLVM API)
 - rust-lang#98623 (fix typo in comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 70b4e04 Jun 28, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants