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

E0384 needs to be updated to new format #35184

Closed
sophiajt opened this issue Aug 2, 2016 · 7 comments
Closed

E0384 needs to be updated to new format #35184

sophiajt opened this issue Aug 2, 2016 · 7 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@sophiajt
Copy link
Contributor

sophiajt commented Aug 2, 2016

E0384 still uses the old format and can be updated to the new format. Ideally, we would move from span_note to span_label, as well as add a few labels.

Given the example:

fn main() {
    let x = 5;
    println!("The value of x is: {}", x);
    x = 6;
    println!("The value of x is: {}", x);
}

This would change the error from this:

error[E0384]: re-assignment of immutable variable `x`
 --> jont/varbinder.rs:4:5
  |
4 |     x = 6;
  |     ^^^^^
  |
note: prior assignment occurs here
 --> jont/varbinder.rs:2:9
  |
2 |     let x = 5;
  |         ^

to:

error[E0384]: re-assignment of immutable variable `x`
 --> jont/varbinder.rs:4:5
2 |     let x = 5;
  |         - first assignment to `x`
3 |     println!("The value of x is: {}", x);
4 |     x = 6;
  |     ^^^^^ re-assignment of immutable `x`
@sophiajt sophiajt added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-diagnostics Area: Messages for errors, warnings, and lints labels Aug 2, 2016
@nagisa
Copy link
Member

nagisa commented Aug 2, 2016

@jonathandturner usually E-easy issues benefit a lot from a short summary on what should be done.

It would likely involve changing this code to use span_label rather than span_note.

Why is there a distinction between these two?

@sophiajt
Copy link
Contributor Author

sophiajt commented Aug 2, 2016

@nagisa - I'm actually hoping up to queue a lot of these to go along with a call-for-volunteers blog post. You're right though it could use some additional guidance.

To your other point, for small messages it makes sense to use labels. For larger, more involved messages, sometimes span_note works a little better. In time, hopefully we'll strike a good balance.

@sophiajt
Copy link
Contributor Author

sophiajt commented Aug 2, 2016

@nagisa - updated

@sophiajt sophiajt added E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. and removed E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Aug 2, 2016
@theypsilon
Copy link
Contributor

I would take this one.

@theypsilon
Copy link
Contributor

theypsilon commented Aug 9, 2016

@jonathandturner there is maybe an issue with this pull request, because I'm using the spec of your blog post instead of the one said here. They are almost identical, but there is a minor difference.

Here says: ^^^^^ re-assignment of immutable x
In blog post: ^^^^^ re-assignment of immutable variable

And the implemented is the later, should I do the former instead? I noticed a bit late, sorry for asking after sending the request.

@sophiajt
Copy link
Contributor Author

sophiajt commented Aug 9, 2016

@theypsilon - what you implemented looks good to me. We'll no doubt improve the wording over time, but this looks good for a first pass.

@theypsilon
Copy link
Contributor

Understood, thanks.

steveklabnik added a commit to steveklabnik/rust that referenced this issue Aug 10, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 10, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 11, 2016
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 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

No branches or pull requests

3 participants