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

Comments

Projects
None yet
6 participants
@bluss
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

brson commented Aug 28, 2015

Let's fix soon!

@brson brson added the E-easy 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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

apasel422 commented Aug 28, 2015

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

This comment has been minimized.

Copy link
Member

apasel422 commented Aug 28, 2015

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

This comment has been minimized.

Copy link
Contributor

terrynsun commented Aug 29, 2015

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

@apasel422

This comment has been minimized.

Copy link
Member

apasel422 commented Aug 29, 2015

@terrynsun Go for it!

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Sep 9, 2015

@terrynsun How's this going?

@terrynsun

This comment has been minimized.

Copy link
Contributor

terrynsun commented Sep 12, 2015

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

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Sep 16, 2015

triage: P-high

@rust-highfive rust-highfive added P-high and removed P-high labels Sep 16, 2015

alexcrichton added a commit to alexcrichton/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

alexcrichton added a commit to alexcrichton/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

homu added a commit to gfx-rs/gfx that referenced this issue Sep 18, 2015

Auto merge of #803 - alexcrichton:no-intrinsics, r=kvark
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

bors-servo
Auto merge of #20 - alexcrichton:no-intrinsics, r=SimonSapin
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

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 added a commit that referenced this issue Sep 22, 2015

@bors bors closed this in #28364 Sep 22, 2015

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.