-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add diagnostics for E0253 #27111
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
Add diagnostics for E0253 #27111
Conversation
use foo::MyTrait::doSomething; | ||
``` | ||
|
||
In general, it's not legal to directly import functions from a crate or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's legal to import fns from crates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "It's not legal to directly import methods"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, that was meant to read trait! I like tamird's wording better though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed.
make sure you make the methods vs functions thing clear, for many people those are the same thing.
@@ -93,6 +93,23 @@ mod bar { | |||
``` | |||
"##, | |||
|
|||
E0253: r##" | |||
Attempt was made to import an unimportable value. This can happen when | |||
trying to import a function from a trait. An example of this error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/function/method?
doh, sorry! Change made - happy to squash it if it looks good now. |
@bors r+ rollup |
📌 Commit 4ea02b7 has been approved by |
⌛ Testing commit 4ea02b7 with merge 2b7a7dc... |
💔 Test failed - auto-linux-32-opt |
@bors retry |
use foo::MyTrait::do_something; | ||
``` | ||
|
||
In general, it's not legal to directly import methods belonging to a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why "in general"? is there an exception? this feels like the diagnostic is not sure why it's firing. Let's not ship slightly ambiguous language like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No exceptions as far as I'm aware. Since this is mid-commit I can always make another PR to fix it up.
As per topic :-). Part of #24407. r? @Manishearth
As per topic :-).
Part of #24407.
r? @Manishearth