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

src/librustc/hir/def.rs:271: attempted .def_id() on invalid def: Err #61732

Closed
little-dude opened this issue Jun 11, 2019 · 5 comments · Fixed by #67008
Closed

src/librustc/hir/def.rs:271: attempted .def_id() on invalid def: Err #61732

little-dude opened this issue Jun 11, 2019 · 5 comments · Fixed by #67008
Labels
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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@little-dude
Copy link
Contributor

Rust version affected

Both stable and nightly:

rustc 1.35.0 (3c235d560 2019-05-20)
rustc 1.37.0-nightly (02564de47 2019-06-10)

How to reproduce

Run cargo doc on this code:

[email protected]:little-dude/xrl.git
cd xrl
git checkout unbox
cargo doc  # note that `cargo build`, `cargo test`, `cargo check` and `cargo clippy` work fine

Stacktrace

error: internal compiler error: src/librustc/hir/def.rs:271: attempted .def_id() on invalid def: Err

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:635:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   5: std::panicking::begin_panic
   6: rustc_errors::Handler::bug
   7: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   8: rustc::ty::context::tls::with_opt::{{closure}}
   9: rustc::ty::context::tls::with_context_opt
  10: rustc::ty::context::tls::with_opt
  11: rustc::util::bug::opt_span_bug_fmt
  12: rustc::util::bug::bug_fmt
  13: rustc::hir::def::Def::def_id::{{closure}}
  14: rustc::hir::def::Def::def_id
  15: rustdoc::clean::register_def
             at src/librustdoc/clean/mod.rs:4219
  16: <rustc::hir::ImplItem as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at src/librustdoc/clean/mod.rs:3196
             at src/librustdoc/clean/mod.rs:2269
  17: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
             at src/librustdoc/clean/mod.rs:125
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/mod.rs:587
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/slice/mod.rs:3150
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/mod.rs:587
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/traits/iterator.rs:604
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1852
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1835
  18: <rustdoc::doctree::Impl as rustdoc::clean::Clean<alloc::vec::Vec<rustdoc::clean::Item>>>::clean
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1721
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/traits/iterator.rs:1465
             at src/librustdoc/clean/mod.rs:125
             at src/librustdoc/clean/mod.rs:3815
  19: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
             at src/librustdoc/clean/mod.rs:627
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/ops/function.rs:279
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/option.rs:414
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/mod.rs:568
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/flatten.rs:218
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/flatten.rs:48
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1929
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1826
  20: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1790
             at src/librustdoc/clean/mod.rs:627
  21: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at src/librustdoc/clean/mod.rs:621
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/mod.rs:587
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/slice/mod.rs:3150
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/mod.rs:587
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/traits/iterator.rs:604
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1852
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1790
             at src/librustdoc/clean/mod.rs:621
  22: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at src/librustdoc/clean/mod.rs:621
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/mod.rs:587
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/slice/mod.rs:3150
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/adapters/mod.rs:587
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/iter/traits/iterator.rs:604
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1852
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1790
             at src/librustdoc/clean/mod.rs:621
  23: <rustdoc::visit_ast::RustdocVisitor as rustdoc::clean::Clean<rustdoc::clean::Crate>>::clean
             at src/librustdoc/clean/mod.rs:164
  24: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
             at src/librustdoc/core.rs:512
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_interface/passes.rs:804
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:2004
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:1971
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:1904
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:1970
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:2003
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_interface/passes.rs:804
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e//<::rustc_data_structures::box_region::declare_box_region_type macros>:17
  25: rustc_interface::passes::create_global_ctxt::{{closure}}
  26: rustdoc::rust_input::{{closure}}
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/boxed.rs:907
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_data_structures/box_region.rs:52
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e//<::rustc_data_structures::box_region::declare_box_region_type macros>:19
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_interface/passes.rs:804
             at src/librustdoc/core.rs:465
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_interface/interface.rs:120
             at src/librustdoc/core.rs:451
             at src/librustdoc/lib.rs:450
  27: std::panicking::try::do_call
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/panic.rs:309
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/panicking.rs:293
  28: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  29: rustc_driver::report_ices_to_stderr_if_any
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/panicking.rs:272
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/panic.rs:388
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_driver/lib.rs:1114
  30: rustdoc::main_args
             at src/librustdoc/lib.rs:447
             at src/librustdoc/lib.rs:404
  31: std::thread::local::LocalKey<T>::with
             at src/librustdoc/lib.rs:98
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/option.rs:414
             at src/librustdoc/lib.rs:98
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_interface/util.rs:186
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:1959
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/thread/local.rs:299
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/thread/local.rs:245
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:1951
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/thread/local.rs:299
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/thread/local.rs:245
  32: scoped_tls::ScopedKey<T>::set
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc/ty/context.rs:1943
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_interface/util.rs:186
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/librustc_interface/util.rs:182
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libsyntax/lib.rs:101
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  33: syntax::with_globals
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libsyntax/lib.rs:100
error: aborting due to previous error


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.35.0 (3c235d560 2019-05-20) running on x86_64-unknown-linux-gnu

