-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
extern crate foo with use self::foo doesn't work inside a function #27626
Comments
It's not true that it does nothing at all (playpen) #![feature(rand)]
fn main() {
extern crate rand;
let rng = rand::chacha::ChaChaRng::new_unseeded();
} |
Huh. Fascinating. And you can use trait methods that way without importing the trait, as long as you use UFCS, which I thought was supposed to be impossible. So, I count this as another confusion caused by use paths being different from all other paths. |
Well, maybe I'll leave the issue open, in case there's any way to fix the diagnostic. |
Given that nobody has commented in over a year, I'm going to give this one a close; a better diagnostic here would be nice, but since nobody else has run into it, and this is a very niche case, I don't think we need to track it. If you feel super strongly, we can re-open I guess, but I doubt this is going to be fixed. |
Would you object if I opened a new bug at least about the ridiculous
suggestion "did you mean `self::self::rand`"? Or maybe there's already an
issue about that.
…On Wed, Nov 30, 2016 at 1:27 PM, Steve Klabnik ***@***.***> wrote:
Closed #27626 <#27626>.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#27626 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n5eo9k-1uu-ES8HBL2iJ8-oanH-tks5rDb_-gaJpZM4FocuD>
.
|
I am not sure if there is; let's re-open this one for that then, I guess. |
extern crate
not at module root does nothing at allextern crate + use
in a function leads to nonsense "did you mean use self::self"
I suppose an easy fix is just to omit the suggestion when the path already
begins with `self::`.
…On Wed, Nov 30, 2016 at 1:38 PM, Steve Klabnik ***@***.***> wrote:
Reopened #27626 <#27626>.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#27626 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC3nxyB8O5GgYcaaxWOsMqziTevpBiuks5rDcKLgaJpZM4FocuD>
.
|
extern crate + use
in a function leads to nonsense "did you mean use self::self"
Triage: this error message has gotten a bit weirder:
It seems like the import both works and doesn't work, simultaneously? Given that |
I'm going to go ahead and close this; the error today in a project that just has rand in Cargo.toml seems mostly acceptable for this niche case, if the extern crate is moved to root scope then things just work, as expected. |
EDIT (@steveklabnik) see #27626 (comment)
This code fails and rustc doesn't tell you why:
(playpen)
I think it should at least warn, assuming there is some reason why it can't do what it looks like it does.
The text was updated successfully, but these errors were encountered: