From 24ab69c608e029d0146cd6b5b9e89f32a0483a34 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 8 Apr 2021 09:27:04 -0700 Subject: Add FIXME for macro case --- crates/ide_assists/src/handlers/extract_function.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crates') diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs index d84f51eae..8e295098f 100644 --- a/crates/ide_assists/src/handlers/extract_function.rs +++ b/crates/ide_assists/src/handlers/extract_function.rs @@ -729,6 +729,14 @@ fn reference_is_exclusive( /// checks if this expr requires `&mut` access, recurses on field access fn expr_require_exclusive_access(ctx: &AssistContext, expr: &ast::Expr) -> Option { + match expr { + ast::Expr::MacroCall(_) => { + // FIXME: expand macro and check output for mutable usages of the variable? + return None; + } + _ => (), + } + let parent = expr.syntax().parent()?; if let Some(bin_expr) = ast::BinExpr::cast(parent.clone()) { @@ -804,6 +812,11 @@ fn path_element_of_reference( stdx::never!(false, "cannot find path parent of variable usage: {:?}", token); None })?; + stdx::always!( + matches!(path, ast::Expr::PathExpr(_) | ast::Expr::MacroCall(_)), + "unexpected expression type for variable usage: {:?}", + path + ); Some(path) } -- cgit v1.2.3