summaryrefslogtreecommitdiffstats
path: root/tests/ui/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/resolve')
-rw-r--r--tests/ui/resolve/112590-2.fixed34
-rw-r--r--tests/ui/resolve/112590-2.rs26
-rw-r--r--tests/ui/resolve/112590-2.stderr71
-rw-r--r--tests/ui/resolve/bad-expr-path.stderr12
-rw-r--r--tests/ui/resolve/bad-expr-path2.stderr12
-rw-r--r--tests/ui/resolve/derive-macro-1.rs (renamed from tests/ui/resolve/issue-112831.rs)6
-rw-r--r--tests/ui/resolve/derive-macro-2.rs18
-rw-r--r--tests/ui/resolve/export-fully-qualified-2018.stderr5
-rw-r--r--tests/ui/resolve/export-fully-qualified.stderr5
-rw-r--r--tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed31
-rw-r--r--tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs31
-rw-r--r--tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr31
-rw-r--r--tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs10
-rw-r--r--tests/ui/resolve/issue-2356.stderr21
-rw-r--r--tests/ui/resolve/resolve-inconsistent-names.stderr18
-rw-r--r--tests/ui/resolve/resolve-self-in-impl.stderr1
-rw-r--r--tests/ui/resolve/unresolved-segments-visibility.rs11
-rw-r--r--tests/ui/resolve/unresolved-segments-visibility.stderr9
-rw-r--r--tests/ui/resolve/unused-qualifications-suggestion.fixed23
-rw-r--r--tests/ui/resolve/unused-qualifications-suggestion.rs23
-rw-r--r--tests/ui/resolve/unused-qualifications-suggestion.stderr31
21 files changed, 379 insertions, 50 deletions
diff --git a/tests/ui/resolve/112590-2.fixed b/tests/ui/resolve/112590-2.fixed
new file mode 100644
index 000000000..3bfe81ae8
--- /dev/null
+++ b/tests/ui/resolve/112590-2.fixed
@@ -0,0 +1,34 @@
+// run-rustfix
+use std::vec;
+
+use std::sync::atomic::AtomicBool;
+
+mod foo {
+ pub mod bar {
+ pub mod baz {
+ pub use std::vec::Vec as MyVec;
+ }
+ }
+}
+
+mod u {
+ use foo::bar::baz::MyVec;
+
+fn _a() {
+ let _: Vec<i32> = MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+mod v {
+ use foo::bar::baz::MyVec;
+
+fn _b() {
+ let _: Vec<i32> = MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+fn main() {
+ let _t: Vec<i32> = Vec::new(); //~ ERROR failed to resolve
+ type _B = vec::Vec::<u8>; //~ ERROR failed to resolve
+ let _t = AtomicBool::new(true); //~ ERROR failed to resolve
+}
diff --git a/tests/ui/resolve/112590-2.rs b/tests/ui/resolve/112590-2.rs
new file mode 100644
index 000000000..e5914cd67
--- /dev/null
+++ b/tests/ui/resolve/112590-2.rs
@@ -0,0 +1,26 @@
+// run-rustfix
+mod foo {
+ pub mod bar {
+ pub mod baz {
+ pub use std::vec::Vec as MyVec;
+ }
+ }
+}
+
+mod u {
+ fn _a() {
+ let _: Vec<i32> = super::foo::baf::baz::MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+mod v {
+ fn _b() {
+ let _: Vec<i32> = fox::bar::baz::MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+fn main() {
+ let _t: Vec<i32> = vec::new(); //~ ERROR failed to resolve
+ type _B = vec::Vec::<u8>; //~ ERROR failed to resolve
+ let _t = std::sync_error::atomic::AtomicBool::new(true); //~ ERROR failed to resolve
+}
diff --git a/tests/ui/resolve/112590-2.stderr b/tests/ui/resolve/112590-2.stderr
new file mode 100644
index 000000000..0db20249d
--- /dev/null
+++ b/tests/ui/resolve/112590-2.stderr
@@ -0,0 +1,71 @@
+error[E0433]: failed to resolve: could not find `baf` in `foo`
+ --> $DIR/112590-2.rs:12:39
+ |
+LL | let _: Vec<i32> = super::foo::baf::baz::MyVec::new();
+ | ^^^ could not find `baf` in `foo`
+ |
+help: consider importing this struct through its public re-export
+ |
+LL + use foo::bar::baz::MyVec;
+ |
+help: if you import `MyVec`, refer to it directly
+ |
+LL - let _: Vec<i32> = super::foo::baf::baz::MyVec::new();
+LL + let _: Vec<i32> = MyVec::new();
+ |
+
+error[E0433]: failed to resolve: use of undeclared crate or module `fox`
+ --> $DIR/112590-2.rs:18:27
+ |
+LL | let _: Vec<i32> = fox::bar::baz::MyVec::new();
+ | ^^^ use of undeclared crate or module `fox`
+ |
+help: consider importing this struct through its public re-export
+ |
+LL + use foo::bar::baz::MyVec;
+ |
+help: if you import `MyVec`, refer to it directly
+ |
+LL - let _: Vec<i32> = fox::bar::baz::MyVec::new();
+LL + let _: Vec<i32> = MyVec::new();
+ |
+
+error[E0433]: failed to resolve: use of undeclared crate or module `vec`
+ --> $DIR/112590-2.rs:24:15
+ |
+LL | type _B = vec::Vec::<u8>;
+ | ^^^ use of undeclared crate or module `vec`
+ |
+help: consider importing this module
+ |
+LL + use std::vec;
+ |
+
+error[E0433]: failed to resolve: could not find `sync_error` in `std`
+ --> $DIR/112590-2.rs:25:19
+ |
+LL | let _t = std::sync_error::atomic::AtomicBool::new(true);
+ | ^^^^^^^^^^ could not find `sync_error` in `std`
+ |
+help: consider importing this struct
+ |
+LL + use std::sync::atomic::AtomicBool;
+ |
+help: if you import `AtomicBool`, refer to it directly
+ |
+LL - let _t = std::sync_error::atomic::AtomicBool::new(true);
+LL + let _t = AtomicBool::new(true);
+ |
+
+error[E0433]: failed to resolve: use of undeclared crate or module `vec`
+ --> $DIR/112590-2.rs:23:24
+ |
+LL | let _t: Vec<i32> = vec::new();
+ | ^^^
+ | |
+ | use of undeclared crate or module `vec`
+ | help: a struct with a similar name exists (notice the capitalization): `Vec`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/resolve/bad-expr-path.stderr b/tests/ui/resolve/bad-expr-path.stderr
index 8261e8e53..411130913 100644
--- a/tests/ui/resolve/bad-expr-path.stderr
+++ b/tests/ui/resolve/bad-expr-path.stderr
@@ -10,12 +10,6 @@ error[E0425]: cannot find value `arguments` in module `m1`
LL | log(debug, m1::arguments);
| ^^^^^^^^^ not found in `m1`
-error[E0425]: cannot find function `log` in this scope
- --> $DIR/bad-expr-path.rs:4:5
- |
-LL | log(debug, m1::arguments);
- | ^^^ not found in this scope
-
error[E0580]: `main` function has wrong type
--> $DIR/bad-expr-path.rs:3:1
|
@@ -25,6 +19,12 @@ LL | fn main(arguments: Vec<String>) {
= note: expected fn pointer `fn()`
found fn pointer `fn(Vec<String>)`
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-expr-path.rs:4:5
+ |
+LL | log(debug, m1::arguments);
+ | ^^^ not found in this scope
+
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0425, E0580.
diff --git a/tests/ui/resolve/bad-expr-path2.stderr b/tests/ui/resolve/bad-expr-path2.stderr
index 6e11296d9..af3ca99c5 100644
--- a/tests/ui/resolve/bad-expr-path2.stderr
+++ b/tests/ui/resolve/bad-expr-path2.stderr
@@ -10,12 +10,6 @@ error[E0423]: expected value, found module `m1::arguments`
LL | log(debug, m1::arguments);
| ^^^^^^^^^^^^^ not a value
-error[E0425]: cannot find function `log` in this scope
- --> $DIR/bad-expr-path2.rs:6:5
- |
-LL | log(debug, m1::arguments);
- | ^^^ not found in this scope
-
error[E0580]: `main` function has wrong type
--> $DIR/bad-expr-path2.rs:5:1
|
@@ -25,6 +19,12 @@ LL | fn main(arguments: Vec<String>) {
= note: expected fn pointer `fn()`
found fn pointer `fn(Vec<String>)`
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-expr-path2.rs:6:5
+ |
+LL | log(debug, m1::arguments);
+ | ^^^ not found in this scope
+
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0423, E0425, E0580.
diff --git a/tests/ui/resolve/issue-112831.rs b/tests/ui/resolve/derive-macro-1.rs
index ffd83ea8b..90cbd903a 100644
--- a/tests/ui/resolve/issue-112831.rs
+++ b/tests/ui/resolve/derive-macro-1.rs
@@ -1,19 +1,17 @@
// check-pass
// aux-build:issue-112831-aux.rs
-mod zeroable {
+mod z {
pub trait Zeroable {}
}
-use zeroable::*;
+use z::*;
mod pod {
use super::*;
pub trait Pod: Zeroable {}
}
-use pod::*;
-
extern crate issue_112831_aux;
use issue_112831_aux::Zeroable;
diff --git a/tests/ui/resolve/derive-macro-2.rs b/tests/ui/resolve/derive-macro-2.rs
new file mode 100644
index 000000000..7cecdd9e3
--- /dev/null
+++ b/tests/ui/resolve/derive-macro-2.rs
@@ -0,0 +1,18 @@
+// check-pass
+// aux-build:issue-112831-aux.rs
+
+extern crate issue_112831_aux;
+use issue_112831_aux::Zeroable;
+
+mod z {
+ pub trait Zeroable {}
+}
+
+use z::*;
+
+mod pod {
+ use super::*;
+ pub trait Pod: Zeroable {}
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/export-fully-qualified-2018.stderr b/tests/ui/resolve/export-fully-qualified-2018.stderr
index 366ffd9bb..b724da930 100644
--- a/tests/ui/resolve/export-fully-qualified-2018.stderr
+++ b/tests/ui/resolve/export-fully-qualified-2018.stderr
@@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo`
|
LL | pub fn bar() { foo::baz(); }
| ^^^ use of undeclared crate or module `foo`
- |
-help: consider importing this module
- |
-LL + use crate::foo;
- |
error: aborting due to previous error
diff --git a/tests/ui/resolve/export-fully-qualified.stderr b/tests/ui/resolve/export-fully-qualified.stderr
index 0cd516ee1..a8af0c7c9 100644
--- a/tests/ui/resolve/export-fully-qualified.stderr
+++ b/tests/ui/resolve/export-fully-qualified.stderr
@@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo`
|
LL | pub fn bar() { foo::baz(); }
| ^^^ use of undeclared crate or module `foo`
- |
-help: consider importing this module
- |
-LL + use foo;
- |
error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed
new file mode 100644
index 000000000..e730f9466
--- /dev/null
+++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed
@@ -0,0 +1,31 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+#![feature(unsized_fn_params)]
+
+#[allow(unused_imports)]
+use std::ops;
+use std::ops::Index;
+
+pub struct A;
+
+impl Index<str> for A {
+ //~^ ERROR unnecessary qualification
+ type Output = ();
+ fn index(&self, _: str) -> &Self::Output {
+ &()
+ }
+}
+
+mod inner {
+ pub trait Trait<T> {}
+}
+
+// the import needs to be here for the lint to show up
+#[allow(unused_imports)]
+use inner::Trait;
+
+impl Trait<u8> for () {}
+//~^ ERROR unnecessary qualification
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs
new file mode 100644
index 000000000..641c892e3
--- /dev/null
+++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs
@@ -0,0 +1,31 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+#![feature(unsized_fn_params)]
+
+#[allow(unused_imports)]
+use std::ops;
+use std::ops::Index;
+
+pub struct A;
+
+impl ops::Index<str> for A {
+ //~^ ERROR unnecessary qualification
+ type Output = ();
+ fn index(&self, _: str) -> &Self::Output {
+ &()
+ }
+}
+
+mod inner {
+ pub trait Trait<T> {}
+}
+
+// the import needs to be here for the lint to show up
+#[allow(unused_imports)]
+use inner::Trait;
+
+impl inner::Trait<u8> for () {}
+//~^ ERROR unnecessary qualification
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr
new file mode 100644
index 000000000..d9c7fd218
--- /dev/null
+++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr
@@ -0,0 +1,31 @@
+error: unnecessary qualification
+ --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:12:6
+ |
+LL | impl ops::Index<str> for A {
+ | ^^^^^^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:3:9
+ |
+LL | #![deny(unused_qualifications)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+help: remove the unnecessary path segments
+ |
+LL - impl ops::Index<str> for A {
+LL + impl Index<str> for A {
+ |
+
+error: unnecessary qualification
+ --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:28:6
+ |
+LL | impl inner::Trait<u8> for () {}
+ | ^^^^^^^^^^^^^^^^
+ |
+help: remove the unnecessary path segments
+ |
+LL - impl inner::Trait<u8> for () {}
+LL + impl Trait<u8> for () {}
+ |
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs
new file mode 100644
index 000000000..83349dd33
--- /dev/null
+++ b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs
@@ -0,0 +1,10 @@
+#![deny(unused_qualifications)]
+// check-pass
+fn bar() {
+ match Option::<Option<()>>::None {
+ Some(v) => {}
+ None => {}
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr
index 313b3e30d..30f5f0595 100644
--- a/tests/ui/resolve/issue-2356.stderr
+++ b/tests/ui/resolve/issue-2356.stderr
@@ -1,18 +1,3 @@
-error[E0425]: cannot find function `default` in this scope
- --> $DIR/issue-2356.rs:31:5
- |
-LL | default();
- | ^^^^^^^
- |
-help: you might have meant to call the associated function
- |
-LL | Self::default();
- | ~~~~~~~~~~~~~
-help: consider importing this function
- |
-LL + use std::default::default;
- |
-
error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:39:5
|
@@ -64,6 +49,12 @@ error[E0425]: cannot find function `clone` in this scope
LL | clone();
| ^^^^^ help: you might have meant to call the method: `self.clone`
+error[E0425]: cannot find function `default` in this scope
+ --> $DIR/issue-2356.rs:31:5
+ |
+LL | default();
+ | ^^^^^^^ help: you might have meant to call the associated function: `Self::default`
+
error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:41:5
|
diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr
index 023db303d..42b7281d7 100644
--- a/tests/ui/resolve/resolve-inconsistent-names.stderr
+++ b/tests/ui/resolve/resolve-inconsistent-names.stderr
@@ -14,6 +14,15 @@ LL | a | b => {}
| |
| pattern doesn't bind `b`
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:19:9
+ |
+LL | (A, B) | (ref B, c) | (c, A) => ()
+ | ^^^^^^ - - variable not in all patterns
+ | | |
+ | | variable not in all patterns
+ | pattern doesn't bind `c`
+
error[E0408]: variable `A` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:19:18
|
@@ -37,15 +46,6 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| | variable not in all patterns
| variable not in all patterns
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:19:9
- |
-LL | (A, B) | (ref B, c) | (c, A) => ()
- | ^^^^^^ - - variable not in all patterns
- | | |
- | | variable not in all patterns
- | pattern doesn't bind `c`
-
error[E0409]: variable `B` is bound inconsistently across alternatives separated by `|`
--> $DIR/resolve-inconsistent-names.rs:19:23
|
diff --git a/tests/ui/resolve/resolve-self-in-impl.stderr b/tests/ui/resolve/resolve-self-in-impl.stderr
index 9f9ed6889..183a17171 100644
--- a/tests/ui/resolve/resolve-self-in-impl.stderr
+++ b/tests/ui/resolve/resolve-self-in-impl.stderr
@@ -56,6 +56,7 @@ LL | | trait Tr<T = u8> {
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 6 previous errors
diff --git a/tests/ui/resolve/unresolved-segments-visibility.rs b/tests/ui/resolve/unresolved-segments-visibility.rs
new file mode 100644
index 000000000..c26171f75
--- /dev/null
+++ b/tests/ui/resolve/unresolved-segments-visibility.rs
@@ -0,0 +1,11 @@
+// Check that we do not ICE due to unresolved segments in visibility path.
+#![crate_type = "lib"]
+
+extern crate alloc as b;
+
+mod foo {
+ mod bar {
+ pub(in b::string::String::newy) extern crate alloc as e;
+ //~^ ERROR failed to resolve: `String` is a struct, not a module [E0433]
+ }
+}
diff --git a/tests/ui/resolve/unresolved-segments-visibility.stderr b/tests/ui/resolve/unresolved-segments-visibility.stderr
new file mode 100644
index 000000000..0a11549cd
--- /dev/null
+++ b/tests/ui/resolve/unresolved-segments-visibility.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve: `String` is a struct, not a module
+ --> $DIR/unresolved-segments-visibility.rs:8:27
+ |
+LL | pub(in b::string::String::newy) extern crate alloc as e;
+ | ^^^^^^ `String` is a struct, not a module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/resolve/unused-qualifications-suggestion.fixed b/tests/ui/resolve/unused-qualifications-suggestion.fixed
new file mode 100644
index 000000000..0d4b9007c
--- /dev/null
+++ b/tests/ui/resolve/unused-qualifications-suggestion.fixed
@@ -0,0 +1,23 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+
+mod foo {
+ pub fn bar() {}
+}
+
+mod baz {
+ pub mod qux {
+ pub fn quux() {}
+ }
+}
+
+fn main() {
+ use foo::bar;
+ bar();
+ //~^ ERROR unnecessary qualification
+
+ use baz::qux::quux;
+ quux();
+ //~^ ERROR unnecessary qualification
+}
diff --git a/tests/ui/resolve/unused-qualifications-suggestion.rs b/tests/ui/resolve/unused-qualifications-suggestion.rs
new file mode 100644
index 000000000..f6722e965
--- /dev/null
+++ b/tests/ui/resolve/unused-qualifications-suggestion.rs
@@ -0,0 +1,23 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+
+mod foo {
+ pub fn bar() {}
+}
+
+mod baz {
+ pub mod qux {
+ pub fn quux() {}
+ }
+}
+
+fn main() {
+ use foo::bar;
+ foo::bar();
+ //~^ ERROR unnecessary qualification
+
+ use baz::qux::quux;
+ baz::qux::quux();
+ //~^ ERROR unnecessary qualification
+}
diff --git a/tests/ui/resolve/unused-qualifications-suggestion.stderr b/tests/ui/resolve/unused-qualifications-suggestion.stderr
new file mode 100644
index 000000000..e3dac37fc
--- /dev/null
+++ b/tests/ui/resolve/unused-qualifications-suggestion.stderr
@@ -0,0 +1,31 @@
+error: unnecessary qualification
+ --> $DIR/unused-qualifications-suggestion.rs:17:5
+ |
+LL | foo::bar();
+ | ^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/unused-qualifications-suggestion.rs:3:9
+ |
+LL | #![deny(unused_qualifications)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+help: remove the unnecessary path segments
+ |
+LL - foo::bar();
+LL + bar();
+ |
+
+error: unnecessary qualification
+ --> $DIR/unused-qualifications-suggestion.rs:21:5
+ |
+LL | baz::qux::quux();
+ | ^^^^^^^^^^^^^^
+ |
+help: remove the unnecessary path segments
+ |
+LL - baz::qux::quux();
+LL + quux();
+ |
+
+error: aborting due to 2 previous errors
+