fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.4 KiB71 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 was previously accepted
15    use super::bar::Bar2;
16    use crate::bar::Bar3;
17
18    use crate::bar;
19    //~^ ERROR absolute
20    //~| WARN this was previously accepted
21    use crate::{bar as something_else};
22
23    use crate::{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
35use crate::bar::Bar;
36//~^ ERROR absolute
37//~| WARN this was previously accepted
38
39pub 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
46mod baz {
47    use crate::*;
48    //~^ ERROR absolute
49    //~| WARN this was previously accepted
50}
51
52impl crate::foo::SomeTrait for u32 { }
53//~^ ERROR absolute
54//~| WARN this was previously accepted
55
56fn main() {
57    let x = crate::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}