mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
Regression test for trait-system-refactor#7
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//@ revisions: old next
|
||||
//@[next] compile-flags: -Znext-solver=globally
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@ check-pass
|
||||
// Regression test for trait-system-refactor-initiative#7
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
#[derive(Default)]
|
||||
struct Foo<T, U>(PhantomData<(T, U)>);
|
||||
|
||||
trait Trait {
|
||||
type Assoc;
|
||||
|
||||
fn to_assoc(self) -> Self::Assoc;
|
||||
}
|
||||
|
||||
impl Trait for Foo<u32, i32> {
|
||||
type Assoc = Foo<u32, i32>;
|
||||
fn to_assoc(self) -> Self::Assoc {
|
||||
Foo(PhantomData)
|
||||
}
|
||||
}
|
||||
impl Trait for Foo<i32, u32> {
|
||||
type Assoc = Foo<i32, u32>;
|
||||
fn to_assoc(self) -> Self::Assoc {
|
||||
Foo(PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_assignments)]
|
||||
fn main() {
|
||||
let mut x: Foo<_, _> = Default::default();
|
||||
let mut assoc = x.to_assoc();
|
||||
assoc = Foo::<u32, _>(PhantomData);
|
||||
assoc = Foo::<_, i32>(PhantomData);
|
||||
x = assoc;
|
||||
}
|
||||
Reference in New Issue
Block a user