add regression tests
This commit is contained in:
parent
2c7ede8f52
commit
1c264ca9ca
2 changed files with 52 additions and 0 deletions
|
@ -0,0 +1,26 @@
|
||||||
|
//@ compile-flags: -Znext-solver
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
// Regression test for trait-system-refactor-initiative#84.
|
||||||
|
//
|
||||||
|
// We try to infer `T::Rigid: Into<?0>` and have 2 candidates from where-clauses:
|
||||||
|
//
|
||||||
|
// - `Into<String>`
|
||||||
|
// - `Into<<T::Rigid as Elaborate>::Assoc>`
|
||||||
|
//
|
||||||
|
// This causes ambiguity unless we normalize the alias in the second candidate
|
||||||
|
// to detect that they actually result in the same constraints.
|
||||||
|
trait Trait {
|
||||||
|
type Rigid: Elaborate<Assoc = String> + Into<String> + Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Elaborate: Into<Self::Assoc> {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test<T: Trait>() {
|
||||||
|
let rigid: T::Rigid = Default::default();
|
||||||
|
drop(rigid.into());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,26 @@
|
||||||
|
//@ compile-flags: -Znext-solver
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
// Regression test for trait-system-refactor-initiative#86. This previously
|
||||||
|
// failed with ambiguity due to multiple candidates with different
|
||||||
|
// normalization.
|
||||||
|
|
||||||
|
trait Bar {
|
||||||
|
type Item;
|
||||||
|
type Assoc: AsRef<[Self::Item]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo<T: Bar> {
|
||||||
|
t: <T as Bar>::Assoc,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Bar<Item = u32>> Foo<T>
|
||||||
|
where
|
||||||
|
<T as Bar>::Assoc: AsRef<[u32]>,
|
||||||
|
{
|
||||||
|
fn hello(&self) {
|
||||||
|
println!("{}", self.t.as_ref().len());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue