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 in librustc_ast_pretty printing of multiline Mixed comments #73626

Closed
dtolnay opened this issue Jun 22, 2020 · 0 comments · Fixed by #74272
Closed

ICE in librustc_ast_pretty printing of multiline Mixed comments #73626

dtolnay opened this issue Jun 22, 2020 · 0 comments · Fixed by #74272
Assignees
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented Jun 22, 2020

main.rs:

fn main(/*
    ---
*/) {}
$ RUST_BACKTRACE=1 rustc main.rs -Zunstable-options --pretty=expanded

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `3`,
 right: `1`', src/librustc_ast_pretty/pprust.rs:441:17
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:217
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  12: rust_begin_unwind
             at src/libstd/panicking.rs:384
  13: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:338
  14: rustc_ast_pretty::pprust::PrintState::print_comment
  15: rustc_ast_pretty::pprust::State::print_block_maybe_unclosed
  16: rustc_ast_pretty::pprust::State::print_item
  17: rustc_ast_pretty::pprust::print_crate
  18: rustc_driver::pretty::print_after_hir_lowering::{{closure}}
  19: rustc_driver::pretty::print_after_hir_lowering
  20: rustc_middle::ty::context::tls::enter_global
  21: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  22: rustc_span::with_source_map
  23: rustc_interface::interface::run_compiler_in_existing_thread_pool
  24: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.46.0-nightly (a8cf39911 2020-06-21) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options

query stack during panic:
end of query stack

fn print_comment(&mut self, cmnt: &comments::Comment) {
match cmnt.style {
comments::Mixed => {
assert_eq!(cmnt.lines.len(), 1);

@dtolnay dtolnay added 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. C-bug Category: This is a bug. labels Jun 22, 2020
@jonas-schievink jonas-schievink added A-pretty Area: Pretty printing (including `-Z unpretty`) requires-nightly This issue requires a nightly compiler in some way. labels Jun 22, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 23, 2020
@davidtwco davidtwco self-assigned this Jul 12, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 14, 2020
…ed-comments, r=Mark-Simulacrum

pprust: support multiline comments within lines

Fixes rust-lang#73626.

This PR adds support to `rustc_ast_pretty` for multiline comments that start and end within a line of source code.

Fun fact: [the commit which added this assert](rust-lang@d12ea39) was from 2011!
https://github.com/rust-lang/rust/blob/d12ea3989649616437a7c1434f5c5a6438235eb7/src/comp/pretty/pprust.rs#L1146-L1150
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jul 14, 2020
…ed-comments, r=Mark-Simulacrum

pprust: support multiline comments within lines

Fixes rust-lang#73626.

This PR adds support to `rustc_ast_pretty` for multiline comments that start and end within a line of source code.

Fun fact: [the commit which added this assert](rust-lang@d12ea39) was from 2011!
https://github.com/rust-lang/rust/blob/d12ea3989649616437a7c1434f5c5a6438235eb7/src/comp/pretty/pprust.rs#L1146-L1150
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 14, 2020
…ed-comments, r=Mark-Simulacrum

pprust: support multiline comments within lines

Fixes rust-lang#73626.

This PR adds support to `rustc_ast_pretty` for multiline comments that start and end within a line of source code.

Fun fact: [the commit which added this assert](rust-lang@d12ea39) was from 2011!
https://github.com/rust-lang/rust/blob/d12ea3989649616437a7c1434f5c5a6438235eb7/src/comp/pretty/pprust.rs#L1146-L1150
@bors bors closed this as completed in 92e90f9 Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants