]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rust-2018/edition-lint-paths.rs
Rollup merge of #62351 - RalfJung:drop-in-place, r=cramertj
[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 was previously accepted
15     use super::bar::Bar2;
16     use crate::bar::Bar3;
17
18     use bar;
19     //~^ ERROR absolute
20     //~| WARN this was previously accepted
21     use crate::{bar as something_else};
22
23     use {Bar as SomethingElse, main};
24     //~^ ERROR absolute
25     //~| WARN this was previously accepted
26
27     use crate::{Bar as SomethingElse2, main as another_main};
28
29     pub fn test() {
30     }
31
32     pub trait SomeTrait { }
33 }
34
35 use bar::Bar;
36 //~^ ERROR absolute
37 //~| WARN this was previously accepted
38
39 pub mod bar {
40     use edition_lint_paths as foo;
41     pub struct Bar;
42     pub type Bar2 = Bar;
43     pub type Bar3 = Bar;
44 }
45
46 mod baz {
47     use *;
48     //~^ ERROR absolute
49     //~| WARN this was previously accepted
50 }
51
52 impl ::foo::SomeTrait for u32 { }
53 //~^ ERROR absolute
54 //~| WARN this was previously accepted
55
56 fn main() {
57     let x = ::bar::Bar;
58     //~^ ERROR absolute
59     //~| WARN this was previously accepted
60     let x = bar::Bar;
61     let x = crate::bar::Bar;
62     let x = self::bar::Bar;
63     foo::test();
64
65     {
66         use edition_lint_paths as bar;
67         edition_lint_paths::foo();
68         bar::foo();
69         ::edition_lint_paths::foo();
70     }
71 }