Skip to content

Commit 97eeb44

Browse files
Merge #513
513: Specify auto trait trait object upcasting r=pietroalbini a=Veykril #511 (comment) Co-authored-by: Lukas Wirth <[email protected]>
2 parents a5d06a2 + e9e24d9 commit 97eeb44

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ Language changes in Rust 1.78.0
145145

146146
* `\`trait Trait: Auto {}\`: allow upcasting from \`dyn Trait\` to \`dyn Trait + Auto\` <https://github.com/rust-lang/rust/pull/119338>`_
147147

148+
* New paragraph: :p:`fls_SYnFJBhi0IWj`
149+
148150
language changes in Rust 1.77.0
149151
-------------------------------
150152

src/glossary.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,6 +5057,14 @@ primitive representation
50575057
:dt:`Primitive representation` is the :t:`type representation` of
50585058
:t:`[integer type]s`.
50595059

5060+
.. _fls_mk3sa7OvtJvB:
5061+
5062+
principal trait
5063+
^^^^^^^^^^^^^^^
5064+
5065+
:dp:`fls_YtYOHoPaMPFX`
5066+
The :dt:`principal trait` of :t:`trait object type` is its first :t:`trait bound`.
5067+
50605068
.. _fls_v1u1mevpj0kj:
50615069

50625070
private visibility

src/types-and-traits.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,10 +1156,14 @@ Trait Object Types
11561156
A :t:`trait object type` is a :t:`type` that implements a :t:`trait`, where the
11571157
:t:`type` is not known at compile time.
11581158

1159+
:dp:`fls_eWac7zOda3lh`
1160+
The :t:`principal trait` of :t:`trait object type` is the first :t:`trait bound`.
1161+
11591162
:dp:`fls_9z8oleh0wdel`
1160-
The first :t:`trait bound` of a :t:`trait object type` shall denote an
1161-
:t:`object safe` :t:`trait`. Any subsequent :t:`[trait bound]s` shall denote
1162-
:t:`[auto trait]s`.
1163+
The :t:`principal trait` shall denote an :t:`object safe` :t:`trait`.
1164+
1165+
:dp:`fls_hJII8XYAtZeY`
1166+
All non-:t:`principal trait` :t:`[trait bound]s` shall denote :t:`[auto trait]s`.
11631167

11641168
:dp:`fls_s0oy2c8t4yz9`
11651169
A :t:`trait object type` shall not contain :t:`[opt-out trait bound]s`.
@@ -1992,6 +1996,11 @@ occur when:
19921996
The source :t:`type` is the :t:`never type` and the target :t:`type` is any
19931997
:t:`type`.
19941998

1999+
* :dp:`fls_SYnFJBhi0IWj`
2000+
The source :t:`type` is a :t:`trait object type` and the target :t:`type` is a
2001+
:t:`trait object type` with the same :t:`[trait bound]s` and additional
2002+
:t:`[auto trait]s`.
2003+
19952004
:dp:`fls_iiiu2q7pym4p`
19962005
An :t:`unsized coercion` is a :t:`type coercion` that converts a :t:`sized type`
19972006
into an :t:`unsized type`. :t:`Unsized coercion` from a source :t:`type` to a

0 commit comments

Comments
 (0)