Merge pull request #18254 from ChayimFriedman2/fix-mut

fix: Nail destructuring assignment once and for all
This commit is contained in:
Lukas Wirth 2024-10-22 17:40:52 +00:00 committed by GitHub
commit c286786888
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1171 additions and 860 deletions

View file

@ -328,7 +328,7 @@ impl SourceToDefCtx<'_, '_> {
.position(|it| it == *src.value)?;
let container = self.find_pat_or_label_container(src.syntax_ref())?;
let (_, source_map) = self.db.body_with_source_map(container);
let expr = source_map.node_expr(src.with_value(&ast::Expr::AsmExpr(asm)))?;
let expr = source_map.node_expr(src.with_value(&ast::Expr::AsmExpr(asm)))?.as_expr()?;
Some(InlineAsmOperand { owner: container, expr, index })
}
@ -372,7 +372,8 @@ impl SourceToDefCtx<'_, '_> {
let break_or_continue = ast::Expr::cast(src.value.syntax().parent()?)?;
let container = self.find_pat_or_label_container(src.syntax_ref())?;
let (body, source_map) = self.db.body_with_source_map(container);
let break_or_continue = source_map.node_expr(src.with_value(&break_or_continue))?;
let break_or_continue =
source_map.node_expr(src.with_value(&break_or_continue))?.as_expr()?;
let (Expr::Break { label, .. } | Expr::Continue { label }) = body[break_or_continue] else {
return None;
};