Skip to content

Stability is not checked for glob imports #23049

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
aturon opened this issue Mar 4, 2015 · 8 comments
Closed

Stability is not checked for glob imports #23049

aturon opened this issue Mar 4, 2015 · 8 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@aturon
Copy link
Member

aturon commented Mar 4, 2015

Just what it says on the tin: this is especially a problem when importing an unstable trait with stable methods.

@aturon aturon added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Mar 4, 2015
@steveklabnik
Copy link
Member

Without staged_api anymore, I am not even sure of an easy way to reproduce this outside of the standard library itself...

@petrochenkov
Copy link
Contributor

Maybe I'm missing something, but what is the problem here?

Assume we imported something unstable with a glob import. We still have to name it to use it and the moment we name it it's caught by a stability checker (modulo bugs like #30209).

@alexcrichton
Copy link
Member

This is pretty orthogonal to staged_api (this is still very relevant for libstd), but I believe this is still relevant for trait imports. We have to be careful to not have unstable traits with stable methods that aren't in the prelude because otherwise via this bug you can use std::foo::* and then call the methods.

@petrochenkov
Copy link
Contributor

We have to be careful to not have unstable traits with stable methods that aren't in the prelude because otherwise via this bug you can use std::foo::* and then call the methods.

But.. if a method is explicitly marked as stable then we certainly can call it. I don't think it's a bug, it's just something library maintainers have to be aware of - "don't make methods stable if you don't want people to call them on stable".

@alexcrichton
Copy link
Member

Perhaps, yeah, although I vaguely remember there being other reasons why this bug was opened that I can't quite recall now.

@bluss
Copy link
Member

bluss commented Dec 19, 2015

This code compiles in the stable channel and it's not intentional:

fn main() {
    let s = SliceConcatExt::concat(&[""][..]);
}

The trait itself is supposed to be unstable, not usable by name like this.

@petrochenkov
Copy link
Contributor

@bluss
This is covered by #30209

@petrochenkov
Copy link
Contributor

Closing as per #23049 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

5 participants