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