Skip to content

unstable feature error needs to specify feature names for better usability. #24125

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

Closed
nejucomo opened this issue Apr 6, 2015 · 14 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-medium Medium priority

Comments

@nejucomo
Copy link

nejucomo commented Apr 6, 2015

Synopsis: The unstable feature compiler error does not specify the explicit feature, so when many are enabled in a single line, the user cannot tell which subset are unstable.

What I did: Tried to build rust-peg with rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)

What I expected: A specific error message that let's me know which unstable features I must explicitly enable in order to build rust-peg.

What happened: I got the following error (rust-peg ticket #72):

src/peg_syntax_ext.rs:1:1: 1:107 error: unstable feature
src/peg_syntax_ext.rs:1 #![feature(plugin_registrar, quote, box_syntax, core, collections, rustc_private, box_patterns, str_char)]
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: this feature may not be used in the beta release channel
error: aborting due to previous error
Could not compile `peg`.

Which feature(s) are unstable? The error message needs to be more specific, otherwise I need to try each combination in the superset. :-<

Meta:

$ rustc --version --verbose
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
binary: rustc
commit-hash: 9854143cba679834bc4ef932858cd5303f015a0e
commit-date: 2015-04-02
build-date: 2015-04-02
host: x86_64-unknown-linux-gnu
release: 1.0.0-beta
@steveklabnik
Copy link
Member

Ah ha! So, until right before beta, we used to say "use feature flag x to enable this feature", but since that doesn't work in beta, we removed it, meaning we lost this bit of info.

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Apr 6, 2015
@huonw
Copy link
Member

huonw commented Apr 6, 2015

All features are unstable in beta, I believe the compiler is trying to say that the feature attribute itself is illegal.

@steveklabnik
Copy link
Member

While that's true, the wording can certainly be better.

@hgrecco
Copy link

hgrecco commented Apr 7, 2015

I was going to report the same thing (even with the same library, peg). In my ignorance I tried to find out which "feature" was not available in beta.

@Jfromchina
Copy link

I encountered the same problem, but my version is Release1.0.0, is it the latest version? which one is stable Release?
$ rustc main.rs
main.rs:1:1: 1:25 error: unstable feature
main.rs:1 #![feature(collections)]
^~~~~~~~~~~~~~~~~~~~~~~~
note: this feature may not be used in the stable release channel
error: aborting due to previous error

$ rustc --version --verbose
rustc 1.0.0 (a59de37 2015-05-13) (built 2015-05-14)
binary: rustc
commit-hash: a59de37
commit-date: 2015-05-13
build-date: 2015-05-14
host: x86_64-unknown-linux-gnu
release: 1.0.0

@steveklabnik
Copy link
Member

@Jfromchina that is stable, yes. If it were beta, it would say 1.0.0-beta, or nightly, 1.0.0-nightly.

@steveklabnik
Copy link
Member

Nominating. While it's sort of a papercut, it's also pretty poor UX.

@nikomatsakis
Copy link
Contributor

cc @brson

@nikomatsakis
Copy link
Contributor

triage: P-medium

@rust-highfive rust-highfive added P-medium Medium priority and removed I-nominated labels Jun 17, 2015
@brson brson added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Jun 17, 2015
@brson
Copy link
Contributor

brson commented Jun 17, 2015

This is an easy matter of modifying the emit_feature_err function.

@brson
Copy link
Contributor

brson commented Jun 17, 2015

Oh, it's not so easy actually because the test cases are going to be very unhappy with the different messages on different channels.

@brson
Copy link
Contributor

brson commented Jun 17, 2015

I've started a patch.

@brson
Copy link
Contributor

brson commented Jun 17, 2015

Oh, this originates from the 'unstable feature' lint, so this is just the standard lint error message, saying that the feature attribute itself is an unstable feature. Harder to fix.

@brson
Copy link
Contributor

brson commented Jun 17, 2015

Probably the unstable_feature lint should be converted to a no-op and this check folded into feature_gate.rs.

brson added a commit to brson/rust that referenced this issue Jun 19, 2015
It now says '#[feature] may not be used on the stable release channel'.

I had to convert this error from a lint to a normal compiler error.

I left the lint previously-used for this in place since removing it is
a breaking change. It will just go unused until the end of time.

Fixes rust-lang#24125
bors added a commit that referenced this issue Jun 20, 2015
It now says '#[feature] may not be used on the stable release channel'.

I had to convert this error from a lint to a normal compiler error.

I left the lint previously-used for this in place since removing it is
a breaking change. It will just go unused until the end of time.

Fixes #24125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

8 participants