-
Notifications
You must be signed in to change notification settings - Fork 13k
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
'duplicate definition' error with static functions in different trait scopes #3427
Comments
This is expected behavior, as static functions live in the enclosing scope. Sorry, you'll have to name your three |
Ok, at least I know now. I've been running into trouble because I've been doing the constructor along the lines of pcwalton's geom::Matrix4 struct, but then I get a conflict when I try to access static functions from another trait. eg:
I mean, I could always do |
Call That said, we've been discussing having traits/types offer a namespace of their own to make this more intuitive: https://mail.mozilla.org/pipermail/rust-dev/2012-August/002255.html |
Ohhhh. I see now. Yeah I think I'm used to the classic OO style of doing things and assumed it was the same (ala Java/C++). The difficulty is I have Good to see that there's some discussion going on, as it would be really nice to take more advantages of traits with static functions. |
Are static functions meant to be in trait scope, or module scope? Here's an example:
This is the error I get when I try to compile:
The text was updated successfully, but these errors were encountered: