@@ -730,6 +730,29 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
730730 self . resolver . get_import_res ( id) . present_items ( )
731731 }
732732
733+ fn make_lang_item_path (
734+ & mut self ,
735+ lang_item : hir:: LangItem ,
736+ def_kind : DefKind ,
737+ span : Span ,
738+ args : Option < & ' hir hir:: GenericArgs < ' hir > > ,
739+ ) -> & ' hir hir:: Path < ' hir > {
740+ let def_id = self . tcx . require_lang_item ( lang_item, Some ( span) ) ;
741+ // FIXME: def_kind could be deduced from the LangItem's Target.
742+ let res = Res :: Def ( def_kind, def_id) ;
743+ self . arena . alloc ( hir:: Path {
744+ span,
745+ res,
746+ segments : self . arena . alloc_from_iter ( [ hir:: PathSegment {
747+ ident : Ident :: new ( lang_item. name ( ) , span) ,
748+ hir_id : self . next_id ( ) ,
749+ res,
750+ args,
751+ infer_args : false ,
752+ } ] ) ,
753+ } )
754+ }
755+
733756 fn diagnostic ( & self ) -> & Handler {
734757 self . tcx . sess . diagnostic ( )
735758 }
@@ -1918,12 +1941,22 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19181941 span_ext : DUMMY_SP ,
19191942 } ) ;
19201943
1921- hir:: GenericBound :: LangItemTrait (
1922- // ::std::future::Future<future_params>
1923- hir:: LangItem :: Future ,
1924- self . lower_span ( span) ,
1925- self . next_id ( ) ,
1926- future_args,
1944+ let span = self . lower_span ( span) ;
1945+ hir:: GenericBound :: Trait (
1946+ hir:: PolyTraitRef {
1947+ bound_generic_params : & [ ] ,
1948+ trait_ref : hir:: TraitRef {
1949+ path : self . make_lang_item_path (
1950+ hir:: LangItem :: Future ,
1951+ DefKind :: Trait ,
1952+ span,
1953+ Some ( future_args) ,
1954+ ) ,
1955+ hir_ref_id : self . next_id ( ) ,
1956+ } ,
1957+ span,
1958+ } ,
1959+ hir:: TraitBoundModifier :: None ,
19271960 )
19281961 }
19291962
0 commit comments