Uh oh!
There was an error while loading. Please reload this page.
coherence: fix is_knowable logic - #46192
Conversation
a583d9e to
b2302bbCompareb2302bb to
5360699Comparearielb1
commented
Nov 23, 2017
@bors try |
bors
commented
Nov 23, 2017
⌛ Trying commit 5360699 with merge faf75254806fa54615158a9058c5a50b81dc8006... |
arielb1
commented
Nov 23, 2017
@bors r- retry |
bors
commented
Nov 23, 2017
⌛ Trying commit 5360699 with merge 999ab8e65bc12abb057c3e7ba58a538ae3ab7c57... |
arielb1
commented
Nov 23, 2017
@bors untry |
arielb1
commented
Nov 23, 2017
@bors retry |
bors
commented
Nov 23, 2017
⌛ Trying commit 5360699 with merge 0bac3d526df71b0959316897d8d8b8d1baf6b4f1... |
arielb1
commented
Nov 23, 2017
@bors try retry |
bors
commented
Nov 23, 2017
coherence: fix is_knowable logic A trait-ref that passes the orphan-check rules can still be implemented in a crate downstream from our crate (for example, `LocalType for LocalTrait<_>` might be matched by a `LocalType for LocalTrait<TypeFromDownstreamCrate>`), and this should be known by the `is_knowable` logic. Trait selection had a hackfix for this, but it's an hacky fix that does not handle all cases. This patch removes it. cc #43355. FIXME: make this a soft error. I suppose we'll crater first. r? @nikomatsakis Needs a crater run
bors
commented
Nov 23, 2017
☀️ Test successful - status-travis |
aidanhs
commented
Nov 27, 2017
Crater run started. |
c4ca8e3 to
11f22abComparebors
commented
Dec 2, 2017
☔ The latest upstream changes (presumably #46430) made this pull request unmergeable. Please resolve the merge conflicts. |
aidanhs
commented
Dec 4, 2017
Hi @arielb1 (crater requester), @nikomatsakis (reviewer)! Crater results are at: http://cargobomb-reports.s3.amazonaws.com/pr-46192/index.html. 'Blacklisted' crates (spurious failures etc) can be found here. If you see any spurious failures not on the list, please make a PR against that file. (interested observers: Crater is a tool for testing the impact of changes on the crates.io ecosystem. You can find out more at the repo if you're curious) |
arielb1
commented
Dec 4, 2017
Regressions: crossbeam-epoch-0.1.0 & bow-1.0.3 (yay I broke Servo, but this is no longer a dependency)This is a problem because any joker can write this (on nightly, but some variants are probably possible using #![feature(optin_builtin_traits)]pubstructFoo;pub auto traitXyz{}impl !XyzforFoo{}impl !XyzforBox<Foo>{}impl<T:Xyz>From<T>forBox<Foo>{fnfrom(_:T) -> Self{Box::new(Foo)}}fnmain(){let _foo = <Box<Foo>>::from(());}Which would cause a coherence conflict on linking for the trait-ref I think the only fix is to not use glib v0.1.3This causes a conflict because downstream crates can implement The crate author had actually encountered some other coherence problems with this approach, and removed this in a new version of their crate: gtk-rs/glib@b36de4e#diff-dd26c2766e65aca43e4228e64ebd0cf8 I don't see any crates depending on ocl v0.15.0rusqlite v0.10.3rusqlcipher v0.14.6This is basically the same issue as impl<'a,E>From<E>forEventArraywhereE:Into<Event>impl<'a,E>From<&'aE>forEventArraywhereE:Into<Event> + CloneThis is still an issue in the newest crate version, probably need to talk with the crate authors
lru-disk-cache v0.1.0 (aka sccache)This is a conflict because coherence can't see that This can be fixed by the crate author by breaking the associated type to a type parameter: use std::borrow::Borrow;/// A trait for measuring the size of a cache entry.////// If you implement this trait, you should use `usize` as the `Measure` type, otherwise you will/// also have to implement [`CountableMeter`][countablemeter].////// [countablemeter]: trait.Meter.htmlpubtraitMeter<K,V>{/// The type used to store measurements.typeMeasure:Default + Copy;/// Calculate the size of `key` and `value`.fnmeasure<Q: ?Sized>(&self,key:&Q,value:&V) -> Self::MeasurewhereK:Borrow<Q>;}/// Size limit based on a simple count of cache items.pubstructCount;impl<K,V>Meter<K,V>forCount{/// Don't store anything, the measurement can be derived from the map.typeMeasure = ();/// Don't actually count anything either.fnmeasure<Q: ?Sized>(&self, _:&Q, _:&V) -> ()whereK:Borrow<Q>{}}/// A trait to allow the default `Count` measurement to not store an/// extraneous counter.pubtraitCountableMeter<K,V>:Meter<K,V>{/// Add `amount` to `current` and return the sum.fnadd(&self,current:Self::Measure,amount:Self::Measure) -> Self::Measure;/// Subtract `amount` from `current` and return the difference.fnsub(&self,current:Self::Measure,amount:Self::Measure) -> Self::Measure;/// Return `current` as a `usize` if possible, otherwise return `None`.////// If this method returns `None` the cache will use the number of cache entries as/// its size.fnsize(&self,current:Self::Measure) -> Option<usize>;}/// `Count` is all no-ops, the number of entries in the map is the size.impl<K,V,T:Meter<K,V>>CountableMeter<K,V>forTwhereT:CountableMeterWithMeasure<K,V, <TasMeter<K,V>>::Measure>{fnadd(&self,current:Self::Measure,amount:Self::Measure) -> Self::Measure{CountableMeterWithMeasure::add(self, current, amount)}fnsub(&self,current:Self::Measure,amount:Self::Measure) -> Self::Measure{CountableMeterWithMeasure::sub(self, current, amount)}fnsize(&self,current:Self::Measure) -> Option<usize>{CountableMeterWithMeasure::size(self, current)}}pubtraitCountableMeterWithMeasure<K,V,M>{/// Add `amount` to `current` and return the sum.fnadd(&self,current:M,amount:M) -> M;/// Subtract `amount` from `current` and return the difference.fnsub(&self,current:M,amount:M) -> M;/// Return `current` as a `usize` if possible, otherwise return `None`.////// If this method returns `None` the cache will use the number of cache entries as/// its size.fnsize(&self,current:M) -> Option<usize>;}/// For any other `Meter` with `Measure=usize`, just do the simple math.impl<K,V,T>CountableMeterWithMeasure<K,V,usize>forT{fnadd(&self,current:usize,amount:usize) -> usize{
current + amount
}fnsub(&self,current:usize,amount:usize) -> usize{
current - amount
}fnsize(&self,current:usize) -> Option<usize>{Some(current)}}impl<K,V>CountableMeterWithMeasure<K,V,()>forCount{fnadd(&self,current:(),amount:()){}fnsub(&self,current:(),amount:()){}fnsize(&self,current:()) -> Option<usize>{None}}fnmain(){} |
nikomatsakis
left a comment
There was a problem hiding this comment.
Left a few documentation nits.
There was a problem hiding this comment.
Nit: s/Option/Vec/, right?
nikomatsakis
commented
Dec 5, 2017
@arielb1 this only issues warnings presently, right? Seems like we ought to land it, no? r=me, if you agree. |
arielb1
commented
Dec 5, 2017
Yea this only issues warnings. I'll land this. |
Patch as suggested by @arielb1: rust-lang/rust#46192 (comment)
luser
commented
Dec 5, 2017
I pushed a fix to lru-disk-cache in sccache, thanks for providing working code! |
arielb1
commented
Dec 5, 2017
@bors r=nikomatsakis |
bors
commented
Dec 5, 2017
📌 Commit 11f22ab has been approved by |
11f22ab to
425c2c3Comparearielb1
commented
Dec 5, 2017
@bors r=nikomatsakis |
bors
commented
Dec 5, 2017
📌 Commit 425c2c3 has been approved by |
bors
commented
Dec 6, 2017
coherence: fix is_knowable logic A trait-ref that passes the orphan-check rules can still be implemented in a crate downstream from our crate (for example, `LocalType for LocalTrait<_>` might be matched by a `LocalType for LocalTrait<TypeFromDownstreamCrate>`), and this should be known by the `is_knowable` logic. Trait selection had a hackfix for this, but it's an hacky fix that does not handle all cases. This patch removes it. fixes#43355. r? @nikomatsakis Needs a crater run
bors
commented
Dec 6, 2017
💔 Test failed - status-travis |
kennytm
commented
Dec 6, 2017
bors
commented
Dec 6, 2017
coherence: fix is_knowable logic A trait-ref that passes the orphan-check rules can still be implemented in a crate downstream from our crate (for example, `LocalType for LocalTrait<_>` might be matched by a `LocalType for LocalTrait<TypeFromDownstreamCrate>`), and this should be known by the `is_knowable` logic. Trait selection had a hackfix for this, but it's an hacky fix that does not handle all cases. This patch removes it. fixes#43355. r? @nikomatsakis Needs a crater run
bors
commented
Dec 6, 2017
☀️ Test successful - status-appveyor, status-travis |
Patch as suggested by @arielb1: rust-lang/rust#46192 (comment)
A trait-ref that passes the orphan-check rules can still be implemented in a crate downstream from our crate (for example,
LocalType for LocalTrait<_>might be matched by aLocalType for LocalTrait<TypeFromDownstreamCrate>), and this should be known by theis_knowablelogic.Trait selection had a hackfix for this, but it's an hacky fix that does not handle all cases. This patch removes it.
fixes#43355.
r? @nikomatsakis
Needs a crater run