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<'_> {
536536
537537 self . alloc_expr ( Expr :: MacroStmts { tail } , syntax_ptr)
538538 }
539- ast:: Expr :: UnderscoreExpr ( _) => return None ,
539+ ast:: Expr :: UnderscoreExpr ( _) => self . alloc_expr ( Expr :: Underscore , syntax_ptr ) ,
540540 } )
541541 }
542542
Original file line number Diff line number Diff line change @@ -203,6 +203,7 @@ pub enum Expr {
203203 } ,
204204 Array ( Array ) ,
205205 Literal ( Literal ) ,
206+ Underscore ,
206207}
207208
208209#[ derive( Debug , Clone , Eq , PartialEq ) ]
@@ -345,6 +346,7 @@ impl Expr {
345346 } ,
346347 Expr :: MacroStmts { tail } => f ( * tail) ,
347348 Expr :: Literal ( _) => { }
349+ Expr :: Underscore => { }
348350 }
349351 }
350352}
Original file line number Diff line number Diff line change @@ -775,6 +775,12 @@ impl<'a> InferenceContext<'a> {
775775 } ,
776776 } ,
777777 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+ }
778784 } ;
779785 // use a new type variable if we got unknown here
780786 let ty = self . insert_type_vars_shallow ( ty) ;
You can’t perform that action at this time.
0 commit comments