]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/issue-32995.rs
Add warning cycle #42238.
[rust.git] / src / test / compile-fail / issue-32995.rs
1 // Copyright 2017 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 #![deny(parenthesized_params_in_types_and_modules)]
12 //~^ NOTE lint level defined here
13 //~| NOTE lint level defined here
14 //~| NOTE lint level defined here
15 //~| NOTE lint level defined here
16 //~| NOTE lint level defined here
17 //~| NOTE lint level defined here
18 //~| NOTE lint level defined here
19 #![allow(dead_code, unused_variables)]
20
21 fn main() {
22     let x: usize() = 1;
23     //~^ ERROR parenthesized parameters may only be used with a trait
24     //~| WARN previously accepted
25     //~| NOTE issue #42238
26
27     let b: ::std::boxed()::Box<_> = Box::new(1);
28     //~^ ERROR parenthesized parameters may only be used with a trait
29     //~| WARN previously accepted
30     //~| NOTE issue #42238
31
32     macro_rules! pathexpr {
33         ($p:path) => { $p }
34     }
35
36     let p = pathexpr!(::std::str()::from_utf8)(b"foo").unwrap();
37     //~^ ERROR parenthesized parameters may only be used with a trait
38     //~| WARN previously accepted
39     //~| NOTE issue #42238
40
41     let p = pathexpr!(::std::str::from_utf8())(b"foo").unwrap();
42     //~^ ERROR parenthesized parameters may only be used with a trait
43     //~| WARN previously accepted
44     //~| NOTE issue #42238
45
46     let o : Box<::std::marker()::Send> = Box::new(1);
47     //~^ ERROR parenthesized parameters may only be used with a trait
48     //~| WARN previously accepted
49     //~| NOTE issue #42238
50
51     let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
52     //~^ ERROR parenthesized parameters may only be used with a trait
53     //~| WARN previously accepted
54     //~| NOTE issue #42238
55 }
56
57 fn foo<X:Default>() {
58     let d : X() = Default::default();
59     //~^ ERROR parenthesized parameters may only be used with a trait
60     //~| WARN previously accepted
61     //~| NOTE issue #42238
62 }