Suggest correct path in include_bytes! by kornelski · Pull Request #121833 · rust-lang/rust
rustbot
added
S-waiting-on-review
labels
Mar 1, 2024
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Mar 6, 2024matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Mar 6, 2024Suggest 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"`
```
bors added a commit to rust-lang-ci/rust that referenced this pull request
Mar 6, 2024…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
bors
removed
the
S-waiting-on-bors
label
Mar 6, 2024
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Mar 26, 2024bors added a commit to rust-lang-ci/rust that referenced this pull request
Mar 26, 2024Suggest 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"`
```
bors
added
S-waiting-on-review
and removed S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.labels
Mar 26, 2024
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Mar 28, 2024This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters