Make things work by using the new solver
This commit is contained in:
parent
7f3c2c7e2c
commit
8597bf1df7
@ -37,6 +37,8 @@ pub(super) trait GoalKind<'tcx>:
|
|||||||
|
|
||||||
fn trait_ref(self, tcx: TyCtxt<'tcx>) -> ty::TraitRef<'tcx>;
|
fn trait_ref(self, tcx: TyCtxt<'tcx>) -> ty::TraitRef<'tcx>;
|
||||||
|
|
||||||
|
fn polarity(self) -> ty::ImplPolarity;
|
||||||
|
|
||||||
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self;
|
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self;
|
||||||
|
|
||||||
fn trait_def_id(self, tcx: TyCtxt<'tcx>) -> DefId;
|
fn trait_def_id(self, tcx: TyCtxt<'tcx>) -> DefId;
|
||||||
|
@ -101,6 +101,10 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
|||||||
self.projection_ty.trait_ref(tcx)
|
self.projection_ty.trait_ref(tcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn polarity(self) -> ty::ImplPolarity {
|
||||||
|
ty::ImplPolarity::Positive
|
||||||
|
}
|
||||||
|
|
||||||
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
||||||
self.with_self_ty(tcx, self_ty)
|
self.with_self_ty(tcx, self_ty)
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,10 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
|
|||||||
self.trait_ref
|
self.trait_ref
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn polarity(self) -> ty::ImplPolarity {
|
||||||
|
self.polarity
|
||||||
|
}
|
||||||
|
|
||||||
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
||||||
self.with_self_ty(tcx, self_ty)
|
self.with_self_ty(tcx, self_ty)
|
||||||
}
|
}
|
||||||
|
@ -398,8 +398,8 @@ fn impl_intersection_has_negative_obligation(
|
|||||||
) -> bool {
|
) -> bool {
|
||||||
debug!("negative_impl(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
|
debug!("negative_impl(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
|
||||||
|
|
||||||
let ref infcx = tcx.infer_ctxt().intercrate(true).build();
|
let ref infcx = tcx.infer_ctxt().intercrate(true).with_next_trait_solver(true).build();
|
||||||
let universe = infcx.create_next_universe();
|
let universe = infcx.universe();
|
||||||
|
|
||||||
let impl1_header = fresh_impl_header(infcx, impl1_def_id);
|
let impl1_header = fresh_impl_header(infcx, impl1_def_id);
|
||||||
let param_env =
|
let param_env =
|
||||||
|
@ -37,7 +37,7 @@ impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
|
|||||||
(TraitSolver::Classic, false) | (TraitSolver::NextCoherence, false) => {
|
(TraitSolver::Classic, false) | (TraitSolver::NextCoherence, false) => {
|
||||||
Box::new(FulfillmentContext::new(infcx))
|
Box::new(FulfillmentContext::new(infcx))
|
||||||
}
|
}
|
||||||
(TraitSolver::Next | TraitSolver::NextCoherence, true) => {
|
(TraitSolver::Classic | TraitSolver::Next | TraitSolver::NextCoherence, true) => {
|
||||||
Box::new(NextFulfillmentCtxt::new(infcx))
|
Box::new(NextFulfillmentCtxt::new(infcx))
|
||||||
}
|
}
|
||||||
_ => bug!(
|
_ => bug!(
|
||||||
|
@ -13,8 +13,6 @@ impl B for u32 {}
|
|||||||
trait C {}
|
trait C {}
|
||||||
impl<T: AB> C for T {}
|
impl<T: AB> C for T {}
|
||||||
impl C for u32 {}
|
impl C for u32 {}
|
||||||
//~^ ERROR
|
//~^ ERROR conflicting implementations of trait `C` for type `u32`
|
||||||
// FIXME it's giving an ungreat error but unsure if we care given that it's using an internal rustc
|
|
||||||
// attribute and an artificial code path for testing purposes
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
error[E0283]: type annotations needed: cannot satisfy `u32: C`
|
error[E0119]: conflicting implementations of trait `C` for type `u32`
|
||||||
--> $DIR/coherence-overlap-trait-alias.rs:15:12
|
--> $DIR/coherence-overlap-trait-alias.rs:15:1
|
||||||
|
|
|
||||||
LL | impl C for u32 {}
|
|
||||||
| ^^^
|
|
||||||
|
|
|
||||||
note: multiple `impl`s satisfying `u32: C` found
|
|
||||||
--> $DIR/coherence-overlap-trait-alias.rs:14:1
|
|
||||||
|
|
|
|
||||||
LL | impl<T: AB> C for T {}
|
LL | impl<T: AB> C for T {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ------------------- first implementation here
|
||||||
LL | impl C for u32 {}
|
LL | impl C for u32 {}
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^ conflicting implementation for `u32`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0283`.
|
For more information about this error, try `rustc --explain E0119`.
|
||||||
|
@ -7,7 +7,7 @@ LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
|
|||||||
LL | impl AnotherTrait for D<OpaqueType> {
|
LL | impl AnotherTrait for D<OpaqueType> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
|
||||||
|
|
|
|
||||||
= note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions
|
= note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `OpaqueType` in future versions
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ LL | impl Bop for Bar<()> {}
|
|||||||
...
|
...
|
||||||
LL | impl Bop for Barr {}
|
LL | impl Bop for Barr {}
|
||||||
| ^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>`
|
| ^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>`
|
||||||
|
|
|
||||||
|
= note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `Barr` in future versions
|
||||||
|
|
||||||
error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
|
error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
|
||||||
--> $DIR/impl_trait_for_same_tait.rs:30:1
|
--> $DIR/impl_trait_for_same_tait.rs:30:1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user