Implement .use keyword as an alias of clone
This commit is contained in:
parent
0cf8dbc96c
commit
05c516446a
36 changed files with 247 additions and 24 deletions
|
@ -312,6 +312,14 @@ pub enum ExprKind<'tcx> {
|
|||
/// (e.g. `foo(a, b)` in `x.foo(a, b)`).
|
||||
fn_span: Span,
|
||||
},
|
||||
/// A use expression `x.use`.
|
||||
ByUse {
|
||||
/// The expression on which use is applied.
|
||||
expr: ExprId,
|
||||
/// The span of use, without the dot and receiver
|
||||
/// (e.g. `use` in `x.use`).
|
||||
span: Span,
|
||||
},
|
||||
/// A *non-overloaded* dereference.
|
||||
Deref {
|
||||
arg: ExprId,
|
||||
|
|
|
@ -59,6 +59,9 @@ pub fn walk_expr<'thir, 'tcx: 'thir, V: Visitor<'thir, 'tcx>>(
|
|||
visitor.visit_expr(&visitor.thir()[arg]);
|
||||
}
|
||||
}
|
||||
ByUse { expr, span: _ } => {
|
||||
visitor.visit_expr(&visitor.thir()[expr]);
|
||||
}
|
||||
Deref { arg } => visitor.visit_expr(&visitor.thir()[arg]),
|
||||
Binary { lhs, rhs, op: _ } | LogicalOp { lhs, rhs, op: _ } => {
|
||||
visitor.visit_expr(&visitor.thir()[lhs]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue