remove subtyping from coercions, it's something else

pull/10/head
Alexis Beingessner 9 years ago committed by Manish Goregaokar
parent a8f62683fb
commit 750d0bccde

@ -1,16 +1,16 @@
% Coercions % Coercions
Types can implicitly be coerced to change in certain contexts. These changes are Types can implicitly be coerced to change in certain contexts. These changes are
generally just *weakening* of types, largely focused around pointers and lifetimes. generally just *weakening* of types, largely focused around pointers and
They mostly exist to make Rust "just work" in more cases, and are largely harmless. lifetimes. They mostly exist to make Rust "just work" in more cases, and are
largely harmless.
Here's all the kinds of coercion: Here's all the kinds of coercion:
Coercion is allowed between the following types: Coercion is allowed between the following types:
* Subtyping: `T` to `U` if `T` is a [subtype][] of `U` * Transitivity: `T_1` to `T_3` where `T_1` coerces to `T_2` and `T_2` coerces to
* Transitivity: `T_1` to `T_3` where `T_1` coerces to `T_2` and `T_2` coerces to `T_3` `T_3`
* Pointer Weakening: * Pointer Weakening:
* `&mut T` to `&T` * `&mut T` to `&T`
* `*mut T` to `*const T` * `*mut T` to `*const T`
@ -68,5 +68,3 @@ fn main() {
<anon>:10 foo(t); <anon>:10 foo(t);
^~~ ^~~
``` ```
[subtype]: subtyping.html

Loading…
Cancel
Save