@@ -1381,53 +1381,48 @@ impl<'a> LoweringContext<'a> {
1381
1381
let ty = match c. kind {
1382
1382
AssocTyConstraintKind :: Equality { ref ty } => self . lower_ty ( ty, itctx) ,
1383
1383
AssocTyConstraintKind :: Bound { ref bounds } => {
1384
- // Piggy-back on the impl trait context to figure out
1385
- // the correct behavior.
1384
+ // Piggy-back on the `impl Trait` context to figure out the correct behavior.
1386
1385
let ( desugar_to_impl_trait, itctx) = match itctx {
1387
1386
// We are in the return position:
1388
1387
//
1389
- // fn foo() -> impl Iterator<Item: Debug>
1388
+ // fn foo() -> impl Iterator<Item: Debug>
1390
1389
//
1391
1390
// so desugar to
1392
1391
//
1393
- // fn foo() -> impl Iterator<Item = impl Debug>
1392
+ // fn foo() -> impl Iterator<Item = impl Debug>
1394
1393
ImplTraitContext :: Existential ( _) => ( true , itctx) ,
1395
1394
1396
1395
// We are in the argument position, but within a dyn type:
1397
1396
//
1398
- // fn foo(x: dyn Iterator<Item: Debug>)
1397
+ // fn foo(x: dyn Iterator<Item: Debug>)
1399
1398
//
1400
1399
// so desugar to
1401
1400
//
1402
- // fn foo(x: dyn Iterator<Item = impl Debug>)
1401
+ // fn foo(x: dyn Iterator<Item = impl Debug>)
1403
1402
ImplTraitContext :: Universal ( _) if self . is_in_dyn_type => ( true , itctx) ,
1404
1403
1405
- // In `type Foo = dyn Iterator<Item: Debug>` we
1406
- // desugar to `type Foo = dyn Iterator<Item = impl
1407
- // Debug>` but we have to override the "impl trait
1408
- // context" to permit `impl Debug` in this
1409
- // position (it desugars then to an existential
1410
- // type).
1404
+ // In `type Foo = dyn Iterator<Item: Debug>` we desugar to
1405
+ // `type Foo = dyn Iterator<Item = impl Debug>` but we have to override the
1406
+ // "impl trait context" to permit `impl Debug` in this position (it desugars
1407
+ // then to an existential type).
1411
1408
//
1412
1409
// FIXME: this is only needed until `impl Trait` is allowed in type aliases.
1413
1410
ImplTraitContext :: Disallowed ( _) if self . is_in_dyn_type =>
1414
1411
( true , ImplTraitContext :: Existential ( None ) ) ,
1415
1412
1416
1413
// We are in the argument position, but not within a dyn type:
1417
1414
//
1418
- // fn foo(x: impl Iterator<Item: Debug>)
1415
+ // fn foo(x: impl Iterator<Item: Debug>)
1419
1416
//
1420
- // so we leave it as is and this gets expanded in
1421
- // astconv to a bound like `<T as Iterator>::Item:
1422
- // Debug` where `T` is the type parameter for the
1417
+ // so we leave it as is and this gets expanded in astconv to a bound like
1418
+ // `<T as Iterator>::Item: Debug` where `T` is the type parameter for the
1423
1419
// `impl Iterator`.
1424
1420
_ => ( false , itctx) ,
1425
1421
} ;
1426
1422
1427
1423
if desugar_to_impl_trait {
1428
- // Desugar `AssocTy: Bounds` into `AssocTy = impl
1429
- // Bounds`. We do this by constructing the HIR
1430
- // for "impl bounds" and then lowering that.
1424
+ // Desugar `AssocTy: Bounds` into `AssocTy = impl Bounds`. We do this by
1425
+ // constructing the HIR for "impl bounds" and then lowering that.
1431
1426
1432
1427
let impl_trait_node_id = self . sess . next_node_id ( ) ;
1433
1428
let parent_def_index = self . current_hir_id_owner . last ( ) . unwrap ( ) . 0 ;
0 commit comments