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

use of unstable function is not gated in import list #28075

Closed
bluss opened this issue Aug 28, 2015 · 9 comments
Closed

use of unstable function is not gated in import list #28075

bluss opened this issue Aug 28, 2015 · 9 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-high High priority T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@bluss
Copy link
Member

bluss commented Aug 28, 2015

This compiles on stable:

use std::thread::{catch_panic};

but this does not:

use std::thread::catch_panic;
error: use of unstable library feature 'catch_panic': recent API addition

Fortunately, I can't find a way to actually use the import anyway, but it's a stability trap.

@brson brson added I-nominated T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Aug 28, 2015
@brson
Copy link
Contributor

brson commented Aug 28, 2015

Let's fix soon!

@brson brson added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Aug 28, 2015
@bluss bluss changed the title use of unstable feature is not gated in import list use of unstable function is not gated in import list Aug 28, 2015
@brson
Copy link
Contributor

brson commented Aug 28, 2015

This should be a matter of fixing the appropriate case in stability.rs and adding a test.

@apasel422
Copy link
Contributor

This actually applies to all stability attributes and unused feature checks, and it looks like this is a result of ViewPathList being visited as a series of calls to visit_ident followed by a call to walk_path with only the path prefix. For example, when use-ing the deprecated std::iter::order this way:

foo.rs:

#![feature(iter_order)]
use std::iter::{order};
fn main() {}

Output:

foo.rs:1:12: 1:22 warning: unused or unknown feature, #[warn(unused_features)] on by default
foo.rs:1 #![feature(iter_order)]
                    ^~~~~~~~~~
foo.rs:3:17: 3:22 warning: unused import, #[warn(unused_imports)] on by default
foo.rs:3 use std::iter::{order};

@apasel422
Copy link
Contributor

Compare that with:

#![feature(iter_order)]
use std::iter::order;
fn main() {}

Output:

foo.rs:2:5: 2:21 warning: unused import, #[warn(unused_imports)] on by default
foo.rs:2 use std::iter::order;
             ^~~~~~~~~~~~~~~~
foo.rs:2:5: 2:21 warning: use of deprecated item: use the equivalent methods on `Iterator` instead, #[warn(deprecated)] on by default
foo.rs:2 use std::iter::order;
             ^~~~~~~~~~~~~~~~

@terrynsun
Copy link
Contributor

I'd like to try looking at this, if that's okay.

@apasel422
Copy link
Contributor

@terrynsun Go for it!

@brson
Copy link
Contributor

brson commented Sep 9, 2015

@terrynsun How's this going?

@terrynsun
Copy link
Contributor

Sorry! I was struggling with the structure of the AST walking and couldn't figure it out.

@alexcrichton alexcrichton added P-medium Medium priority P-high High priority and removed I-nominated P-medium Medium priority labels Sep 16, 2015
@alexcrichton
Copy link
Member

triage: P-high

@rust-highfive rust-highfive added P-high High priority and removed P-high High priority labels Sep 16, 2015
alexcrichton added a commit to alexcrichton/tendril that referenced this issue Sep 18, 2015
This is actually unstable but [there's a bug][bug] in the compiler allowing it
to be used. Good news is that these functions are available stable elsewhere!

[bug]: rust-lang/rust#28075
alexcrichton added a commit to alexcrichton/gfx that referenced this issue Sep 18, 2015
This is actually unstable but [there's a bug][bug] in the compiler allowing it
to be used. Good news is that these functions are available stable elsewhere!

[bug]: rust-lang/rust#28075
homu added a commit to gfx-rs/gfx that referenced this issue Sep 18, 2015
Avoid using the std::intrinsics module

This is actually unstable but [there's a bug][bug] in the compiler allowing it
to be used. Good news is that these functions are available stable elsewhere!

[bug]: rust-lang/rust#28075
bors-servo pushed a commit to servo/tendril that referenced this issue Sep 18, 2015
Avoid using the std::intrinsics module

This is actually unstable but [there's a bug][bug] in the compiler allowing it
to be used. Good news is that these functions are available stable elsewhere!

[bug]: rust-lang/rust#28075

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/tendril/20)
<!-- Reviewable:end -->
ghost pushed a commit to gfx-rs/gfx that referenced this issue Sep 18, 2015
This is actually unstable but [there's a bug][bug] in the compiler allowing it
to be used. Good news is that these functions are available stable elsewhere!

[bug]: rust-lang/rust#28075
bors added a commit that referenced this issue Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-high High priority T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants