@@ -960,38 +960,29 @@ impl ExprCollector<'_> {
960960 impl_trait_lower_fn : ImplTraitLowerFn < ' _ > ,
961961 ) -> TypeBound {
962962 match node. kind ( ) {
963- ast:: TypeBoundKind :: PathType ( path_type) => {
963+ ast:: TypeBoundKind :: PathType ( binder, path_type) => {
964+ let binder = match binder. and_then ( |it| it. generic_param_list ( ) ) {
965+ Some ( gpl) => gpl
966+ . lifetime_params ( )
967+ . flat_map ( |lp| lp. lifetime ( ) . map ( |lt| Name :: new_lifetime ( & lt. text ( ) ) ) )
968+ . collect ( ) ,
969+ None => ThinVec :: default ( ) ,
970+ } ;
964971 let m = match node. question_mark_token ( ) {
965972 Some ( _) => TraitBoundModifier :: Maybe ,
966973 None => TraitBoundModifier :: None ,
967974 } ;
968975 self . lower_path_type ( & path_type, impl_trait_lower_fn)
969976 . map ( |p| {
970- TypeBound :: Path ( self . alloc_path ( p, AstPtr :: new ( & path_type) . upcast ( ) ) , m)
977+ let path = self . alloc_path ( p, AstPtr :: new ( & path_type) . upcast ( ) ) ;
978+ if binder. is_empty ( ) {
979+ TypeBound :: Path ( path, m)
980+ } else {
981+ TypeBound :: ForLifetime ( binder, path)
982+ }
971983 } )
972984 . unwrap_or ( TypeBound :: Error )
973985 }
974- ast:: TypeBoundKind :: ForType ( for_type) => {
975- let lt_refs = match for_type. generic_param_list ( ) {
976- Some ( gpl) => gpl
977- . lifetime_params ( )
978- . flat_map ( |lp| lp. lifetime ( ) . map ( |lt| Name :: new_lifetime ( & lt. text ( ) ) ) )
979- . collect ( ) ,
980- None => ThinVec :: default ( ) ,
981- } ;
982- let path = for_type. ty ( ) . and_then ( |ty| match & ty {
983- ast:: Type :: PathType ( path_type) => {
984- self . lower_path_type ( path_type, impl_trait_lower_fn) . map ( |p| ( p, ty) )
985- }
986- _ => None ,
987- } ) ;
988- match path {
989- Some ( ( p, ty) ) => {
990- TypeBound :: ForLifetime ( lt_refs, self . alloc_path ( p, AstPtr :: new ( & ty) ) )
991- }
992- None => TypeBound :: Error ,
993- }
994- }
995986 ast:: TypeBoundKind :: Use ( gal) => TypeBound :: Use (
996987 gal. use_bound_generic_args ( )
997988 . map ( |p| match p {
@@ -1981,13 +1972,7 @@ impl ExprCollector<'_> {
19811972 return collector ( self , None ) ;
19821973 }
19831974 } ;
1984- if record_diagnostics {
1985- if let Some ( err) = res. err {
1986- self . store
1987- . diagnostics
1988- . push ( ExpressionStoreDiagnostics :: MacroError { node : macro_call_ptr, err } ) ;
1989- }
1990- }
1975+ // No need to push macro and parsing errors as they'll be recreated from `macro_calls()`.
19911976
19921977 match res. value {
19931978 Some ( ( mark, expansion) ) => {
@@ -1997,10 +1982,6 @@ impl ExprCollector<'_> {
19971982 self . store . expansions . insert ( macro_call_ptr, macro_file) ;
19981983 }
19991984
2000- if record_diagnostics {
2001- // FIXME: Report parse errors here
2002- }
2003-
20041985 let id = collector ( self , expansion. map ( |it| it. tree ( ) ) ) ;
20051986 self . expander . exit ( mark) ;
20061987 id
0 commit comments