@@ -766,6 +766,28 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
766766 self . resolver . get_import_res ( id) . present_items ( )
767767 }
768768
769+ fn make_lang_item_path (
770+ & mut self ,
771+ lang_item : hir:: LangItem ,
772+ span : Span ,
773+ args : Option < & ' hir hir:: GenericArgs < ' hir > > ,
774+ ) -> & ' hir hir:: Path < ' hir > {
775+ let def_id = self . tcx . require_lang_item ( lang_item, Some ( span) ) ;
776+ let def_kind = self . tcx . def_kind ( def_id) ;
777+ let res = Res :: Def ( def_kind, def_id) ;
778+ self . arena . alloc ( hir:: Path {
779+ span,
780+ res,
781+ segments : self . arena . alloc_from_iter ( [ hir:: PathSegment {
782+ ident : Ident :: new ( lang_item. name ( ) , span) ,
783+ hir_id : self . next_id ( ) ,
784+ res,
785+ args,
786+ infer_args : false ,
787+ } ] ) ,
788+ } )
789+ }
790+
769791 /// Reuses the span but adds information like the kind of the desugaring and features that are
770792 /// allowed inside this span.
771793 fn mark_span_with_reason (
@@ -1977,18 +1999,27 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19771999 CoroutineKind :: AsyncGen { .. } => ( sym:: Item , hir:: LangItem :: AsyncIterator ) ,
19782000 } ;
19792001
1980- let future_args = self . arena . alloc ( hir:: GenericArgs {
2002+ let bound_args = self . arena . alloc ( hir:: GenericArgs {
19812003 args : & [ ] ,
19822004 bindings : arena_vec ! [ self ; self . assoc_ty_binding( assoc_ty_name, opaque_ty_span, output_ty) ] ,
19832005 parenthesized : hir:: GenericArgsParentheses :: No ,
19842006 span_ext : DUMMY_SP ,
19852007 } ) ;
19862008
1987- hir:: GenericBound :: LangItemTrait (
1988- trait_lang_item,
1989- opaque_ty_span,
1990- self . next_id ( ) ,
1991- future_args,
2009+ hir:: GenericBound :: Trait (
2010+ hir:: PolyTraitRef {
2011+ bound_generic_params : & [ ] ,
2012+ trait_ref : hir:: TraitRef {
2013+ path : self . make_lang_item_path (
2014+ trait_lang_item,
2015+ opaque_ty_span,
2016+ Some ( bound_args) ,
2017+ ) ,
2018+ hir_ref_id : self . next_id ( ) ,
2019+ } ,
2020+ span : opaque_ty_span,
2021+ } ,
2022+ hir:: TraitBoundModifier :: None ,
19922023 )
19932024 }
19942025
0 commit comments