mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
Add FIXME for macro case
This commit is contained in:
parent
1ccfd0ceda
commit
24ab69c608
1 changed files with 13 additions and 0 deletions
|
@ -729,6 +729,14 @@ fn reference_is_exclusive(
|
||||||
|
|
||||||
/// checks if this expr requires `&mut` access, recurses on field access
|
/// checks if this expr requires `&mut` access, recurses on field access
|
||||||
fn expr_require_exclusive_access(ctx: &AssistContext, expr: &ast::Expr) -> Option<bool> {
|
fn expr_require_exclusive_access(ctx: &AssistContext, expr: &ast::Expr) -> Option<bool> {
|
||||||
|
match expr {
|
||||||
|
ast::Expr::MacroCall(_) => {
|
||||||
|
// FIXME: expand macro and check output for mutable usages of the variable?
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
|
||||||
let parent = expr.syntax().parent()?;
|
let parent = expr.syntax().parent()?;
|
||||||
|
|
||||||
if let Some(bin_expr) = ast::BinExpr::cast(parent.clone()) {
|
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);
|
stdx::never!(false, "cannot find path parent of variable usage: {:?}", token);
|
||||||
None
|
None
|
||||||
})?;
|
})?;
|
||||||
|
stdx::always!(
|
||||||
|
matches!(path, ast::Expr::PathExpr(_) | ast::Expr::MacroCall(_)),
|
||||||
|
"unexpected expression type for variable usage: {:?}",
|
||||||
|
path
|
||||||
|
);
|
||||||
Some(path)
|
Some(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue