-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Labels
T-langdisposition-mergeThe FCP starter wants to merge (accept) thisThe FCP starter wants to merge (accept) thisfinal-comment-periodThe FCP has started, most (if not all) team members are in agreementThe FCP has started, most (if not all) team members are in agreementmajor-changeMajor change proposalMajor change proposalmajor-change-acceptedMajor change proposal that was acceptedMajor change proposal that was acceptedto-announceNot yet announced MCP proposalsNot yet announced MCP proposals
Description
Proposal
Summary and problem statement
- Add the
trait_upcasting
feature to the language.
Motivation, use-cases, and solution sketches
- The
trait_upcasting
feature adds support for trait upcasting coercion. This allows a
trait object of typedyn Bar
to be cast to a trait object of typedyn Foo
so long asBar: Foo
.
#![feature(trait_upcasting)]
trait Foo {}
trait Bar: Foo {}
impl Foo for i32 {}
impl<T: Foo + ?Sized> Bar for T {}
let foo: &dyn Foo = &123;
let bar: &dyn Bar = foo;
Prioritization
- This belongs to the "Trait and type system extensions" part of the lang team priorities.
Links and related work
- Previously established tracking issue: Tracking issue for dyn upcasting coercion rust#65991
Initial people involved
Also cc @alexreg and @eddyb in case they're interested.
What happens now?
This issue is part of the experimental MCP process described in RFC 2936. Once this issue is filed, a Zulip topic will be opened for discussion, and the lang-team will review open MCPs in its weekly triage meetings. You should receive feedback within a week or two.
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
kaleidawave, thinkphoebe, surban, DevinR528, iddm and 3 moreTOETOE55, Aaron1011, jerielverissimo, kellerkindt, Folyd and 6 moreshepmaster and kellerkindt
Metadata
Metadata
Assignees
Labels
T-langdisposition-mergeThe FCP starter wants to merge (accept) thisThe FCP starter wants to merge (accept) thisfinal-comment-periodThe FCP has started, most (if not all) team members are in agreementThe FCP has started, most (if not all) team members are in agreementmajor-changeMajor change proposalMajor change proposalmajor-change-acceptedMajor change proposal that was acceptedMajor change proposal that was acceptedto-announceNot yet announced MCP proposalsNot yet announced MCP proposals