diff --git a/src/changelog.rst b/src/changelog.rst index dcc84327..f1195ca3 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -145,6 +145,8 @@ Language changes in Rust 1.78.0 * `\`trait Trait: Auto {}\`: allow upcasting from \`dyn Trait\` to \`dyn Trait + Auto\` `_ + * New paragraph: :p:`fls_SYnFJBhi0IWj` + language changes in Rust 1.77.0 ------------------------------- diff --git a/src/glossary.rst b/src/glossary.rst index c355290c..4ada47b6 100644 --- a/src/glossary.rst +++ b/src/glossary.rst @@ -5057,6 +5057,14 @@ primitive representation :dt:`Primitive representation` is the :t:`type representation` of :t:`[integer type]s`. +.. _fls_mk3sa7OvtJvB: + +principal trait +^^^^^^^^^^^^^^^ + +:dp:`fls_YtYOHoPaMPFX` +The :dt:`principal trait` of :t:`trait object type` is its first :t:`trait bound`. + .. _fls_v1u1mevpj0kj: private visibility diff --git a/src/types-and-traits.rst b/src/types-and-traits.rst index 93fa081e..80863eb7 100644 --- a/src/types-and-traits.rst +++ b/src/types-and-traits.rst @@ -1156,10 +1156,14 @@ Trait Object Types A :t:`trait object type` is a :t:`type` that implements a :t:`trait`, where the :t:`type` is not known at compile time. +:dp:`fls_eWac7zOda3lh` +The :t:`principal trait` of :t:`trait object type` is the first :t:`trait bound`. + :dp:`fls_9z8oleh0wdel` -The first :t:`trait bound` of a :t:`trait object type` shall denote an -:t:`object safe` :t:`trait`. Any subsequent :t:`[trait bound]s` shall denote -:t:`[auto trait]s`. +The :t:`principal trait` shall denote an :t:`object safe` :t:`trait`. + +:dp:`fls_hJII8XYAtZeY` +All non-:t:`principal trait` :t:`[trait bound]s` shall denote :t:`[auto trait]s`. :dp:`fls_s0oy2c8t4yz9` A :t:`trait object type` shall not contain :t:`[opt-out trait bound]s`. @@ -1992,6 +1996,11 @@ occur when: The source :t:`type` is the :t:`never type` and the target :t:`type` is any :t:`type`. +* :dp:`fls_SYnFJBhi0IWj` + The source :t:`type` is a :t:`trait object type` and the target :t:`type` is a + :t:`trait object type` with the same :t:`[trait bound]s` and additional + :t:`[auto trait]s`. + :dp:`fls_iiiu2q7pym4p` An :t:`unsized coercion` is a :t:`type coercion` that converts a :t:`sized type` into an :t:`unsized type`. :t:`Unsized coercion` from a source :t:`type` to a