-
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
most borrowck
diagnostic migration
#101686
Conversation
(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
borrow_desc: br_desc, | ||
local_name, | ||
type_desc: &type_desc, | ||
dtor_desc, |
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.
Except english words, There are also variables passed in dtor_desc
, which would be better:
- add a field for the diagnose struct
- make
dtor_desc
a subdiag - some flunet magic I should go check out
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.
Probably a subdiagnostic.
@@ -54,7 +54,311 @@ borrowck_returned_lifetime_wrong = | |||
{$mir_def_name} was supposed to return data with lifetime `{$outlived_fr_name}` but it is returning data with lifetime `{$fr_name}` | |||
|
|||
borrowck_returned_lifetime_short = | |||
{$category_desc}requires that `{$free_region_name}` must outlive `{$outlived_fr_name}` | |||
{$category -> | |||
[Assignment] assignment {""} |
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.
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.
[OpaqueType] opaque type {""} | ||
[ClosureUpvar] closure capture {""} | ||
[Usage] this usage {""} | ||
*[other] {""} |
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.
How practical do you think it would be to separate these out into variants of a type rather than using string-based dispatching?
borrow_desc: br_desc, | ||
local_name, | ||
type_desc: &type_desc, | ||
dtor_desc, |
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.
Probably a subdiagnostic.
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, |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -418,6 +414,7 @@ fn check_opaque_type_parameter_valid( | |||
.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have eager translation now.
@@ -7,7 +7,7 @@ LL | } | |||
| - | |||
| | | |||
| `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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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