-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add suggestions for misspelled labels #45173
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_resolve/lib.rs
Outdated
@@ -263,13 +263,16 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver, | |||
err.span_label(span, "used in a pattern more than once"); | |||
err | |||
} | |||
ResolutionError::UndeclaredLabel(name) => { | |||
ResolutionError::UndeclaredLabel(name, lev_candidate) => { | |||
let mut err = struct_span_err!(resolver.session, | |||
span, | |||
E0426, | |||
"use of undeclared label `{}`", | |||
name); | |||
err.span_label(span, format!("undeclared label `{}`", 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.
Could you replace the default label with Levenshtein-based message instead to avoid multiple messages?
if some lev_candidate {
span_label("did you mean...")
} else {
span_label("undeclared label")
}
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.
Sure!
LGTM modulo #45173 (comment) |
b998a93
to
b9ba10e
Compare
Another part of rust-lang#30197
b9ba10e
to
843dc60
Compare
@bors r+ |
📌 Commit 843dc60 has been approved by |
⌛ Testing commit 843dc60 with merge 2cedc4b58db20d3715cbfe40bed1d05b8de30c86... |
💔 Test failed - status-travis |
@bors retry
|
Is there something I need to do here? |
@laumann Nope. There was an incident several hours ago causing the CI to reject every PR. Now that it is fixed, all approved PR are re-queued. Currently this is at the 19th place in the queue, so expect to wait about 2 days before this actually get tested. |
@kennytm Oh, ok, thanks for the explanation :-) |
@bors rollup |
…r=petrochenkov Add suggestions for misspelled labels Another part of rust-lang#30197
Another part of #30197