Skip to content
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

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

Closed
nejucomo opened this Issue Apr 6, 2015 · 14 comments

Comments

Projects
None yet
8 participants
@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

This comment has been minimized.

Copy link
Member

steveklabnik commented Apr 6, 2015

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.

@huonw

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

steveklabnik commented Apr 6, 2015

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

@hgrecco

This comment has been minimized.

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

This comment has been minimized.

Copy link

Jfromchina commented Jun 4, 2015

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

This comment has been minimized.

Copy link
Member

steveklabnik commented Jun 4, 2015

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

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Jun 4, 2015

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

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jun 17, 2015

cc @brson

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jun 17, 2015

triage: P-medium

@rust-highfive rust-highfive added P-medium and removed I-nominated labels Jun 17, 2015

@brson brson added the E-easy label Jun 17, 2015

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Jun 17, 2015

This is an easy matter of modifying the emit_feature_err function.

@brson

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

brson commented Jun 17, 2015

I've started a patch.

@brson

This comment has been minimized.

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

This comment has been minimized.

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

Make a better error message for using #[feature] on stable rust
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

brson added a commit to brson/rust that referenced this issue Jun 19, 2015

Make a better error message for using #[feature] on stable rust
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

Manishearth added a commit to Manishearth/rust that referenced this issue Jun 20, 2015

Rollup merge of rust-lang#26417 - brson:feature-err, r=steveklabnik
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

Auto merge of #26417 - brson:feature-err, r=steveklabnik
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

@bors bors closed this in #26417 Jun 20, 2015

jroesch added a commit to jroesch/rust that referenced this issue Jul 21, 2015

Make a better error message for using #[feature] on stable rust
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

thepowersgang added a commit to thepowersgang/rust that referenced this issue Jul 25, 2015

Make a better error message for using #[feature] on stable rust
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.