diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-01-13 03:20:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-13 03:20:21 +0100 |
| commit | 7ce8246a2393af53492d2c415f6f415099ce08d2 (patch) | |
| tree | dfb642e0da76e43afef1220c60e15d45e9d3b952 /compiler/rustc_driver/src | |
| parent | 330e196c492ec22f50786bf75676dd837d61b967 (diff) | |
| parent | d7ce9d5b6d43a78cc6ac47d653b372fbada01edc (diff) | |
Rollup merge of #80859 - jsgf:fix-pretty-remap, r=davidtwco
Fix --pretty=expanded with --remap-path-prefix Per https://github.com/rust-lang/rust/issues/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. ~~There don't appear to be any existing tests for --pretty=expanded; I'll look into adding some.~~ Never mind, found the pretty tests. Fixes #80832
Diffstat (limited to 'compiler/rustc_driver/src')
| -rw-r--r-- | compiler/rustc_driver/src/pretty.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_driver/src/pretty.rs b/compiler/rustc_driver/src/pretty.rs index 305fa838afa..b7edc24bc4a 100644 --- a/compiler/rustc_driver/src/pretty.rs +++ b/compiler/rustc_driver/src/pretty.rs @@ -363,8 +363,15 @@ impl<'tcx> pprust_hir::PpAnn for TypedAnnotation<'tcx> { fn get_source(input: &Input, sess: &Session) -> (String, FileName) { let src_name = input.source_name(); - let src = - String::clone(&sess.source_map().get_source_file(&src_name).unwrap().src.as_ref().unwrap()); + let src = String::clone( + &sess + .source_map() + .get_source_file(&src_name) + .expect("get_source_file") + .src + .as_ref() + .expect("src"), + ); (src, src_name) } |
