This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -536,7 +536,7 @@ impl ExprCollector<'_> {
536
536
537
537
self . alloc_expr ( Expr :: MacroStmts { tail } , syntax_ptr)
538
538
}
539
- ast:: Expr :: UnderscoreExpr ( _) => return None ,
539
+ ast:: Expr :: UnderscoreExpr ( _) => self . alloc_expr ( Expr :: Underscore , syntax_ptr ) ,
540
540
} )
541
541
}
542
542
Original file line number Diff line number Diff line change @@ -203,6 +203,7 @@ pub enum Expr {
203
203
} ,
204
204
Array ( Array ) ,
205
205
Literal ( Literal ) ,
206
+ Underscore ,
206
207
}
207
208
208
209
#[ derive( Debug , Clone , Eq , PartialEq ) ]
@@ -345,6 +346,7 @@ impl Expr {
345
346
} ,
346
347
Expr :: MacroStmts { tail } => f ( * tail) ,
347
348
Expr :: Literal ( _) => { }
349
+ Expr :: Underscore => { }
348
350
}
349
351
}
350
352
}
Original file line number Diff line number Diff line change @@ -775,6 +775,12 @@ impl<'a> InferenceContext<'a> {
775
775
} ,
776
776
} ,
777
777
Expr :: MacroStmts { tail } => self . infer_expr_inner ( * tail, expected) ,
778
+ Expr :: Underscore => {
779
+ // Underscore expressions may only appear in assignee expressions,
780
+ // which are handled by `infer_assignee_expr()`, so any underscore
781
+ // expression reaching this branch is an error.
782
+ self . err_ty ( )
783
+ }
778
784
} ;
779
785
// use a new type variable if we got unknown here
780
786
let ty = self . insert_type_vars_shallow ( ty) ;
You can’t perform that action at this time.
0 commit comments