@@ -253,7 +253,7 @@ enum ImplTraitContext {
253
253
/// equivalent to a fresh universal parameter like `fn foo<T: Debug>(x: T)`.
254
254
///
255
255
/// Newly generated parameters should be inserted into the given `Vec`.
256
- Universal ( LocalDefId ) ,
256
+ Universal ,
257
257
258
258
/// Treat `impl Trait` as shorthand for a new opaque type.
259
259
/// Example: `fn foo() -> impl Debug`, where `impl Debug` is conceptually
@@ -887,7 +887,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
887
887
hir:: TypeBindingKind :: Equality { term }
888
888
}
889
889
AssocConstraintKind :: Bound { ref bounds } => {
890
- let mut parent_def_id = self . current_hir_id_owner ;
891
890
// Piggy-back on the `impl Trait` context to figure out the correct behavior.
892
891
let ( desugar_to_impl_trait, itctx) = match itctx {
893
892
// We are in the return position:
@@ -907,10 +906,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
907
906
// so desugar to
908
907
//
909
908
// fn foo(x: dyn Iterator<Item = impl Debug>)
910
- ImplTraitContext :: Universal ( parent) if self . is_in_dyn_type => {
911
- parent_def_id = parent;
912
- ( true , itctx)
913
- }
909
+ ImplTraitContext :: Universal if self . is_in_dyn_type => ( true , itctx) ,
914
910
915
911
// In `type Foo = dyn Iterator<Item: Debug>` we desugar to
916
912
// `type Foo = dyn Iterator<Item = impl Debug>` but we have to override the
@@ -936,6 +932,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
936
932
// Desugar `AssocTy: Bounds` into `AssocTy = impl Bounds`. We do this by
937
933
// constructing the HIR for `impl bounds...` and then lowering that.
938
934
935
+ let parent_def_id = self . current_hir_id_owner ;
939
936
let impl_trait_node_id = self . resolver . next_node_id ( ) ;
940
937
self . resolver . create_def (
941
938
parent_def_id,
@@ -1214,12 +1211,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1214
1211
|this| this. lower_param_bounds ( bounds, nested_itctx) ,
1215
1212
)
1216
1213
}
1217
- ImplTraitContext :: Universal ( parent_def_id ) => {
1214
+ ImplTraitContext :: Universal => {
1218
1215
// Add a definition for the in-band `Param`.
1219
1216
let def_id = self . resolver . local_def_id ( def_node_id) ;
1220
1217
1221
- let hir_bounds = self
1222
- . lower_param_bounds ( bounds, ImplTraitContext :: Universal ( parent_def_id ) ) ;
1218
+ let hir_bounds =
1219
+ self . lower_param_bounds ( bounds, ImplTraitContext :: Universal ) ;
1223
1220
// Set the name to `impl Bound1 + Bound2`.
1224
1221
let ident = Ident :: from_str_and_span ( & pprust:: ty_to_string ( t) , span) ;
1225
1222
let param = hir:: GenericParam {
@@ -1429,10 +1426,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1429
1426
}
1430
1427
let inputs = self . arena . alloc_from_iter ( inputs. iter ( ) . map ( |param| {
1431
1428
if fn_node_id. is_some ( ) {
1432
- self . lower_ty_direct (
1433
- & param. ty ,
1434
- ImplTraitContext :: Universal ( self . current_hir_id_owner ) ,
1435
- )
1429
+ self . lower_ty_direct ( & param. ty , ImplTraitContext :: Universal )
1436
1430
} else {
1437
1431
self . lower_ty_direct (
1438
1432
& param. ty ,
0 commit comments