]>
Commit | Line | Data |
---|---|---|
62682a34 SL |
1 | // Check that when there are vacuous predicates in the environment |
2 | // (which make a fn uncallable) we don't erroneously cache those and | |
3 | // then consider them satisfied elsewhere. The current technique for | |
94b46f34 XL |
4 | // doing this is to not use global caches when there is a chance that |
5 | // the environment contains such a predicate. | |
6 | // We still error for `i32: Bar<u32>` pending #48214 | |
62682a34 SL |
7 | |
8 | trait Foo<X,Y>: Bar<X> { | |
9 | } | |
10 | ||
11 | trait Bar<X> { } | |
12 | ||
9cc50fc6 SL |
13 | // We don't always check where clauses for sanity, but in this case |
14 | // wfcheck does report an error here: | |
3c0e092e XL |
15 | fn vacuous<A>() |
16 | where i32: Foo<u32, A> //~ ERROR the trait bound `i32: Bar<u32>` is not satisfied | |
62682a34 | 17 | { |
9cc50fc6 SL |
18 | // ... the original intention was to check that we don't use that |
19 | // vacuous where clause (which could never be satisfied) to accept | |
20 | // the following line and then mess up calls elsewhere. | |
62682a34 | 21 | require::<i32, u32>(); |
62682a34 SL |
22 | } |
23 | ||
24 | fn require<A,B>() | |
25 | where A: Bar<B> | |
26 | { | |
27 | } | |
28 | ||
29 | fn main() { | |
30 | require::<i32, u32>(); | |
31 | } |