Uh oh!
There was an error while loading. Please reload this page.
Stablize trait_upcasting feature - #101718
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
crlf0710
commented
Sep 12, 2022
1f0111b to
81b4025CompareNote: FCP for unblocking upcasts at #101336. |
nikomatsakis
commented
Sep 12, 2022
crlf0710
commented
Sep 13, 2022
Stabilization reportThis PR proposes the stablization of the We are stablizing a new kind of coercion, which is "upcasts" from a traitFoo{fnfoo_method(&self);}traitBar:Foo{fnbar_method(&self);}let x:&dynBar = /* ... */;let y:&dynFoo = x;// compilesThe key factor for these upcasts is that they require adjusting the vtable. The current implementation strategy is that the vtables for the This way, given a For some examples of code patterns that this feature enables, see Integration with |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
nikomatsakis
commented
Sep 19, 2022
@rfcbot fcp merge Now that the FCP in #101336 has ended, I'm going to move to stabilize dyn upcasting. @crlf0710 has provided a stabilization report here. |
Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
nikomatsakis
commented
Sep 19, 2022
@rfcbot concern doc-pr I believe we need a PR against the reference describing when upcasts are allowed (it doesn't, I think, have to document the vtable layout or anything like that). I'm not sure if the reference also talks at all about validity/unsafety invariants, though. |
nikomatsakis
commented
Sep 19, 2022
@rustbot label +I-types-nominated I'm nominating this for @rust-lang/types visibility, however, to make sure we feel comfortable with this being stabilized from a type system perspective. It is implemented by extending the existing ability to "upcast" a |
crlf0710
commented
Sep 19, 2022
The Reference PR is at rust-lang/reference#1259, though admittedly the descriptions are pretty brief, only covered the major points... Let me know if the text needs any expansion :) |
joshtriplett
commented
Sep 20, 2022
@rfcbot concern rfc This has been the subject of a great deal of discussion and iteration, and I really do think this should have an RFC before stabilization. I've been expecting that it would get an RFC. |
nikomatsakis
commented
Sep 20, 2022
rfcbot
commented
Sep 20, 2022
@nikomatsakis proposal cancelled. |
nikomatsakis
commented
Sep 20, 2022
I think we should keep the reference PR open, but add a note. |
…affleLapkin Stabilize RFC3324 dyn upcasting coercion This PR stabilize the `trait_upcasting` feature, aka rust-lang/rfcs#3324. The FCP was completed here: rust-lang#65991 (comment). ~~And also remove the `deref_into_dyn_supertrait` lint which is now handled by dyn upcasting coercion.~~ Heavily inspired by rust-lang#101718Fixesrust-lang#65991
…affleLapkin Stabilize RFC3324 dyn upcasting coercion This PR stabilize the `trait_upcasting` feature, aka rust-lang/rfcs#3324. The FCP was completed here: rust-lang#65991 (comment). ~~And also remove the `deref_into_dyn_supertrait` lint which is now handled by dyn upcasting coercion.~~ Heavily inspired by rust-lang#101718Fixesrust-lang#65991
Stabilize RFC3324 dyn upcasting coercion This PR stabilize the `trait_upcasting` feature, aka rust-lang/rfcs#3324. The FCP was completed here: rust-lang/rust#65991 (comment). ~~And also remove the `deref_into_dyn_supertrait` lint which is now handled by dyn upcasting coercion.~~ Heavily inspired by rust-lang/rust#101718Fixesrust-lang/rust#65991
Closes#65991.
Closes#89460.