-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Show the span of feature that is unstable when using a feature-list. #25571
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
Conversation
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
The code looks fine, but I wonder if this is the best solution - it seems like it could increase the number of errors by an annoying amount. How would you feel about listing the features which are unstable instead? E.g,
Assumming that only slice_patterns and core are unstable for this example. Or do you have any other ideas for giving better errors without giving more of them? |
Yes, first I wanted to implement it the way you suggested. But then I realized that warnings of unused features where realized this way. So I did the same for unstable features.
|
OK makes sense. @bors: r+ rollup |
📌 Commit 70db73a has been approved by |
cc @alexcrichton Wondering if we should make unused and unstable features a single error when there are multiple features? |
This is probably fine for now, most crates don't have lots of features that aren't already on nightly. |
It is hard to find the actual unstable feature which caused the error when using a list of stable and unstable features as the span marks the whole line ``` src/k8055.rs:22:1: 22:64 error: unstable feature src/k8055.rs:22 #![feature(slice_patterns, rustc_private, core, convert, libc)] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` This PR spawns an error for each unstable feature in the list: ``` est.rs:1:12: 1:26 error: unstable feature [-D unstable-features] test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)] ^~~~~~~~~~~~~~ test.rs:1:28: 1:41 error: unstable feature [-D unstable-features] test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)] ^~~~~~~~~~~~~ test.rs:1:43: 1:47 error: unstable feature [-D unstable-features] test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)] ^~~~ test.rs:1:49: 1:56 error: unstable feature [-D unstable-features] test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)] ^~~~~~~ test.rs:1:58: 1:62 error: unstable feature [-D unstable-features] test.rs:1 #![feature(slice_patterns, rustc_private, core, convert, libc)] ^~~~ ```
It is hard to find the actual unstable feature which caused the error when using a list of stable and unstable features as the span marks the whole line
This PR spawns an error for each unstable feature in the list: