most borrowck diagnostic migration #101686
most borrowck diagnostic migration #101686AndyJado wants to merge 5 commits intorust-lang:masterfrom
borrowck diagnostic migration #101686Conversation
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
r? @davidtwco |
|
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
|
I'd also like it if you could squash some of your commits because these aren't particularly meaningful to anyone reading them later to understand the changes you've made and why. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
|
Please run |
55d0619 to
e34758c
Compare
There was a problem hiding this comment.
Except english words, There are also variables passed in dtor_desc, which would be better:
- add a field for the diagnose struct
- make
dtor_desca subdiag - some flunet magic I should go check out
There was a problem hiding this comment.
Is it necessary to end all of these with an empty string? I assume you don't want to just add a space after the selector because then the other case would have two leading spaces? Maybe we could trim translated messages to avoid this, that's probably sensible anyway.
There was a problem hiding this comment.
How practical do you think it would be to separate these out into variants of a type rather than using string-based dispatching?
7fb512b to
3491f33
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #102700) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Hi, I've seen you changed some diagnostic structs in your PR. After #103345, the way we refer to fluent messages changed. They are now in a flat namespace with the same identifier as in the fluent file. For example, |
davidtwco
left a comment
There was a problem hiding this comment.
Apologies for the delay in getting back to reviewing this.
| let case: ClosureConstructLabel; | ||
| let diff_span: Option<Span>; | ||
| if old_loan_span == new_loan_span { | ||
| err.span_label( | ||
| old_loan_span, | ||
| "closures are constructed here in different iterations of loop", | ||
| ); | ||
| case = ClosureConstructLabel::Both { old_loan_span }; | ||
| diff_span = None; | ||
| } else { | ||
| err.span_label(old_loan_span, "first closure is constructed here"); | ||
| err.span_label(new_loan_span, "second closure is constructed here"); | ||
| case = ClosureConstructLabel::First { old_loan_span }; | ||
| diff_span = Some(new_loan_span); | ||
| } |
There was a problem hiding this comment.
let (case, diff_span) = if /* .. */ {
/* .. */
} else {
/* .. */
};
I think this would be tidier if it was written this way.
|
|
||
| let loop_message = if location == move_out.source || move_site.traversed_back_edge { | ||
| ", in previous iteration of loop" | ||
| "InLoop" |
There was a problem hiding this comment.
I think it would be better if we could avoid having strings like these and dispatching on them - it isn't easy for translators to know what possible values there are.
| .into_iter() | ||
| .map(|i| tcx.def_span(opaque_generics.param_at(i, tcx).def_id)) | ||
| .collect(); | ||
| // FIXME(#100717) requires eager translation/list support |
There was a problem hiding this comment.
We have eager translation now.
| | | | ||
| | `v` dropped here while still borrowed | ||
| | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Wrap` | ||
| | borrow might be used here, when `v` is dropped and runs the destructor for type `Wrap` |
There was a problem hiding this comment.
I don't think there's much advantage to changing the message here.
|
I am closing this PR since it relies too much on string base dispatch and out-dated discussion. I'll try to keep following PR clear and small like this one |
Covered the simple cases for the whole crate, looking for merge. Then I can focus on the nested ones, rebase is becoming rather slow.
@rustbot label +S-waiting-on-author -S-waiting-on-review