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

Nonsequitur error message when trying to use Self in odd way #31168

Closed
ketsuban opened this issue Jan 24, 2016 · 2 comments
Closed

Nonsequitur error message when trying to use Self in odd way #31168

ketsuban opened this issue Jan 24, 2016 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution

Comments

@ketsuban
Copy link
Contributor

This doesn't seem that unreasonable.

enum FooBar {
    Foo,
    Bar
}

impl Default for FooBar {
    fn default() -> Self {
        Self::Foo
    }
}

However, it doesn't work. That's not so bad, but the error message is very unintuitive.

error: no associated item named `Foo` found for type 'hallo::salut::sunt_eu::un_haiduc::FooBar` in the current scope

I can see FooBar::Foo, it's right there. Telling me I can't use Self like this would be fine, but as it stands it's ludicrous.

@sfackler sfackler added A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution labels Jan 24, 2016
@jseyfried
Copy link
Contributor

This might be related to #28556

@petrochenkov
Copy link
Contributor

Closing as duplicate of #26264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants