Skip to content

Conversation

pcwalton
Copy link
Contributor

@pcwalton pcwalton commented Dec 8, 2012

@nikomatsakis
Copy link
Contributor

r+ to coherence check special-casing Copy bounds

@brson
Copy link
Contributor

brson commented Dec 8, 2012

Why is this special-cased for Copy? When we discussed it yesterday I understood that it was a general problem.

@nikomatsakis
Copy link
Contributor

So, there is a larger issue here. In general I am nervous about "negative logic" in type rules. That is, saying something like "this is ok because type X does NOT have this property" (in this case, copy-ness) vs "this is ok because type X DOES have this property". This is because it leads to non-monotonicity which tends to create complications when things are combined.

All that said, I think in the abstract it's ok for coherence to consider a type variable T:U and some type X that does not implement U as disjoint. This is because of coherence itself, basically, which ensures that since both X and U are defined in crates that we know about, if there was any impl of U for X, we'd be able to see it. So we can't screw up crate linking this way

But that said, supporting this sort of reasoning in coherence is complicated. It requires nested checks. We need to be very careful to ensure termination in these kinds of scenarios (but we probably have to anyhow, long story). Perhaps just supporting this reasoning for the built-in kinds is an acceptable compromise.

@pcwalton pcwalton closed this Dec 14, 2012
RalfJung added a commit to RalfJung/rust that referenced this pull request Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants