-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
fix: break inside async closure has incorrect span for enclosing closure #125078
base: master
Are you sure you want to change the base?
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
compiler/rustc_passes/src/loops.rs
Outdated
@@ -91,6 +91,10 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { | |||
}) => { | |||
let cx = match kind { | |||
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(kind, source)) => { | |||
let fn_decl_span = match self.cx { |
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 seems like a bit too specific of a case here. I think we should just fix the fn_decl_span
for the hir::Closure
from an async closure.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
Pls look into fixing this in a more general way
Hope my latest submit general enough, I haven't see other code modules, such as the hir: : CoroutineKind: : Desugared |
@rustbot ready |
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.
Sorry, I wasn't clear when I meant that this should be made more general. I think this needs to be fixed when the hir::Closure
is constructed, somewhere in rustc_ast_lowering
.
See https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_ast_lowering/expr.rs.html#1056-1122 or somewhere nearby.
This comment has been minimized.
This comment has been minimized.
@rustbot ready |
Fixes #124496