-
Notifications
You must be signed in to change notification settings - Fork 13.2k
/
Copy pathno-define-in-wf-check.rs
66 lines (57 loc) · 1.45 KB
/
no-define-in-wf-check.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] check-pass
// Regression test for trait-system-refactor-initiative#106. We previously
// tried to define other opaques while checking that opaques are well-formed.
//
// This resulted in undesirable ambiguity
#![feature(type_alias_impl_trait)]
mod ex0 {
fn foo() -> (impl Sized, impl Sized) {
((), ())
}
}
mod ex1 {
type Tait1 = impl Sized;
//[current]~^ ERROR unconstrained opaque type
fn foo(x: Tait1) -> impl Sized {
let () = x;
}
}
mod ex2 {
type Tait1 = impl Sized;
//[current]~^ ERROR unconstrained opaque type
type Tait2 = impl Sized;
fn foo(x: Tait1) -> Tait2 {
let () = x;
}
}
mod ex3 {
type Tait1 = impl Sized;
//[current]~^ ERROR unconstrained opaque type
trait Something<T> {}
impl<T, U> Something<U> for T {}
type Tait2 = impl Something<Tait1>;
fn foo(x: Tait1) -> Tait2 {
let () = x;
}
}
mod ex4 {
type Tait1 = impl Sized;
//[current]~^ ERROR unconstrained opaque type
trait Trait<U> {
type Assoc;
}
impl<T, U> Trait<U> for T {
type Assoc = T;
}
// ambiguity when checking that `Tait2` is wf
//
// ambiguity proving `(): Trait<Tait1>`.
type Tait2 = impl Trait<(), Assoc = impl Trait<Tait1>>;
fn foo(x: Tait1) -> Tait2 {
let () = x;
}
}
fn main() {}