]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rust-2018/edition-lint-paths.rs
Rollup merge of #105843 - compiler-errors:sugg-const, r=lcnr
[rust.git] / src / test / ui / rust-2018 / edition-lint-paths.rs
1 // aux-build:edition-lint-paths.rs
2 // run-rustfix
3
4 #![feature(rust_2018_preview)]
5 #![deny(absolute_paths_not_starting_with_crate)]
6 #![allow(unused)]
7
8 extern crate edition_lint_paths;
9
10 pub mod foo {
11     use edition_lint_paths;
12     use bar::Bar;
13     //~^ ERROR absolute
14     //~| WARN this is accepted in the current edition
15
16     use super::bar::Bar2;
17     use crate::bar::Bar3;
18
19     use bar;
20     //~^ ERROR absolute
21     //~| WARN this is accepted in the current edition
22
23     use crate::bar as something_else;
24
25     use {main, Bar as SomethingElse};
26     //~^ ERROR absolute
27     //~| WARN this is accepted in the current edition
28     //~| ERROR absolute
29     //~| WARN this is accepted in the current edition
30     //~| ERROR absolute
31     //~| WARN this is accepted in the current edition
32
33     use crate::{main as another_main, Bar as SomethingElse2};
34
35     pub fn test() {}
36
37     pub trait SomeTrait {}
38 }
39
40 use bar::Bar;
41 //~^ ERROR absolute
42 //~| WARN this is accepted in the current edition
43
44 pub mod bar {
45     use edition_lint_paths as foo;
46     pub struct Bar;
47     pub type Bar2 = Bar;
48     pub type Bar3 = Bar;
49 }
50
51 mod baz {
52     use *;
53     //~^ ERROR absolute
54     //~| WARN this is accepted in the current edition
55 }
56
57 impl ::foo::SomeTrait for u32 {}
58 //~^ ERROR absolute
59 //~| WARN this is accepted in the current edition
60
61 fn main() {
62     let x = ::bar::Bar;
63     //~^ ERROR absolute
64     //~| WARN this is accepted in the current edition
65
66     let x = bar::Bar;
67     let x = crate::bar::Bar;
68     let x = self::bar::Bar;
69     foo::test();
70
71     {
72         use edition_lint_paths as bar;
73         edition_lint_paths::foo();
74         bar::foo();
75         ::edition_lint_paths::foo();
76     }
77 }