summaryrefslogtreecommitdiffstats
path: root/src/test/ui/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/resolve')
-rw-r--r--src/test/ui/resolve/bad-module.stderr12
-rw-r--r--src/test/ui/resolve/blind-item-local-shadow.rs13
-rw-r--r--src/test/ui/resolve/issue-101749-2.rs16
-rw-r--r--src/test/ui/resolve/issue-101749-2.stderr9
-rw-r--r--src/test/ui/resolve/issue-101749.fixed19
-rw-r--r--src/test/ui/resolve/issue-101749.rs19
-rw-r--r--src/test/ui/resolve/issue-101749.stderr14
-rw-r--r--src/test/ui/resolve/issue-103474.rs28
-rw-r--r--src/test/ui/resolve/issue-103474.stderr35
-rw-r--r--src/test/ui/resolve/issue-105069.rs11
-rw-r--r--src/test/ui/resolve/issue-105069.stderr21
-rw-r--r--src/test/ui/resolve/issue-18252.rs2
-rw-r--r--src/test/ui/resolve/issue-18252.stderr9
-rw-r--r--src/test/ui/resolve/issue-19452.stderr18
-rw-r--r--src/test/ui/resolve/issue-2356.stderr4
-rw-r--r--src/test/ui/resolve/issue-24968.stderr24
-rw-r--r--src/test/ui/resolve/issue-35675.rs42
-rw-r--r--src/test/ui/resolve/issue-35675.stderr75
-rw-r--r--src/test/ui/resolve/issue-50599.rs2
-rw-r--r--src/test/ui/resolve/issue-50599.stderr9
-rw-r--r--src/test/ui/resolve/issue-5927.rs7
-rw-r--r--src/test/ui/resolve/issue-5927.stderr16
-rw-r--r--src/test/ui/resolve/issue-60057.rs19
-rw-r--r--src/test/ui/resolve/issue-60057.stderr15
-rw-r--r--src/test/ui/resolve/issue-73427.stderr22
-rw-r--r--src/test/ui/resolve/missing-in-namespace.stderr4
-rw-r--r--src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr16
-rw-r--r--src/test/ui/resolve/privacy-enum-ctor.stderr90
-rw-r--r--src/test/ui/resolve/resolve-self-in-impl.stderr30
-rw-r--r--src/test/ui/resolve/typo-suggestion-mistyped-in-path.rs42
-rw-r--r--src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr54
-rw-r--r--src/test/ui/resolve/use_suggestion.stderr14
32 files changed, 555 insertions, 156 deletions
diff --git a/src/test/ui/resolve/bad-module.stderr b/src/test/ui/resolve/bad-module.stderr
index 581a66198..558760c67 100644
--- a/src/test/ui/resolve/bad-module.stderr
+++ b/src/test/ui/resolve/bad-module.stderr
@@ -1,15 +1,15 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `thing`
- --> $DIR/bad-module.rs:2:15
- |
-LL | let foo = thing::len(Vec::new());
- | ^^^^^ use of undeclared crate or module `thing`
-
error[E0433]: failed to resolve: use of undeclared crate or module `foo`
--> $DIR/bad-module.rs:5:15
|
LL | let foo = foo::bar::baz();
| ^^^ use of undeclared crate or module `foo`
+error[E0433]: failed to resolve: use of undeclared crate or module `thing`
+ --> $DIR/bad-module.rs:2:15
+ |
+LL | let foo = thing::len(Vec::new());
+ | ^^^^^ use of undeclared crate or module `thing`
+
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/resolve/blind-item-local-shadow.rs b/src/test/ui/resolve/blind-item-local-shadow.rs
new file mode 100644
index 000000000..942aeb6fd
--- /dev/null
+++ b/src/test/ui/resolve/blind-item-local-shadow.rs
@@ -0,0 +1,13 @@
+// run-pass
+
+#![allow(dead_code)]
+#![allow(unused_imports)]
+mod bar {
+ pub fn foo() -> bool { true }
+}
+
+fn main() {
+ let foo = || false;
+ use bar::foo;
+ assert_eq!(foo(), false);
+}
diff --git a/src/test/ui/resolve/issue-101749-2.rs b/src/test/ui/resolve/issue-101749-2.rs
new file mode 100644
index 000000000..4d3d46944
--- /dev/null
+++ b/src/test/ui/resolve/issue-101749-2.rs
@@ -0,0 +1,16 @@
+struct Rectangle {
+ width: i32,
+ height: i32,
+}
+impl Rectangle {
+ fn new(width: i32, height: i32) -> Self {
+ Self { width, height }
+ }
+}
+
+fn main() {
+ let rect = Rectangle::new(3, 4);
+ // `area` is not implemented for `Rectangle`, so this should not suggest
+ let _ = rect::area();
+ //~^ ERROR failed to resolve: use of undeclared crate or module `rect`
+}
diff --git a/src/test/ui/resolve/issue-101749-2.stderr b/src/test/ui/resolve/issue-101749-2.stderr
new file mode 100644
index 000000000..370d4b145
--- /dev/null
+++ b/src/test/ui/resolve/issue-101749-2.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve: use of undeclared crate or module `rect`
+ --> $DIR/issue-101749-2.rs:14:13
+ |
+LL | let _ = rect::area();
+ | ^^^^ use of undeclared crate or module `rect`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/resolve/issue-101749.fixed b/src/test/ui/resolve/issue-101749.fixed
new file mode 100644
index 000000000..3e5544296
--- /dev/null
+++ b/src/test/ui/resolve/issue-101749.fixed
@@ -0,0 +1,19 @@
+// run-rustfix
+struct Rectangle {
+ width: i32,
+ height: i32,
+}
+impl Rectangle {
+ fn new(width: i32, height: i32) -> Self {
+ Self { width, height }
+ }
+ fn area(&self) -> i32 {
+ self.height * self.width
+ }
+}
+
+fn main() {
+ let rect = Rectangle::new(3, 4);
+ let _ = rect.area();
+ //~^ ERROR failed to resolve: use of undeclared crate or module `rect`
+}
diff --git a/src/test/ui/resolve/issue-101749.rs b/src/test/ui/resolve/issue-101749.rs
new file mode 100644
index 000000000..fd67ccab6
--- /dev/null
+++ b/src/test/ui/resolve/issue-101749.rs
@@ -0,0 +1,19 @@
+// run-rustfix
+struct Rectangle {
+ width: i32,
+ height: i32,
+}
+impl Rectangle {
+ fn new(width: i32, height: i32) -> Self {
+ Self { width, height }
+ }
+ fn area(&self) -> i32 {
+ self.height * self.width
+ }
+}
+
+fn main() {
+ let rect = Rectangle::new(3, 4);
+ let _ = rect::area();
+ //~^ ERROR failed to resolve: use of undeclared crate or module `rect`
+}
diff --git a/src/test/ui/resolve/issue-101749.stderr b/src/test/ui/resolve/issue-101749.stderr
new file mode 100644
index 000000000..dd29d7fc0
--- /dev/null
+++ b/src/test/ui/resolve/issue-101749.stderr
@@ -0,0 +1,14 @@
+error[E0433]: failed to resolve: use of undeclared crate or module `rect`
+ --> $DIR/issue-101749.rs:17:13
+ |
+LL | let _ = rect::area();
+ | ^^^^ use of undeclared crate or module `rect`
+ |
+help: you may have meant to call an instance method
+ |
+LL | let _ = rect.area();
+ | ~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/resolve/issue-103474.rs b/src/test/ui/resolve/issue-103474.rs
new file mode 100644
index 000000000..14f2259e1
--- /dev/null
+++ b/src/test/ui/resolve/issue-103474.rs
@@ -0,0 +1,28 @@
+struct S {}
+impl S {
+ fn first(&self) {}
+
+ fn second(&self) {
+ first()
+ //~^ ERROR cannot find function `first` in this scope
+ }
+
+ fn third(&self) {
+ no_method_err()
+ //~^ ERROR cannot find function `no_method_err` in this scope
+ }
+}
+
+// https://github.com/rust-lang/rust/pull/103531#discussion_r1004728080
+struct Foo {
+ i: i32,
+}
+
+impl Foo {
+ fn needs_self() {
+ this.i
+ //~^ ERROR cannot find value `this` in this scope
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/resolve/issue-103474.stderr b/src/test/ui/resolve/issue-103474.stderr
new file mode 100644
index 000000000..415d23155
--- /dev/null
+++ b/src/test/ui/resolve/issue-103474.stderr
@@ -0,0 +1,35 @@
+error[E0425]: cannot find value `this` in this scope
+ --> $DIR/issue-103474.rs:23:9
+ |
+LL | this.i
+ | ^^^^ not found in this scope
+ |
+help: you might have meant to use `self` here instead
+ |
+LL | self.i
+ | ~~~~
+help: if you meant to use `self`, you are also missing a `self` receiver argument
+ |
+LL | fn needs_self(&self) {
+ | +++++
+
+error[E0425]: cannot find function `first` in this scope
+ --> $DIR/issue-103474.rs:6:9
+ |
+LL | first()
+ | ^^^^^ not found in this scope
+ |
+help: consider using the associated function
+ |
+LL | self.first()
+ | +++++
+
+error[E0425]: cannot find function `no_method_err` in this scope
+ --> $DIR/issue-103474.rs:11:9
+ |
+LL | no_method_err()
+ | ^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/resolve/issue-105069.rs b/src/test/ui/resolve/issue-105069.rs
new file mode 100644
index 000000000..73455cf77
--- /dev/null
+++ b/src/test/ui/resolve/issue-105069.rs
@@ -0,0 +1,11 @@
+use self::A::*;
+use V; //~ ERROR `V` is ambiguous
+use self::B::*;
+enum A {
+ V
+}
+enum B {
+ V
+}
+
+fn main() {}
diff --git a/src/test/ui/resolve/issue-105069.stderr b/src/test/ui/resolve/issue-105069.stderr
new file mode 100644
index 000000000..1e6c9c6e2
--- /dev/null
+++ b/src/test/ui/resolve/issue-105069.stderr
@@ -0,0 +1,21 @@
+error[E0659]: `V` is ambiguous
+ --> $DIR/issue-105069.rs:2:5
+ |
+LL | use V;
+ | ^ ambiguous name
+ |
+ = note: ambiguous because of multiple potential import sources
+note: `V` could refer to the variant imported here
+ --> $DIR/issue-105069.rs:1:5
+ |
+LL | use self::A::*;
+ | ^^^^^^^^^^
+note: `V` could also refer to the variant imported here
+ --> $DIR/issue-105069.rs:3:5
+ |
+LL | use self::B::*;
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/resolve/issue-18252.rs b/src/test/ui/resolve/issue-18252.rs
index af0a3cbcb..f6ebe2920 100644
--- a/src/test/ui/resolve/issue-18252.rs
+++ b/src/test/ui/resolve/issue-18252.rs
@@ -4,5 +4,5 @@ enum Foo {
fn main() {
let f = Foo::Variant(42);
- //~^ ERROR expected function, tuple struct or tuple variant, found struct variant `Foo::Variant`
+ //~^ ERROR expected value, found struct variant `Foo::Variant`
}
diff --git a/src/test/ui/resolve/issue-18252.stderr b/src/test/ui/resolve/issue-18252.stderr
index 13e7a5973..d9006c0a6 100644
--- a/src/test/ui/resolve/issue-18252.stderr
+++ b/src/test/ui/resolve/issue-18252.stderr
@@ -1,12 +1,9 @@
-error[E0423]: expected function, tuple struct or tuple variant, found struct variant `Foo::Variant`
+error[E0533]: expected value, found struct variant `Foo::Variant`
--> $DIR/issue-18252.rs:6:13
|
-LL | Variant { x: usize }
- | -------------------- `Foo::Variant` defined here
-...
LL | let f = Foo::Variant(42);
- | ^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `Foo::Variant { x: val }`
+ | ^^^^^^^^^^^^ not a value
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0423`.
+For more information about this error, try `rustc --explain E0533`.
diff --git a/src/test/ui/resolve/issue-19452.stderr b/src/test/ui/resolve/issue-19452.stderr
index 8df84067e..eff89241f 100644
--- a/src/test/ui/resolve/issue-19452.stderr
+++ b/src/test/ui/resolve/issue-19452.stderr
@@ -1,23 +1,15 @@
-error[E0423]: expected value, found struct variant `Homura::Madoka`
+error[E0533]: expected value, found struct variant `Homura::Madoka`
--> $DIR/issue-19452.rs:10:18
|
-LL | Madoka { age: u32 }
- | ------------------- `Homura::Madoka` defined here
-...
LL | let homura = Homura::Madoka;
- | ^^^^^^^^^^^^^^ help: use struct literal syntax instead: `Homura::Madoka { age: val }`
+ | ^^^^^^^^^^^^^^ not a value
-error[E0423]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
+error[E0533]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
--> $DIR/issue-19452.rs:13:18
|
LL | let homura = issue_19452_aux::Homura::Madoka;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `issue_19452_aux::Homura::Madoka { /* fields */ }`
- |
- ::: $DIR/auxiliary/issue-19452-aux.rs:2:5
- |
-LL | Madoka { age: u32 }
- | ------ `issue_19452_aux::Homura::Madoka` defined here
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a value
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0423`.
+For more information about this error, try `rustc --explain E0533`.
diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr
index e7c53ff44..36f3da7c9 100644
--- a/src/test/ui/resolve/issue-2356.stderr
+++ b/src/test/ui/resolve/issue-2356.stderr
@@ -85,7 +85,7 @@ LL | static_method();
help: consider using the associated function
|
LL | Self::static_method();
- | ~~~~~~~~~~~~~~~~~~~
+ | ++++++
error[E0425]: cannot find function `purr` in this scope
--> $DIR/issue-2356.rs:54:9
@@ -114,7 +114,7 @@ LL | grow_older();
help: consider using the associated function
|
LL | Self::grow_older();
- | ~~~~~~~~~~~~~~~~
+ | ++++++
error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:74:5
diff --git a/src/test/ui/resolve/issue-24968.stderr b/src/test/ui/resolve/issue-24968.stderr
index 7e539d258..82f5a1d5b 100644
--- a/src/test/ui/resolve/issue-24968.stderr
+++ b/src/test/ui/resolve/issue-24968.stderr
@@ -1,15 +1,3 @@
-error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
- --> $DIR/issue-24968.rs:21:19
- |
-LL | const FOO2: u32 = Self::bar();
- | ^^^^ `Self` is only available in impls, traits, and type definitions
-
-error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
- --> $DIR/issue-24968.rs:27:22
- |
-LL | static FOO_S2: u32 = Self::bar();
- | ^^^^ `Self` is only available in impls, traits, and type definitions
-
error[E0411]: cannot find type `Self` in this scope
--> $DIR/issue-24968.rs:3:11
|
@@ -51,6 +39,18 @@ LL | static FOO_S: Self = 0;
| |
| `Self` not allowed in a static item
+error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
+ --> $DIR/issue-24968.rs:21:19
+ |
+LL | const FOO2: u32 = Self::bar();
+ | ^^^^ `Self` is only available in impls, traits, and type definitions
+
+error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
+ --> $DIR/issue-24968.rs:27:22
+ |
+LL | static FOO_S2: u32 = Self::bar();
+ | ^^^^ `Self` is only available in impls, traits, and type definitions
+
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0411, E0433.
diff --git a/src/test/ui/resolve/issue-35675.rs b/src/test/ui/resolve/issue-35675.rs
new file mode 100644
index 000000000..683761667
--- /dev/null
+++ b/src/test/ui/resolve/issue-35675.rs
@@ -0,0 +1,42 @@
+// these two HELPs are actually in a new line between this line and the `enum Fruit` line
+enum Fruit {
+ Apple(i64),
+ Orange(i64),
+}
+
+fn should_return_fruit() -> Apple {
+ //~^ ERROR cannot find type `Apple` in this scope
+ Apple(5)
+ //~^ ERROR cannot find function, tuple struct or tuple variant `Apple` in this scope
+}
+
+fn should_return_fruit_too() -> Fruit::Apple {
+ //~^ ERROR expected type, found variant `Fruit::Apple`
+ Apple(5)
+ //~^ ERROR cannot find function, tuple struct or tuple variant `Apple` in this scope
+}
+
+fn foo() -> Ok {
+ //~^ ERROR expected type, found variant `Ok`
+ Ok(())
+}
+
+fn bar() -> Variant3 {
+ //~^ ERROR cannot find type `Variant3` in this scope
+}
+
+fn qux() -> Some {
+ //~^ ERROR expected type, found variant `Some`
+ Some(1)
+}
+
+fn main() {}
+
+mod x {
+ pub enum Enum {
+ Variant1,
+ Variant2(),
+ Variant3(usize),
+ Variant4 {},
+ }
+}
diff --git a/src/test/ui/resolve/issue-35675.stderr b/src/test/ui/resolve/issue-35675.stderr
new file mode 100644
index 000000000..4a06196d5
--- /dev/null
+++ b/src/test/ui/resolve/issue-35675.stderr
@@ -0,0 +1,75 @@
+error[E0412]: cannot find type `Apple` in this scope
+ --> $DIR/issue-35675.rs:7:29
+ |
+LL | fn should_return_fruit() -> Apple {
+ | ^^^^^ not found in this scope
+ |
+help: there is an enum variant `Fruit::Apple`; try using the variant's enum
+ |
+LL | fn should_return_fruit() -> Fruit {
+ | ~~~~~
+
+error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope
+ --> $DIR/issue-35675.rs:9:5
+ |
+LL | Apple(5)
+ | ^^^^^ not found in this scope
+ |
+help: consider importing this tuple variant
+ |
+LL | use Fruit::Apple;
+ |
+
+error[E0573]: expected type, found variant `Fruit::Apple`
+ --> $DIR/issue-35675.rs:13:33
+ |
+LL | fn should_return_fruit_too() -> Fruit::Apple {
+ | ^^^^^^^^^^^^
+ | |
+ | not a type
+ | help: try using the variant's enum: `Fruit`
+
+error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope
+ --> $DIR/issue-35675.rs:15:5
+ |
+LL | Apple(5)
+ | ^^^^^ not found in this scope
+ |
+help: consider importing this tuple variant
+ |
+LL | use Fruit::Apple;
+ |
+
+error[E0573]: expected type, found variant `Ok`
+ --> $DIR/issue-35675.rs:19:13
+ |
+LL | fn foo() -> Ok {
+ | ^^
+ | |
+ | not a type
+ | help: try using the variant's enum: `std::result::Result`
+
+error[E0412]: cannot find type `Variant3` in this scope
+ --> $DIR/issue-35675.rs:24:13
+ |
+LL | fn bar() -> Variant3 {
+ | ^^^^^^^^ not found in this scope
+ |
+help: there is an enum variant `x::Enum::Variant3`; try using the variant's enum
+ |
+LL | fn bar() -> x::Enum {
+ | ~~~~~~~
+
+error[E0573]: expected type, found variant `Some`
+ --> $DIR/issue-35675.rs:28:13
+ |
+LL | fn qux() -> Some {
+ | ^^^^
+ | |
+ | not a type
+ | help: try using the variant's enum: `std::option::Option`
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0412, E0425, E0573.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/src/test/ui/resolve/issue-50599.rs b/src/test/ui/resolve/issue-50599.rs
index 78a20cf8e..72238a591 100644
--- a/src/test/ui/resolve/issue-50599.rs
+++ b/src/test/ui/resolve/issue-50599.rs
@@ -2,5 +2,5 @@ fn main() {
const N: u32 = 1_000;
const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value
let mut digits = [0u32; M];
- //~^ ERROR evaluation of constant value failed
+ //~^ constant
}
diff --git a/src/test/ui/resolve/issue-50599.stderr b/src/test/ui/resolve/issue-50599.stderr
index 910deddd8..b07482c83 100644
--- a/src/test/ui/resolve/issue-50599.stderr
+++ b/src/test/ui/resolve/issue-50599.stderr
@@ -16,13 +16,12 @@ LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
LL + const M: usize = (f64::from(N) * LOG10_2) as usize;
|
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/issue-50599.rs:4:29
|
LL | let mut digits = [0u32; M];
- | ^ referenced constant has errors
+ | ^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0080, E0425.
-For more information about an error, try `rustc --explain E0080`.
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/resolve/issue-5927.rs b/src/test/ui/resolve/issue-5927.rs
new file mode 100644
index 000000000..14f95827b
--- /dev/null
+++ b/src/test/ui/resolve/issue-5927.rs
@@ -0,0 +1,7 @@
+fn main() {
+ let z = match 3 {
+ x(1) => x(1) //~ ERROR cannot find tuple struct or tuple variant `x` in this scope
+ //~^ ERROR cannot find function `x` in this scope
+ };
+ assert!(z == 3);
+}
diff --git a/src/test/ui/resolve/issue-5927.stderr b/src/test/ui/resolve/issue-5927.stderr
new file mode 100644
index 000000000..d6cd6853d
--- /dev/null
+++ b/src/test/ui/resolve/issue-5927.stderr
@@ -0,0 +1,16 @@
+error[E0531]: cannot find tuple struct or tuple variant `x` in this scope
+ --> $DIR/issue-5927.rs:3:9
+ |
+LL | x(1) => x(1)
+ | ^ not found in this scope
+
+error[E0425]: cannot find function `x` in this scope
+ --> $DIR/issue-5927.rs:3:17
+ |
+LL | x(1) => x(1)
+ | ^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0425, E0531.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/ui/resolve/issue-60057.rs b/src/test/ui/resolve/issue-60057.rs
new file mode 100644
index 000000000..b52343ada
--- /dev/null
+++ b/src/test/ui/resolve/issue-60057.rs
@@ -0,0 +1,19 @@
+struct A {
+ banana: u8,
+}
+
+impl A {
+ fn new(peach: u8) -> A {
+ A {
+ banana: banana //~ ERROR cannot find value `banana` in this scope
+ }
+ }
+
+ fn foo(&self, peach: u8) -> A {
+ A {
+ banana: banana //~ ERROR cannot find value `banana` in this scope
+ }
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/resolve/issue-60057.stderr b/src/test/ui/resolve/issue-60057.stderr
new file mode 100644
index 000000000..4d915fcd9
--- /dev/null
+++ b/src/test/ui/resolve/issue-60057.stderr
@@ -0,0 +1,15 @@
+error[E0425]: cannot find value `banana` in this scope
+ --> $DIR/issue-60057.rs:8:21
+ |
+LL | banana: banana
+ | ^^^^^^ a field by this name exists in `Self`
+
+error[E0425]: cannot find value `banana` in this scope
+ --> $DIR/issue-60057.rs:14:21
+ |
+LL | banana: banana
+ | ^^^^^^ help: you might have meant to use the available field: `self.banana`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/resolve/issue-73427.stderr b/src/test/ui/resolve/issue-73427.stderr
index d31c5e477..4af5f29d8 100644
--- a/src/test/ui/resolve/issue-73427.stderr
+++ b/src/test/ui/resolve/issue-73427.stderr
@@ -17,16 +17,12 @@ LL | | }
| |_^
help: you might have meant to use one of the following enum variants
|
-LL | (A::Struct {}).foo();
- | ~~~~~~~~~~~~~~
LL | (A::Tuple()).foo();
| ~~~~~~~~~~~~
LL | A::Unit.foo();
| ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
|
-LL | (A::StructWithFields { /* fields */ }).foo();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | (A::TupleWithFields(/* fields */)).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -34,7 +30,7 @@ error[E0423]: expected value, found enum `B`
--> $DIR/issue-73427.rs:35:5
|
LL | B.foo();
- | ^
+ | ^ help: the following enum variant is available: `(B::TupleWithFields(/* fields */))`
|
note: the enum is defined here
--> $DIR/issue-73427.rs:9:1
@@ -44,12 +40,6 @@ LL | | StructWithFields { x: () },
LL | | TupleWithFields(()),
LL | | }
| |_^
-help: the following enum variants are available
- |
-LL | (B::StructWithFields { /* fields */ }).foo();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | (B::TupleWithFields(/* fields */)).foo();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0423]: expected value, found enum `C`
--> $DIR/issue-73427.rs:37:5
@@ -70,10 +60,8 @@ help: you might have meant to use the following enum variant
|
LL | C::Unit.foo();
| ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
|
-LL | (C::StructWithFields { /* fields */ }).foo();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | (C::TupleWithFields(/* fields */)).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -130,7 +118,7 @@ error[E0532]: expected tuple struct or tuple variant, found enum `A`
LL | if let A(3) = x { }
| ^
|
- = help: you might have meant to match against one of the enum's non-tuple variants
+ = help: you might have meant to match against the enum's non-tuple variant
note: the enum is defined here
--> $DIR/issue-73427.rs:1:1
|
@@ -155,7 +143,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found enum `A`
LL | let x = A(3);
| ^
|
- = help: you might have meant to construct one of the enum's non-tuple variants
+ = help: you might have meant to construct the enum's non-tuple variant
note: the enum is defined here
--> $DIR/issue-73427.rs:1:1
|
diff --git a/src/test/ui/resolve/missing-in-namespace.stderr b/src/test/ui/resolve/missing-in-namespace.stderr
index 3d49b2e5d..fc925ba3b 100644
--- a/src/test/ui/resolve/missing-in-namespace.stderr
+++ b/src/test/ui/resolve/missing-in-namespace.stderr
@@ -1,8 +1,8 @@
error[E0433]: failed to resolve: could not find `hahmap` in `std`
- --> $DIR/missing-in-namespace.rs:2:29
+ --> $DIR/missing-in-namespace.rs:2:21
|
LL | let _map = std::hahmap::HashMap::new();
- | ^^^^^^^ not found in `std::hahmap`
+ | ^^^^^^ could not find `hahmap` in `std`
|
help: consider importing this struct
|
diff --git a/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr
index eb26cd9ca..5790e425c 100644
--- a/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr
+++ b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr
@@ -1,16 +1,14 @@
error[E0574]: expected struct, variant or union type, found type parameter `Baz`
--> $DIR/point-at-type-parameter-shadowing-another-type.rs:16:13
|
-LL | / struct Baz {
-LL | | num: usize,
-LL | | }
- | |_- you might have meant to refer to this struct
-LL |
-LL | impl<Baz> Foo<Baz> for Bar {
- | --- found this type parameter
+LL | struct Baz {
+ | --- you might have meant to refer to this struct
...
-LL | Baz { num } => num,
- | ^^^ not a struct, variant or union type
+LL | impl<Baz> Foo<Baz> for Bar {
+ | --- found this type parameter
+...
+LL | Baz { num } => num,
+ | ^^^ not a struct, variant or union type
error: aborting due to previous error
diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr
index 82a4211f0..d734fa76b 100644
--- a/src/test/ui/resolve/privacy-enum-ctor.stderr
+++ b/src/test/ui/resolve/privacy-enum-ctor.stderr
@@ -19,12 +19,10 @@ help: you might have meant to use the following enum variant
|
LL | m::Z::Unit;
| ~~~~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
|
LL | (m::Z::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~~~~
-LL | (m::Z::Struct { /* fields */ });
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0423]: expected value, found enum `Z`
--> $DIR/privacy-enum-ctor.rs:25:9
@@ -47,23 +45,10 @@ help: you might have meant to use the following enum variant
|
LL | m::Z::Unit;
| ~~~~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
|
LL | (m::Z::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~~~~
-LL | (m::Z::Struct { /* fields */ });
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-error[E0423]: expected value, found struct variant `Z::Struct`
- --> $DIR/privacy-enum-ctor.rs:29:20
- |
-LL | / Struct {
-LL | | s: u8,
-LL | | },
- | |_____________- `Z::Struct` defined here
-...
-LL | let _: Z = Z::Struct;
- | ^^^^^^^^^ help: use struct literal syntax instead: `Z::Struct { s: val }`
error[E0423]: expected value, found enum `m::E`
--> $DIR/privacy-enum-ctor.rs:41:16
@@ -89,12 +74,10 @@ help: you might have meant to use the following enum variant
|
LL | let _: E = E::Unit;
| ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
|
LL | let _: E = (E::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~
-LL | let _: E = (E::Struct { /* fields */ });
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: a function with a similar name exists
|
LL | let _: E = m::f;
@@ -111,17 +94,6 @@ LL - let _: E = m::E;
LL + let _: E = E;
|
-error[E0423]: expected value, found struct variant `m::E::Struct`
- --> $DIR/privacy-enum-ctor.rs:45:16
- |
-LL | / Struct {
-LL | | s: u8,
-LL | | },
- | |_________- `m::E::Struct` defined here
-...
-LL | let _: E = m::E::Struct;
- | ^^^^^^^^^^^^ help: use struct literal syntax instead: `m::E::Struct { s: val }`
-
error[E0423]: expected value, found enum `E`
--> $DIR/privacy-enum-ctor.rs:49:16
|
@@ -143,12 +115,10 @@ help: you might have meant to use the following enum variant
|
LL | let _: E = E::Unit;
| ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
|
LL | let _: E = (E::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~
-LL | let _: E = (E::Struct { /* fields */ });
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: consider importing one of these items instead
|
LL | use std::f32::consts::E;
@@ -156,17 +126,6 @@ LL | use std::f32::consts::E;
LL | use std::f64::consts::E;
|
-error[E0423]: expected value, found struct variant `E::Struct`
- --> $DIR/privacy-enum-ctor.rs:53:16
- |
-LL | / Struct {
-LL | | s: u8,
-LL | | },
- | |_________- `E::Struct` defined here
-...
-LL | let _: E = E::Struct;
- | ^^^^^^^^^ help: use struct literal syntax instead: `E::Struct { s: val }`
-
error[E0412]: cannot find type `Z` in this scope
--> $DIR/privacy-enum-ctor.rs:57:12
|
@@ -203,12 +162,10 @@ help: you might have meant to use the following enum variant
|
LL | let _: Z = m::Z::Unit;
| ~~~~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
|
LL | let _: Z = (m::Z::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~~~~
-LL | let _: Z = (m::Z::Struct { /* fields */ });
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0412]: cannot find type `Z` in this scope
--> $DIR/privacy-enum-ctor.rs:61:12
@@ -240,17 +197,6 @@ note: enum `m::Z` exists but is inaccessible
LL | pub(in m) enum Z {
| ^^^^^^^^^^^^^^^^ not accessible
-error[E0423]: expected value, found struct variant `m::n::Z::Struct`
- --> $DIR/privacy-enum-ctor.rs:64:16
- |
-LL | / Struct {
-LL | | s: u8,
-LL | | },
- | |_____________- `m::n::Z::Struct` defined here
-...
-LL | let _: Z = m::n::Z::Struct;
- | ^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `m::n::Z::Struct { s: val }`
-
error[E0412]: cannot find type `Z` in this scope
--> $DIR/privacy-enum-ctor.rs:68:12
|
@@ -332,6 +278,12 @@ help: use parentheses to construct this tuple variant
LL | let _: Z = Z::Fn(/* u8 */);
| ++++++++++
+error[E0533]: expected value, found struct variant `Z::Struct`
+ --> $DIR/privacy-enum-ctor.rs:29:20
+ |
+LL | let _: Z = Z::Struct;
+ | ^^^^^^^^^ not a value
+
error[E0618]: expected function, found enum variant `Z::Unit`
--> $DIR/privacy-enum-ctor.rs:31:17
|
@@ -367,6 +319,12 @@ help: use parentheses to construct this tuple variant
LL | let _: E = m::E::Fn(/* u8 */);
| ++++++++++
+error[E0533]: expected value, found struct variant `m::E::Struct`
+ --> $DIR/privacy-enum-ctor.rs:45:16
+ |
+LL | let _: E = m::E::Struct;
+ | ^^^^^^^^^^^^ not a value
+
error[E0618]: expected function, found enum variant `m::E::Unit`
--> $DIR/privacy-enum-ctor.rs:47:16
|
@@ -402,6 +360,12 @@ help: use parentheses to construct this tuple variant
LL | let _: E = E::Fn(/* u8 */);
| ++++++++++
+error[E0533]: expected value, found struct variant `E::Struct`
+ --> $DIR/privacy-enum-ctor.rs:53:16
+ |
+LL | let _: E = E::Struct;
+ | ^^^^^^^^^ not a value
+
error[E0618]: expected function, found enum variant `E::Unit`
--> $DIR/privacy-enum-ctor.rs:55:16
|
@@ -419,7 +383,13 @@ LL - let _: E = E::Unit();
LL + let _: E = E::Unit;
|
+error[E0533]: expected value, found struct variant `m::n::Z::Struct`
+ --> $DIR/privacy-enum-ctor.rs:64:16
+ |
+LL | let _: Z = m::n::Z::Struct;
+ | ^^^^^^^^^^^^^^^ not a value
+
error: aborting due to 23 previous errors
-Some errors have detailed explanations: E0308, E0412, E0423, E0603, E0618.
+Some errors have detailed explanations: E0308, E0412, E0423, E0533, E0603, E0618.
For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr
index 9f9ed6889..b3042d413 100644
--- a/src/test/ui/resolve/resolve-self-in-impl.stderr
+++ b/src/test/ui/resolve/resolve-self-in-impl.stderr
@@ -1,40 +1,40 @@
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:14:13
+ --> $DIR/resolve-self-in-impl.rs:16:6
|
-LL | impl Tr for Self {}
- | ^^^^
+LL | impl Self {}
+ | ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:15:15
+ --> $DIR/resolve-self-in-impl.rs:17:8
|
-LL | impl Tr for S<Self> {}
- | ^^^^
+LL | impl S<Self> {}
+ | ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:16:6
+ --> $DIR/resolve-self-in-impl.rs:18:7
|
-LL | impl Self {}
- | ^^^^
+LL | impl (Self, Self) {}
+ | ^^^^ ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:17:8
+ --> $DIR/resolve-self-in-impl.rs:14:13
|
-LL | impl S<Self> {}
- | ^^^^
+LL | impl Tr for Self {}
+ | ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:18:7
+ --> $DIR/resolve-self-in-impl.rs:15:15
|
-LL | impl (Self, Self) {}
- | ^^^^ ^^^^
+LL | impl Tr for S<Self> {}
+ | ^^^^
|
= note: replace `Self` with a different type
diff --git a/src/test/ui/resolve/typo-suggestion-mistyped-in-path.rs b/src/test/ui/resolve/typo-suggestion-mistyped-in-path.rs
new file mode 100644
index 000000000..3ce17a14f
--- /dev/null
+++ b/src/test/ui/resolve/typo-suggestion-mistyped-in-path.rs
@@ -0,0 +1,42 @@
+struct Struct;
+//~^ NOTE function or associated item `fob` not found for this struct
+
+impl Struct {
+ fn foo() { }
+}
+
+mod module {
+ fn foo() { }
+
+ struct Struct;
+
+ impl Struct {
+ fn foo() { }
+ }
+}
+
+trait Trait {
+ fn foo();
+}
+
+fn main() {
+ Struct::fob();
+ //~^ ERROR no function or associated item named `fob` found for struct `Struct` in the current scope
+ //~| NOTE function or associated item not found in `Struct`
+
+ Struc::foo();
+ //~^ ERROR failed to resolve: use of undeclared type `Struc`
+ //~| NOTE use of undeclared type `Struc`
+
+ modul::foo();
+ //~^ ERROR failed to resolve: use of undeclared crate or module `modul`
+ //~| NOTE use of undeclared crate or module `modul`
+
+ module::Struc::foo();
+ //~^ ERROR failed to resolve: could not find `Struc` in `module`
+ //~| NOTE could not find `Struc` in `module`
+
+ Trai::foo();
+ //~^ ERROR failed to resolve: use of undeclared type `Trai`
+ //~| NOTE use of undeclared type `Trai`
+}
diff --git a/src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr
new file mode 100644
index 000000000..89b69e140
--- /dev/null
+++ b/src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr
@@ -0,0 +1,54 @@
+error[E0433]: failed to resolve: could not find `Struc` in `module`
+ --> $DIR/typo-suggestion-mistyped-in-path.rs:35:13
+ |
+LL | module::Struc::foo();
+ | ^^^^^
+ | |
+ | could not find `Struc` in `module`
+ | help: a struct with a similar name exists: `Struct`
+
+error[E0599]: no function or associated item named `fob` found for struct `Struct` in the current scope
+ --> $DIR/typo-suggestion-mistyped-in-path.rs:23:13
+ |
+LL | struct Struct;
+ | ------------- function or associated item `fob` not found for this struct
+...
+LL | Struct::fob();
+ | ^^^
+ | |
+ | function or associated item not found in `Struct`
+ | help: there is an associated function with a similar name: `foo`
+
+error[E0433]: failed to resolve: use of undeclared type `Struc`
+ --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5
+ |
+LL | Struc::foo();
+ | ^^^^^
+ | |
+ | use of undeclared type `Struc`
+ | help: a struct with a similar name exists: `Struct`
+
+error[E0433]: failed to resolve: use of undeclared crate or module `modul`
+ --> $DIR/typo-suggestion-mistyped-in-path.rs:31:5
+ |
+LL | modul::foo();
+ | ^^^^^ use of undeclared crate or module `modul`
+ |
+help: there is a crate or module with a similar name
+ |
+LL | module::foo();
+ | ~~~~~~
+
+error[E0433]: failed to resolve: use of undeclared type `Trai`
+ --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5
+ |
+LL | Trai::foo();
+ | ^^^^
+ | |
+ | use of undeclared type `Trai`
+ | help: a trait with a similar name exists: `Trait`
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0433, E0599.
+For more information about an error, try `rustc --explain E0433`.
diff --git a/src/test/ui/resolve/use_suggestion.stderr b/src/test/ui/resolve/use_suggestion.stderr
index 4fff179b1..54ad85383 100644
--- a/src/test/ui/resolve/use_suggestion.stderr
+++ b/src/test/ui/resolve/use_suggestion.stderr
@@ -1,14 +1,8 @@
-error[E0433]: failed to resolve: use of undeclared type `GooMap`
- --> $DIR/use_suggestion.rs:3:14
- |
-LL | let x2 = GooMap::new();
- | ^^^^^^ use of undeclared type `GooMap`
-
error[E0433]: failed to resolve: use of undeclared type `HashMap`
--> $DIR/use_suggestion.rs:2:14
|
LL | let x1 = HashMap::new();
- | ^^^^^^^ not found in this scope
+ | ^^^^^^^ use of undeclared type `HashMap`
|
help: consider importing this struct
|
@@ -32,6 +26,12 @@ error[E0412]: cannot find type `GooMap` in this scope
LL | let y2: GooMap;
| ^^^^^^ not found in this scope
+error[E0433]: failed to resolve: use of undeclared type `GooMap`
+ --> $DIR/use_suggestion.rs:3:14
+ |
+LL | let x2 = GooMap::new();
+ | ^^^^^^ use of undeclared type `GooMap`
+
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0412, E0433.