Skip to content

Commit 07814fd

Browse files
committed
Adjust rules to say that trailing lifetimes may only be shortened
1 parent 1c0f083 commit 07814fd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/expressions/operator-expr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ r[expr.as.pointer.unsized.trait]
747747
1. The principal trait must be the same. (you can't cast from `dyn Foo` to `dyn Bar`)
748748
2. Auto traits may be removed. (you can cast `dyn Foo + Send` to `dyn Foo`)
749749
3. Auto traits may be added only if they are a super trait of the principal trait. (you can cast `dyn Foo` to `dyn Foo + Send` only if `Send` is a super trait of `Foo`)
750-
4. Trailing lifetimes may be changed. (you can cast `dyn Foo + 'a` to `dyn Foo + 'b` for any `'a`,`'b`)
750+
4. Trailing lifetimes may only be shortened. (you can cast `dyn Foo + 'long` to `dyn Foo + 'short`, but the opposite is not legal)
751751
5. Generics (including lifetimes) and associated types must match exactly. (`*dyn T<'a, A>` -> `*dyn T<'b, B>` requires `'a = 'b` and `A = B`)
752752

753753
Note that [trait upcasting][coerce.unsize.trait-upcast] (including the addition of auto traits) requires a coercion and is not supported by `as` casts.

0 commit comments

Comments
 (0)