File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
crates/ide_assists/src/handlers Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -729,6 +729,14 @@ fn reference_is_exclusive(
729
729
730
730
/// checks if this expr requires `&mut` access, recurses on field access
731
731
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
+
732
740
let parent = expr. syntax ( ) . parent ( ) ?;
733
741
734
742
if let Some ( bin_expr) = ast:: BinExpr :: cast ( parent. clone ( ) ) {
@@ -804,6 +812,11 @@ fn path_element_of_reference(
804
812
stdx:: never!( false , "cannot find path parent of variable usage: {:?}" , token) ;
805
813
None
806
814
} ) ?;
815
+ stdx:: always!(
816
+ matches!( path, ast:: Expr :: PathExpr ( _) | ast:: Expr :: MacroCall ( _) ) ,
817
+ "unexpected expression type for variable usage: {:?}" ,
818
+ path
819
+ ) ;
807
820
Some ( path)
808
821
}
809
822
You can’t perform that action at this time.
0 commit comments