]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/cross-fn-cache-hole.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Check that when there are vacuous predicates in the environment
12 // (which make a fn uncallable) we don't erroneously cache those and
13 // then consider them satisfied elsewhere. The current technique for
14 // doing this is just to filter "global" predicates out of the
15 // environment, which means that we wind up with an error in the
16 // function `vacuous`, because even though `i32: Bar<u32>` is implied
17 // by its where clause, that where clause never holds.
19 trait Foo
<X
,Y
>: Bar
<X
> {
24 // We don't always check where clauses for sanity, but in this case
25 // wfcheck does report an error here:
26 fn vacuous
<A
>() //~ ERROR the trait bound `i32: Bar<u32>` is not satisfied
27 where i32: Foo
<u32, A
>
29 // ... the original intention was to check that we don't use that
30 // vacuous where clause (which could never be satisfied) to accept
31 // the following line and then mess up calls elsewhere.
32 require
::<i32, u32>();
41 require
::<i32, u32>();