-
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
[WIP] borrowck diagnostic migration with eager booted #104941
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
r? @davidtwco |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Support eager subdiagnostics again See rust-lang#104941 (comment) I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.
I'll look at this after we land #104055 |
Support eager subdiagnostics again See rust-lang#104941 (comment) I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.
Support eager subdiagnostics again See rust-lang#104941 (comment) I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.
Support eager subdiagnostics again See rust-lang/rust#104941 (comment) I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
I'm back! I'll get the engine running in a few days. |
This comment has been minimized.
This comment has been minimized.
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.
@davidtwco I suppose this is a need eager on Diagonostic (not Subdiag)
case, I've made all my attempts and I can't pass ui test,they are like whack-a-mole
This comment was marked as resolved.
This comment was marked as resolved.
77e8f1b
to
5fc91ad
Compare
This comment has been minimized.
This comment has been minimized.
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.
Left some more comments, you'll need to look at where the backticks are being added and make sure that we either only do them in the IntoDiagnosticArg
implementations or in the Fluent messages.
debug!( | ||
"report_mutability_error: item_msg and reason is moved to a struct due to diagnosing migration: [E0594] & [E0596], now they are typed value: {:?}", | ||
&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.
You don't need to keep these debug
logs if they aren't necessary anymore.
@@ -1,9 +1,20 @@ | |||
// #![deny(rustc::untranslatable_diagnostic)] | |||
// #![deny(rustc::diagnostic_outside_of_impl)] |
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.
This comment still seems relevant.
@@ -174,6 +186,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { | |||
} | |||
} | |||
|
|||
pub(super) fn describe_place_typed(&self, place_ref: PlaceRef<'tcx>) -> DescribedPlace { |
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 presume this exists because changing describe_place
to return a DescribedPlace` isn't practical?
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.
describe_place
is used a lot, I'm currently narrowing the scope so it covers only PlaceAndReason
cases.
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { | ||
match self.0 { | ||
Some(descr) => descr.into_diagnostic_arg(), | ||
None => "value".into_diagnostic_arg(), |
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.
Maybe bug!
here?
@@ -63,6 +63,18 @@ pub(super) struct DescribePlaceOpt { | |||
|
|||
pub(super) struct IncludingTupleField(pub(super) bool); | |||
|
|||
#[derive(Debug)] | |||
pub(super) struct DescribedPlace(pub(super) Option<String>); |
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 is this necessary if self.0
already implements IntoDiagnosticArg
?
} | ||
let name = ptr_source.describe_for_immutable_place(self.infcx.tcx); | ||
diagnostic = PlaceAndReason::BehindPointer( | ||
self.describe_place_typed(access_place.as_ref()), |
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 "value" case in DescribedPlace
is to handle the situation of "data" here?
I tracked function fn emit_diagnostic(&mut self, diagnostic: &mut Diagnostic) -> Option<ErrorGuaranteed> {
dbg!(&diagnostic.args().collect::<Vec<_>>()); I was runing a single UI test. RUST_LOG=[emit_diagnostic] ./x.py test tests/ui/issues/issue-21600.rs Here's the output diff:
|
☔ The latest upstream changes (presumably #118316) made this pull request unmergeable. Please resolve the merge conflicts. |
@AndyJado any updates on this? thanks |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
- error[E0596]: cannot borrow `r` as mutable
+ error[E0596]: cannot borrow ``r`` as mutable I believe the answer lies in the macro implementation but I don't have the guts diving in. @Dylan-DPC I'll keep conflict resolved. |
☔ The latest upstream changes (presumably #121489) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #122190) made this pull request unmergeable. Please resolve the merge conflicts. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
☔ The latest upstream changes (presumably #122571) made this pull request unmergeable. Please resolve the merge conflicts. |
@AndyJado @rustbot label: +S-inactive |
on top of #104055