error: Could not document `xrl`.

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-name xrl src/lib.rs --color always -o /home/corentin/code/rust/xrl/target/doc -L dependency=/home/corentin/code/rust/xrl/target/debug/deps --extern bytes=/home/corentin/code/rust/xrl/target/debug/deps/libbytes-108147dcc8a98bf1.rmeta --extern futures=/home/corentin/code/rust/xrl/target/debug/deps/libfutures-cff790ae6a3349be.rmeta --extern log=/home/corentin/code/rust/xrl/target/debug/deps/liblog-a8de2cbee05dee45.rmeta --extern serde=/home/corentin/code/rust/xrl/target/debug/deps/libserde-f4ecaf05341de282.rmeta --extern serde_derive=/home/corentin/code/rust/xrl/target/debug/deps/libserde_derive-c80992fe8c56822b.so --extern serde_json=/home/corentin/code/rust/xrl/target/debug/deps/libserde_json-ec94a732172a058b.rmeta --extern syntect=/home/corentin/code/rust/xrl/target/debug/deps/libsyntect-cb5e37e398c2ed09.rmeta --extern tokio=/home/corentin/code/rust/xrl/target/debug/deps/libtokio-1d7926ccc99d0bfa.rmeta --extern tokio_codec=/home/corentin/code/rust/xrl/target/debug/deps/libtokio_codec-3edc61048161bb42.rmeta --extern tokio_process=/home/corentin/code/rust/xrl/target/debug/deps/libtokio_process-3237d53038e010b9.rmeta` (exit code: 1)

Potentially related issue: #54320, although here it happens only with cargo doc not cargo build

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 11, 2019
@Cogitri
Copy link

Cogitri commented Jun 20, 2019

Can confirm on rustc 1.35.0 (3c235d560 2019-05-20) running on x86_64-unknown-linux-musl.

@Skepfyr
Copy link
Contributor

Skepfyr commented Jun 26, 2019

MCVE:

pub(in crate::r#mod) fn main() {}

Bisected to find regression is in nightly 2019-01-01, from:

error[E0578]: cannot find module `mod` in module `crate`
 --> main.rs:1:15
  |
1 | pub(in crate::r#mod) fn foo() {}
  |               ^^^^^ not found in `crate`

error: Compilation failed, aborting rustdoc

to the above ICE.

As far as I can tell only rustdoc triggers it, but I don't know enough to say that for certain.

@jonas-schievink jonas-schievink added I-nominated regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Jun 27, 2019
@JohnTitor
Copy link
Member

Cannot reproduce the ICE with the above MCVE on latest nightly (playground)

@Skepfyr
Copy link
Contributor

Skepfyr commented Oct 4, 2019

After too much time bisecting, it has worked since nightly-2019-08-11, more specifically commit be3fb0c which is this rollup: #63437. My guess is that this is another bug fixed by #63400.

@ollie27
Copy link
Member

ollie27 commented Dec 4, 2019

I can confirm that #63400 probably fixed this. I've submitted the MCVE as a regression test: #67008

@ollie27 ollie27 added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed I-nominated regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Dec 4, 2019
@bors bors closed this as completed in 0df1609 Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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-rustdoc Relevant to the rustdoc 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