Closed
Description
Code
The following doctest causes an ICE when compiled in a doctest via cargo test
. However, the same code causes the expected parse error when compiled outside the context of a doctest.
//! ```
//! fn test() -> Result< {}
//! ```
Meta
rustc --version --verbose
:
rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-unknown-linux-gnu
release: 1.49.0
This error still exists in beta and nightly as well.
Error output (when backtrace enabled)
Standard error:
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-beta.5 (ff5998292 2021-01-05) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no --crate-type lib
error: test failed, to rerun pass '--doc'
Standard output:
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
running 1 test
test src/lib.rs - (line 1) ... FAILED
failures:
---- src/lib.rs - (line 1) stdout ----
thread 'src/lib.rs - (line 1)' 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
query stack during panic:
end of query stack
failures:
src/lib.rs - (line 1)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Backtrace
thread 'src/lib.rs - (line 1)' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:974:13
stack backtrace:
0: rust_begin_unwind
at /rustc/ff59982926d98c8508008f0559f8a055260ac05e/library/std/src/panicking.rs:493:5
1: std::panicking::begin_panic_fmt
at /rustc/ff59982926d98c8508008f0559f8a055260ac05e/library/std/src/panicking.rs:435:5
2: rustc_errors::HandlerInner::flush_delayed
3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
4: core::ptr::drop_in_place
5: core::ptr::drop_in_place
6: scoped_tls::ScopedKey<T>::set
7: std::panic::catch_unwind
8: rustc_driver::catch_fatal_errors
9: rustdoc::doctest::make_test
10: rustdoc::doctest::run_test
11: core::ops::function::FnOnce::call_once{{vtable.shim}}
12: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/ff59982926d98c8508008f0559f8a055260ac05e/library/alloc/src/boxed.rs:1328:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.