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: rustdoc on associated-types-path-1.rs attempted .def_id() on invalid res: Err #79465

Closed
matthiaskrgr opened this issue Nov 27, 2020 · 2 comments · Fixed by #94399
Closed
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

code from ./src/test/ui/associated-types/associated-types-path-1.rs

// Test that we have one and only one associated type per ref.

pub trait Foo {
    type A;
}
pub trait Bar {
    type A;
}

pub fn f1<T>(a: T, x: T::A) {} //~ERROR associated type `A` not found
pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} //~ERROR ambiguous associated type `A`

pub fn main() {}

Meta

rustc --version --verbose:

rustdoc 1.50.0-nightly (1c389ffef 2020-11-24)
binary: rustdoc
commit-hash: 1c389ffeff814726dec325f0f2b0c99107df2673
commit-date: 2020-11-24
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

error[E0220]: associated type `A` not found for `T`
  --> ./src/test/ui/associated-types/associated-types-path-1.rs:10:26
   |
10 | pub fn f1<T>(a: T, x: T::A) {} //~ERROR associated type `A` not found
   |                          ^ associated type `A` not found

error[E0221]: ambiguous associated type `A` in bounds of `T`
  --> ./src/test/ui/associated-types/associated-types-path-1.rs:11:34
   |
4  |     type A;
   |     ------- ambiguous `A` from `Foo`
...
7  |     type A;
   |     ------- ambiguous `A` from `Bar`
...
11 | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} //~ERROR ambiguous associated type `A`
   |                                  ^^^^ ambiguous associated type `A`
   |
help: use fully qualified syntax to disambiguate
   |
11 | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {} //~ERROR ambiguous associated type `A`
   |                                  ^^^^^^^^^^^^^
help: use fully qualified syntax to disambiguate
   |
11 | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {} //~ERROR ambiguous associated type `A`
   |                                  ^^^^^^^^^^^^^

thread 'rustc' panicked at 'attempted .def_id() on invalid res: Err', /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/compiler/rustc_hir/src/def.rs:408: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 (1c389ffef 2020-11-24) running on x86_64-unknown-linux-gnu

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

Some errors have detailed explanations: E0220, E0221.
For more information about an error, try `rustc --explain E0220`.
Backtrace

error[E0220]: associated type `A` not found for `T`
  --> ./src/test/ui/associated-types/associated-types-path-1.rs:10:26
   |
10 | pub fn f1<T>(a: T, x: T::A) {} //~ERROR associated type `A` not found
   |                          ^ associated type `A` not found

error[E0221]: ambiguous associated type `A` in bounds of `T`
  --> ./src/test/ui/associated-types/associated-types-path-1.rs:11:34
   |
4  |     type A;
   |     ------- ambiguous `A` from `Foo`
...
7  |     type A;
   |     ------- ambiguous `A` from `Bar`
...
11 | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} //~ERROR ambiguous associated type `A`
   |                                  ^^^^ ambiguous associated type `A`
   |
help: use fully qualified syntax to disambiguate
   |
11 | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {} //~ERROR ambiguous associated type `A`
   |                                  ^^^^^^^^^^^^^
help: use fully qualified syntax to disambiguate
   |
11 | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {} //~ERROR ambiguous associated type `A`
   |                                  ^^^^^^^^^^^^^

