Skip to content

Commit fd60187

Browse files
crlf0710WaffleLapkin
authored andcommitted
Add trait_upcasting related languages changes
1 parent beb22c7 commit fd60187

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/behavior-considered-undefined.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ undefined behavior, it is *unsound*.
4949
* Invoking undefined behavior via compiler intrinsics.
5050
* Executing code compiled with platform features that the current platform
5151
does not support (see [`target_feature`]), *except* if the platform explicitly documents this to be safe.
52+
* Performing non-nop coercion on a dangling or unaligned raw pointer.
5253
* Calling a function with the wrong call ABI or unwinding from a function with the wrong unwind ABI.
5354
* Producing an [invalid value][invalid-values]. "Producing" a
5455
value happens any time a value is assigned to or read from a place, passed to

src/type-coercions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Coercion is allowed between the following types:
159159
### Unsized Coercions
160160

161161
The following coercions are called `unsized coercions`, since they
162-
relate to converting sized types to unsized types, and are permitted in a few
162+
relate to converting types to unsized types, and are permitted in a few
163163
cases where other coercions are not, as described above. They can still happen
164164
anywhere else a coercion can occur.
165165

@@ -172,6 +172,8 @@ an implementation of `Unsize<U>` for `T` will be provided:
172172

173173
* `T` to `dyn U`, when `T` implements `U + Sized`, and `U` is [object safe].
174174

175+
* `dyn T` to `dyn U`, when `T` has `U` as one of its ancestor trait.
176+
175177
* `Foo<..., T, ...>` to `Foo<..., U, ...>`, when:
176178
* `Foo` is a struct.
177179
* `T` implements `Unsize<U>`.

0 commit comments

Comments
 (0)