@@ -767,6 +767,28 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
767
767
self . resolver . get_import_res ( id) . present_items ( )
768
768
}
769
769
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
+
770
792
/// Reuses the span but adds information like the kind of the desugaring and features that are
771
793
/// allowed inside this span.
772
794
fn mark_span_with_reason (
@@ -1975,18 +1997,27 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1975
1997
CoroutineKind :: AsyncGen { .. } => ( sym:: Item , hir:: LangItem :: AsyncIterator ) ,
1976
1998
} ;
1977
1999
1978
- let future_args = self . arena . alloc ( hir:: GenericArgs {
2000
+ let bound_args = self . arena . alloc ( hir:: GenericArgs {
1979
2001
args : & [ ] ,
1980
2002
bindings : arena_vec ! [ self ; self . assoc_ty_binding( assoc_ty_name, opaque_ty_span, output_ty) ] ,
1981
2003
parenthesized : hir:: GenericArgsParentheses :: No ,
1982
2004
span_ext : DUMMY_SP ,
1983
2005
} ) ;
1984
2006
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 ,
1990
2021
)
1991
2022
}
1992
2023
0 commit comments