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