Skip to content

Commit 24ab69c

Browse files
author
Brandon
committed
Add FIXME for macro case
1 parent 1ccfd0c commit 24ab69c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

crates/ide_assists/src/handlers/extract_function.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,14 @@ fn reference_is_exclusive(
729729

730730
/// checks if this expr requires `&mut` access, recurses on field access
731731
fn expr_require_exclusive_access(ctx: &AssistContext, expr: &ast::Expr) -> Option<bool> {
732+
match expr {
733+
ast::Expr::MacroCall(_) => {
734+
// FIXME: expand macro and check output for mutable usages of the variable?
735+
return None;
736+
}
737+
_ => (),
738+
}
739+
732740
let parent = expr.syntax().parent()?;
733741

734742
if let Some(bin_expr) = ast::BinExpr::cast(parent.clone()) {
@@ -804,6 +812,11 @@ fn path_element_of_reference(
804812
stdx::never!(false, "cannot find path parent of variable usage: {:?}", token);
805813
None
806814
})?;
815+
stdx::always!(
816+
matches!(path, ast::Expr::PathExpr(_) | ast::Expr::MacroCall(_)),
817+
"unexpected expression type for variable usage: {:?}",
818+
path
819+
);
807820
Some(path)
808821
}
809822

0 commit comments

Comments
 (0)