-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add E0400 error explanation #30167
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 E0400 error explanation #30167
Conversation
|
||
impl Deref for A { | ||
type Target = B; | ||
fn deref(&self)->&B { static B_: B = B; &B_ } |
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.
I think this extra static here confuses the example. Perhaps just dereference to a str
and return "foo"
?
also, formatting
c8059e4
to
da4ca48
Compare
fn deref(&self)-> &str { "foo" } | ||
} | ||
|
||
const S: &'static str = &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.
Perhaps you meant *A?
da4ca48
to
e10fe2e
Compare
Updated. |
@bors r+ rollup |
📌 Commit e10fe2e has been approved by |
|
||
You cannot directly use a dereference operation whilst initializing a constant | ||
or a static. To fix this error, restructure your code to avoid this dereference, | ||
perharps moving it inline: |
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.
hmm, I arrived a little too late to point out the spelling error: "perharps" before bors started its run...
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.
Well, I'll fix it next error explanation I create. :)
r? @Manishearth