Skip to content

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

Description

@bluss

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.

Activity

  1. brson commented on Aug 28, 2015

    @brson
    Contributor

    Let's fix soon!

  2. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    on Aug 28, 2015
  3. changed the title [-]`use` of unstable feature is not gated in import list[/-] [+]`use` of unstable function is not gated in import list[/+] on Aug 28, 2015
  4. brson commented on Aug 28, 2015

    @brson
    Contributor

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

  5. apasel422 commented on Aug 28, 2015

    @apasel422
    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};
    
  6. apasel422 commented on Aug 28, 2015

    @apasel422
    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;
                 ^~~~~~~~~~~~~~~~
    
  7. terryxsun commented on Aug 29, 2015

    @terryxsun
    Contributor

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

  8. apasel422 commented on Aug 29, 2015

    @apasel422
    Contributor

    @terrynsun Go for it!

  9. brson commented on Sep 9, 2015

    @brson
    Contributor

    @terrynsun How's this going?

  10. terryxsun commented on Sep 12, 2015

    @terryxsun
    Contributor

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

  11. alexcrichton commented on Sep 16, 2015

    @alexcrichton
    Member

    triage: P-high

  12. added
    P-highHigh priority
    and removed
    P-highHigh priority
    on Sep 16, 2015
  13. added a commit that references this issue on Sep 18, 2015
  14. added a commit that references this issue on Sep 18, 2015
  15. ghost added a commit that references this issue on Sep 18, 2015
  16. added a commit that references this issue on Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-highHigh priorityT-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions