Skip to content

--pretty=expanded crashes with --remap-path-prefix #80832

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jsgf opened this issue Jan 9, 2021 · 0 comments · Fixed by #80859
Closed

--pretty=expanded crashes with --remap-path-prefix #80832

jsgf opened this issue Jan 9, 2021 · 0 comments · Fixed by #80859
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) 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.

Comments

@jsgf
Copy link
Contributor

jsgf commented Jan 9, 2021

I tried this code:

fn main() {}

in t.rs.

With rustc +nightly -Zunstable-options --pretty=expanded ./t.rs I see the expected output:

#![feature(prelude_import)]
#![no_std]
#[prelude_import]
use ::std::prelude::v1::*;
#[macro_use]
extern crate std;
fn main() { }

However adding --remap-path-prefix ./= causes an ICE:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_driver/src/pretty.rs:367:69
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.51.0-nightly (80184183b 2021-01-03) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options

query stack during panic:
end of query stack

Meta

rustc --version --verbose:

binary: rustc
commit-hash: 80184183ba0a53aa4f491753de9502acd3d6920c
commit-date: 2021-01-03
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
Backtrace

   0: rust_begin_unwind
             at /rustc/80184183ba0a53aa4f491753de9502acd3d6920c/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/80184183ba0a53aa4f491753de9502acd3d6920c/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/80184183ba0a53aa4f491753de9502acd3d6920c/library/core/src/panicking.rs:50:5
   3: rustc_driver::pretty::get_source
   4: rustc_driver::pretty::print_after_hir_lowering
   5: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
   6: rustc_span::with_source_map
   7: rustc_interface::interface::create_compiler_and_run
   8: rustc_span::with_session_globals

@jsgf jsgf added the C-bug Category: This is a bug. label Jan 9, 2021
@jonas-schievink jonas-schievink added A-pretty Area: Pretty printing (including `-Z unpretty`) 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 9, 2021
jsgf added a commit to jsgf/rust that referenced this issue Jan 10, 2021
Per rust-lang#80832, using
--pretty=expanded and --remap-path-prefix results in an ICE.

This is becasue the session source files table is stored in remapped
form, whereas --pretty-expanded looks up unremapped files. This remaps
the path prefixes before lookup.
@bors bors closed this as completed in 7ce8246 Jan 13, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants