about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-22 18:55:54 +0000
committerbors <bors@rust-lang.org>2018-05-22 18:55:54 +0000
commitd034ae53c43352b06341455fb1394cb5d4069999 (patch)
tree2215f3ab4713afba2ec61bbc7dc13382d9989011 /src/test
parente0635188ed30e083245482218a0de9237f14ce90 (diff)
parentdfd2a138eb81556fe7fd2c2745c0e18d25911084 (diff)
downloadrust-d034ae53c43352b06341455fb1394cb5d4069999.tar.gz
rust-d034ae53c43352b06341455fb1394cb5d4069999.zip
Auto merge of #50969 - nikomatsakis:issue-50673-broken-migration-lint, r=alexcrichton
fix suggestions with nested paths

Fixes #50673

cc @Manishearth @petrochenkov
r? @alexcrichton
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs (renamed from src/test/ui/auxiliary/edition-lint-paths.rs)0
-rw-r--r--src/test/ui/rust-2018/edition-lint-nested-paths.fixed28
-rw-r--r--src/test/ui/rust-2018/edition-lint-nested-paths.rs28
-rw-r--r--src/test/ui/rust-2018/edition-lint-nested-paths.stderr16
-rw-r--r--src/test/ui/rust-2018/edition-lint-paths.fixed (renamed from src/test/ui/edition-lint-paths.fixed)6
-rw-r--r--src/test/ui/rust-2018/edition-lint-paths.rs (renamed from src/test/ui/edition-lint-paths.rs)6
-rw-r--r--src/test/ui/rust-2018/edition-lint-paths.stderr (renamed from src/test/ui/edition-lint-paths.stderr)17
7 files changed, 97 insertions, 4 deletions
diff --git a/src/test/ui/auxiliary/edition-lint-paths.rs b/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs
index cc17a9bd661..cc17a9bd661 100644
--- a/src/test/ui/auxiliary/edition-lint-paths.rs
+++ b/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs
diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.fixed b/src/test/ui/rust-2018/edition-lint-nested-paths.fixed
new file mode 100644
index 00000000000..308f2ac406e
--- /dev/null
+++ b/src/test/ui/rust-2018/edition-lint-nested-paths.fixed
@@ -0,0 +1,28 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+#![feature(rust_2018_preview)]
+#![deny(absolute_path_not_starting_with_crate)]
+
+use crate::foo::{a, b};
+//~^ ERROR absolute paths must start with
+//~| this was previously accepted
+
+mod foo {
+    crate fn a() {}
+    crate fn b() {}
+}
+
+fn main() {
+    a();
+    b();
+}
diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.rs b/src/test/ui/rust-2018/edition-lint-nested-paths.rs
new file mode 100644
index 00000000000..df8b585ef6c
--- /dev/null
+++ b/src/test/ui/rust-2018/edition-lint-nested-paths.rs
@@ -0,0 +1,28 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+#![feature(rust_2018_preview)]
+#![deny(absolute_path_not_starting_with_crate)]
+
+use foo::{a, b};
+//~^ ERROR absolute paths must start with
+//~| this was previously accepted
+
+mod foo {
+    crate fn a() {}
+    crate fn b() {}
+}
+
+fn main() {
+    a();
+    b();
+}
diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.stderr b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr
new file mode 100644
index 00000000000..40d8e4e90e6
--- /dev/null
+++ b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr
@@ -0,0 +1,16 @@
+error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
+  --> $DIR/edition-lint-nested-paths.rs:16:5
+   |
+LL | use foo::{a, b};
+   |     ^^^^^^^^^^^ help: use `crate`: `crate::foo::{a, b}`
+   |
+note: lint level defined here
+  --> $DIR/edition-lint-nested-paths.rs:14:9
+   |
+LL | #![deny(absolute_path_not_starting_with_crate)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
+   = note: for more information, see issue TBD
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/edition-lint-paths.fixed b/src/test/ui/rust-2018/edition-lint-paths.fixed
index 9975a6db4b2..80eb52a3e5d 100644
--- a/src/test/ui/edition-lint-paths.fixed
+++ b/src/test/ui/rust-2018/edition-lint-paths.fixed
@@ -40,6 +40,8 @@ pub mod foo {
 
     pub fn test() {
     }
+
+    pub trait SomeTrait { }
 }
 
 use crate::bar::Bar;
@@ -59,6 +61,10 @@ mod baz {
     //~| WARN this was previously accepted
 }
 
+impl crate::foo::SomeTrait for u32 { }
+//~^ ERROR absolute
+//~| WARN this was previously accepted
+
 fn main() {
     let x = crate::bar::Bar;
     //~^ ERROR absolute
diff --git a/src/test/ui/edition-lint-paths.rs b/src/test/ui/rust-2018/edition-lint-paths.rs
index 6cc3295a4d9..f2ca342635b 100644
--- a/src/test/ui/edition-lint-paths.rs
+++ b/src/test/ui/rust-2018/edition-lint-paths.rs
@@ -40,6 +40,8 @@ pub mod foo {
 
     pub fn test() {
     }
+
+    pub trait SomeTrait { }
 }
 
 use bar::Bar;
@@ -59,6 +61,10 @@ mod baz {
     //~| WARN this was previously accepted
 }
 
+impl ::foo::SomeTrait for u32 { }
+//~^ ERROR absolute
+//~| WARN this was previously accepted
+
 fn main() {
     let x = ::bar::Bar;
     //~^ ERROR absolute
diff --git a/src/test/ui/edition-lint-paths.stderr b/src/test/ui/rust-2018/edition-lint-paths.stderr
index 1588e242f22..9f3bef062ca 100644
--- a/src/test/ui/edition-lint-paths.stderr
+++ b/src/test/ui/rust-2018/edition-lint-paths.stderr
@@ -40,7 +40,7 @@ LL |     use {Bar as SomethingElse, main};
    = note: for more information, see issue TBD
 
 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
-  --> $DIR/edition-lint-paths.rs:45:5
+  --> $DIR/edition-lint-paths.rs:47:5
    |
 LL | use bar::Bar;
    |     ^^^^^^^^ help: use `crate`: `crate::bar::Bar`
@@ -49,7 +49,7 @@ LL | use bar::Bar;
    = note: for more information, see issue TBD
 
 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
-  --> $DIR/edition-lint-paths.rs:57:9
+  --> $DIR/edition-lint-paths.rs:59:9
    |
 LL |     use *;
    |         ^ help: use `crate`: `crate::*`
@@ -58,7 +58,16 @@ LL |     use *;
    = note: for more information, see issue TBD
 
 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
-  --> $DIR/edition-lint-paths.rs:63:13
+  --> $DIR/edition-lint-paths.rs:64:6
+   |
+LL | impl ::foo::SomeTrait for u32 { }
+   |      ^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::SomeTrait`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
+   = note: for more information, see issue TBD
+
+error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
+  --> $DIR/edition-lint-paths.rs:69:13
    |
 LL |     let x = ::bar::Bar;
    |             ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar`
@@ -66,5 +75,5 @@ LL |     let x = ::bar::Bar;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
    = note: for more information, see issue TBD
 
-error: aborting due to 7 previous errors
+error: aborting due to 8 previous errors