@@ -289,11 +289,11 @@ pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanChe
289
289
/// - but (knowing that `Vec<T>` is non-fundamental, and assuming it's
290
290
/// not local), `Vec<LocalType>` is bad, because `Vec<->` is between
291
291
/// the local type and the type parameter.
292
- /// 3. Every type parameter before the local key parameter is fully known in C.
293
- /// - e.g., `impl<T> T: Trait<LocalType>` is bad, because `T` might be
294
- /// an unknown type .
295
- /// - but `impl<T> LocalType: Trait <T>` is OK, because `LocalType`
296
- /// occurs before `T `.
292
+ /// 3. Before this local type, no generic type parameter of the impl must
293
+ /// be reachable through fundamental types.
294
+ /// - e.g. `impl<T> Trait<LocalType> for Vec<T>` is fine, as `Vec` is not fundamental .
295
+ /// - while `impl<T> Trait< LocalType for Box <T>` results in an error, as `T` is
296
+ /// reachable through the fundamental type `Box `.
297
297
/// 4. Every type in the local key parameter not known in C, going
298
298
/// through the parameter's type tree, must appear only as a subtree of
299
299
/// a type local to C, with only fundamental types between the type
@@ -387,8 +387,8 @@ fn orphan_check_trait_ref<'tcx>(
387
387
ty : Ty < ' tcx > ,
388
388
in_crate : InCrate ,
389
389
) -> Vec < Ty < ' tcx > > {
390
- // FIXME(eddyb) figure out if this is redundant with `ty_is_non_local` ,
391
- // or maybe if this should be calling `ty_is_non_local_constructor` .
390
+ // FIXME: this is currently somewhat overly complicated ,
391
+ // but fixing this requires a more complicated refactor .
392
392
if !contained_non_local_types ( tcx, ty, in_crate) . is_empty ( ) {
393
393
if let Some ( inner_tys) = fundamental_ty_inner_tys ( tcx, ty) {
394
394
return inner_tys
0 commit comments