[DO NOT MERGE YET] Replace #[rustc_do_not_implement_via_object] with #[rustc_dyn_incompatible_trait]
#148637
+378
−160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
May fix #148615
This affects three groups of traits:
MetaSized#[rustc_do_not_implement_via_object]. Still dyn-compatible after this change. See question 1 belowPointeeSized#[rustc_do_not_implement_via_object]. It doesn't seem to have been doing anything anyway (playground), sincePointeeSizedis removed before trait solving(?).#[rustc_do_not_implement_via_object](includingPointee,Tuple,Destruct, etc)#[rustc_dyn_incompatible_trait]and are now dyn-incompatible.Questions before merge:
dyn MetaSized: MetaSizedhaving bothSizedCandidateandObjectCandidateMetaSized(which is the only trait that was previously#[rustc_do_not_implement_via_object]that is still dyn-compatible after this change). Is it fine to just remove them? Removing them (as I did in the second commit) doesn't change any UI test results.dyn MetaSizedcould get itsMetaSizedimplementation in two ways: the object candidate (the normaldyn Trait: Trait) that was supressed by#[rustc_do_not_implement_via_object], and theSizedCandidate(that alldyn Traitget fordyn Trait: MetaSized). Given thatMetaSizedhas no associated types or methods, is it fine that these both exist now? Or is it better to only have theSizedCandidateand leave these checks in (i.e. drop the second commit, and remove the FIXMEs)?trait Foo: Pointee {}, you now get a note that reads like Foo "opted out of dyn-compatbility", when reallyPointeedid that.diagnostic example