]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/rfc1214-warn-and-error.rs
Auto merge of #30286 - oli-obk:const_error_span, r=nikomatsakis
[rust.git] / src / test / compile-fail / rfc1214-warn-and-error.rs
1 // Copyright 2015 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.
4 //
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.
10
11 // Test that an RFC1214 warning from an earlier function (`foo`) does
12 // not suppress an error for the same problem (`WantEq<NotEq>`,
13 // `NotEq: !Eq`) in a later function (`bar)`. Earlier versions of the
14 // warning mechanism had an issue due to caching.
15
16 #![allow(dead_code)]
17 #![allow(unused_variables)]
18
19 struct WantEq<T:Eq> { t: T }
20
21 struct NotEq;
22
23 trait Trait<T> { }
24
25 fn foo() {
26     let x: Box<Trait<WantEq<NotEq>>> = loop { };
27     //~^ WARN E0277
28 }
29
30 fn bar() {
31     wf::<WantEq<NotEq>>();
32     //~^ ERROR E0277
33 }
34
35 fn wf<T>() { }
36
37 fn main() { }