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 given unclosed angle-bracket *only* in doctest #80992

Closed
plaidfinch opened this issue Jan 13, 2021 · 0 comments · Fixed by #81040
Closed

ICE given unclosed angle-bracket *only* in doctest #80992

plaidfinch opened this issue Jan 13, 2021 · 0 comments · Fixed by #81040
Labels
A-doctests Area: Documentation tests, run by rustdoc 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@plaidfinch
Copy link

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.

@plaidfinch plaidfinch 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 Jan 13, 2021
@JohnTitor JohnTitor added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-doctests Area: Documentation tests, run by rustdoc labels Jan 15, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jan 16, 2021
doctest: Reset errors before dropping the parse session

The first parse is to collect whether the code contains macros, has
`main`, and uses other crates. In that pass we ignore errors as those
will be reported when the test file is actually built.

For that we need to reset errors in the `Diagnostic` otherwise when
dropping it unhandled errors will be reported as compiler bugs.

Fixes rust-lang#80992
m-ou-se added a commit to m-ou-se/rust that referenced this issue Jan 16, 2021
doctest: Reset errors before dropping the parse session

The first parse is to collect whether the code contains macros, has
`main`, and uses other crates. In that pass we ignore errors as those
will be reported when the test file is actually built.

For that we need to reset errors in the `Diagnostic` otherwise when
dropping it unhandled errors will be reported as compiler bugs.

Fixes rust-lang#80992
m-ou-se added a commit to m-ou-se/rust that referenced this issue Jan 16, 2021
doctest: Reset errors before dropping the parse session

The first parse is to collect whether the code contains macros, has
`main`, and uses other crates. In that pass we ignore errors as those
will be reported when the test file is actually built.

For that we need to reset errors in the `Diagnostic` otherwise when
dropping it unhandled errors will be reported as compiler bugs.

Fixes rust-lang#80992
@bors bors closed this as completed in eef383f Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc 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. 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.

2 participants