@@ -960,38 +960,29 @@ impl ExprCollector<'_> {
960
960
impl_trait_lower_fn : ImplTraitLowerFn < ' _ > ,
961
961
) -> TypeBound {
962
962
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
+ } ;
964
971
let m = match node. question_mark_token ( ) {
965
972
Some ( _) => TraitBoundModifier :: Maybe ,
966
973
None => TraitBoundModifier :: None ,
967
974
} ;
968
975
self . lower_path_type ( & path_type, impl_trait_lower_fn)
969
976
. 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
+ }
971
983
} )
972
984
. unwrap_or ( TypeBound :: Error )
973
985
}
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
- }
995
986
ast:: TypeBoundKind :: Use ( gal) => TypeBound :: Use (
996
987
gal. use_bound_generic_args ( )
997
988
. map ( |p| match p {
@@ -1981,13 +1972,7 @@ impl ExprCollector<'_> {
1981
1972
return collector ( self , None ) ;
1982
1973
}
1983
1974
} ;
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()`.
1991
1976
1992
1977
match res. value {
1993
1978
Some ( ( mark, expansion) ) => {
@@ -1997,10 +1982,6 @@ impl ExprCollector<'_> {
1997
1982
self . store . expansions . insert ( macro_call_ptr, macro_file) ;
1998
1983
}
1999
1984
2000
- if record_diagnostics {
2001
- // FIXME: Report parse errors here
2002
- }
2003
-
2004
1985
let id = collector ( self , expansion. map ( |it| it. tree ( ) ) ) ;
2005
1986
self . expander . exit ( mark) ;
2006
1987
id
0 commit comments