Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up`rustc::traits::orphan_check_trait_ref` does not consider `TraitDef::is_marker` #67919
Comments
|
Hmm. This depends, I suppose, on the "role" of the orphan rules. Do they exist only to prevent overlap, or also to give a degree of "ownership" to the crate that defined I suspect the answer should probably be the former, because the current rules don't actually give that much "ownership", especially for traits that have multiple input types. But I'm not entirely sure. This same question arose in the context of the |
|
I agree that orphan rules should be about preventing the potential for overlap. In this specific case the user has marked the trait as As for |
|
Wouldn't this force us to consider that the following impl overlaps with anything? impl <T: MarkerTrait> NonMarker for T {}How is this supposed to interact with specialization? |
It seems like #53693 did not update the orphan checker to consider
#[marker]traits.#[marker] trait Foo {}struct Bar;impl Foo for Bar {}This should be OK because the overlap would actually be permitted as
Foois a#[marker]trait.However, there might be something I've overlooked here such as impl polarity (
impls_are_allowed_to_overlap) so I'm not filing a PR just now.cc @nikomatsakis @arielb1 @scottmcm
cc #29864
References: