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

Fix --pretty=expanded with --remap-path-prefix #80859

Merged
merged 2 commits into from
Jan 13, 2021

Conversation

jsgf
Copy link
Contributor

@jsgf jsgf commented Jan 10, 2021

Per #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

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 10, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
skip untracked path cpu-usage.csv during rustfmt invocations
skip untracked path src/doc/book/ during rustfmt invocations
skip untracked path src/doc/rust-by-example/ during rustfmt invocations
skip untracked path src/llvm-project/ during rustfmt invocations
Diff in /checkout/compiler/rustc_span/src/source_map.rs at line 1049:
                 let (path, mapped) = self.map_prefix(path.to_path_buf());
                 (FileName::Real(RealFileName::Named(path)), mapped)
             }
-            other => (other.clone(), false)
Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt" "--config-path" "/checkout" "--edition" "2018" "--unstable-features" "--skip-children" "--check" "/checkout/compiler/rustc_span/src/source_map.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
+            other => (other.clone(), false),
     }
 }
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --stage 2 src/tools/tidy
Build completed unsuccessfully in 0:00:21

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.
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, r=me after minor change

src/test/pretty/issue-80832.rs Outdated Show resolved Hide resolved
@davidtwco
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Jan 12, 2021

📌 Commit d7ce9d5 has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 12, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 13, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#78901 (diagnostics: Note capturing closures can't be coerced to fns)
 - rust-lang#79588 (Provide more information for HRTB lifetime errors involving closures)
 - rust-lang#80232 (Remove redundant def_id lookups)
 - rust-lang#80662 (Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnu)
 - rust-lang#80736 (use Once instead of Mutex to manage capture resolution)
 - rust-lang#80796 (Update to LLVM 11.0.1)
 - rust-lang#80859 (Fix --pretty=expanded with --remap-path-prefix)
 - rust-lang#80922 (Revert "Auto merge of rust-lang#76896 - spastorino:codegen-inline-fns2)
 - rust-lang#80924 (Fix rustdoc --test-builder argument parsing)
 - rust-lang#80935 (Rename `rustc_middle::lint::LevelSource` to `LevelAndSource`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7ce8246 into rust-lang:master Jan 13, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 13, 2021
@jsgf jsgf deleted the fix-pretty-remap branch January 13, 2021 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--pretty=expanded crashes with --remap-path-prefix
6 participants