@@ -763,6 +763,28 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
763
763
self . resolver . get_import_res ( id) . present_items ( )
764
764
}
765
765
766
+ fn make_lang_item_path (
767
+ & mut self ,
768
+ lang_item : hir:: LangItem ,
769
+ span : Span ,
770
+ args : Option < & ' hir hir:: GenericArgs < ' hir > > ,
771
+ ) -> & ' hir hir:: Path < ' hir > {
772
+ let def_id = self . tcx . require_lang_item ( lang_item, Some ( span) ) ;
773
+ let def_kind = self . tcx . def_kind ( def_id) ;
774
+ let res = Res :: Def ( def_kind, def_id) ;
775
+ self . arena . alloc ( hir:: Path {
776
+ span,
777
+ res,
778
+ segments : self . arena . alloc_from_iter ( [ hir:: PathSegment {
779
+ ident : Ident :: new ( lang_item. name ( ) , span) ,
780
+ hir_id : self . next_id ( ) ,
781
+ res,
782
+ args,
783
+ infer_args : false ,
784
+ } ] ) ,
785
+ } )
786
+ }
787
+
766
788
/// Reuses the span but adds information like the kind of the desugaring and features that are
767
789
/// allowed inside this span.
768
790
fn mark_span_with_reason (
@@ -1965,18 +1987,24 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1965
1987
CoroutineKind :: Gen { .. } => ( hir:: ITERATOR_ITEM_NAME , hir:: LangItem :: Iterator ) ,
1966
1988
} ;
1967
1989
1968
- let future_args = self . arena . alloc ( hir:: GenericArgs {
1990
+ let bound_args = self . arena . alloc ( hir:: GenericArgs {
1969
1991
args : & [ ] ,
1970
1992
bindings : arena_vec ! [ self ; self . assoc_ty_binding( assoc_ty_name, span, output_ty) ] ,
1971
1993
parenthesized : hir:: GenericArgsParentheses :: No ,
1972
1994
span_ext : DUMMY_SP ,
1973
1995
} ) ;
1974
1996
1975
- hir:: GenericBound :: LangItemTrait (
1976
- trait_lang_item,
1977
- self . lower_span ( span) ,
1978
- self . next_id ( ) ,
1979
- future_args,
1997
+ let span = self . lower_span ( span) ;
1998
+ hir:: GenericBound :: Trait (
1999
+ hir:: PolyTraitRef {
2000
+ bound_generic_params : & [ ] ,
2001
+ trait_ref : hir:: TraitRef {
2002
+ path : self . make_lang_item_path ( trait_lang_item, span, Some ( bound_args) ) ,
2003
+ hir_ref_id : self . next_id ( ) ,
2004
+ } ,
2005
+ span,
2006
+ } ,
2007
+ hir:: TraitBoundModifier :: None ,
1980
2008
)
1981
2009
}
1982
2010
0 commit comments