-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Do not ICE on missing access place description during mutability error reporting #61192
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
Cc @rust-lang/wg-diagnostics @cramertj for wording |
I've only had a cursory glance, but would we be able to give the name of the place if we allowed
|
We could probably detect the |
Disregard, just managed to get it working (was looking at the wrong span). |
(None, Place::Base(PlaceBase::Local(local))) if self.mir.local_decls[*local] | ||
.source_info.span.is_compiler_desugaring(CompilerDesugaringKind::Async) | ||
=> "`async fn` parameter".to_string(), | ||
(None, _) => "temporary place".to_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.
I don't see any output actually producing this. Should we bug!
or at least delay_span_bug
here?
@bors r+ p=5 async await priorization my nit may be fixed in a separate PR |
📌 Commit d72f97d has been approved by |
"just following orders" 😛 |
Do not ICE on missing access place description during mutability error reporting Fix rust-lang#61187.
Do not ICE on missing access place description during mutability error reporting Fix rust-lang#61187.
Do not ICE on missing access place description during mutability error reporting Fix rust-lang#61187.
Do not ICE on missing access place description during mutability error reporting Fix rust-lang#61187.
I don't think this is really the correct fix, the variable being mutated here shouldn't have it's Span marked. I guess this is fine for now. |
Do not ICE on missing access place description during mutability error reporting Fix rust-lang#61187.
EDIT: Nevermind, I misremembered, and didn't read the following method carefully enough during review: rust/src/librustc_mir/borrow_check/error_reporting.rs Lines 280 to 289 in 8197085
yea, we should probably not mark the local's span during HIR lowering. |
@bors r- |
@oli-obk why shouldn't we? I believe there are a couple of places where we mark spans that aren't strictly part of the desugared output, but that not marking would make it impossible to provide good diagnostics in some cases. I believe this might just be one of these cases :-/ |
In this instance, the span is marked to avoid |
Hmm... in that case, would it make sense to special case |
The problems is that we are marking more than we should be. The lowered code here looks like: async fn response(
data: Vec<u8> // This is an internal variable, it should have its Span marked
) -> ::std::future::from_generator(move || {
let data // This variable is effectively the user's parameter, it should not have it's Span marked
= data;
data.reverse();
}) This is causing false negatives in cases like: #![deny(unused_mut)]
pub async fn response(mut data: Vec<u8>) {
let _ = data;
} |
…-sane-way, r=eddyb Re-implement async fn drop order lowering This PR re-implements the async fn drop order lowering changes so that it all takes place in HIR lowering, building atop the work done by @eddyb to refactor `Res::Upvar`. Previously, this types involved in the lowering were constructed in libsyntax as they had to be used during name resolution and HIR lowering. This was awful because none of that logic should have existed in libsyntax. This commit also changes `ArgSource` to keep a `HirId` to the original argument pattern rather than a cloned copy of the pattern. Only b7aa4ed and 71fb8fa should be reviewed, any other commits are from rust-lang#61276 (though 447e336 might end up staying in this PR). As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192). r? @eddyb cc @cramertj
…-sane-way, r=eddyb Re-implement async fn drop order lowering This PR re-implements the async fn drop order lowering changes so that it all takes place in HIR lowering, building atop the work done by @eddyb to refactor `Res::Upvar`. Previously, this types involved in the lowering were constructed in libsyntax as they had to be used during name resolution and HIR lowering. This was awful because none of that logic should have existed in libsyntax. This commit also changes `ArgSource` to keep a `HirId` to the original argument pattern rather than a cloned copy of the pattern. Only b7aa4ed and 71fb8fa should be reviewed, any other commits are from rust-lang#61276 (though 447e336 might end up staying in this PR). As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192). r? @eddyb cc @cramertj
…-sane-way, r=eddyb Re-implement async fn drop order lowering This PR re-implements the async fn drop order lowering changes so that it all takes place in HIR lowering, building atop the work done by @eddyb to refactor `Res::Upvar`. Previously, this types involved in the lowering were constructed in libsyntax as they had to be used during name resolution and HIR lowering. This was awful because none of that logic should have existed in libsyntax. This commit also changes `ArgSource` to keep a `HirId` to the original argument pattern rather than a cloned copy of the pattern. Only b7aa4ed and 71fb8fa should be reviewed, any other commits are from rust-lang#61276 (though 447e336 might end up staying in this PR). As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192). r? @eddyb cc @cramertj
Fix #61187.