@@ -200,35 +200,29 @@ fn do_orphan_check_impl<'tcx>(
200
200
NonlocalImpl :: DisallowOther ,
201
201
) ,
202
202
203
- // trait Id { type This: ?Sized; }
204
- // impl<T: ?Sized> Id for T {
205
- // type This = T;
206
- // }
207
- // impl<T: ?Sized> AutoTrait for <T as Id>::This {}
208
- ty:: Alias ( AliasKind :: Projection , _) => (
209
- LocalImpl :: Disallow { problematic_kind : "associated type" } ,
210
- NonlocalImpl :: DisallowOther ,
211
- ) ,
212
-
213
- // ```
214
- // struct S<T>(T);
215
- // impl<T: ?Sized> S<T> {
216
- // type This = T;
217
- // }
218
- // impl<T: ?Sized> AutoTrait for S<T>::This {}
219
- // ```
220
- // FIXME(inherent_associated_types): The example code above currently leads to a cycle
221
- ty:: Alias ( AliasKind :: Inherent , _) => (
222
- LocalImpl :: Disallow { problematic_kind : "associated type" } ,
223
- NonlocalImpl :: DisallowOther ,
224
- ) ,
225
-
226
- // type Opaque = impl Trait;
227
- // impl AutoTrait for Opaque {}
228
- ty:: Alias ( AliasKind :: Opaque , _) => (
229
- LocalImpl :: Disallow { problematic_kind : "opaque type" } ,
230
- NonlocalImpl :: DisallowOther ,
231
- ) ,
203
+ ty:: Alias ( kind, _) => {
204
+ let problematic_kind = match kind {
205
+ // trait Id { type This: ?Sized; }
206
+ // impl<T: ?Sized> Id for T {
207
+ // type This = T;
208
+ // }
209
+ // impl<T: ?Sized> AutoTrait for <T as Id>::This {}
210
+ AliasKind :: Projection => "associated type" ,
211
+ // type Opaque = impl Trait;
212
+ // impl AutoTrait for Opaque {}
213
+ AliasKind :: Opaque => "opaque type" ,
214
+ // ```
215
+ // struct S<T>(T);
216
+ // impl<T: ?Sized> S<T> {
217
+ // type This = T;
218
+ // }
219
+ // impl<T: ?Sized> AutoTrait for S<T>::This {}
220
+ // ```
221
+ // FIXME(inherent_associated_types): The example code above currently leads to a cycle
222
+ AliasKind :: Inherent => "associated type" ,
223
+ } ;
224
+ ( LocalImpl :: Disallow { problematic_kind } , NonlocalImpl :: DisallowOther )
225
+ }
232
226
233
227
ty:: Bool
234
228
| ty:: Char
0 commit comments