@@ -46,14 +46,14 @@ use std::ops::{Deref, DerefMut};
4646use thin_vec:: { thin_vec, ThinVec } ;
4747
4848/// Creates a placeholder argument.
49- pub ( super ) fn dummy_arg ( ident : Ident ) -> Param {
49+ pub ( super ) fn dummy_arg ( ident : Ident , guar : ErrorGuaranteed ) -> Param {
5050 let pat = P ( Pat {
5151 id : ast:: DUMMY_NODE_ID ,
5252 kind : PatKind :: Ident ( BindingAnnotation :: NONE , ident, None ) ,
5353 span : ident. span ,
5454 tokens : None ,
5555 } ) ;
56- let ty = Ty { kind : TyKind :: Err , span : ident. span , id : ast:: DUMMY_NODE_ID , tokens : None } ;
56+ let ty = Ty { kind : TyKind :: Err ( guar ) , span : ident. span , id : ast:: DUMMY_NODE_ID , tokens : None } ;
5757 Param {
5858 attrs : AttrVec :: default ( ) ,
5959 id : ast:: DUMMY_NODE_ID ,
@@ -1540,14 +1540,14 @@ impl<'a> Parser<'a> {
15401540 pub ( super ) fn maybe_recover_from_question_mark ( & mut self , ty : P < Ty > ) -> P < Ty > {
15411541 if self . token == token:: Question {
15421542 self . bump ( ) ;
1543- self . dcx ( ) . emit_err ( QuestionMarkInType {
1543+ let guar = self . dcx ( ) . emit_err ( QuestionMarkInType {
15441544 span : self . prev_token . span ,
15451545 sugg : QuestionMarkInTypeSugg {
15461546 left : ty. span . shrink_to_lo ( ) ,
15471547 right : self . prev_token . span ,
15481548 } ,
15491549 } ) ;
1550- self . mk_ty ( ty. span . to ( self . prev_token . span ) , TyKind :: Err )
1550+ self . mk_ty ( ty. span . to ( self . prev_token . span ) , TyKind :: Err ( guar ) )
15511551 } else {
15521552 ty
15531553 }
@@ -2304,8 +2304,8 @@ impl<'a> Parser<'a> {
23042304
23052305 pub ( super ) fn recover_bad_self_param ( & mut self , mut param : Param ) -> PResult < ' a , Param > {
23062306 let span = param. pat . span ;
2307- param . ty . kind = TyKind :: Err ;
2308- self . dcx ( ) . emit_err ( SelfParamNotFirst { span } ) ;
2307+ let guar = self . dcx ( ) . emit_err ( SelfParamNotFirst { span } ) ;
2308+ param . ty . kind = TyKind :: Err ( guar ) ;
23092309 Ok ( param)
23102310 }
23112311
@@ -2437,7 +2437,7 @@ impl<'a> Parser<'a> {
24372437 pub ( super ) fn deduplicate_recovered_params_names ( & self , fn_inputs : & mut ThinVec < Param > ) {
24382438 let mut seen_inputs = FxHashSet :: default ( ) ;
24392439 for input in fn_inputs. iter_mut ( ) {
2440- let opt_ident = if let ( PatKind :: Ident ( _, ident, _) , TyKind :: Err ) =
2440+ let opt_ident = if let ( PatKind :: Ident ( _, ident, _) , TyKind :: Err ( _ ) ) =
24412441 ( & input. pat . kind , & input. ty . kind )
24422442 {
24432443 Some ( * ident)
@@ -2644,8 +2644,10 @@ impl<'a> Parser<'a> {
26442644 "::" ,
26452645 Applicability :: MaybeIncorrect ,
26462646 ) ;
2647- err. emit ( ) ;
2648- return Ok ( GenericArg :: Type ( self . mk_ty ( start. to ( expr. span ) , TyKind :: Err ) ) ) ;
2647+ let guar = err. emit ( ) ;
2648+ return Ok ( GenericArg :: Type (
2649+ self . mk_ty ( start. to ( expr. span ) , TyKind :: Err ( guar) ) ,
2650+ ) ) ;
26492651 } else if token:: Comma == self . token . kind || self . token . kind . should_end_const_arg ( )
26502652 {
26512653 // Avoid the following output by checking that we consumed a full const arg:
0 commit comments