]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/issue-20427.rs
Make name resolution errors non-fatal
[rust.git] / src / test / compile-fail / issue-20427.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 // aux-build:i8.rs
12 extern crate i8;
13 use std::string as i16;
14 static i32: i32 = 0;
15 const i64: i64 = 0;
16 fn u8(f32: f32) {}
17 fn f<f64>(f64: f64) {}
18 //~^ ERROR user-defined types or type parameters cannot shadow the primitive types
19 type u16 = u16; //~ ERROR user-defined types or type parameters cannot shadow the primitive types
20 enum u32 {} //~ ERROR user-defined types or type parameters cannot shadow the primitive types
21 struct u64; //~ ERROR user-defined types or type parameters cannot shadow the primitive types
22 trait bool {} //~ ERROR user-defined types or type parameters cannot shadow the primitive types
23
24 mod char {
25     extern crate i8;
26     static i32_: i32 = 0;
27     const i64_: i64 = 0;
28     fn u8_(f32: f32) {}
29     fn f_<f64_>(f64: f64_) {}
30     type u16_ = u16;
31     enum u32_ {}
32     struct u64_;
33     trait bool_ {}
34     mod char_ {}
35
36     mod str {
37         use super::i8 as i8;
38         use super::i32_ as i32;
39         use super::i64_ as i64;
40         use super::u8_ as u8;
41         use super::f_ as f64;
42         use super::u16_ as u16;
43         //~^ ERROR user-defined types or type parameters cannot shadow the primitive types
44         use super::u32_ as u32;
45         //~^ ERROR user-defined types or type parameters cannot shadow the primitive types
46         use super::u64_ as u64;
47         //~^ ERROR user-defined types or type parameters cannot shadow the primitive types
48         use super::bool_ as bool;
49         //~^ ERROR user-defined types or type parameters cannot shadow the primitive types
50         use super::{bool_ as str};
51         //~^ ERROR user-defined types or type parameters cannot shadow the primitive types
52         use super::char_ as char;
53     }
54 }
55
56 trait isize_ {
57     type isize; //~ ERROR user-defined types or type parameters cannot shadow the primitive types
58 }
59
60 fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize }
61
62 fn main() {
63     let bool = true;
64     match bool {
65         str @ true => if str { i32 as i64 } else { i64 },
66         false => i64,
67     };
68 }