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

Add suggestions for misspelled labels #45173

Merged
merged 1 commit into from
Oct 13, 2017

Conversation

laumann
Copy link
Contributor

@laumann laumann commented Oct 10, 2017

Another part of #30197

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@@ -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));
Copy link
Contributor

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")
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

@petrochenkov
Copy link
Contributor

LGTM modulo #45173 (comment)

@petrochenkov petrochenkov assigned petrochenkov and unassigned eddyb Oct 10, 2017
@laumann laumann force-pushed the suggest-misspelled-labels branch from b998a93 to b9ba10e Compare October 10, 2017 15:21
@laumann laumann force-pushed the suggest-misspelled-labels branch from b9ba10e to 843dc60 Compare October 10, 2017 15:23
@petrochenkov
Copy link
Contributor

@bors r+
Thanks!

@bors
Copy link
Contributor

bors commented Oct 10, 2017

📌 Commit 843dc60 has been approved by petrochenkov

@bors
Copy link
Contributor

bors commented Oct 11, 2017

⌛ Testing commit 843dc60 with merge 2cedc4b58db20d3715cbfe40bed1d05b8de30c86...

@bors
Copy link
Contributor

bors commented Oct 11, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Oct 11, 2017

@bors retry

@laumann
Copy link
Contributor Author

laumann commented Oct 11, 2017

Is there something I need to do here?

@kennytm
Copy link
Member

kennytm commented Oct 11, 2017

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

@laumann
Copy link
Contributor Author

laumann commented Oct 11, 2017

@kennytm Oh, ok, thanks for the explanation :-)

@aidanhs aidanhs added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 12, 2017
@Mark-Simulacrum
Copy link
Member

@bors rollup

kennytm added a commit to kennytm/rust that referenced this pull request Oct 13, 2017
…r=petrochenkov

Add suggestions for misspelled labels

Another part of rust-lang#30197
bors added a commit that referenced this pull request Oct 13, 2017
Rollup of 14 pull requests

- Successful merges: #44855, #45110, #45122, #45133, #45173, #45178, #45189, #45203, #45209, #45221, #45236, #45240, #45245, #45253
- Failed merges:
@bors bors merged commit 843dc60 into rust-lang:master Oct 13, 2017
@laumann laumann deleted the suggest-misspelled-labels branch October 16, 2017 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants