]> git.lizzy.rs Git - rust.git/blob - tests/ui/complex_types.rs
Merge remote-tracking branch 'upstream/master'
[rust.git] / tests / ui / complex_types.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10
11
12
13 #![warn(clippy::all)]
14 #![allow(unused, clippy::needless_pass_by_value)]
15 #![feature(associated_type_defaults)]
16
17 type Alias = Vec<Vec<Box<(u32, u32, u32, u32)>>>; // no warning here
18
19 const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
20 static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
21
22 struct S {
23     f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
24 }
25
26 struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
27
28 enum E {
29     Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
30     Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
31 }
32
33 impl S {
34     const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
35     fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
36 }
37
38 trait T {
39     const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
40     type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
41     fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
42     fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
43 }
44
45 fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> { vec![] }
46
47 fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
48
49 fn test3() {
50     let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
51 }
52
53 #[repr(C)]
54 struct D {
55     // should not warn, since we don't have control over the signature (#3222)
56     test4: extern "C" fn(
57         itself: &D,
58         a: usize,
59         b: usize,
60         c: usize,
61         d: usize,
62         e: usize,
63         f: usize,
64         g: usize,
65         h: usize,
66         i: usize,
67     ),
68 }
69
70 fn main() {
71 }