about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-28 02:47:46 +0000
committerbors <bors@rust-lang.org>2024-03-28 02:47:46 +0000
commit463a11bef4d6378439afebf2a9543aef36ccf2c1 (patch)
tree067185805e8b595771bec3529730b98d5a676a49 /compiler/rustc_mir_transform/src/coverage/mod.rs
parentd779a7a25f67fced5f8fea232ef407c5b228a22f (diff)
parent826ddb30180373a1972cdf5787044d12f8ad868e (diff)
downloadrust-463a11bef4d6378439afebf2a9543aef36ccf2c1.tar.gz
rust-463a11bef4d6378439afebf2a9543aef36ccf2c1.zip
Auto merge of #121833 - kornelski:parent_include, 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"`
```
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions