@@ -763,6 +763,28 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
763763 self . resolver . get_import_res ( id) . present_items ( )
764764 }
765765
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+
766788 /// Reuses the span but adds information like the kind of the desugaring and features that are
767789 /// allowed inside this span.
768790 fn mark_span_with_reason (
@@ -1957,12 +1979,22 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19571979 span_ext : DUMMY_SP ,
19581980 } ) ;
19591981
1960- hir:: GenericBound :: LangItemTrait (
1961- // ::std::future::Future<future_params>
1962- hir:: LangItem :: Future ,
1963- self . lower_span ( span) ,
1964- self . next_id ( ) ,
1965- future_args,
1982+ let span = self . lower_span ( span) ;
1983+ hir:: GenericBound :: Trait (
1984+ hir:: PolyTraitRef {
1985+ bound_generic_params : & [ ] ,
1986+ trait_ref : hir:: TraitRef {
1987+ path : self . make_lang_item_path (
1988+ hir:: LangItem :: Future ,
1989+ DefKind :: Trait ,
1990+ span,
1991+ Some ( future_args) ,
1992+ ) ,
1993+ hir_ref_id : self . next_id ( ) ,
1994+ } ,
1995+ span,
1996+ } ,
1997+ hir:: TraitBoundModifier :: None ,
19661998 )
19671999 }
19682000
0 commit comments