rust-lang/rust

ICE: bad_placeholder_type: rustdoc on glacier fixed/69204.rs

matthiaskrgr opened this issue · 3 comments

Code

code from glacier fixed/69204.rs

trait IAmATrait {
    type Item;
    fn function(&self) -> Self::Item;
}

struct IAmAnObject(usize);

impl IAmATrait for IAmAnObject {
    type Item = _;
    fn function(&self) -> Self::Item {
        self.0
    }
}

fn main() {}

Meta

rustc --version --verbose:

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

Error output

error: internal compiler error: bad_placeholder_type
 --> ./69204.rs:9:17
  |
9 |     type Item = _;
  |                 ^
  |
  = note: delayed at compiler/rustc_typeck/src/collect.rs:326:20

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:974:13
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
Backtrace

error: internal compiler error: bad_placeholder_type
 --> ./69204.rs:9:17
  |
9 |     type Item = _;
  |                 ^
  |
  = note: delayed at compiler/rustc_typeck/src/collect.rs:326:20

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:974:13
stack backtrace:
   0:     0x7f131cc4ce30 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f131cc4ce30 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f131cc4ce30 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f131cc4ce30 - <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:     0x7f131ccbfc4c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f131cc3e9a2 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/io/mod.rs:1519:15
   6:     0x7f131cc50a95 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f131cc50a95 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f131cc50a95 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:208:50
   9:     0x7f131cc505ea - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:225:9
  10:     0x7f131d4ddbb8 - rustc_driver::report_ice::ha25ae86a5858acc3
  11:     0x7f131cc51396 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:595:17
  12:     0x7f131cc50eb7 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:497:13
  13:     0x7f131cc4d2ec - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f131cc50e19 - rust_begin_unwind
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:493:5
  15:     0x7f131cc50dcb - std::panicking::begin_panic_fmt::hee67ce14b77d0396
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:435:5
  16:     0x7f1320640f11 - rustc_errors::HandlerInner::flush_delayed::h336555a5d5079cda
  17:     0x7f132063d3d1 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::he52694f8b8fafc7c
  18:     0x55c40791e226 - core::ptr::drop_in_place::he12f0fc8a3bb0500
  19:     0x55c4079222b6 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::hc65b7dbe435be8b6
  20:     0x55c4078a3e0c - rustdoc::main_options::h8a5cda9c1c8c625b
  21:     0x55c4079eaa68 - rustc_span::with_session_globals::h7a83fbbd64fb6823
  22:     0x55c4078d130e - std::sys_common::backtrace::__rust_begin_short_backtrace::h50722f4a01515f7b
  23:     0x55c407a0303a - core::ops::function::FnOnce::call_once{{vtable.shim}}::h22276985fb540191
  24:     0x7f131cc6065a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318:9
  25:     0x7f131cc6065a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318:9
  26:     0x7f131cc6065a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys/unix/thread.rs:71:17
  27:     0x7f131cb3c3e9 - start_thread
  28:     0x7f131c922293 - __GI___clone
  29:                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

MCVE:

type Item = _;

Rustc gives the correct error:

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> wild.rs:1:13
  |
1 | type Item = _;
  |             ^ not allowed in type signatures

I expect this is the same sort of issue as #73566 (comment) where rustdoc ignores errors that the compiler requires to be emitted.

Assigning P-low by the same rationale as #79496 (comment).

Fixed by #108576