Skip to content

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

Closed
@jsgf

Description

@jsgf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions