Canonicalize path when displaying a FileName::Real - #68654
Canonicalize path when displaying a FileName::Real#68654LeSeulArtichaut wants to merge 3 commits into
FileName::Real#68654Conversation
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
What effect does this PR have on windows systems? |
|
@estebank I couldn’t test this, as I haven’t got a Windows device myself |
87d3774 to
2c67a66
Compare
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
Could you please canonicalize when creating the |
b0947bb to
b13b60f
Compare
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
Ping from triage: @LeSeulArtichaut can you please address the check failures? Thank you. |
c016e98 to
e208404
Compare
|
@JohnCSimon Done! |
e208404 to
ffcb348
Compare
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
ffcb348 to
b7d992b
Compare
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
I think you'd need to modify |
|
ping from triage: |
|
☔ The latest upstream changes (presumably #66364) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@LeSeulArtichaut closing this as inactive because it hasn't been moved in a month. Please reopen when you're ready to continue with this. |
…ths, r=estebank Normalize .. and . in diagnostic file paths Fixes rust-lang#51349 Lexically normalize `.` and `..` in file paths when rendering diagnostics, so errors show `foo.rs` instead of `sub/../foo.rs`. Normalization is scoped to the new `FileNameDisplayPreference::Diagnostics` variant used by `SourceMap::filename_for_diagnostics`; `file!()`, debuginfo, and remapped/local/short paths are unchanged. Uses the unstable `Path::normalize_lexically`, `canonicalize` is avoided because it turns relative paths absolute, which broke the previous attempt in rust-lang#83345. Paths that `normalize_lexically` rejects (leading escapes, net-negative `..`) fall back to the raw path and don't occur in practice for the diagnostic paths this PR targets. Compiletest gains a `$DIR/..` substitution so existing `.stderr` files that referenced auxiliary paths above `$DIR` keep matching. Previous attempt was rust-lang#68654. r? @estebank
…ths, r=estebank Normalize .. and . in diagnostic file paths Fixes rust-lang#51349 Lexically normalize `.` and `..` in file paths when rendering diagnostics, so errors show `foo.rs` instead of `sub/../foo.rs`. Normalization is scoped to the new `FileNameDisplayPreference::Diagnostics` variant used by `SourceMap::filename_for_diagnostics`; `file!()`, debuginfo, and remapped/local/short paths are unchanged. Uses the unstable `Path::normalize_lexically`, `canonicalize` is avoided because it turns relative paths absolute, which broke the previous attempt in rust-lang#83345. Paths that `normalize_lexically` rejects (leading escapes, net-negative `..`) fall back to the raw path and don't occur in practice for the diagnostic paths this PR targets. Compiletest gains a `$DIR/..` substitution so existing `.stderr` files that referenced auxiliary paths above `$DIR` keep matching. Previous attempt was rust-lang#68654. r? @estebank
…ths, r=estebank Normalize .. and . in diagnostic file paths Fixes rust-lang#51349 Lexically normalize `.` and `..` in file paths when rendering diagnostics, so errors show `foo.rs` instead of `sub/../foo.rs`. Normalization is scoped to the new `FileNameDisplayPreference::Diagnostics` variant used by `SourceMap::filename_for_diagnostics`; `file!()`, debuginfo, and remapped/local/short paths are unchanged. Uses the unstable `Path::normalize_lexically`, `canonicalize` is avoided because it turns relative paths absolute, which broke the previous attempt in rust-lang#83345. Paths that `normalize_lexically` rejects (leading escapes, net-negative `..`) fall back to the raw path and don't occur in practice for the diagnostic paths this PR targets. Compiletest gains a `$DIR/..` substitution so existing `.stderr` files that referenced auxiliary paths above `$DIR` keep matching. Previous attempt was rust-lang#68654. r? @estebank
…ths, r=estebank Normalize .. and . in diagnostic file paths Fixes rust-lang#51349 Lexically normalize `.` and `..` in file paths when rendering diagnostics, so errors show `foo.rs` instead of `sub/../foo.rs`. Normalization is scoped to the new `FileNameDisplayPreference::Diagnostics` variant used by `SourceMap::filename_for_diagnostics`; `file!()`, debuginfo, and remapped/local/short paths are unchanged. Uses the unstable `Path::normalize_lexically`, `canonicalize` is avoided because it turns relative paths absolute, which broke the previous attempt in rust-lang#83345. Paths that `normalize_lexically` rejects (leading escapes, net-negative `..`) fall back to the raw path and don't occur in practice for the diagnostic paths this PR targets. Compiletest gains a `$DIR/..` substitution so existing `.stderr` files that referenced auxiliary paths above `$DIR` keep matching. Previous attempt was rust-lang#68654. r? @estebank
…ths, r=estebank Normalize .. and . in diagnostic file paths Fixes rust-lang#51349 Lexically normalize `.` and `..` in file paths when rendering diagnostics, so errors show `foo.rs` instead of `sub/../foo.rs`. Normalization is scoped to the new `FileNameDisplayPreference::Diagnostics` variant used by `SourceMap::filename_for_diagnostics`; `file!()`, debuginfo, and remapped/local/short paths are unchanged. Uses the unstable `Path::normalize_lexically`, `canonicalize` is avoided because it turns relative paths absolute, which broke the previous attempt in rust-lang#83345. Paths that `normalize_lexically` rejects (leading escapes, net-negative `..`) fall back to the raw path and don't occur in practice for the diagnostic paths this PR targets. Compiletest gains a `$DIR/..` substitution so existing `.stderr` files that referenced auxiliary paths above `$DIR` keep matching. Previous attempt was rust-lang#68654. r? @estebank
Addresses #51349 (?)
I'm also not sure if failing to canonicalize the path should result in failing to display the
FileName, or if the original path should be used as a fallback. My current implementation uses the latter, as it seemed the "wisest" solution to me.r? @estebank