Skip to content

Commit 943f00c

Browse files
committed
nyaa
1 parent 68681fc commit 943f00c

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

src/trait-bounds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ r[bound.satisfaction.impl]
6464

6565
[bound.satisfaction.impl.builtin]
6666

67-
There exists impls which are automatically generated by the compiler.
67+
There exist impls which are automatically generated by the compiler.
6868

6969
- `Sized`,`Copy`, `Clone`,...
7070

src/types.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,27 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
152152

153153
## Equality of types
154154

155+
r[types.equality]
156+
155157
Equality and subtyping of types is generally structural. If the outermost type constructors are the same,
156-
the fields are pairwise related. The only exceptions from this rule are higher ranked types and alias types
158+
corresponding generic arguments are compared. The only exceptions from this rule are higher ranked types and alias types.
159+
160+
r[types.equality.aliases]
161+
162+
Aliases are compared by first normalizing them to a *rigid* type? and then equating their type constructors and recursing into their generic arguments.
163+
164+
r[types.equality.higher-ranked]
165+
166+
Function pointers and trait objects may be higher-ranked.
167+
168+
r[types.equality.higher-ranked.sub]
169+
170+
Subtyping is checked by instantiating the `for` of the subtype with inference variables and the `for` of the supertype with placeholders before relating them as normal.
171+
172+
r[types.equality.higher-ranked.eq]
157173

158-
higher ranked types:
159-
uwu, instantiate binder with placeholders, eq
174+
Equality is checked by both instantiating the `for` of the lhs with inference variables and the `for` of the rhs with placeholders before equating them, and also doing the opposite.
160175

161-
aliases
162-
normalized to a rigid type, then equated as normal
163176

164177
[Array]: types/array.md
165178
[Boolean]: types/boolean.md

src/types/alias-types.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ r[type.alias]
66

77
r[type.alias.rigid]
88

9-
Aliases might be treated as rigid in their current environment. In this case they behave like other rigid types.
9+
Aliases might be treated as *rigid* in their current environment. In this case they behave like other types.
10+
Their equality is structural, *rigid* aliases are only equal if both have the same type constructor and equal corresponding arguments.
1011

1112
r[type.alias.normalization]
1213

0 commit comments

Comments
 (0)