thread 'rustc' panicked at 'attempted .def_id() on invalid res: Err', /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/compiler/rustc_hir/src/def.rs:408:32
stack backtrace:
   0:     0x7fbb8f223e30 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fbb8f223e30 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fbb8f223e30 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fbb8f223e30 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fbb8f296c4c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/fmt/mod.rs:1078:17
   5:     0x7fbb8f2159a2 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/io/mod.rs:1519:15
   6:     0x7fbb8f227a95 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fbb8f227a95 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fbb8f227a95 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:208:50
   9:     0x7fbb8f2275ea - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:225:9
  10:     0x7fbb8fab4bb8 - rustc_driver::report_ice::ha25ae86a5858acc3
  11:     0x7fbb8f228396 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:595:17
  12:     0x7fbb8f227eb7 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:497:13
  13:     0x7fbb8f2242ec - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7fbb8f227e19 - rust_begin_unwind
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:493:5
  15:     0x7fbb8f227dcb - std::panicking::begin_panic_fmt::hee67ce14b77d0396
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:435:5
  16:     0x55d873ee0428 - rustc_hir::def::Res<Id>::def_id::{{closure}}::h06aeb0acc3e82fae
  17:     0x55d8740cda3d - rustdoc::clean::utils::register_res::h9cf2ca016844dce1
  18:     0x55d8740cd5b1 - rustdoc::clean::utils::resolve_type::hc4dd6a14930238e2
  19:     0x55d8740412af - <rustc_hir::hir::Ty as rustdoc::clean::Clean<rustdoc::clean::types::Type>>::clean::h7e12b892841ced7b
  20:     0x55d873e61dcf - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h64c59269cd1e2f54
  21:     0x55d87403e666 - <(&rustc_hir::hir::FnDecl,A) as rustdoc::clean::Clean<rustdoc::clean::types::FnDecl>>::clean::h0d96c315d7646885
  22:     0x55d8740ce18e - rustdoc::clean::utils::enter_impl_trait::h89ecd5f85c6cf117
  23:     0x55d874046339 - <(&rustc_hir::hir::Item,core::option::Option<rustc_span::symbol::Ident>) as rustdoc::clean::Clean<alloc::vec::Vec<rustdoc::clean::types::Item>>>::clean::h6efe2622d62f0879
  24:     0x55d87415201f - <alloc::vec::Vec<T,A> as alloc::vec::SpecExtend<T,I>>::spec_extend::hbf27f2437fec8031
  25:     0x55d8740cede8 - <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean::hee8955bac14e83bc
  26:     0x55d8740c8153 - rustdoc::clean::utils::krate::h68bb50ab032123ce
  27:     0x55d873e43b3b - rustdoc::core::run_global_ctxt::h7cf39be6ea65128e
  28:     0x55d873ebdece - rustc_interface::passes::QueryContext::enter::hedb615e17429b641
  29:     0x55d873fb3917 - rustc_interface::interface::create_compiler_and_run::h25fa5935e40978f2
  30:     0x55d873e5a0d3 - rustdoc::main_options::h8a5cda9c1c8c625b
  31:     0x55d873fa4a68 - rustc_span::with_session_globals::h7a83fbbd64fb6823
  32:     0x55d873e8b30e - std::sys_common::backtrace::__rust_begin_short_backtrace::h50722f4a01515f7b
  33:     0x55d873fbd03a - core::ops::function::FnOnce::call_once{{vtable.shim}}::h22276985fb540191
  34:     0x7fbb8f23765a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318:9
  35:     0x7fbb8f23765a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318:9
  36:     0x7fbb8f23765a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys/unix/thread.rs:71:17
  37:     0x7fbb8f1133e9 - start_thread
  38:     0x7fbb8eef9293 - __GI___clone
  39:                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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.50.0-nightly (1c389ffef 2020-11-24) running on x86_64-unknown-linux-gnu

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

Some errors have detailed explanations: E0220, E0221.
For more information about an error, try `rustc --explain E0220`.

@matthiaskrgr matthiaskrgr 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 Nov 27, 2020
@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 27, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 20, 2020

MCVE:

pub fn f1<T>(x: T::A) {}

Assigning P-low by the same rationale as #79496 (comment), but I expect this to be much easier to fix than the other ICEs that are outside of rustdoc proper.

@jyn514 jyn514 added the P-low Low priority label Dec 20, 2020
@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Feb 18, 2022
@matthiaskrgr
Copy link
Member Author

No longer crashing

error[E0220]: associated type `A` not found for `T`
 --> out.rs:3:20
  |
3 | pub fn f1<T>(x: T::A) {}
  |                    ^ associated type `A` not found

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Feb 26, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 26, 2022
…5, r=matthiaskrgr

Add test for rust-lang#79465 to prevent regression

Fixes rust-lang#79465.

Like this we will be able to close the issue.

r? `@matthiaskrgr`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Feb 27, 2022
…5, r=matthiaskrgr

Add test for rust-lang#79465 to prevent regression

Fixes rust-lang#79465.

Like this we will be able to close the issue.

r? ``@matthiaskrgr``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 27, 2022
…5, r=matthiaskrgr

Add test for rust-lang#79465 to prevent regression

Fixes rust-lang#79465.

Like this we will be able to close the issue.

r? ```@matthiaskrgr```
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 28, 2022
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#94396 (1 - Make more use of `let_chains`)
 - rust-lang#94397 (Document that pre-expansion lint passes are softly deprecated)
 - rust-lang#94399 (Add test for rust-lang#79465 to prevent regression)
 - rust-lang#94409 (avoid rebuilding bootstrap when PATH changes)
 - rust-lang#94415 (Use the first codegen backend in the config.toml as default)
 - rust-lang#94417 (Fix duplicated impl links)
 - rust-lang#94420 (3 - Make more use of `let_chains`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 19958c2 Feb 28, 2022
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority 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.

3 participants