-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Suggest correct path in include_bytes! #121833
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, especially the way you suggest making this part of your workflow :)
dee40b1
to
4040f9f
Compare
☔ The latest upstream changes (presumably #121998) made this pull request unmergeable. Please resolve the merge conflicts. |
6eeb9ab
to
2435ebf
Compare
This comment has been minimized.
This comment has been minimized.
2435ebf
to
0d146de
Compare
This comment has been minimized.
This comment has been minimized.
0d146de
to
da8cbe4
Compare
@bors r+ |
Suggest correct path in include_bytes! `include_bytes!` paths are relative, and I'm often not sure how nested is the `.rs` file that I'm editing, so I have to guess the number of `"../.."`. This change searches `..` and `../..` for the given file and offers corrected path as a suggestion. I wasn't sure how to get the right span, and how to properly escape it. ```text error: couldn't read src/file.txt: No such file or directory (os error 2) --> src/main.rs:2:13 | 2 | let x = include_bytes!("file.txt"); | ^^^^^^^^^^^^^^^----------^ | | | help: it's in a parent directory: `"../../file.txt"` ```
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#113518 (bootstrap/libtest: print test name eagerly on failure even with `verbose-tests=false` / `--quiet`) - rust-lang#117199 (Change the documented implicit value of `-C instrument-coverage` to `=yes`) - rust-lang#121190 (avoid overlapping privacy suggestion for single nested imports) - rust-lang#121382 (Rework `untranslatable_diagnostic` lint) - rust-lang#121833 (Suggest correct path in include_bytes!) - rust-lang#121959 (Removing absolute path in proc-macro) - rust-lang#122038 (Fix linting paths with qself in `unused_qualifications`) - rust-lang#122051 (cleanup: remove zero-offset GEP) r? `@ghost` `@rustbot` modify labels: rollup
502e254
to
0e4d790
Compare
I've made error message normalization normalize the error code too |
@bors r=estebank |
Suggest correct path in include_bytes! `include_bytes!` paths are relative, and I'm often not sure how nested is the `.rs` file that I'm editing, so I have to guess the number of `"../.."`. This change searches `..` and `../..` for the given file and offers corrected path as a suggestion. I wasn't sure how to get the right span, and how to properly escape it. ```text error: couldn't read src/file.txt: No such file or directory (os error 2) --> src/main.rs:2:13 | 2 | let x = include_bytes!("file.txt"); | ^^^^^^^^^^^^^^^----------^ | | | help: it's in a parent directory: `"../../file.txt"` ```
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
0e4d790
to
826ddb3
Compare
I've made it change |
hmm, do we usually emit "localized" or "Unixed" paths in diagnostics? @bors r=estebank |
There are other diagnostics that print file paths unmodified, but this one is special, because the suggested path may be written back to the source code. Paths with forward slashes work on Windows, but paths with backslashes won't work elsewhere. |
ah, that makes sense! was just wondering why the choice. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (463a11b): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 669.547s -> 671.737s (0.33%) |
include_bytes!
paths are relative, and I'm often not sure how nested is the.rs
file that I'm editing, so I have to guess the number of"../.."
. This change searches..
and../..
for the given file and offers corrected path as a suggestion.I wasn't sure how to get the right span, and how to properly escape it.