-
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
use structured suggestion for "missing mut" label #54157
Conversation
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.
Also, are the HELP and SUGGESTION comments necessary?
They are. Test files' annotation with ERROR
is always mandatory, and if there are any NOTE
/HELP
annotation, all of them need to be added. These comments are a way of making sure that the important messages being tested are looked at, while the stderr
files let us see and catch any visual regressions that wouldn't be noticed if we only looked at the raw text.
r=me with the nits resolved
let_span, | ||
format!("consider changing this to `mut {}`", snippet), | ||
"consider changing this to", | ||
format!("mut {}", snippet), | ||
); |
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'm not super happy with the existing wording here, since it's now a suggestion.
What about "make this binding mutable":
LL | let x: isize;
| - help: make this binding mutable: `mut x`
LL | x = 1;
| ----- first assignment to `x`
@@ -1299,9 +1299,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { | |||
snippet | |||
); | |||
} else { | |||
db.span_label( | |||
db.span_suggestion( |
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.
Use span_suggestion_with_applicability
and Applicability::MachineApplicable
, so that rustfix
and VScode can apply this automagically.
decl.source_info.span, | ||
format!("consider changing this to `mut {}`", name), | ||
"consider changing this to", | ||
format!("mut {}", name), | ||
); |
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.
Use span_suggestion_with_applicability
and Applicability::MachineApplicable
, so that rustfix
and VScode can apply this automagically.
c173cdb
to
d871b8a
Compare
Addressed nits. |
@bors r+ |
📌 Commit d871b8a has been approved by |
⌛ Testing commit d871b8a with merge b7f9284df0619182adfbb9d855232c730d64db17... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
use structured suggestion for "missing mut" label Fixes #54133 for both NLL and non-NLL. r? @estebank I'm not super happy with the existing wording here, since it's now a suggestion. I wonder if the message would work better as something like "help: make binding mutable: `mut foo`"? Also, are the `HELP` and `SUGGESTION` comments necessary?
☀️ Test successful - status-appveyor, status-travis |
Fixes #54133 for both NLL and non-NLL.
r? @estebank
I'm not super happy with the existing wording here, since it's now a suggestion. I wonder if the message would work better as something like "help: make binding mutable:
mut foo
"?Also, are the
HELP
andSUGGESTION
comments necessary?