mirror of
https://github.com/rust-lang/rust.git
synced 2026-07-25 09:01:37 -04:00
bc0f005f4d
rustc_resolve: point the label span at the segment that could not be resolved
This is part of work that @weiznich and I are doing for `#[diagnostic::on_unknown]`.
This means that you can put the attribute in macro_rules macros and have the label message point at the input the user gave. It's imo also the right thing to point the span at in general.
```rust
mod things {}
macro_rules! mac {
($thing: ident) => {{
const _x: u32 = {
#[diagnostic::on_unknown(label = "you did the bad thing")]
use things::$thing;
//~^ERROR unresolved import `things::what` [E0432]
//~|ERROR unresolved import `things::what2` [E0432]
$thing
};
}};
}
```
```
LL | | what2
| | ----- you did the bad thing
```
See also the first and last commit for what these messages look(ed) like.
cc @estebank