summaryrefslogtreecommitdiffstats
path: root/src/test/ui/resolve
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:28 +0000
commit94a0819fe3a0d679c3042a77bfe6a2afc505daea (patch)
tree2b827afe6a05f3538db3f7803a88c4587fe85648 /src/test/ui/resolve
parentAdding upstream version 1.64.0+dfsg1. (diff)
downloadrustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.tar.xz
rustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.zip
Adding upstream version 1.66.0+dfsg1.upstream/1.66.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/resolve')
-rw-r--r--src/test/ui/resolve/bad-env-capture.stderr12
-rw-r--r--src/test/ui/resolve/bad-env-capture2.stderr12
-rw-r--r--src/test/ui/resolve/bad-env-capture3.stderr12
-rw-r--r--src/test/ui/resolve/bad-expr-path.stderr12
-rw-r--r--src/test/ui/resolve/bad-expr-path2.stderr12
-rw-r--r--src/test/ui/resolve/bad-type-env-capture.stderr6
-rw-r--r--src/test/ui/resolve/issue-100365.rs50
-rw-r--r--src/test/ui/resolve/issue-100365.stderr54
-rw-r--r--src/test/ui/resolve/issue-102946.rs7
-rw-r--r--src/test/ui/resolve/issue-102946.stderr26
-rw-r--r--src/test/ui/resolve/issue-103202.rs7
-rw-r--r--src/test/ui/resolve/issue-103202.stderr9
-rw-r--r--src/test/ui/resolve/issue-14254.stderr127
-rw-r--r--src/test/ui/resolve/issue-22692.rs59
-rw-r--r--src/test/ui/resolve/issue-22692.stderr85
-rw-r--r--src/test/ui/resolve/issue-23305.rs2
-rw-r--r--src/test/ui/resolve/issue-23305.stderr16
-rw-r--r--src/test/ui/resolve/issue-2356.stderr90
-rw-r--r--src/test/ui/resolve/issue-3021-c.stderr16
-rw-r--r--src/test/ui/resolve/issue-42944.stderr24
-rw-r--r--src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs1
-rw-r--r--src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr43
-rw-r--r--src/test/ui/resolve/issue-73427.rs6
-rw-r--r--src/test/ui/resolve/issue-73427.stderr74
-rw-r--r--src/test/ui/resolve/levenshtein.stderr18
-rw-r--r--src/test/ui/resolve/name-collision-in-trait-fn-sig.rs11
-rw-r--r--src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs21
-rw-r--r--src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr17
-rw-r--r--src/test/ui/resolve/privacy-enum-ctor.stderr28
-rw-r--r--src/test/ui/resolve/resolve-assoc-suggestions.stderr2
-rw-r--r--src/test/ui/resolve/resolve-hint-macro.stderr22
-rw-r--r--src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr8
-rw-r--r--src/test/ui/resolve/resolve-inconsistent-names.rs1
-rw-r--r--src/test/ui/resolve/resolve-inconsistent-names.stderr9
-rw-r--r--src/test/ui/resolve/resolve-primitive-fallback.stderr2
-rw-r--r--src/test/ui/resolve/resolve-self-in-impl.rs9
-rw-r--r--src/test/ui/resolve/resolve-self-in-impl.stderr74
-rw-r--r--src/test/ui/resolve/resolve-speculative-adjustment.stderr12
-rw-r--r--src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr18
-rw-r--r--src/test/ui/resolve/suggest-path-for-tuple-struct.stderr8
-rw-r--r--src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs52
-rw-r--r--src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr82
-rw-r--r--src/test/ui/resolve/tuple-struct-alias.stderr16
-rw-r--r--src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr38
44 files changed, 824 insertions, 386 deletions
diff --git a/src/test/ui/resolve/bad-env-capture.stderr b/src/test/ui/resolve/bad-env-capture.stderr
index f78a38a3d..59b1fabfd 100644
--- a/src/test/ui/resolve/bad-env-capture.stderr
+++ b/src/test/ui/resolve/bad-env-capture.stderr
@@ -6,18 +6,18 @@ LL | fn bar() { log(debug, x); }
|
= help: use the `|| { ... }` closure form instead
-error[E0425]: cannot find function `log` in this scope
- --> $DIR/bad-env-capture.rs:4:16
- |
-LL | fn bar() { log(debug, x); }
- | ^^^ not found in this scope
-
error[E0425]: cannot find value `debug` in this scope
--> $DIR/bad-env-capture.rs:4:20
|
LL | fn bar() { log(debug, x); }
| ^^^^^ not found in this scope
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-env-capture.rs:4:16
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^ not found in this scope
+
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0425, E0434.
diff --git a/src/test/ui/resolve/bad-env-capture2.stderr b/src/test/ui/resolve/bad-env-capture2.stderr
index 57c807fd7..811c259de 100644
--- a/src/test/ui/resolve/bad-env-capture2.stderr
+++ b/src/test/ui/resolve/bad-env-capture2.stderr
@@ -6,18 +6,18 @@ LL | fn bar() { log(debug, x); }
|
= help: use the `|| { ... }` closure form instead
-error[E0425]: cannot find function `log` in this scope
- --> $DIR/bad-env-capture2.rs:3:16
- |
-LL | fn bar() { log(debug, x); }
- | ^^^ not found in this scope
-
error[E0425]: cannot find value `debug` in this scope
--> $DIR/bad-env-capture2.rs:3:20
|
LL | fn bar() { log(debug, x); }
| ^^^^^ not found in this scope
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-env-capture2.rs:3:16
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^ not found in this scope
+
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0425, E0434.
diff --git a/src/test/ui/resolve/bad-env-capture3.stderr b/src/test/ui/resolve/bad-env-capture3.stderr
index d6eb4f86e..eab37fde9 100644
--- a/src/test/ui/resolve/bad-env-capture3.stderr
+++ b/src/test/ui/resolve/bad-env-capture3.stderr
@@ -6,18 +6,18 @@ LL | fn bar() { log(debug, x); }
|
= help: use the `|| { ... }` closure form instead
-error[E0425]: cannot find function `log` in this scope
- --> $DIR/bad-env-capture3.rs:4:20
- |
-LL | fn bar() { log(debug, x); }
- | ^^^ not found in this scope
-
error[E0425]: cannot find value `debug` in this scope
--> $DIR/bad-env-capture3.rs:4:24
|
LL | fn bar() { log(debug, x); }
| ^^^^^ not found in this scope
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-env-capture3.rs:4:20
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^ not found in this scope
+
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0425, E0434.
diff --git a/src/test/ui/resolve/bad-expr-path.stderr b/src/test/ui/resolve/bad-expr-path.stderr
index 77c48c951..8261e8e53 100644
--- a/src/test/ui/resolve/bad-expr-path.stderr
+++ b/src/test/ui/resolve/bad-expr-path.stderr
@@ -1,9 +1,3 @@
-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[E0425]: cannot find value `debug` in this scope
--> $DIR/bad-expr-path.rs:4:9
|
@@ -16,6 +10,12 @@ 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
|
diff --git a/src/test/ui/resolve/bad-expr-path2.stderr b/src/test/ui/resolve/bad-expr-path2.stderr
index d06e10271..6e11296d9 100644
--- a/src/test/ui/resolve/bad-expr-path2.stderr
+++ b/src/test/ui/resolve/bad-expr-path2.stderr
@@ -1,9 +1,3 @@
-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[E0425]: cannot find value `debug` in this scope
--> $DIR/bad-expr-path2.rs:6:9
|
@@ -16,6 +10,12 @@ 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
|
diff --git a/src/test/ui/resolve/bad-type-env-capture.stderr b/src/test/ui/resolve/bad-type-env-capture.stderr
index 6f24c0d86..b6282c2d0 100644
--- a/src/test/ui/resolve/bad-type-env-capture.stderr
+++ b/src/test/ui/resolve/bad-type-env-capture.stderr
@@ -4,9 +4,9 @@ error[E0401]: can't use generic parameters from outer function
LL | fn foo<T>() {
| - type parameter from outer function
LL | fn bar(b: T) { }
- | --- ^ use of generic parameter from outer function
- | |
- | help: try using a local generic parameter instead: `bar<T>`
+ | - ^ use of generic parameter from outer function
+ | |
+ | help: try using a local generic parameter instead: `<T>`
error: aborting due to previous error
diff --git a/src/test/ui/resolve/issue-100365.rs b/src/test/ui/resolve/issue-100365.rs
new file mode 100644
index 000000000..1d8835036
--- /dev/null
+++ b/src/test/ui/resolve/issue-100365.rs
@@ -0,0 +1,50 @@
+fn main() {
+ let addr = Into::<std::net::IpAddr>.into([127, 0, 0, 1]);
+ //~^ ERROR expected value, found trait `Into`
+ //~| HELP use the path separator
+
+ let _ = Into.into(());
+ //~^ ERROR expected value, found trait `Into`
+ //~| HELP use the path separator
+
+ let _ = Into::<()>.into;
+ //~^ ERROR expected value, found trait `Into`
+ //~| HELP use the path separator
+}
+
+macro_rules! Trait {
+ () => {
+ ::std::iter::Iterator
+ //~^ ERROR expected value, found trait `std::iter::Iterator`
+ //~| ERROR expected value, found trait `std::iter::Iterator`
+ };
+}
+
+macro_rules! create {
+ () => {
+ Into::<String>.into("")
+ //~^ ERROR expected value, found trait `Into`
+ //~| HELP use the path separator
+ };
+}
+
+fn interaction_with_macros() {
+ //
+ // Note that if the receiver is a macro call, we do not want to suggest to replace
+ // `.` with `::` as that would be a syntax error.
+ // Since the receiver is a trait and not a type, we cannot suggest to surround
+ // it with angle brackets. It would be interpreted as a trait object type void of
+ // `dyn` which is most likely not what the user intended to write.
+ // `<_ as Trait!()>::` is also not an option as it's equally syntactically invalid.
+ //
+
+ Trait!().map(std::convert::identity); // no `help` here!
+
+ Trait!().map; // no `help` here!
+
+ //
+ // Ensure that the suggestion is shown for expressions inside of macro definitions.
+ //
+
+ let _ = create!();
+}
diff --git a/src/test/ui/resolve/issue-100365.stderr b/src/test/ui/resolve/issue-100365.stderr
new file mode 100644
index 000000000..372d77266
--- /dev/null
+++ b/src/test/ui/resolve/issue-100365.stderr
@@ -0,0 +1,54 @@
+error[E0423]: expected value, found trait `Into`
+ --> $DIR/issue-100365.rs:2:16
+ |
+LL | let addr = Into::<std::net::IpAddr>.into([127, 0, 0, 1]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::`
+
+error[E0423]: expected value, found trait `Into`
+ --> $DIR/issue-100365.rs:6:13
+ |
+LL | let _ = Into.into(());
+ | ^^^^- help: use the path separator to refer to an item: `::`
+
+error[E0423]: expected value, found trait `Into`
+ --> $DIR/issue-100365.rs:10:13
+ |
+LL | let _ = Into::<()>.into;
+ | ^^^^^^^^^^- help: use the path separator to refer to an item: `::`
+
+error[E0423]: expected value, found trait `std::iter::Iterator`
+ --> $DIR/issue-100365.rs:17:9
+ |
+LL | ::std::iter::Iterator
+ | ^^^^^^^^^^^^^^^^^^^^^ not a value
+...
+LL | Trait!().map(std::convert::identity); // no `help` here!
+ | -------- in this macro invocation
+ |
+ = note: this error originates in the macro `Trait` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found trait `std::iter::Iterator`
+ --> $DIR/issue-100365.rs:17:9
+ |
+LL | ::std::iter::Iterator
+ | ^^^^^^^^^^^^^^^^^^^^^ not a value
+...
+LL | Trait!().map; // no `help` here!
+ | -------- in this macro invocation
+ |
+ = note: this error originates in the macro `Trait` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found trait `Into`
+ --> $DIR/issue-100365.rs:25:9
+ |
+LL | Into::<String>.into("")
+ | ^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::`
+...
+LL | let _ = create!();
+ | --------- in this macro invocation
+ |
+ = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0423`.
diff --git a/src/test/ui/resolve/issue-102946.rs b/src/test/ui/resolve/issue-102946.rs
new file mode 100644
index 000000000..c6feca6f3
--- /dev/null
+++ b/src/test/ui/resolve/issue-102946.rs
@@ -0,0 +1,7 @@
+impl Error for str::Utf8Error {
+ //~^ ERROR cannot find trait `Error` in this scope
+ //~| ERROR ambiguous associated type
+ fn description(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/resolve/issue-102946.stderr b/src/test/ui/resolve/issue-102946.stderr
new file mode 100644
index 000000000..65be0258e
--- /dev/null
+++ b/src/test/ui/resolve/issue-102946.stderr
@@ -0,0 +1,26 @@
+error[E0405]: cannot find trait `Error` in this scope
+ --> $DIR/issue-102946.rs:1:6
+ |
+LL | impl Error for str::Utf8Error {
+ | ^^^^^ not found in this scope
+ |
+help: consider importing this trait
+ |
+LL | use std::error::Error;
+ |
+
+error[E0223]: ambiguous associated type
+ --> $DIR/issue-102946.rs:1:16
+ |
+LL | impl Error for str::Utf8Error {
+ | ^^^^^^^^^^^^^^
+ |
+help: you are looking for the module in `std`, not the primitive type
+ |
+LL | impl Error for std::str::Utf8Error {
+ | +++++
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0223, E0405.
+For more information about an error, try `rustc --explain E0223`.
diff --git a/src/test/ui/resolve/issue-103202.rs b/src/test/ui/resolve/issue-103202.rs
new file mode 100644
index 000000000..469d9d7c8
--- /dev/null
+++ b/src/test/ui/resolve/issue-103202.rs
@@ -0,0 +1,7 @@
+struct S {}
+
+impl S {
+ fn f(self: &S::x) {} //~ ERROR ambiguous associated type
+}
+
+fn main() {}
diff --git a/src/test/ui/resolve/issue-103202.stderr b/src/test/ui/resolve/issue-103202.stderr
new file mode 100644
index 000000000..880389371
--- /dev/null
+++ b/src/test/ui/resolve/issue-103202.stderr
@@ -0,0 +1,9 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/issue-103202.rs:4:17
+ |
+LL | fn f(self: &S::x) {}
+ | ^^^^ help: use fully-qualified syntax: `<S as Trait>::x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0223`.
diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr
index b1f45adb8..690a40f7e 100644
--- a/src/test/ui/resolve/issue-14254.stderr
+++ b/src/test/ui/resolve/issue-14254.stderr
@@ -1,21 +1,9 @@
-error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:19:9
- |
-LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
-
error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:21:9
|
LL | a;
| ^ not found in this scope
-error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:28:9
- |
-LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
-
error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:30:9
|
@@ -38,7 +26,12 @@ error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:36:9
|
LL | bah;
- | ^^^ help: you might have meant to call the associated function: `Self::bah`
+ | ^^^
+ |
+help: you might have meant to refer to the associated function
+ |
+LL | Self::bah;
+ | ~~~~~~~~~
error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:38:9
@@ -46,12 +39,6 @@ error[E0425]: cannot find value `b` in this scope
LL | b;
| ^ not found in this scope
-error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:45:9
- |
-LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
-
error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:47:9
|
@@ -74,7 +61,12 @@ error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:53:9
|
LL | bah;
- | ^^^ help: you might have meant to call the associated function: `Self::bah`
+ | ^^^
+ |
+help: you might have meant to refer to the associated function
+ |
+LL | Self::bah;
+ | ~~~~~~~~~
error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:55:9
@@ -82,65 +74,108 @@ error[E0425]: cannot find value `b` in this scope
LL | b;
| ^ not found in this scope
-error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:62:9
+error[E0425]: cannot find value `bah` in this scope
+ --> $DIR/issue-14254.rs:64:9
|
-LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+LL | bah;
+ | ^^^
+ |
+help: you might have meant to refer to the associated function
+ |
+LL | Self::bah;
+ | ~~~~~~~~~
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:64:9
+ --> $DIR/issue-14254.rs:73:9
+ |
+LL | bah;
+ | ^^^
+ |
+help: you might have meant to refer to the associated function
+ |
+LL | Self::bah;
+ | ~~~~~~~~~
+
+error[E0425]: cannot find value `bah` in this scope
+ --> $DIR/issue-14254.rs:82:9
+ |
+LL | bah;
+ | ^^^
+ |
+help: you might have meant to refer to the associated function
+ |
+LL | Self::bah;
+ | ~~~~~~~~~
+
+error[E0425]: cannot find value `bah` in this scope
+ --> $DIR/issue-14254.rs:91:9
+ |
+LL | bah;
+ | ^^^
+ |
+help: you might have meant to refer to the associated function
+ |
+LL | Self::bah;
+ | ~~~~~~~~~
+
+error[E0425]: cannot find value `bah` in this scope
+ --> $DIR/issue-14254.rs:100:9
|
LL | bah;
- | ^^^ help: you might have meant to call the associated function: `Self::bah`
+ | ^^^
+ |
+help: you might have meant to refer to the associated function
+ |
+LL | Self::bah;
+ | ~~~~~~~~~
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:71:9
+ --> $DIR/issue-14254.rs:19:9
|
LL | baz();
| ^^^ help: you might have meant to call the method: `self.baz`
-error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:73:9
+error[E0425]: cannot find function `baz` in this scope
+ --> $DIR/issue-14254.rs:28:9
|
-LL | bah;
- | ^^^ help: you might have meant to call the associated function: `Self::bah`
+LL | baz();
+ | ^^^ help: you might have meant to call the method: `self.baz`
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:80:9
+ --> $DIR/issue-14254.rs:45:9
|
LL | baz();
| ^^^ help: you might have meant to call the method: `self.baz`
-error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:82:9
+error[E0425]: cannot find function `baz` in this scope
+ --> $DIR/issue-14254.rs:62:9
|
-LL | bah;
- | ^^^ help: you might have meant to call the associated function: `Self::bah`
+LL | baz();
+ | ^^^ help: you might have meant to call the method: `self.baz`
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:89:9
+ --> $DIR/issue-14254.rs:71:9
|
LL | baz();
| ^^^ help: you might have meant to call the method: `self.baz`
-error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:91:9
+error[E0425]: cannot find function `baz` in this scope
+ --> $DIR/issue-14254.rs:80:9
|
-LL | bah;
- | ^^^ help: you might have meant to call the associated function: `Self::bah`
+LL | baz();
+ | ^^^ help: you might have meant to call the method: `self.baz`
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:98:9
+ --> $DIR/issue-14254.rs:89:9
|
LL | baz();
| ^^^ help: you might have meant to call the method: `self.baz`
-error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:100:9
+error[E0425]: cannot find function `baz` in this scope
+ --> $DIR/issue-14254.rs:98:9
|
-LL | bah;
- | ^^^ help: you might have meant to call the associated function: `Self::bah`
+LL | baz();
+ | ^^^ help: you might have meant to call the method: `self.baz`
error: aborting due to 24 previous errors
diff --git a/src/test/ui/resolve/issue-22692.rs b/src/test/ui/resolve/issue-22692.rs
index 1d8f44222..31a762614 100644
--- a/src/test/ui/resolve/issue-22692.rs
+++ b/src/test/ui/resolve/issue-22692.rs
@@ -1,3 +1,60 @@
fn main() {
- let _ = String.new(); //~ ERROR expected value, found struct `String`
+ let _ = String.new();
+ //~^ ERROR expected value, found struct `String`
+ //~| HELP use the path separator
+
+ let _ = String.default;
+ //~^ ERROR expected value, found struct `String`
+ //~| HELP use the path separator
+
+ let _ = Vec::<()>.with_capacity(1);
+ //~^ ERROR expected value, found struct `Vec`
+ //~| HELP use the path separator
+}
+
+macro_rules! Type {
+ () => {
+ ::std::cell::Cell
+ //~^ ERROR expected value, found struct `std::cell::Cell`
+ //~| ERROR expected value, found struct `std::cell::Cell`
+ //~| ERROR expected value, found struct `std::cell::Cell`
+ };
+}
+
+macro_rules! create {
+ (type method) => {
+ Vec.new()
+ //~^ ERROR expected value, found struct `Vec`
+ //~| HELP use the path separator
+ };
+ (type field) => {
+ Vec.new
+ //~^ ERROR expected value, found struct `Vec`
+ //~| HELP use the path separator
+ };
+ (macro method) => {
+ Type!().new(0)
+ //~^ HELP use the path separator
+ };
+}
+
+fn interaction_with_macros() {
+ //
+ // Verify that we do not only suggest to replace `.` with `::` if the receiver is a
+ // macro call but that we also correctly suggest to surround it with angle brackets.
+ //
+
+ Type!().get();
+ //~^ HELP use the path separator
+
+ Type! {}.get;
+ //~^ HELP use the path separator
+
+ //
+ // Ensure that the suggestion is shown for expressions inside of macro definitions.
+ //
+
+ let _ = create!(type method);
+ let _ = create!(type field);
+ let _ = create!(macro method);
}
diff --git a/src/test/ui/resolve/issue-22692.stderr b/src/test/ui/resolve/issue-22692.stderr
index e076419f6..6962aa161 100644
--- a/src/test/ui/resolve/issue-22692.stderr
+++ b/src/test/ui/resolve/issue-22692.stderr
@@ -2,10 +2,87 @@ error[E0423]: expected value, found struct `String`
--> $DIR/issue-22692.rs:2:13
|
LL | let _ = String.new();
- | ^^^^^^----
- | |
- | help: use the path separator to refer to an item: `String::new`
+ | ^^^^^^- help: use the path separator to refer to an item: `::`
-error: aborting due to previous error
+error[E0423]: expected value, found struct `String`
+ --> $DIR/issue-22692.rs:6:13
+ |
+LL | let _ = String.default;
+ | ^^^^^^- help: use the path separator to refer to an item: `::`
+
+error[E0423]: expected value, found struct `Vec`
+ --> $DIR/issue-22692.rs:10:13
+ |
+LL | let _ = Vec::<()>.with_capacity(1);
+ | ^^^^^^^^^- help: use the path separator to refer to an item: `::`
+
+error[E0423]: expected value, found struct `std::cell::Cell`
+ --> $DIR/issue-22692.rs:17:9
+ |
+LL | ::std::cell::Cell
+ | ^^^^^^^^^^^^^^^^^
+...
+LL | Type!().get();
+ | ------- in this macro invocation
+ |
+ = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: use the path separator to refer to an item
+ |
+LL | <Type!()>::get();
+ | ~~~~~~~~~~~
+
+error[E0423]: expected value, found struct `std::cell::Cell`
+ --> $DIR/issue-22692.rs:17:9
+ |
+LL | ::std::cell::Cell
+ | ^^^^^^^^^^^^^^^^^
+...
+LL | Type! {}.get;
+ | -------- in this macro invocation
+ |
+ = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: use the path separator to refer to an item
+ |
+LL | <Type! {}>::get;
+ | ~~~~~~~~~~~~
+
+error[E0423]: expected value, found struct `Vec`
+ --> $DIR/issue-22692.rs:26:9
+ |
+LL | Vec.new()
+ | ^^^- help: use the path separator to refer to an item: `::`
+...
+LL | let _ = create!(type method);
+ | -------------------- in this macro invocation
+ |
+ = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found struct `Vec`
+ --> $DIR/issue-22692.rs:31:9
+ |
+LL | Vec.new
+ | ^^^- help: use the path separator to refer to an item: `::`
+...
+LL | let _ = create!(type field);
+ | ------------------- in this macro invocation
+ |
+ = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found struct `std::cell::Cell`
+ --> $DIR/issue-22692.rs:17:9
+ |
+LL | ::std::cell::Cell
+ | ^^^^^^^^^^^^^^^^^
+...
+LL | let _ = create!(macro method);
+ | --------------------- in this macro invocation
+ |
+ = note: this error originates in the macro `Type` which comes from the expansion of the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: use the path separator to refer to an item
+ |
+LL | <Type!()>::new(0)
+ | ~~~~~~~~~~~
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0423`.
diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs
index 95635e12a..6d7fe7c50 100644
--- a/src/test/ui/resolve/issue-23305.rs
+++ b/src/test/ui/resolve/issue-23305.rs
@@ -3,6 +3,6 @@ pub trait ToNbt<T> {
}
impl dyn ToNbt<Self> {}
-//~^ ERROR cycle detected
+//~^ ERROR `Self` is not valid in the self type of an impl block
fn main() {}
diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr
index 20aeb7b99..aad1b583a 100644
--- a/src/test/ui/resolve/issue-23305.stderr
+++ b/src/test/ui/resolve/issue-23305.stderr
@@ -1,22 +1,10 @@
-error[E0391]: cycle detected when computing type of `<impl at $DIR/issue-23305.rs:5:1: 5:21>`
+error: `Self` is not valid in the self type of an impl block
--> $DIR/issue-23305.rs:5:16
|
LL | impl dyn ToNbt<Self> {}
| ^^^^
|
- = note: ...which immediately requires computing type of `<impl at $DIR/issue-23305.rs:5:1: 5:21>` again
-note: cycle used when collecting item types in top-level module
- --> $DIR/issue-23305.rs:1:1
- |
-LL | / pub trait ToNbt<T> {
-LL | | fn new(val: T) -> Self;
-LL | | }
-LL | |
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: replace `Self` with a different type
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr
index b8d528efc..e7c53ff44 100644
--- a/src/test/ui/resolve/issue-2356.stderr
+++ b/src/test/ui/resolve/issue-2356.stderr
@@ -1,15 +1,3 @@
-error[E0425]: cannot find function `shave` in this scope
- --> $DIR/issue-2356.rs:17:5
- |
-LL | shave();
- | ^^^^^ not found in this scope
-
-error[E0425]: cannot find function `clone` in this scope
- --> $DIR/issue-2356.rs:24:5
- |
-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
|
@@ -31,6 +19,51 @@ error[E0425]: cannot find value `whiskers` in this scope
LL | whiskers -= other;
| ^^^^^^^^ a field by this name exists in `Self`
+error[E0424]: expected value, found module `self`
+ --> $DIR/issue-2356.rs:65:8
+ |
+LL | fn meow() {
+ | ---- this function doesn't have a `self` parameter
+LL | if self.whiskers > 3 {
+ | ^^^^ `self` value is a keyword only available in methods with a `self` parameter
+ |
+help: add a `self` receiver parameter to make the associated `fn` a method
+ |
+LL | fn meow(&self) {
+ | +++++
+
+error[E0425]: cannot find value `whiskers` in this scope
+ --> $DIR/issue-2356.rs:79:5
+ |
+LL | whiskers = 0;
+ | ^^^^^^^^ help: you might have meant to use the available field: `self.whiskers`
+
+error[E0425]: cannot find value `whiskers` in this scope
+ --> $DIR/issue-2356.rs:84:5
+ |
+LL | whiskers = 4;
+ | ^^^^^^^^ a field by this name exists in `Self`
+
+error[E0424]: expected value, found module `self`
+ --> $DIR/issue-2356.rs:92:5
+ |
+LL | fn main() {
+ | ---- this function can't have a `self` parameter
+LL | self += 1;
+ | ^^^^ `self` value is a keyword only available in methods with a `self` parameter
+
+error[E0425]: cannot find function `shave` in this scope
+ --> $DIR/issue-2356.rs:17:5
+ |
+LL | shave();
+ | ^^^^^ not found in this scope
+
+error[E0425]: cannot find function `clone` in this scope
+ --> $DIR/issue-2356.rs:24:5
+ |
+LL | clone();
+ | ^^^^^ help: you might have meant to call the method: `self.clone`
+
error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:41:5
|
@@ -72,19 +105,6 @@ error[E0425]: cannot find function `purr` in this scope
LL | purr();
| ^^^^ not found in this scope
-error[E0424]: expected value, found module `self`
- --> $DIR/issue-2356.rs:65:8
- |
-LL | fn meow() {
- | ---- this function doesn't have a `self` parameter
-LL | if self.whiskers > 3 {
- | ^^^^ `self` value is a keyword only available in methods with a `self` parameter
- |
-help: add a `self` receiver parameter to make the associated `fn` a method
- |
-LL | fn meow(&self) {
- | +++++
-
error[E0425]: cannot find function `grow_older` in this scope
--> $DIR/issue-2356.rs:72:5
|
@@ -102,32 +122,12 @@ error[E0425]: cannot find function `shave` in this scope
LL | shave();
| ^^^^^ not found in this scope
-error[E0425]: cannot find value `whiskers` in this scope
- --> $DIR/issue-2356.rs:79:5
- |
-LL | whiskers = 0;
- | ^^^^^^^^ help: you might have meant to use the available field: `self.whiskers`
-
-error[E0425]: cannot find value `whiskers` in this scope
- --> $DIR/issue-2356.rs:84:5
- |
-LL | whiskers = 4;
- | ^^^^^^^^ a field by this name exists in `Self`
-
error[E0425]: cannot find function `purr_louder` in this scope
--> $DIR/issue-2356.rs:86:5
|
LL | purr_louder();
| ^^^^^^^^^^^ not found in this scope
-error[E0424]: expected value, found module `self`
- --> $DIR/issue-2356.rs:92:5
- |
-LL | fn main() {
- | ---- this function can't have a `self` parameter
-LL | self += 1;
- | ^^^^ `self` value is a keyword only available in methods with a `self` parameter
-
error: aborting due to 17 previous errors
Some errors have detailed explanations: E0424, E0425.
diff --git a/src/test/ui/resolve/issue-3021-c.stderr b/src/test/ui/resolve/issue-3021-c.stderr
index 8764ac8a8..5176efc3a 100644
--- a/src/test/ui/resolve/issue-3021-c.stderr
+++ b/src/test/ui/resolve/issue-3021-c.stderr
@@ -3,22 +3,22 @@ error[E0401]: can't use generic parameters from outer function
|
LL | fn siphash<T>() {
| - type parameter from outer function
-...
+LL |
+LL | trait U {
+ | - help: try using a local generic parameter instead: `<T>`
LL | fn g(&self, x: T) -> T;
- | - ^ use of generic parameter from outer function
- | |
- | help: try using a local generic parameter instead: `g<T>`
+ | ^ use of generic parameter from outer function
error[E0401]: can't use generic parameters from outer function
--> $DIR/issue-3021-c.rs:4:30
|
LL | fn siphash<T>() {
| - type parameter from outer function
-...
+LL |
+LL | trait U {
+ | - help: try using a local generic parameter instead: `<T>`
LL | fn g(&self, x: T) -> T;
- | - ^ use of generic parameter from outer function
- | |
- | help: try using a local generic parameter instead: `g<T>`
+ | ^ use of generic parameter from outer function
error: aborting due to 2 previous errors
diff --git a/src/test/ui/resolve/issue-42944.stderr b/src/test/ui/resolve/issue-42944.stderr
index cad3ccc4a..0ee9fd391 100644
--- a/src/test/ui/resolve/issue-42944.stderr
+++ b/src/test/ui/resolve/issue-42944.stderr
@@ -1,15 +1,3 @@
-error[E0423]: cannot initialize a tuple struct which contains private fields
- --> $DIR/issue-42944.rs:9:9
- |
-LL | Bx(());
- | ^^
- |
-note: constructor is not visible here due to private fields
- --> $DIR/issue-42944.rs:2:19
- |
-LL | pub struct Bx(());
- | ^^ private field
-
error[E0425]: cannot find function, tuple struct or tuple variant `Bx` in this scope
--> $DIR/issue-42944.rs:16:9
|
@@ -22,6 +10,18 @@ note: tuple struct `foo::Bx` exists but is inaccessible
LL | pub struct Bx(());
| ^^^^^^^^^^^^^^^^^^ not accessible
+error[E0423]: cannot initialize a tuple struct which contains private fields
+ --> $DIR/issue-42944.rs:9:9
+ |
+LL | Bx(());
+ | ^^
+ |
+note: constructor is not visible here due to private fields
+ --> $DIR/issue-42944.rs:2:19
+ |
+LL | pub struct Bx(());
+ | ^^ private field
+
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0423, E0425.
diff --git a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
index aaf0f7eae..49462f52f 100644
--- a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
+++ b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
@@ -14,7 +14,6 @@ trait B {
impl B for A {
async fn associated(); //~ ERROR without body
//~^ ERROR cannot be declared `async`
- //~| ERROR has an incompatible type for trait
}
fn main() {}
diff --git a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
index d3214458e..1354abb4f 100644
--- a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
+++ b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
@@ -14,17 +14,6 @@ LL | async fn inherent();
| |
| help: provide a definition for the function: `{ <body> }`
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5
- |
-LL | async fn associated();
- | -----^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
-
error: associated function in `impl` without body
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
@@ -34,7 +23,7 @@ LL | async fn associated();
| help: provide a definition for the function: `{ <body> }`
error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
+ --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5
|
LL | async fn associated();
| -----^^^^^^^^^^^^^^^^^
@@ -43,26 +32,22 @@ LL | async fn associated();
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-error[E0053]: method `associated` has an incompatible type for trait
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:26
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
LL | async fn associated();
- | ^
- | |
- | checked the `Output` of this `async fn`, found opaque type
- | expected `()`, found opaque type
- |
- = note: while checking the return type of the `async fn`
-note: type in trait
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:26
+ | -----^^^^^^^^^^^^^^^^^
+ | |
+ | `async` because of this
|
-LL | async fn associated();
- | ^
- = note: expected fn pointer `fn()`
- found fn pointer `fn() -> impl Future<Output = ()>`
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0053, E0706.
-For more information about an error, try `rustc --explain E0053`.
+For more information about this error, try `rustc --explain E0706`.
diff --git a/src/test/ui/resolve/issue-73427.rs b/src/test/ui/resolve/issue-73427.rs
index 3c62782a8..5c2459a59 100644
--- a/src/test/ui/resolve/issue-73427.rs
+++ b/src/test/ui/resolve/issue-73427.rs
@@ -22,6 +22,10 @@ enum D {
Unit,
}
+enum E {
+ TupleWithFields(()),
+}
+
fn main() {
// Only variants without fields are suggested (and others mentioned in a note) where an enum
// is used rather than a variant.
@@ -34,6 +38,8 @@ fn main() {
//~^ ERROR expected value, found enum `C`
D.foo();
//~^ ERROR expected value, found enum `D`
+ E.foo();
+ //~^ ERROR expected value, found enum `E`
// Only tuple variants are suggested in calls or tuple struct pattern matching.
diff --git a/src/test/ui/resolve/issue-73427.stderr b/src/test/ui/resolve/issue-73427.stderr
index 59bb98a34..d31c5e477 100644
--- a/src/test/ui/resolve/issue-73427.stderr
+++ b/src/test/ui/resolve/issue-73427.stderr
@@ -1,5 +1,5 @@
error[E0423]: expected value, found enum `A`
- --> $DIR/issue-73427.rs:29:5
+ --> $DIR/issue-73427.rs:33:5
|
LL | A.foo();
| ^
@@ -23,7 +23,7 @@ LL | (A::Tuple()).foo();
| ~~~~~~~~~~~~
LL | A::Unit.foo();
| ~~~~~~~
-help: the following enum variants are available
+help: alternatively, the following enum variants are also available
|
LL | (A::StructWithFields { /* fields */ }).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -31,7 +31,7 @@ LL | (A::TupleWithFields(/* fields */)).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0423]: expected value, found enum `B`
- --> $DIR/issue-73427.rs:31:5
+ --> $DIR/issue-73427.rs:35:5
|
LL | B.foo();
| ^
@@ -52,7 +52,7 @@ LL | (B::TupleWithFields(/* fields */)).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0423]: expected value, found enum `C`
- --> $DIR/issue-73427.rs:33:5
+ --> $DIR/issue-73427.rs:37:5
|
LL | C.foo();
| ^
@@ -70,7 +70,7 @@ help: you might have meant to use the following enum variant
|
LL | C::Unit.foo();
| ~~~~~~~
-help: the following enum variants are available
+help: alternatively, the following enum variants are also available
|
LL | (C::StructWithFields { /* fields */ }).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -78,7 +78,7 @@ LL | (C::TupleWithFields(/* fields */)).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0423]: expected value, found enum `D`
- --> $DIR/issue-73427.rs:35:5
+ --> $DIR/issue-73427.rs:39:5
|
LL | D.foo();
| ^
@@ -95,38 +95,37 @@ help: you might have meant to use the following enum variant
|
LL | D::Unit.foo();
| ~~~~~~~
-help: the following enum variant is available
+help: alternatively, the following enum variant is available
|
LL | (D::TupleWithFields(/* fields */)).foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-error[E0423]: expected function, tuple struct or tuple variant, found enum `A`
- --> $DIR/issue-73427.rs:40:13
+error[E0423]: expected value, found enum `E`
+ --> $DIR/issue-73427.rs:41:5
|
-LL | let x = A(3);
- | ^
+LL | E.foo();
+ | ^
|
- = help: you might have meant to construct one of the enum's non-tuple variants
note: the enum is defined here
- --> $DIR/issue-73427.rs:1:1
+ --> $DIR/issue-73427.rs:25:1
|
-LL | / enum A {
-LL | | StructWithFields { x: () },
+LL | / enum E {
LL | | TupleWithFields(()),
-LL | | Struct {},
-LL | | Tuple(),
-LL | | Unit,
LL | | }
| |_^
-help: try to construct one of the enum's variants
+help: the following enum variant is available
+ |
+LL | (E::TupleWithFields(/* fields */)).foo();
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+help: consider importing one of these items instead
+ |
+LL | use std::f32::consts::E;
+ |
+LL | use std::f64::consts::E;
|
-LL | let x = A::Tuple(3);
- | ~~~~~~~~
-LL | let x = A::TupleWithFields(3);
- | ~~~~~~~~~~~~~~~~~~
error[E0532]: expected tuple struct or tuple variant, found enum `A`
- --> $DIR/issue-73427.rs:42:12
+ --> $DIR/issue-73427.rs:48:12
|
LL | if let A(3) = x { }
| ^
@@ -150,7 +149,32 @@ LL | if let A::Tuple(3) = x { }
LL | if let A::TupleWithFields(3) = x { }
| ~~~~~~~~~~~~~~~~~~
-error: aborting due to 6 previous errors
+error[E0423]: expected function, tuple struct or tuple variant, found enum `A`
+ --> $DIR/issue-73427.rs:46:13
+ |
+LL | let x = A(3);
+ | ^
+ |
+ = help: you might have meant to construct one of the enum's non-tuple variants
+note: the enum is defined here
+ --> $DIR/issue-73427.rs:1:1
+ |
+LL | / enum A {
+LL | | StructWithFields { x: () },
+LL | | TupleWithFields(()),
+LL | | Struct {},
+LL | | Tuple(),
+LL | | Unit,
+LL | | }
+ | |_^
+help: try to construct one of the enum's variants
+ |
+LL | let x = A::Tuple(3);
+ | ~~~~~~~~
+LL | let x = A::TupleWithFields(3);
+ | ~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 7 previous errors
Some errors have detailed explanations: E0423, E0532.
For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr
index 249a7e53d..9a2d61ea4 100644
--- a/src/test/ui/resolve/levenshtein.stderr
+++ b/src/test/ui/resolve/levenshtein.stderr
@@ -39,15 +39,6 @@ LL | const MAX_ITEM: usize = 10;
LL | let v = [0u32; MAXITEM]; // Misspelled constant name.
| ^^^^^^^ help: a constant with a similar name exists: `MAX_ITEM`
-error[E0425]: cannot find function `foobar` in this scope
- --> $DIR/levenshtein.rs:26:5
- |
-LL | fn foo_bar() {}
- | ------------ similarly named function `foo_bar` defined here
-...
-LL | foobar(); // Misspelled function name.
- | ^^^^^^ help: a function with a similar name exists: `foo_bar`
-
error[E0412]: cannot find type `first` in module `m`
--> $DIR/levenshtein.rs:28:15
|
@@ -66,6 +57,15 @@ LL | pub struct Second;
LL | let b: m::first = m::second; // Misspelled item in module.
| ^^^^^^ help: a unit struct with a similar name exists (notice the capitalization): `Second`
+error[E0425]: cannot find function `foobar` in this scope
+ --> $DIR/levenshtein.rs:26:5
+ |
+LL | fn foo_bar() {}
+ | ------------ similarly named function `foo_bar` defined here
+...
+LL | foobar(); // Misspelled function name.
+ | ^^^^^^ help: a function with a similar name exists: `foo_bar`
+
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0412, E0425.
diff --git a/src/test/ui/resolve/name-collision-in-trait-fn-sig.rs b/src/test/ui/resolve/name-collision-in-trait-fn-sig.rs
new file mode 100644
index 000000000..fba4ffa1c
--- /dev/null
+++ b/src/test/ui/resolve/name-collision-in-trait-fn-sig.rs
@@ -0,0 +1,11 @@
+// check-pass
+// This is currently stable behavior, which was almost accidentally made an
+// error in #102161 since there is no test exercising it. I am not sure if
+// this _should_ be the desired behavior, but at least we should know if it
+// changes.
+
+fn main() {}
+
+trait Foo {
+ fn fn_with_type_named_same_as_local_in_param(b: i32, b: i32);
+}
diff --git a/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs
new file mode 100644
index 000000000..bd496875e
--- /dev/null
+++ b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs
@@ -0,0 +1,21 @@
+trait Foo<T> {
+ fn foo(&self, name: T) -> usize;
+}
+
+struct Bar {
+ baz: Baz,
+}
+
+struct Baz {
+ num: usize,
+}
+
+impl<Baz> Foo<Baz> for Bar {
+ fn foo(&self, _name: Baz) -> usize {
+ match self.baz {
+ Baz { num } => num, //~ ERROR expected struct, variant or union type, found type parameter `Baz`
+ }
+ }
+}
+
+fn main() {}
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
new file mode 100644
index 000000000..eb26cd9ca
--- /dev/null
+++ b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr
@@ -0,0 +1,17 @@
+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 | Baz { num } => num,
+ | ^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr
index f885ac215..82a4211f0 100644
--- a/src/test/ui/resolve/privacy-enum-ctor.stderr
+++ b/src/test/ui/resolve/privacy-enum-ctor.stderr
@@ -19,7 +19,7 @@ help: you might have meant to use the following enum variant
|
LL | m::Z::Unit;
| ~~~~~~~~~~
-help: the following enum variants are available
+help: alternatively, the following enum variants are also available
|
LL | (m::Z::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -47,7 +47,7 @@ help: you might have meant to use the following enum variant
|
LL | m::Z::Unit;
| ~~~~~~~~~~
-help: the following enum variants are available
+help: alternatively, the following enum variants are also available
|
LL | (m::Z::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -89,7 +89,7 @@ help: you might have meant to use the following enum variant
|
LL | let _: E = E::Unit;
| ~~~~~~~
-help: the following enum variants are available
+help: alternatively, the following enum variants are also available
|
LL | let _: E = (E::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~
@@ -143,7 +143,7 @@ help: you might have meant to use the following enum variant
|
LL | let _: E = E::Unit;
| ~~~~~~~
-help: the following enum variants are available
+help: alternatively, the following enum variants are also available
|
LL | let _: E = (E::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~
@@ -203,7 +203,7 @@ help: you might have meant to use the following enum variant
|
LL | let _: Z = m::Z::Unit;
| ~~~~~~~~~~
-help: the following enum variants are available
+help: alternatively, the following enum variants are also available
|
LL | let _: Z = (m::Z::Fn(/* fields */));
| ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -327,10 +327,10 @@ LL | let _: Z = Z::Fn;
|
= note: expected enum `Z`
found fn item `fn(u8) -> Z {Z::Fn}`
-help: use parentheses to instantiate this tuple variant
+help: use parentheses to construct this tuple variant
|
-LL | let _: Z = Z::Fn(_);
- | +++
+LL | let _: Z = Z::Fn(/* u8 */);
+ | ++++++++++
error[E0618]: expected function, found enum variant `Z::Unit`
--> $DIR/privacy-enum-ctor.rs:31:17
@@ -362,10 +362,10 @@ LL | let _: E = m::E::Fn;
|
= note: expected enum `E`
found fn item `fn(u8) -> E {E::Fn}`
-help: use parentheses to instantiate this tuple variant
+help: use parentheses to construct this tuple variant
|
-LL | let _: E = m::E::Fn(_);
- | +++
+LL | let _: E = m::E::Fn(/* u8 */);
+ | ++++++++++
error[E0618]: expected function, found enum variant `m::E::Unit`
--> $DIR/privacy-enum-ctor.rs:47:16
@@ -397,10 +397,10 @@ LL | let _: E = E::Fn;
|
= note: expected enum `E`
found fn item `fn(u8) -> E {E::Fn}`
-help: use parentheses to instantiate this tuple variant
+help: use parentheses to construct this tuple variant
|
-LL | let _: E = E::Fn(_);
- | +++
+LL | let _: E = E::Fn(/* u8 */);
+ | ++++++++++
error[E0618]: expected function, found enum variant `E::Unit`
--> $DIR/privacy-enum-ctor.rs:55:16
diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr
index b6acaeb8c..8def9aa20 100644
--- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr
+++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr
@@ -50,7 +50,7 @@ error[E0425]: cannot find value `method` in this scope
--> $DIR/resolve-assoc-suggestions.rs:34:9
|
LL | method;
- | ^^^^^^ help: you might have meant to call the method: `self.method`
+ | ^^^^^^ help: you might have meant to refer to the method: `self.method`
error: aborting due to 9 previous errors
diff --git a/src/test/ui/resolve/resolve-hint-macro.stderr b/src/test/ui/resolve/resolve-hint-macro.stderr
index bc69ddd8f..1e7ab48ef 100644
--- a/src/test/ui/resolve/resolve-hint-macro.stderr
+++ b/src/test/ui/resolve/resolve-hint-macro.stderr
@@ -14,17 +14,6 @@ LL | assert_eq { 1, 1 };
| |
| while parsing this struct
-error[E0423]: expected function, found macro `assert_eq`
- --> $DIR/resolve-hint-macro.rs:3:5
- |
-LL | assert_eq(1, 1);
- | ^^^^^^^^^ not a function
- |
-help: use `!` to invoke the macro
- |
-LL | assert_eq!(1, 1);
- | +
-
error[E0574]: expected struct, variant or union type, found macro `assert_eq`
--> $DIR/resolve-hint-macro.rs:5:5
|
@@ -47,6 +36,17 @@ help: use `!` to invoke the macro
LL | assert![true];
| +
+error[E0423]: expected function, found macro `assert_eq`
+ --> $DIR/resolve-hint-macro.rs:3:5
+ |
+LL | assert_eq(1, 1);
+ | ^^^^^^^^^ not a function
+ |
+help: use `!` to invoke the macro
+ |
+LL | assert_eq!(1, 1);
+ | +
+
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0423, E0574.
diff --git a/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr
index 96c1869b4..c805c9eb1 100644
--- a/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr
+++ b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr
@@ -31,6 +31,10 @@ LL | Opts::A(ref i) | Opts::B(i) => {}
| first introduced with type `&isize` here
|
= note: in the same arm, a binding must have the same type in all alternatives
+help: consider adding `ref`
+ |
+LL | Opts::A(ref i) | Opts::B(ref i) => {}
+ | +++
error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-binding-mode.rs:18:34
@@ -43,6 +47,10 @@ LL | Opts::A(ref i) | Opts::B(i) => {}
| first introduced with type `&isize` here
|
= note: in the same arm, a binding must have the same type in all alternatives
+help: consider adding `ref`
+ |
+LL | Opts::A(ref i) | Opts::B(ref i) => {}
+ | +++
error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-binding-mode.rs:27:38
diff --git a/src/test/ui/resolve/resolve-inconsistent-names.rs b/src/test/ui/resolve/resolve-inconsistent-names.rs
index 989d2d452..9a40b2034 100644
--- a/src/test/ui/resolve/resolve-inconsistent-names.rs
+++ b/src/test/ui/resolve/resolve-inconsistent-names.rs
@@ -23,6 +23,7 @@ fn main() {
//~| ERROR mismatched types
//~| ERROR variable `c` is not bound in all patterns
//~| HELP if you meant to match on unit variant `E::A`, use the full path in the pattern
+ //~| HELP consider removing `ref`
}
let z = (10, 20);
diff --git a/src/test/ui/resolve/resolve-inconsistent-names.stderr b/src/test/ui/resolve/resolve-inconsistent-names.stderr
index 9de191f7d..773c9f6cd 100644
--- a/src/test/ui/resolve/resolve-inconsistent-names.stderr
+++ b/src/test/ui/resolve/resolve-inconsistent-names.stderr
@@ -55,7 +55,7 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| first binding
error[E0408]: variable `CONST1` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:30:23
+ --> $DIR/resolve-inconsistent-names.rs:31:23
|
LL | (CONST1, _) | (_, Const2) => ()
| ------ ^^^^^^^^^^^ pattern doesn't bind `CONST1`
@@ -69,7 +69,7 @@ LL | const CONST1: usize = 10;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible
error[E0408]: variable `Const2` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:30:9
+ --> $DIR/resolve-inconsistent-names.rs:31:9
|
LL | (CONST1, _) | (_, Const2) => ()
| ^^^^^^^^^^^ ------ variable not in all patterns
@@ -92,6 +92,11 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| first introduced with type `E` here
|
= note: in the same arm, a binding must have the same type in all alternatives
+help: consider removing `ref`
+ |
+LL - (A, B) | (ref B, c) | (c, A) => ()
+LL + (A, B) | (B, c) | (c, A) => ()
+ |
error: aborting due to 9 previous errors
diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr
index f0eb1a4f4..6d5d5bad9 100644
--- a/src/test/ui/resolve/resolve-primitive-fallback.stderr
+++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr
@@ -34,7 +34,7 @@ LL | pub const fn size_of<T>() -> usize {
help: remove the extra argument
|
LL | std::mem::size_of();
- | ~~~~~~~~~~~~~~~~~~~
+ | ~~
error: aborting due to 3 previous errors
diff --git a/src/test/ui/resolve/resolve-self-in-impl.rs b/src/test/ui/resolve/resolve-self-in-impl.rs
index 024fdc51e..d0872d1b7 100644
--- a/src/test/ui/resolve/resolve-self-in-impl.rs
+++ b/src/test/ui/resolve/resolve-self-in-impl.rs
@@ -11,10 +11,11 @@ impl Tr for S where Self: Copy {} // OK
impl Tr for S where S<Self>: Copy {} // OK
impl Tr for S where Self::A: Copy {} // OK
-impl Tr for Self {} //~ ERROR cycle detected
-impl Tr for S<Self> {} //~ ERROR cycle detected
-impl Self {} //~ ERROR cycle detected
-impl S<Self> {} //~ ERROR cycle detected
+impl Tr for Self {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl Tr for S<Self> {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl Self {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl S<Self> {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl (Self, Self) {} //~ ERROR `Self` is not valid in the self type of an impl block
impl Tr<Self::A> for S {} //~ ERROR cycle detected
fn main() {}
diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr
index aa99c1a33..9f9ed6889 100644
--- a/src/test/ui/resolve/resolve-self-in-impl.stderr
+++ b/src/test/ui/resolve/resolve-self-in-impl.stderr
@@ -1,86 +1,50 @@
-error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:14:1: 14:17>`
+error: `Self` is not valid in the self type of an impl block
--> $DIR/resolve-self-in-impl.rs:14:13
|
LL | impl Tr for Self {}
| ^^^^
|
- = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:14:1: 14:17>` again
-note: cycle used when collecting item types in top-level module
- --> $DIR/resolve-self-in-impl.rs:1:1
- |
-LL | / #![feature(associated_type_defaults)]
-LL | |
-LL | | struct S<T = u8>(T);
-LL | | trait Tr<T = u8> {
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: replace `Self` with a different type
-error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:15:1: 15:20>`
+error: `Self` is not valid in the self type of an impl block
--> $DIR/resolve-self-in-impl.rs:15:15
|
LL | impl Tr for S<Self> {}
| ^^^^
|
- = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:15:1: 15:20>` again
-note: cycle used when collecting item types in top-level module
- --> $DIR/resolve-self-in-impl.rs:1:1
- |
-LL | / #![feature(associated_type_defaults)]
-LL | |
-LL | | struct S<T = u8>(T);
-LL | | trait Tr<T = u8> {
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: replace `Self` with a different type
-error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:16:1: 16:10>`
+error: `Self` is not valid in the self type of an impl block
--> $DIR/resolve-self-in-impl.rs:16:6
|
LL | impl Self {}
| ^^^^
|
- = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:16:1: 16:10>` again
-note: cycle used when collecting item types in top-level module
- --> $DIR/resolve-self-in-impl.rs:1:1
- |
-LL | / #![feature(associated_type_defaults)]
-LL | |
-LL | | struct S<T = u8>(T);
-LL | | trait Tr<T = u8> {
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: replace `Self` with a different type
-error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:17:1: 17:13>`
+error: `Self` is not valid in the self type of an impl block
--> $DIR/resolve-self-in-impl.rs:17:8
|
LL | impl S<Self> {}
| ^^^^
|
- = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:17:1: 17:13>` again
-note: cycle used when collecting item types in top-level module
- --> $DIR/resolve-self-in-impl.rs:1:1
+ = 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
|
-LL | / #![feature(associated_type_defaults)]
-LL | |
-LL | | struct S<T = u8>(T);
-LL | | trait Tr<T = u8> {
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+LL | impl (Self, Self) {}
+ | ^^^^ ^^^^
+ |
+ = note: replace `Self` with a different type
-error[E0391]: cycle detected when computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:18:1: 18:23>`
- --> $DIR/resolve-self-in-impl.rs:18:1
+error[E0391]: cycle detected when computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:19:1: 19:23>`
+ --> $DIR/resolve-self-in-impl.rs:19:1
|
LL | impl Tr<Self::A> for S {}
| ^^^^^^^^^^^^^^^^^^^^^^
|
- = note: ...which immediately requires computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:18:1: 18:23>` again
+ = note: ...which immediately requires computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:19:1: 19:23>` again
note: cycle used when collecting item types in top-level module
--> $DIR/resolve-self-in-impl.rs:1:1
|
@@ -93,6 +57,6 @@ LL | |
LL | | fn main() {}
| |____________^
-error: aborting due to 5 previous errors
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.stderr b/src/test/ui/resolve/resolve-speculative-adjustment.stderr
index 1c34af6d0..be11a7ebe 100644
--- a/src/test/ui/resolve/resolve-speculative-adjustment.stderr
+++ b/src/test/ui/resolve/resolve-speculative-adjustment.stderr
@@ -4,12 +4,6 @@ error[E0425]: cannot find value `field` in this scope
LL | field;
| ^^^^^ not found in this scope
-error[E0425]: cannot find function `method` in this scope
- --> $DIR/resolve-speculative-adjustment.rs:19:13
- |
-LL | method();
- | ^^^^^^ not found in this scope
-
error[E0425]: cannot find value `field` in this scope
--> $DIR/resolve-speculative-adjustment.rs:23:9
|
@@ -22,6 +16,12 @@ error[E0425]: cannot find function `method` in this scope
LL | method();
| ^^^^^^ help: you might have meant to call the method: `self.method`
+error[E0425]: cannot find function `method` in this scope
+ --> $DIR/resolve-speculative-adjustment.rs:19:13
+ |
+LL | method();
+ | ^^^^^^ not found in this scope
+
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr
index 10a703ee0..0a6d1cc3b 100644
--- a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr
+++ b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr
@@ -4,8 +4,8 @@ error[E0401]: can't use generic parameters from outer function
LL | trait TraitA<A> {
| - type parameter from outer function
LL | fn outer(&self) {
- | ----- try adding a local generic parameter in this method instead
LL | enum Foo<B> {
+ | - help: try using a local generic parameter instead: `A,`
LL | Variance(A)
| ^ use of generic parameter from outer function
@@ -15,9 +15,10 @@ error[E0401]: can't use generic parameters from outer function
LL | trait TraitB<A> {
| - type parameter from outer function
LL | fn outer(&self) {
- | ----- try adding a local generic parameter in this method instead
LL | struct Foo<B>(A);
- | ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer function
+ | |
+ | help: try using a local generic parameter instead: `A,`
error[E0401]: can't use generic parameters from outer function
--> $DIR/resolve-type-param-in-item-in-trait.rs:23:28
@@ -25,9 +26,10 @@ error[E0401]: can't use generic parameters from outer function
LL | trait TraitC<A> {
| - type parameter from outer function
LL | fn outer(&self) {
- | ----- try adding a local generic parameter in this method instead
LL | struct Foo<B> { a: A }
- | ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer function
+ | |
+ | help: try using a local generic parameter instead: `A,`
error[E0401]: can't use generic parameters from outer function
--> $DIR/resolve-type-param-in-item-in-trait.rs:30:22
@@ -36,9 +38,9 @@ LL | trait TraitD<A> {
| - type parameter from outer function
LL | fn outer(&self) {
LL | fn foo<B>(a: A) { }
- | ------ ^ use of generic parameter from outer function
- | |
- | help: try using a local generic parameter instead: `foo<B, A>`
+ | - ^ use of generic parameter from outer function
+ | |
+ | help: try using a local generic parameter instead: `A,`
error: aborting due to 4 previous errors
diff --git a/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr b/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr
index 957045ca7..4764cf2db 100644
--- a/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr
+++ b/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr
@@ -2,17 +2,13 @@ error[E0423]: expected value, found struct `SomeTupleStruct`
--> $DIR/suggest-path-for-tuple-struct.rs:22:13
|
LL | let _ = SomeTupleStruct.new();
- | ^^^^^^^^^^^^^^^----
- | |
- | help: use the path separator to refer to an item: `SomeTupleStruct::new`
+ | ^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::`
error[E0423]: expected value, found struct `SomeRegularStruct`
--> $DIR/suggest-path-for-tuple-struct.rs:24:13
|
LL | let _ = SomeRegularStruct.new();
- | ^^^^^^^^^^^^^^^^^----
- | |
- | help: use the path separator to refer to an item: `SomeRegularStruct::new`
+ | ^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs
index 204a27240..d5d6b13d6 100644
--- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs
+++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs
@@ -16,44 +16,96 @@ pub mod a {
fn h1() -> i32 {
a.I
//~^ ERROR expected value, found module `a`
+ //~| HELP use the path separator
}
fn h2() -> i32 {
a.g()
//~^ ERROR expected value, found module `a`
+ //~| HELP use the path separator
}
fn h3() -> i32 {
a.b.J
//~^ ERROR expected value, found module `a`
+ //~| HELP use the path separator
}
fn h4() -> i32 {
a::b.J
//~^ ERROR expected value, found module `a::b`
+ //~| HELP a constant with a similar name exists
+ //~| HELP use the path separator
}
fn h5() {
a.b.f();
//~^ ERROR expected value, found module `a`
+ //~| HELP use the path separator
let v = Vec::new();
v.push(a::b);
//~^ ERROR expected value, found module `a::b`
+ //~| HELP a constant with a similar name exists
}
fn h6() -> i32 {
a::b.f()
//~^ ERROR expected value, found module `a::b`
+ //~| HELP a constant with a similar name exists
+ //~| HELP use the path separator
}
fn h7() {
a::b
//~^ ERROR expected value, found module `a::b`
+ //~| HELP a constant with a similar name exists
}
fn h8() -> i32 {
a::b()
//~^ ERROR expected function, found module `a::b`
+ //~| HELP a constant with a similar name exists
+}
+
+macro_rules! module {
+ () => {
+ a
+ //~^ ERROR expected value, found module `a`
+ //~| ERROR expected value, found module `a`
+ };
+}
+
+macro_rules! create {
+ (method) => {
+ a.f()
+ //~^ ERROR expected value, found module `a`
+ //~| HELP use the path separator
+ };
+ (field) => {
+ a.f
+ //~^ ERROR expected value, found module `a`
+ //~| HELP use the path separator
+ };
+}
+
+fn h9() {
+ //
+ // Note that if the receiver is a macro call, we do not want to suggest to replace
+ // `.` with `::` as that would be a syntax error.
+ // Since the receiver is a module and not a type, we cannot suggest to surround
+ // it with angle brackets.
+ //
+
+ module!().g::<()>(); // no `help` here!
+
+ module!().g; // no `help` here!
+
+ //
+ // Ensure that the suggestion is shown for expressions inside of macro definitions.
+ //
+
+ let _ = create!(method);
+ let _ = create!(field);
}
fn main() {}
diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr
index 54b242123..a4ce0deeb 100644
--- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr
+++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr
@@ -2,28 +2,22 @@ error[E0423]: expected value, found module `a`
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:17:5
|
LL | a.I
- | ^--
- | |
- | help: use the path separator to refer to an item: `a::I`
+ | ^- help: use the path separator to refer to an item: `::`
error[E0423]: expected value, found module `a`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:22:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:23:5
|
LL | a.g()
- | ^--
- | |
- | help: use the path separator to refer to an item: `a::g`
+ | ^- help: use the path separator to refer to an item: `::`
error[E0423]: expected value, found module `a`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:27:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:29:5
|
LL | a.b.J
- | ^--
- | |
- | help: use the path separator to refer to an item: `a::b`
+ | ^- help: use the path separator to refer to an item: `::`
error[E0423]: expected value, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:32:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:35:5
|
LL | pub const I: i32 = 1;
| --------------------- similarly named constant `I` defined here
@@ -34,22 +28,20 @@ LL | a::b.J
help: use the path separator to refer to an item
|
LL | a::b::J
- |
+ | ~~
help: a constant with a similar name exists
|
LL | a::I.J
| ~
error[E0423]: expected value, found module `a`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:37:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5
|
LL | a.b.f();
- | ^--
- | |
- | help: use the path separator to refer to an item: `a::b`
+ | ^- help: use the path separator to refer to an item: `::`
error[E0423]: expected value, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:40:12
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:46:12
|
LL | pub const I: i32 = 1;
| --------------------- similarly named constant `I` defined here
@@ -60,7 +52,7 @@ LL | v.push(a::b);
| help: a constant with a similar name exists: `I`
error[E0423]: expected value, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:52:5
|
LL | pub const I: i32 = 1;
| --------------------- similarly named constant `I` defined here
@@ -71,14 +63,14 @@ LL | a::b.f()
help: use the path separator to refer to an item
|
LL | a::b::f()
- | ~~~~~~~
+ | ~~
help: a constant with a similar name exists
|
LL | a::I.f()
| ~
error[E0423]: expected value, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:50:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:59:5
|
LL | pub const I: i32 = 1;
| --------------------- similarly named constant `I` defined here
@@ -89,7 +81,7 @@ LL | a::b
| help: a constant with a similar name exists: `I`
error[E0423]: expected function, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:65:5
|
LL | pub const I: i32 = 1;
| --------------------- similarly named constant `I` defined here
@@ -99,6 +91,50 @@ LL | a::b()
| |
| help: a constant with a similar name exists: `I`
-error: aborting due to 9 previous errors
+error[E0423]: expected value, found module `a`
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9
+ |
+LL | a
+ | ^ not a value
+...
+LL | module!().g::<()>(); // no `help` here!
+ | --------- in this macro invocation
+ |
+ = note: this error originates in the macro `module` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found module `a`
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9
+ |
+LL | a
+ | ^ not a value
+...
+LL | module!().g; // no `help` here!
+ | --------- in this macro invocation
+ |
+ = note: this error originates in the macro `module` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found module `a`
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:80:9
+ |
+LL | a.f()
+ | ^- help: use the path separator to refer to an item: `::`
+...
+LL | let _ = create!(method);
+ | --------------- in this macro invocation
+ |
+ = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found module `a`
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:85:9
+ |
+LL | a.f
+ | ^- help: use the path separator to refer to an item: `::`
+...
+LL | let _ = create!(field);
+ | -------------- in this macro invocation
+ |
+ = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0423`.
diff --git a/src/test/ui/resolve/tuple-struct-alias.stderr b/src/test/ui/resolve/tuple-struct-alias.stderr
index 5a7873301..a739ea43e 100644
--- a/src/test/ui/resolve/tuple-struct-alias.stderr
+++ b/src/test/ui/resolve/tuple-struct-alias.stderr
@@ -1,22 +1,22 @@
-error[E0423]: expected function, tuple struct or tuple variant, found type alias `A`
- --> $DIR/tuple-struct-alias.rs:5:13
+error[E0532]: expected tuple struct or tuple variant, found type alias `A`
+ --> $DIR/tuple-struct-alias.rs:7:9
|
LL | struct S(u8, u16);
| ------------------ similarly named tuple struct `S` defined here
...
-LL | let s = A(0, 1);
- | ^ help: a tuple struct with a similar name exists: `S`
+LL | A(..) => {}
+ | ^ help: a tuple struct with a similar name exists: `S`
|
= note: can't use a type alias as a constructor
-error[E0532]: expected tuple struct or tuple variant, found type alias `A`
- --> $DIR/tuple-struct-alias.rs:7:9
+error[E0423]: expected function, tuple struct or tuple variant, found type alias `A`
+ --> $DIR/tuple-struct-alias.rs:5:13
|
LL | struct S(u8, u16);
| ------------------ similarly named tuple struct `S` defined here
...
-LL | A(..) => {}
- | ^ help: a tuple struct with a similar name exists: `S`
+LL | let s = A(0, 1);
+ | ^ help: a tuple struct with a similar name exists: `S`
|
= note: can't use a type alias as a constructor
diff --git a/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
index 0b0a37f24..f32e0404e 100644
--- a/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
+++ b/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
@@ -31,24 +31,6 @@ help: a local variable with a similar name exists
LL | println!("{cofig}");
| ~~~~~
-error[E0425]: cannot find function `baz` in this scope
- --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:31:9
- |
-LL | baz();
- | ^^^
-...
-LL | fn ba() {}
- | ------- similarly named function `ba` defined here
- |
-help: you might have meant to call the method
- |
-LL | self.baz();
- | ~~~~~~~~
-help: a function with a similar name exists
- |
-LL | ba();
- | ~~
-
error[E0425]: cannot find value `bah` in this scope
--> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:33:9
|
@@ -58,7 +40,7 @@ LL | bah;
LL | fn ba() {}
| ------- similarly named function `ba` defined here
|
-help: you might have meant to call the associated function
+help: you might have meant to refer to the associated function
|
LL | Self::bah;
| ~~~~~~~~~
@@ -103,6 +85,24 @@ help: a type alias with a similar name exists
LL | let foo: Bar = "".to_string();
| ~~~
+error[E0425]: cannot find function `baz` in this scope
+ --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:31:9
+ |
+LL | baz();
+ | ^^^
+...
+LL | fn ba() {}
+ | ------- similarly named function `ba` defined here
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | ~~~~~~~~
+help: a function with a similar name exists
+ |
+LL | ba();
+ | ~~
+
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0412, E0425.