Skip to content

Commit cfcbca6

Browse files
committed
update coherence docs
1 parent c71b196 commit cfcbca6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/librustc_trait_selection/traits/coherence.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,11 @@ pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanChe
289289
/// - but (knowing that `Vec<T>` is non-fundamental, and assuming it's
290290
/// not local), `Vec<LocalType>` is bad, because `Vec<->` is between
291291
/// 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`.
297297
/// 4. Every type in the local key parameter not known in C, going
298298
/// through the parameter's type tree, must appear only as a subtree of
299299
/// a type local to C, with only fundamental types between the type
@@ -387,8 +387,8 @@ fn orphan_check_trait_ref<'tcx>(
387387
ty: Ty<'tcx>,
388388
in_crate: InCrate,
389389
) -> 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.
392392
if !contained_non_local_types(tcx, ty, in_crate).is_empty() {
393393
if let Some(inner_tys) = fundamental_ty_inner_tys(tcx, ty) {
394394
return inner_tys

0 commit comments

Comments
 (0)