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

Failed to run cargo rustc --profile=check -- -Zunstable-options --pretty=expanded on simple code with comments #64833

Closed
olegnn opened this issue Sep 27, 2019 · 3 comments
Labels
C-bug Category: This is a bug. 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

@olegnn
Copy link
Contributor

olegnn commented Sep 27, 2019

Code:

fn main() {}
/*
*/

Command (used to expand macros):

RUST_BACKTRACE=full cargo rustc --profile=check -- -Zunstable-options --pretty=expanded

Result:

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `2`,
 right: `1`', src/libsyntax/print/pprust.rs:491:17
stack backtrace:
   0:        0x109cd6155 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfa26be1652cd9787
   1:        0x109d0ce10 - core::fmt::write::h9204dad1f05752a2
   2:        0x109cc97ab - std::io::Write::write_fmt::h3236e023140ca9e5
   3:        0x109cda49a - std::panicking::default_hook::{{closure}}::h6b39e7bec1c0e07f
   4:        0x109cda1a5 - std::panicking::default_hook::hd940c417edf5953e
   5:        0x107236962 - rustc_driver::report_ice::he8f462601d7e6546
   6:        0x109cdacd2 - std::panicking::rust_panic_with_hook::hb5f0fb06584b7c80
   7:        0x109cda73d - std::panicking::continue_panic_fmt::hfee7d7df13a8f380
   8:        0x109cda69e - std::panicking::begin_panic_fmt::hf84ec34c30992fe3
   9:        0x108c59f71 - syntax::print::pprust::PrintState::print_comment::h24e7691f3cd985b3
  10:        0x108c5259d - syntax::print::pprust::print_crate::h8bcae347660e5c9a
  11:        0x1071df51f - rustc_driver::pretty::print_after_hir_lowering::{{closure}}::h84dff5163ceef5e6
  12:        0x1071dded7 - rustc_driver::pretty::print_after_hir_lowering::h5c41c09a7531a919
  13:        0x107205c7f - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::hc486952ecd38d4e9
  14:        0x10732d5bb - rustc_interface::passes::create_global_ctxt::{{closure}}::h8852eb73e68f14aa
  15:        0x1072068e0 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h33cd099bc358d208
  16:        0x1072382d4 - std::thread::local::LocalKey<T>::with::h2792dce5fe6fe5af
  17:        0x10723c6d2 - scoped_tls::ScopedKey<T>::set::h16d79aeca6a52ed8
  18:        0x107255575 - syntax::with_globals::h92b424eebfdbfd3d
  19:        0x1071ca8ad - std::sys_common::backtrace::__rust_begin_short_backtrace::haa6aa3f0127b885d
  20:        0x109ce9f7f - __rust_maybe_catch_panic
  21:        0x1071fb427 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hd2853b0c0007f607
  22:        0x109cbbffe - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h26e311d1235d42ea
  23:        0x109ce8d8e - std::sys::unix::thread::Thread::new::thread_start::h3569effff07e966a
  24:     0x7fff769f02eb - _pthread_body
  25:     0x7fff769f3249 - _pthread_start

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.40.0-nightly (ddf43867a 2019-09-26) running on x86_64-apple-darwin

note: compiler flags: -Z unstable-options -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
@olegnn olegnn changed the title Failed to run cargo rustc --profile=check -- -Zunstable-options --pretty=expanded on simple code Failed to run cargo rustc --profile=check -- -Zunstable-options --pretty=expanded on simple code with comments Sep 27, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. 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. labels Sep 27, 2019
@fanninpm
Copy link

I know it's been roughly seven months since there's been any activity on this issue, but in my efforts to add things to the glacier, I can't get an ICE from this. Have you tried the latest nightly?

@leudz
Copy link

leudz commented May 13, 2020

I got this error using:

rustc 1.45.0-nightly (769d12e 2020-05-12)
binary: rustc
commit-hash: 769d12e
commit-date: 2020-05-12
host: x86_64-pc-windows-msvc
release: 1.45.0-nightly
LLVM version: 9.0

I also noticed a few things:

  • left is always the number of lines of the last block comment and right is always 1
  • adding anything after the block comment prevents the crash, even an empty line

@Enselic
Copy link
Member

Enselic commented Aug 27, 2023

Triage: I could reproduce, but only on Windows, strangely enough. It was fixed in nightly-2020-07-15. Probably by #74272 which added a test that seems to cover the code in the issue. Closing as fixed.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Aug 27, 2023
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. 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

No branches or pull requests

5 participants