-
Couldn't load subscription status.
- Fork 13.9k
Omit suggestions when spans are invalid #147849
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
base: master
Are you sure you want to change the base?
Conversation
|
related MCP: rust-lang/compiler-team#929 |
|
|
||
| #[proc_macro_attribute] | ||
| pub fn all_spans_same(_: TokenStream, ts: TokenStream) -> TokenStream { | ||
| spans_callsite(ts) |
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.
recursively set all spans in the output to the callsite
This comment has been minimized.
This comment has been minimized.
|
|
||
| #[all_spans_same::all_spans_same] | ||
| //~^ ERROR wrong meta list delimiters | ||
| #[allow{}] |
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.
crashes, because we suggest changing {} to () but the suggestion consists of two parts ( and ) with both the same span
b876dd7 to
7d26571
Compare
| .substitutions | ||
| .iter() | ||
| .filter_map(|substitution| { | ||
| let mut parts = substitution.parts.clone(); |
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.
skip outputting suggestions with overlapping spans to JSON, same check as in lib.rs
| // handed approach to avoid ICEs by ignoring the suggestion outright. | ||
| let invalid = subst.parts.iter().any(|item| sm.is_valid_span(item.span).is_err()); | ||
| if invalid { | ||
| num_omitted.update(|i| i + 1); |
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.
some suggestions were already silently dropped, change this to count them
| if substitution | ||
| .parts | ||
| .array_windows() | ||
| .find(|[a, b]| a.span.overlaps(b.span)) |
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.
instead of failing an assertion, count how many times this happens and show this to the user
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| @@ -259,6 +259,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ | |||
| "run-pass", | |||
| "run-rustfix", | |||
| "rustc-env", | |||
| "rustfix-dont-test-fixed", | |||
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.
Suggestion: if we do go with this, can you please describe this new directive in src/doc/rustc-dev-guide, and also in the UI test chapter perhaps add a little remark on what this intended to be used for?
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.
Absolutely
|
☔ The latest upstream changes (presumably #147913) made this pull request unmergeable. Please resolve the merge conflicts. |
Revert "fix: Filter suggestion parts that match existing code" As requested by `@wesleywiser` in #147973 (comment) this is a revert of #146121 due to the handful of diagnostics ICEs that have been since reported, and found in the beta crater run. This should thus also be backported to beta so the ICEs don't make it to next week's stable. Works around (after backport) - #146261 - #146706 - #146834 but I didn't add a test for this allowed-by-default lint - as well as the crater run regressions from #147973 of which I only added the MCVE as a test. The proper fix would likely be #147849 but it's still currently at the MCP stage. In the meantime, this PR would still emit the same overlapping suggestions, but still use a debug-assert... r? `@wesleywiser`
Revert "fix: Filter suggestion parts that match existing code" As requested by `@wesleywiser` in #147973 (comment) this is a revert of #146121 due to the handful of diagnostics ICEs that have been since reported, and found in the beta crater run. This should thus also be backported to beta so the ICEs don't make it to next week's stable. Works around (after backport) - #146261 - #146706 - #146834 but I didn't add a test for this allowed-by-default lint - as well as the crater run regressions from #147973 of which I only added the MCVE as a test. The proper fix would likely be #147849 but it's still currently at the MCP stage. In the meantime, this PR would still emit the same overlapping suggestions, but still use a debug-assert... r? `@wesleywiser`
Revert "fix: Filter suggestion parts that match existing code" As requested by `@wesleywiser` in rust-lang/rust#147973 (comment) this is a revert of rust-lang/rust#146121 due to the handful of diagnostics ICEs that have been since reported, and found in the beta crater run. This should thus also be backported to beta so the ICEs don't make it to next week's stable. Works around (after backport) - rust-lang/rust#146261 - rust-lang/rust#146706 - rust-lang/rust#146834 but I didn't add a test for this allowed-by-default lint - as well as the crater run regressions from rust-lang/rust#147973 of which I only added the MCVE as a test. The proper fix would likely be rust-lang/rust#147849 but it's still currently at the MCP stage. In the meantime, this PR would still emit the same overlapping suggestions, but still use a debug-assert... r? `@wesleywiser`
r? @ghost
introduces a new compiletest directive:
//@ rustfix-dont-test-fixedwhich is needed because I want to run rustfix, making sure rustfix doesn't crash, but then I don't expect the fixed code to compile since the suggestion was omitted and nothing was fixed.