Improve declare_features! macro error#157931
Conversation
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
That is unwarranted in my eyes. The existing deduplication that already happens here is not done by the resolver, it's done in rustc_errors. Which just compares the errors by hashing them. I don't want to make such changes in the resolver, nor does a smarter deduplication mechanism in rustc_error seem worth it. Especially when there are already several easy tricks to avoid error duplication by rewriting the macro slightly (like what i did here, or by binding the metavariable to a local and using that) |
|
⌛ Testing commit 3ae0f01 with merge f9279b5... Workflow: https://github.com/rust-lang/rust/actions/runs/27679398121 |
Improve `declare_features!` macro error
I got mildly annoyed when I went to add a new feature, and the fix for this is relatively simple.
Current error:
```
error[E0425]: cannot find value `better_rust` in module `sym`
--> compiler\rustc_feature\src\unstable.rs:240:16
|
157 | name: sym::$feature,
| -------- due to this macro variable
...
240 | (internal, better_rust, "2.0.0", None),
| ^^^^^^^^^^^ not found in `sym`
For more information about this error, try `rustc --explain E0425`
```
Previous error:
```
error[E0425]: cannot find value `better_rust` in module `sym`
--> compiler\rustc_feature\src\unstable.rs:240:16
|
157 | name: sym::$feature,
| -------- due to this macro variable
...
240 | (internal, better_rust, "2.0.0", None),
| ^^^^^^^^^^^ not found in `sym`
error[E0531]: cannot find unit struct, unit variant or constant `better_rust` in module `sym`
--> compiler\rustc_feature\src\unstable.rs:240:16
|
157 | name: sym::$feature,
| -------- due to this macro variable
...
240 | (internal, better_rust, "2.0.0", None),
| ^^^^^^^^^^^ not found in `sym`
Some errors have detailed explanations: E0425, E0531.
```
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #158015. |
Rollup merge of #157931 - mejrs:feature_macro, r=jieyouxu Improve `declare_features!` macro error I got mildly annoyed when I went to add a new feature, and the fix for this is relatively simple. Current error: ``` error[E0425]: cannot find value `better_rust` in module `sym` --> compiler\rustc_feature\src\unstable.rs:240:16 | 157 | name: sym::$feature, | -------- due to this macro variable ... 240 | (internal, better_rust, "2.0.0", None), | ^^^^^^^^^^^ not found in `sym` For more information about this error, try `rustc --explain E0425` ``` Previous error: ``` error[E0425]: cannot find value `better_rust` in module `sym` --> compiler\rustc_feature\src\unstable.rs:240:16 | 157 | name: sym::$feature, | -------- due to this macro variable ... 240 | (internal, better_rust, "2.0.0", None), | ^^^^^^^^^^^ not found in `sym` error[E0531]: cannot find unit struct, unit variant or constant `better_rust` in module `sym` --> compiler\rustc_feature\src\unstable.rs:240:16 | 157 | name: sym::$feature, | -------- due to this macro variable ... 240 | (internal, better_rust, "2.0.0", None), | ^^^^^^^^^^^ not found in `sym` Some errors have detailed explanations: E0425, E0531. ```
I got mildly annoyed when I went to add a new feature, and the fix for this is relatively simple.
Current error:
Previous error: