Skip to content

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

Merged
merged 1 commit into from
Dec 3, 2015
Merged

Add E0400 error explanation #30167

merged 1 commit into from
Dec 3, 2015

Conversation

GuillaumeGomez
Copy link
Member


impl Deref for A {
type Target = B;
fn deref(&self)->&B { static B_: B = B; &B_ }
Copy link
Member

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

@GuillaumeGomez GuillaumeGomez force-pushed the patch-3 branch 2 times, most recently from c8059e4 to da4ca48 Compare December 3, 2015 09:52
fn deref(&self)-> &str { "foo" }
}

const S: &'static str = &A;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you meant *A?

@GuillaumeGomez
Copy link
Member Author

Updated.

@Manishearth
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 3, 2015

📌 Commit e10fe2e has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Dec 3, 2015

⌛ Testing commit e10fe2e with merge 7540dcd...


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:
Copy link
Member

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...

Copy link
Member Author

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. :)

@bors bors merged commit e10fe2e into rust-lang:master Dec 3, 2015
@GuillaumeGomez GuillaumeGomez deleted the patch-3 branch December 3, 2015 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants