@@ -5733,11 +5733,13 @@ interface CommonTypeWith(T:! type) {
57335733says that if ` Self ` implements ` CommonTypeWith(T) ` , then ` T ` must implement
57345734` CommonTypeWith(Self) ` .
57355735
5736- A ` require ` ...` impls ` constraint in an ` interface ` , or ` constraint ` , definition
5737- must still use ` Self ` in some way. It can be an argument to either the
5738- [ type] ( #parameterized-types ) or [ interface] ( #parameterized-interfaces ) . The
5739- ` Self ` can be omitted and will be implied as the type between ` require impls ` .
5740- For example:
5736+ A ` require <type> impls <facet type> ` constraint in an ` interface ` , or
5737+ ` constraint ` , definition must still use ` Self ` as either the type, or as a
5738+ parameter to the [ type] ( #parameterized-types ) or an
5739+ [ interface] ( #parameterized-interfaces ) in the facet type. In particular, it
5740+ requires ` Self ` be part of the type structure of any ` impl ` that could satisfy
5741+ that ` require ` . If the ` <type> ` is omitted entirely, it will be implied to be
5742+ ` Self ` . For example:
57415743
57425744- ✅ Allowed: ` require impls Equatable `
57435745- ✅ Allowed: ` require Self impls Equatable `
@@ -5746,7 +5748,8 @@ For example:
57465748- ✅ Allowed: ` require impls CommonTypeWith(Self) `
57475749- ✅ Allowed: ` require Self impls CommonTypeWith(Self) `
57485750- ❌ Error: ` require i32 impls Equatable `
5749- - ❌ Error: ` require T impls Equatable ` where ` T ` is some parameter to the
5751+ - ❌ Error: ` require i32 impls Equatable where .Result = Self `
5752+ - ❌ Error: ` require T impls Equatable ` when ` T ` is some parameter to the
57505753 interface
57515754
57525755This restriction allows the Carbon compiler to know where to look for facts
0 commit comments