-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc_parse: diagnostics migration, v4 #105670
Conversation
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
This comment was marked as resolved.
This comment was marked as resolved.
0d23e8e
to
7658faa
Compare
src/test/ui/pub/pub-ident-fn-3.rs
Outdated
// #60115 | ||
|
||
mod foo { | ||
pub bar(); | ||
//~^ ERROR missing `fn` or `struct` for function or struct definition | ||
} | ||
|
||
fn main() {} |
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.
Why were these tests deleted?
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.
They weren't deleted, just changed and renamed. I've split the changing and renaming into different commits to ease reviewing.
if let FieldInnerTy::Vec(_) = info.ty { | ||
throw_invalid_attr!(attr, &meta, |diag| diag | ||
.help("#[suggestion_*(...)] applied to `Vec` field is ambiguous")); | ||
} | ||
|
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.
What do these changes to the macros do? Also, it might be nice to have that message be a bit more helpful, like: "it's not supported at all" or "try x instead".
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've improved the message. The problem is that #[suggestion(code = "foo")] spans: Vec<Span>
could either mean:
for span in spans {
span_suggestion(span, "foo");
}
or:
multipart_suggestion(spans.into_iter().map(|span| (span, "foo")));
In order to avoid ambiguity, a Subdiagnostic
must be used (either a Vec
of #[suggestion]
subdiagnostics, or a single #[multipart_suggestion]
subdiagnostic).
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.
Ah, so the change is not "forbid x" but "give a better error if x happens"? Thanks for this change, these sort of papercuts have been annoying me in the past 👍
Please add this case to one of the files in https://github.com/rust-lang/rust/tree/master/src/test/ui-fulldeps/session-diagnostic
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.
It is "forbid x", but previously "x" was the first behaviour, which, while technically a correct interpretation, is probably not what most people would want. This behaviour wasn't actually used anywhere, it's just a preventative measure.
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.
Thanks for clarifying, that seems like a good idea.
671c276
to
7843eb0
Compare
This comment was marked as resolved.
This comment was marked as resolved.
7843eb0
to
2a46df2
Compare
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.
(now to wait for someone with r+ permissions to drive by 😅 )
📌 Commit ddfdcbe5e279ee76e618c6f29f50953abb537527 has been approved by It is now in the queue for this repository. |
This comment was marked as resolved.
This comment was marked as resolved.
ddfdcbe
to
02141b6
Compare
@rustbot ready |
The check previously matched this, and suggested adding a missing `struct`: pub Foo(...): It was probably intended to match this instead (semicolon instead of colon): pub Foo(...);
This is required in order to support translatable diagnostics.
#[derive(Subdiagnostic)] does not allow multiple subdiagnostics on one variant, as in NonItemInItemListSub::Other.
d623e3f
to
0d0d369
Compare
@rustbot ready |
@bors r=davidtwco |
🌲 The tree is currently closed for pull requests below priority 50. This pull request will be tested once the tree is reopened. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (131f0c6): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
This is all the
rustc_parse
migrations I have in store right now; unfortunately life is pretty busy right now, so I won't be able to do much more in the near future.cc #100717
r? @davidtwco