fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.7 KiB77 linesraw
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
8extern crate edition_lint_paths;
9
10pub mod foo {
11    use edition_lint_paths;
12    use crate::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 crate::bar;
20    //~^ ERROR absolute
21    //~| WARN this is accepted in the current edition
22
23    use crate::bar as something_else;
24
25    use crate::{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
40use crate::bar::Bar;
41//~^ ERROR absolute
42//~| WARN this is accepted in the current edition
43
44pub 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
51mod baz {
52    use crate::*;
53    //~^ ERROR absolute
54    //~| WARN this is accepted in the current edition
55}
56
57impl crate::foo::SomeTrait for u32 {}
58//~^ ERROR absolute
59//~| WARN this is accepted in the current edition
60
61fn main() {
62    let x = crate::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}