]> git.lizzy.rs Git - rust.git/blob - tests/ui/cross/cross-fn-cache-hole.rs
Rollup merge of #107102 - compiler-errors:new-solver-new-candidats-4, r=lcnr
[rust.git] / tests / ui / cross / cross-fn-cache-hole.rs
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
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
7
8 trait Foo<X,Y>: Bar<X> {
9 }
10
11 trait Bar<X> { }
12
13 // We don't always check where clauses for sanity, but in this case
14 // wfcheck does report an error here:
15 fn vacuous<A>()
16     where i32: Foo<u32, A> //~ ERROR the trait bound `i32: Bar<u32>` is not satisfied
17 {
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.
21     require::<i32, u32>();
22 }
23
24 fn require<A,B>()
25     where A: Bar<B>
26 {
27 }
28
29 fn main() {
30     require::<i32, u32>();
31 }