summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/ui/suggestions
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/suggestions')
-rw-r--r--tests/ui/suggestions/as-ref.stderr88
-rw-r--r--tests/ui/suggestions/auxiliary/missing-assoc-fn-applicable-suggestions.rs16
-rw-r--r--tests/ui/suggestions/derive-macro-missing-bounds.stderr8
-rw-r--r--tests/ui/suggestions/invalid-bin-op.stderr4
-rw-r--r--tests/ui/suggestions/issue-109436.stderr2
-rw-r--r--tests/ui/suggestions/issue-109854.rs12
-rw-r--r--tests/ui/suggestions/issue-109854.stderr31
-rw-r--r--tests/ui/suggestions/issue-68049-2.stderr8
-rw-r--r--tests/ui/suggestions/issue-71394-no-from-impl.rs5
-rw-r--r--tests/ui/suggestions/issue-71394-no-from-impl.stderr13
-rw-r--r--tests/ui/suggestions/issue-94171.rs5
-rw-r--r--tests/ui/suggestions/issue-94171.stderr36
-rw-r--r--tests/ui/suggestions/issue-96555.stderr12
-rw-r--r--tests/ui/suggestions/issue-99597.rs15
-rw-r--r--tests/ui/suggestions/issue-99597.stderr15
-rw-r--r--tests/ui/suggestions/many-type-ascription.rs2
-rw-r--r--tests/ui/suggestions/many-type-ascription.stderr10
-rw-r--r--tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.fixed21
-rw-r--r--tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs21
-rw-r--r--tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr18
-rw-r--r--tests/ui/suggestions/missing-assoc-fn.stderr2
-rw-r--r--tests/ui/suggestions/path-by-value.stderr3
-rw-r--r--tests/ui/suggestions/restrict-type-not-param.stderr4
-rw-r--r--tests/ui/suggestions/suggest-borrow-to-dyn-object.rs16
-rw-r--r--tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr17
-rw-r--r--tests/ui/suggestions/suggest-boxed-empty-block.fixed12
-rw-r--r--tests/ui/suggestions/suggest-boxed-empty-block.rs12
-rw-r--r--tests/ui/suggestions/suggest-boxed-empty-block.stderr33
-rw-r--r--tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.fixed2
-rw-r--r--tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.rs2
-rw-r--r--tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr10
-rw-r--r--tests/ui/suggestions/suggest-ref-macro.rs4
-rw-r--r--tests/ui/suggestions/suggest-ref-macro.stderr19
-rw-r--r--tests/ui/suggestions/suggest-ref-mut.rs3
-rw-r--r--tests/ui/suggestions/suggest-ref-mut.stderr12
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-let.fixed11
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-let.rs7
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-let.stderr21
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-method.fixed2
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-method.rs2
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-method.stderr10
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-path-2.fixed2
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-path-2.rs2
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-path-2.stderr14
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-path.rs3
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-path.stderr18
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-variant.fixed2
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-variant.rs2
-rw-r--r--tests/ui/suggestions/type-ascription-instead-of-variant.stderr10
49 files changed, 379 insertions, 220 deletions
diff --git a/tests/ui/suggestions/as-ref.stderr b/tests/ui/suggestions/as-ref.stderr
index 0ee343ebf..2147d2d92 100644
--- a/tests/ui/suggestions/as-ref.stderr
+++ b/tests/ui/suggestions/as-ref.stderr
@@ -2,61 +2,73 @@ error[E0308]: mismatched types
--> $DIR/as-ref.rs:7:29
|
LL | opt.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().map`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | opt.as_ref().map(|arg| takes_ref(arg));
+ | +++++++++
error[E0308]: mismatched types
--> $DIR/as-ref.rs:8:39
|
LL | opt.and_then(|arg| Some(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().and_then`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | opt.as_ref().and_then(|arg| Some(takes_ref(arg)));
+ | +++++++++
error[E0308]: mismatched types
--> $DIR/as-ref.rs:10:29
|
LL | opt.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().map`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | opt.as_ref().map(|arg| takes_ref(arg));
+ | +++++++++
error[E0308]: mismatched types
--> $DIR/as-ref.rs:11:37
|
LL | opt.and_then(|arg| Ok(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().and_then`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | opt.as_ref().and_then(|arg| Ok(takes_ref(arg)));
+ | +++++++++
error[E0308]: mismatched types
--> $DIR/as-ref.rs:13:29
@@ -101,61 +113,73 @@ error[E0308]: mismatched types
--> $DIR/as-ref.rs:22:42
|
LL | multiple_ref_opt.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().map`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | multiple_ref_opt.as_ref().map(|arg| takes_ref(arg));
+ | +++++++++
error[E0308]: mismatched types
--> $DIR/as-ref.rs:23:52
|
LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().and_then`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | multiple_ref_opt.as_ref().and_then(|arg| Some(takes_ref(arg)));
+ | +++++++++
error[E0308]: mismatched types
--> $DIR/as-ref.rs:25:45
|
LL | multiple_ref_result.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().map`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | multiple_ref_result.as_ref().map(|arg| takes_ref(arg));
+ | +++++++++
error[E0308]: mismatched types
--> $DIR/as-ref.rs:26:53
|
LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found `Foo`
- | | |
- | | arguments to this function are incorrect
- | help: consider using `as_ref` instead: `as_ref().and_then`
+ | --------- ^^^ expected `&Foo`, found `Foo`
+ | |
+ | arguments to this function are incorrect
|
note: function defined here
--> $DIR/as-ref.rs:3:4
|
LL | fn takes_ref(_: &Foo) {}
| ^^^^^^^^^ -------
+help: consider using `as_ref` instead
+ |
+LL | multiple_ref_result.as_ref().and_then(|arg| Ok(takes_ref(arg)));
+ | +++++++++
error: aborting due to 11 previous errors
diff --git a/tests/ui/suggestions/auxiliary/missing-assoc-fn-applicable-suggestions.rs b/tests/ui/suggestions/auxiliary/missing-assoc-fn-applicable-suggestions.rs
new file mode 100644
index 000000000..b026035a6
--- /dev/null
+++ b/tests/ui/suggestions/auxiliary/missing-assoc-fn-applicable-suggestions.rs
@@ -0,0 +1,16 @@
+pub trait TraitB {
+ type Item;
+}
+
+pub trait TraitA<A> {
+ type Type;
+
+ fn bar<T>(_: T) -> Self;
+
+ fn baz<T>(_: T) -> Self
+ where
+ T: TraitB,
+ <T as TraitB>::Item: Copy;
+
+ const A: usize;
+}
diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
index c3f305c17..bffcb1af4 100644
--- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr
+++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
@@ -36,7 +36,7 @@ LL | impl<T: Debug + Trait> Debug for Inner<T> {
| unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&c::Inner<T>` to implement `Debug`
- = note: required for the cast from `&c::Inner<T>` to the object type `dyn Debug`
+ = note: required for the cast from `&&c::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
|
@@ -58,7 +58,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug, T: Trait {
| ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&d::Inner<T>` to implement `Debug`
- = note: required for the cast from `&d::Inner<T>` to the object type `dyn Debug`
+ = note: required for the cast from `&&d::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
|
@@ -80,7 +80,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug + Trait {
| ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&e::Inner<T>` to implement `Debug`
- = note: required for the cast from `&e::Inner<T>` to the object type `dyn Debug`
+ = note: required for the cast from `&&e::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
|
@@ -102,7 +102,7 @@ LL | impl<T: Debug> Debug for Inner<T> where T: Trait {
| ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&f::Inner<T>` to implement `Debug`
- = note: required for the cast from `&f::Inner<T>` to the object type `dyn Debug`
+ = note: required for the cast from `&&f::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
|
diff --git a/tests/ui/suggestions/invalid-bin-op.stderr b/tests/ui/suggestions/invalid-bin-op.stderr
index e291cedb8..570afcea6 100644
--- a/tests/ui/suggestions/invalid-bin-op.stderr
+++ b/tests/ui/suggestions/invalid-bin-op.stderr
@@ -6,11 +6,11 @@ LL | let _ = s == t;
| |
| S<T>
|
-note: an implementation of `PartialEq<_>` might be missing for `S<T>`
+note: an implementation of `PartialEq` might be missing for `S<T>`
--> $DIR/invalid-bin-op.rs:5:1
|
LL | struct S<T>(T);
- | ^^^^^^^^^^^ must implement `PartialEq<_>`
+ | ^^^^^^^^^^^ must implement `PartialEq`
help: consider annotating `S<T>` with `#[derive(PartialEq)]`
|
LL + #[derive(PartialEq)]
diff --git a/tests/ui/suggestions/issue-109436.stderr b/tests/ui/suggestions/issue-109436.stderr
index 48518b33d..c479326f9 100644
--- a/tests/ui/suggestions/issue-109436.stderr
+++ b/tests/ui/suggestions/issue-109436.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Into<_>` is not satisfied
--> $DIR/issue-109436.rs:12:22
|
LL | let b: Bar = foo.into();
- | ^^^^ the trait `~const Into<_>` is not implemented for `Foo`
+ | ^^^^ the trait `Into<_>` is not implemented for `Foo`
|
= note: required for `Foo` to implement `Into<Bar>`
help: consider borrowing here
diff --git a/tests/ui/suggestions/issue-109854.rs b/tests/ui/suggestions/issue-109854.rs
new file mode 100644
index 000000000..dd4542dd7
--- /dev/null
+++ b/tests/ui/suggestions/issue-109854.rs
@@ -0,0 +1,12 @@
+fn generate_setter() {
+ String::with_capacity(
+ //~^ ERROR this function takes 1 argument but 3 arguments were supplied
+ generate_setter,
+ r#"
+pub(crate) struct Person<T: Clone> {}
+"#,
+ r#""#,
+ );
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-109854.stderr b/tests/ui/suggestions/issue-109854.stderr
new file mode 100644
index 000000000..621a38971
--- /dev/null
+++ b/tests/ui/suggestions/issue-109854.stderr
@@ -0,0 +1,31 @@
+error[E0061]: this function takes 1 argument but 3 arguments were supplied
+ --> $DIR/issue-109854.rs:2:5
+ |
+LL | String::with_capacity(
+ | ^^^^^^^^^^^^^^^^^^^^^
+...
+LL | / r#"
+LL | | pub(crate) struct Person<T: Clone> {}
+LL | | "#,
+ | |__- unexpected argument of type `&'static str`
+LL | r#""#,
+ | ----- unexpected argument of type `&'static str`
+ |
+note: expected `usize`, found fn item
+ --> $DIR/issue-109854.rs:4:5
+ |
+LL | generate_setter,
+ | ^^^^^^^^^^^^^^^
+ = note: expected type `usize`
+ found fn item `fn() {generate_setter}`
+note: associated function defined here
+ --> $SRC_DIR/alloc/src/string.rs:LL:COL
+help: remove the extra arguments
+ |
+LL - generate_setter,
+LL + /* usize */,
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/suggestions/issue-68049-2.stderr b/tests/ui/suggestions/issue-68049-2.stderr
index de35aa5b1..6f3c78443 100644
--- a/tests/ui/suggestions/issue-68049-2.stderr
+++ b/tests/ui/suggestions/issue-68049-2.stderr
@@ -4,10 +4,10 @@ error[E0594]: cannot assign to `*input`, which is behind a `&` reference
LL | *input = self.0;
| ^^^^^^^^^^^^^^^ `input` is a `&` reference, so the data it refers to cannot be written
|
-help: consider changing that to be a mutable reference
+help: consider changing this to be a mutable reference
|
-LL | fn example(&self, input: &mut i32); // should suggest here
- | ~~~~~~~~
+LL | fn example(&self, input: &mut i32) { // should not suggest here
+ | +++
error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
--> $DIR/issue-68049-2.rs:17:5
@@ -15,7 +15,7 @@ error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
LL | self.0 += *input;
| ^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
|
-help: consider changing that to be a mutable reference
+help: consider changing this to be a mutable reference
|
LL | fn example(&mut self, input: &i32); // should suggest here
| ~~~~~~~~~
diff --git a/tests/ui/suggestions/issue-71394-no-from-impl.rs b/tests/ui/suggestions/issue-71394-no-from-impl.rs
index 0c35deb51..63f12a912 100644
--- a/tests/ui/suggestions/issue-71394-no-from-impl.rs
+++ b/tests/ui/suggestions/issue-71394-no-from-impl.rs
@@ -1,3 +1,8 @@
+// ignore-wasm
+// ignore-msvc
+// ignore-emscripten
+// ignore-uwp
+
fn main() {
let data: &[u8] = &[0; 10];
let _: &[i8] = data.into();
diff --git a/tests/ui/suggestions/issue-71394-no-from-impl.stderr b/tests/ui/suggestions/issue-71394-no-from-impl.stderr
index a5e6f5b5f..2cd036d2b 100644
--- a/tests/ui/suggestions/issue-71394-no-from-impl.stderr
+++ b/tests/ui/suggestions/issue-71394-no-from-impl.stderr
@@ -1,12 +1,19 @@
error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied
- --> $DIR/issue-71394-no-from-impl.rs:3:25
+ --> $DIR/issue-71394-no-from-impl.rs:8:25
|
LL | let _: &[i8] = data.into();
| ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
|
= help: the following other types implement trait `From<T>`:
- <[T; LANES] as From<Simd<T, LANES>>>
- <[bool; LANES] as From<Mask<T, LANES>>>
+ <[T; 10] as From<(T, T, T, T, T, T, T, T, T, T)>>
+ <[T; 11] as From<(T, T, T, T, T, T, T, T, T, T, T)>>
+ <[T; 12] as From<(T, T, T, T, T, T, T, T, T, T, T, T)>>
+ <[T; 1] as From<(T,)>>
+ <[T; 2] as From<(T, T)>>
+ <[T; 3] as From<(T, T, T)>>
+ <[T; 4] as From<(T, T, T, T)>>
+ <[T; 5] as From<(T, T, T, T, T)>>
+ and 6 others
= note: required for `&[u8]` to implement `Into<&[i8]>`
error: aborting due to previous error
diff --git a/tests/ui/suggestions/issue-94171.rs b/tests/ui/suggestions/issue-94171.rs
new file mode 100644
index 000000000..cbb9f9cec
--- /dev/null
+++ b/tests/ui/suggestions/issue-94171.rs
@@ -0,0 +1,5 @@
+fn L(]{match
+(; {`
+//~^^ ERROR mismatched closing delimiter
+//~^^ ERROR unknown start of token
+//~ ERROR this file contains an unclosed delimiter
diff --git a/tests/ui/suggestions/issue-94171.stderr b/tests/ui/suggestions/issue-94171.stderr
new file mode 100644
index 000000000..b3440e46e
--- /dev/null
+++ b/tests/ui/suggestions/issue-94171.stderr
@@ -0,0 +1,36 @@
+error: unknown start of token: `
+ --> $DIR/issue-94171.rs:2:5
+ |
+LL | (; {`
+ | ^
+ |
+help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
+ |
+LL | (; {'
+ | ~
+
+error: mismatched closing delimiter: `]`
+ --> $DIR/issue-94171.rs:1:5
+ |
+LL | fn L(]{match
+ | ^^ mismatched closing delimiter
+ | |
+ | unclosed delimiter
+
+error: this file contains an unclosed delimiter
+ --> $DIR/issue-94171.rs:5:52
+ |
+LL | fn L(]{match
+ | -- unclosed delimiter
+ | |
+ | missing open `[` for this delimiter
+LL | (; {`
+ | - - unclosed delimiter
+ | |
+ | unclosed delimiter
+...
+LL |
+ | ^
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/suggestions/issue-96555.stderr b/tests/ui/suggestions/issue-96555.stderr
index 9a8a183dc..1a1e069f0 100644
--- a/tests/ui/suggestions/issue-96555.stderr
+++ b/tests/ui/suggestions/issue-96555.stderr
@@ -1,8 +1,8 @@
error[E0277]: `()` is not a future
- --> $DIR/issue-96555.rs:4:12
+ --> $DIR/issue-96555.rs:4:13
|
LL | m::f1().await;
- | -------^^^^^^ `()` is not a future
+ | ------- ^^^^^ `()` is not a future
| |
| this call returns `()`
|
@@ -20,10 +20,10 @@ LL | pub async fn f1() {}
| +++++
error[E0277]: `()` is not a future
- --> $DIR/issue-96555.rs:5:12
+ --> $DIR/issue-96555.rs:5:13
|
LL | m::f2().await;
- | -------^^^^^^ `()` is not a future
+ | ------- ^^^^^ `()` is not a future
| |
| this call returns `()`
|
@@ -41,10 +41,10 @@ LL | pub(crate) async fn f2() {}
| +++++
error[E0277]: `()` is not a future
- --> $DIR/issue-96555.rs:6:12
+ --> $DIR/issue-96555.rs:6:13
|
LL | m::f3().await;
- | -------^^^^^^ `()` is not a future
+ | ------- ^^^^^ `()` is not a future
| |
| this call returns `()`
|
diff --git a/tests/ui/suggestions/issue-99597.rs b/tests/ui/suggestions/issue-99597.rs
new file mode 100644
index 000000000..8ba9e1fdd
--- /dev/null
+++ b/tests/ui/suggestions/issue-99597.rs
@@ -0,0 +1,15 @@
+#![allow(dead_code)]
+
+trait T1 { }
+
+trait T2 {
+ fn test(&self) { }
+}
+
+fn go(s: &impl T1) {
+ //~^ SUGGESTION (
+ s.test();
+ //~^ ERROR no method named `test`
+}
+
+fn main() { }
diff --git a/tests/ui/suggestions/issue-99597.stderr b/tests/ui/suggestions/issue-99597.stderr
new file mode 100644
index 000000000..bdf2a07c1
--- /dev/null
+++ b/tests/ui/suggestions/issue-99597.stderr
@@ -0,0 +1,15 @@
+error[E0599]: no method named `test` found for reference `&impl T1` in the current scope
+ --> $DIR/issue-99597.rs:11:7
+ |
+LL | s.test();
+ | ^^^^ method not found in `&impl T1`
+ |
+ = help: items from traits can only be used if the type parameter is bounded by the trait
+help: the following trait defines an item `test`, perhaps you need to restrict type parameter `impl T1` with it:
+ |
+LL | fn go(s: &(impl T1 + T2)) {
+ | + +++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/suggestions/many-type-ascription.rs b/tests/ui/suggestions/many-type-ascription.rs
index 31ac556b9..cc2406d66 100644
--- a/tests/ui/suggestions/many-type-ascription.rs
+++ b/tests/ui/suggestions/many-type-ascription.rs
@@ -1,4 +1,4 @@
fn main() {
- let _ = 0: i32; //~ ERROR: type ascription is experimental
+ let _ = 0: i32; //~ ERROR: expected one of
let _ = 0: i32; // (error only emitted once)
}
diff --git a/tests/ui/suggestions/many-type-ascription.stderr b/tests/ui/suggestions/many-type-ascription.stderr
index 3706bbae9..e36919c82 100644
--- a/tests/ui/suggestions/many-type-ascription.stderr
+++ b/tests/ui/suggestions/many-type-ascription.stderr
@@ -1,12 +1,10 @@
-error[E0658]: type ascription is experimental
- --> $DIR/many-type-ascription.rs:2:13
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/many-type-ascription.rs:2:14
|
LL | let _ = 0: i32;
- | ^^^^^^
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
- = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
- = help: add `#![feature(type_ascription)]` to the crate attributes to enable
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.fixed b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.fixed
deleted file mode 100644
index a0cb39a3f..000000000
--- a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.fixed
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-rustfix
-trait TraitB {
- type Item;
-}
-
-trait TraitA<A> {
- type Type;
- fn bar<T>(_: T) -> Self;
- fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy;
-}
-
-struct S;
-struct Type;
-
-impl TraitA<()> for S { //~ ERROR not all trait items implemented
-fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy { todo!() }
-fn bar<T>(_: T) -> Self { todo!() }
-type Type = Type;
-}
-
-fn main() {}
diff --git a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs
index c80ede1b2..11e0c9a3a 100644
--- a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs
+++ b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.rs
@@ -1,18 +1,15 @@
-// run-rustfix
-trait TraitB {
- type Item;
-}
+// aux-build:missing-assoc-fn-applicable-suggestions.rs
-trait TraitA<A> {
- type Type;
- fn bar<T>(_: T) -> Self;
- fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy;
-}
+extern crate missing_assoc_fn_applicable_suggestions;
+use missing_assoc_fn_applicable_suggestions::TraitA;
struct S;
-struct Type;
-
-impl TraitA<()> for S { //~ ERROR not all trait items implemented
+impl TraitA<()> for S {
+ //~^ ERROR not all trait items implemented
}
+//~^ HELP implement the missing item: `type Type = /* Type */;`
+//~| HELP implement the missing item: `fn bar<T>(_: T) -> Self { todo!() }`
+//~| HELP implement the missing item: `fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy { todo!() }`
+//~| HELP implement the missing item: `const A: usize = 42;`
fn main() {}
diff --git a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr
index 4c75fbe4c..4c2d2776d 100644
--- a/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr
+++ b/tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr
@@ -1,15 +1,13 @@
-error[E0046]: not all trait items implemented, missing: `Type`, `bar`, `baz`
- --> $DIR/missing-assoc-fn-applicable-suggestions.rs:15:1
+error[E0046]: not all trait items implemented, missing: `Type`, `bar`, `baz`, `A`
+ --> $DIR/missing-assoc-fn-applicable-suggestions.rs:7:1
|
-LL | type Type;
- | --------- `Type` from trait
-LL | fn bar<T>(_: T) -> Self;
- | ------------------------ `bar` from trait
-LL | fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy;
- | ------------------------------------------------------------------- `baz` from trait
-...
LL | impl TraitA<()> for S {
- | ^^^^^^^^^^^^^^^^^^^^^ missing `Type`, `bar`, `baz` in implementation
+ | ^^^^^^^^^^^^^^^^^^^^^ missing `Type`, `bar`, `baz`, `A` in implementation
+ |
+ = help: implement the missing item: `type Type = /* Type */;`
+ = help: implement the missing item: `fn bar<T>(_: T) -> Self { todo!() }`
+ = help: implement the missing item: `fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy { todo!() }`
+ = help: implement the missing item: `const A: usize = 42;`
error: aborting due to previous error
diff --git a/tests/ui/suggestions/missing-assoc-fn.stderr b/tests/ui/suggestions/missing-assoc-fn.stderr
index 136ec2152..77fa95628 100644
--- a/tests/ui/suggestions/missing-assoc-fn.stderr
+++ b/tests/ui/suggestions/missing-assoc-fn.stderr
@@ -28,7 +28,7 @@ error[E0046]: not all trait items implemented, missing: `from_iter`
LL | impl FromIterator<()> for X {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_iter` in implementation
|
- = help: implement the missing item: `fn from_iter<T>(_: T) -> Self where T: IntoIterator, std::iter::IntoIterator::Item = A { todo!() }`
+ = help: implement the missing item: `fn from_iter<T>(_: T) -> Self where T: IntoIterator, std::iter::IntoIterator::Item = () { todo!() }`
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/path-by-value.stderr b/tests/ui/suggestions/path-by-value.stderr
index bbeaa26a9..fd3646b8c 100644
--- a/tests/ui/suggestions/path-by-value.stderr
+++ b/tests/ui/suggestions/path-by-value.stderr
@@ -5,7 +5,8 @@ LL | fn f(p: Path) { }
| ^ doesn't have a size known at compile-time
|
= help: within `Path`, the trait `Sized` is not implemented for `[u8]`
- = note: required because it appears within the type `Path`
+note: required because it appears within the type `Path`
+ --> $SRC_DIR/std/src/path.rs:LL:COL
= help: unsized fn params are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
diff --git a/tests/ui/suggestions/restrict-type-not-param.stderr b/tests/ui/suggestions/restrict-type-not-param.stderr
index 5434472ce..3c7d42888 100644
--- a/tests/ui/suggestions/restrict-type-not-param.stderr
+++ b/tests/ui/suggestions/restrict-type-not-param.stderr
@@ -6,11 +6,11 @@ LL | a + b
| |
| Wrapper<T>
|
-note: an implementation of `Add<_>` might be missing for `Wrapper<T>`
+note: an implementation of `Add<T>` might be missing for `Wrapper<T>`
--> $DIR/restrict-type-not-param.rs:3:1
|
LL | struct Wrapper<T>(T);
- | ^^^^^^^^^^^^^^^^^ must implement `Add<_>`
+ | ^^^^^^^^^^^^^^^^^ must implement `Add<T>`
note: the trait `Add` must be implemented
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
diff --git a/tests/ui/suggestions/suggest-borrow-to-dyn-object.rs b/tests/ui/suggestions/suggest-borrow-to-dyn-object.rs
deleted file mode 100644
index 120fc5383..000000000
--- a/tests/ui/suggestions/suggest-borrow-to-dyn-object.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-use std::ffi::{OsStr, OsString};
-use std::path::Path;
-
-fn check(p: &dyn AsRef<Path>) {
- let m = std::fs::metadata(&p);
- println!("{:?}", &m);
-}
-
-fn main() {
- let s: OsString = ".".into();
- let s: &OsStr = &s;
- check(s);
- //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
- //~| HELP within `OsStr`, the trait `Sized` is not implemented for `[u8]`
- //~| HELP consider borrowing the value, since `&OsStr` can be coerced into `dyn AsRef<Path>`
-}
diff --git a/tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr b/tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr
deleted file mode 100644
index 6ce9bfd9d..000000000
--- a/tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/suggest-borrow-to-dyn-object.rs:12:11
- |
-LL | check(s);
- | ^ doesn't have a size known at compile-time
- |
- = help: within `OsStr`, the trait `Sized` is not implemented for `[u8]`
- = note: required because it appears within the type `OsStr`
- = note: required for the cast from `OsStr` to the object type `dyn AsRef<Path>`
-help: consider borrowing the value, since `&OsStr` can be coerced into `dyn AsRef<Path>`
- |
-LL | check(&s);
- | +
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.fixed b/tests/ui/suggestions/suggest-boxed-empty-block.fixed
new file mode 100644
index 000000000..46683aa09
--- /dev/null
+++ b/tests/ui/suggestions/suggest-boxed-empty-block.fixed
@@ -0,0 +1,12 @@
+#![feature(async_closure)]
+
+// edition:2021
+// run-rustfix
+
+fn foo<T>(_: Box<T>) {}
+fn bar<T>(_: impl Fn() -> Box<T>) {}
+
+fn main() {
+ foo(Box::new(())); //~ ERROR mismatched types
+ bar(|| Box::new(())); //~ ERROR mismatched types
+}
diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.rs b/tests/ui/suggestions/suggest-boxed-empty-block.rs
new file mode 100644
index 000000000..e19670a50
--- /dev/null
+++ b/tests/ui/suggestions/suggest-boxed-empty-block.rs
@@ -0,0 +1,12 @@
+#![feature(async_closure)]
+
+// edition:2021
+// run-rustfix
+
+fn foo<T>(_: Box<T>) {}
+fn bar<T>(_: impl Fn() -> Box<T>) {}
+
+fn main() {
+ foo({}); //~ ERROR mismatched types
+ bar(|| {}); //~ ERROR mismatched types
+}
diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.stderr b/tests/ui/suggestions/suggest-boxed-empty-block.stderr
new file mode 100644
index 000000000..474a37b88
--- /dev/null
+++ b/tests/ui/suggestions/suggest-boxed-empty-block.stderr
@@ -0,0 +1,33 @@
+error[E0308]: mismatched types
+ --> $DIR/suggest-boxed-empty-block.rs:10:9
+ |
+LL | foo({});
+ | ^^ expected `Box<_>`, found `()`
+ |
+ = note: expected struct `Box<_>`
+ found unit type `()`
+ = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
+help: store this in the heap by calling `Box::new`
+ |
+LL - foo({});
+LL + foo(Box::new(()));
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/suggest-boxed-empty-block.rs:11:12
+ |
+LL | bar(|| {});
+ | ^^ expected `Box<_>`, found `()`
+ |
+ = note: expected struct `Box<_>`
+ found unit type `()`
+ = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
+help: store this in the heap by calling `Box::new`
+ |
+LL - bar(|| {});
+LL + bar(|| Box::new(()));
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.fixed b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.fixed
index b69bad988..556c95438 100644
--- a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.fixed
+++ b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.fixed
@@ -11,7 +11,7 @@ fn main() {
let mut map = HashMap::new();
map.insert("a", Test { v: 0 });
- for (_k, mut v) in map.iter_mut() {
+ for (_k, v) in map.iter_mut() {
//~^ HELP use mutable method
//~| NOTE this iterator yields `&` references
v.v += 1;
diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.rs b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.rs
index 9284410df..b9d49a074 100644
--- a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.rs
+++ b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.rs
@@ -11,7 +11,7 @@ fn main() {
let mut map = HashMap::new();
map.insert("a", Test { v: 0 });
- for (_k, mut v) in map.iter() {
+ for (_k, v) in map.iter() {
//~^ HELP use mutable method
//~| NOTE this iterator yields `&` references
v.v += 1;
diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr
index 74433daa6..c442ed637 100644
--- a/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr
+++ b/tests/ui/suggestions/suggest-mut-method-for-loop-hashmap.stderr
@@ -1,11 +1,11 @@
error[E0594]: cannot assign to `v.v`, which is behind a `&` reference
--> $DIR/suggest-mut-method-for-loop-hashmap.rs:17:9
|
-LL | for (_k, mut v) in map.iter() {
- | ----------
- | | |
- | | help: use mutable method: `iter_mut()`
- | this iterator yields `&` references
+LL | for (_k, v) in map.iter() {
+ | ----------
+ | | |
+ | | help: use mutable method: `iter_mut()`
+ | this iterator yields `&` references
...
LL | v.v += 1;
| ^^^^^^^^ `v` is a `&` reference, so the data it refers to cannot be written
diff --git a/tests/ui/suggestions/suggest-ref-macro.rs b/tests/ui/suggestions/suggest-ref-macro.rs
index 6f780f32a..730f5fa1b 100644
--- a/tests/ui/suggestions/suggest-ref-macro.rs
+++ b/tests/ui/suggestions/suggest-ref-macro.rs
@@ -14,7 +14,7 @@ macro_rules! bla {
() => {
x(123);
//~^ ERROR mismatched types
- //~| SUGGESTION &mut 123
+ //~| SUGGESTION &mut
};
($v:expr) => {
x($v)
@@ -25,5 +25,5 @@ fn main() {
bla!();
bla!(456);
//~^ ERROR mismatched types
- //~| SUGGESTION &mut 456
+ //~| SUGGESTION &mut
}
diff --git a/tests/ui/suggestions/suggest-ref-macro.stderr b/tests/ui/suggestions/suggest-ref-macro.stderr
index 17de49fbd..08bc9e86a 100644
--- a/tests/ui/suggestions/suggest-ref-macro.stderr
+++ b/tests/ui/suggestions/suggest-ref-macro.stderr
@@ -18,10 +18,8 @@ error[E0308]: mismatched types
--> $DIR/suggest-ref-macro.rs:15:11
|
LL | x(123);
- | - ^^^
- | | |
- | | expected `&mut i32`, found integer
- | | help: consider mutably borrowing here: `&mut 123`
+ | - ^^^ expected `&mut i32`, found integer
+ | |
| arguments to this function are incorrect
...
LL | bla!();
@@ -33,6 +31,10 @@ note: function defined here
LL | fn x(_: &mut i32) {}
| ^ -----------
= note: this error originates in the macro `bla` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider mutably borrowing here
+ |
+LL | x(&mut 123);
+ | ++++
error[E0308]: mismatched types
--> $DIR/suggest-ref-macro.rs:26:10
@@ -41,16 +43,17 @@ LL | x($v)
| - arguments to this function are incorrect
...
LL | bla!(456);
- | ^^^
- | |
- | expected `&mut i32`, found integer
- | help: consider mutably borrowing here: `&mut 456`
+ | ^^^ expected `&mut i32`, found integer
|
note: function defined here
--> $DIR/suggest-ref-macro.rs:11:4
|
LL | fn x(_: &mut i32) {}
| ^ -----------
+help: consider mutably borrowing here
+ |
+LL | bla!(&mut 456);
+ | ++++
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/suggest-ref-mut.rs b/tests/ui/suggestions/suggest-ref-mut.rs
index d04113ffc..b40439b8e 100644
--- a/tests/ui/suggestions/suggest-ref-mut.rs
+++ b/tests/ui/suggestions/suggest-ref-mut.rs
@@ -12,12 +12,10 @@ impl X {
fn main() {
let ref foo = 16;
//~^ HELP
- //~| SUGGESTION ref mut foo
*foo = 32;
//~^ ERROR
if let Some(ref bar) = Some(16) {
//~^ HELP
- //~| SUGGESTION ref mut bar
*bar = 32;
//~^ ERROR
}
@@ -25,6 +23,5 @@ fn main() {
ref quo => { *quo = 32; },
//~^ ERROR
//~| HELP
- //~| SUGGESTION ref mut quo
}
}
diff --git a/tests/ui/suggestions/suggest-ref-mut.stderr b/tests/ui/suggestions/suggest-ref-mut.stderr
index 7973759bf..cc00022ab 100644
--- a/tests/ui/suggestions/suggest-ref-mut.stderr
+++ b/tests/ui/suggestions/suggest-ref-mut.stderr
@@ -10,7 +10,7 @@ LL | fn zap(&mut self) {
| ~~~~~~~~~
error[E0594]: cannot assign to `*foo`, which is behind a `&` reference
- --> $DIR/suggest-ref-mut.rs:16:5
+ --> $DIR/suggest-ref-mut.rs:15:5
|
LL | *foo = 32;
| ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written
@@ -18,10 +18,10 @@ LL | *foo = 32;
help: consider changing this to be a mutable reference
|
LL | let ref mut foo = 16;
- | ~~~~~~~~~~~
+ | +++
error[E0594]: cannot assign to `*bar`, which is behind a `&` reference
- --> $DIR/suggest-ref-mut.rs:21:9
+ --> $DIR/suggest-ref-mut.rs:19:9
|
LL | *bar = 32;
| ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written
@@ -29,10 +29,10 @@ LL | *bar = 32;
help: consider changing this to be a mutable reference
|
LL | if let Some(ref mut bar) = Some(16) {
- | ~~~~~~~~~~~
+ | +++
error[E0594]: cannot assign to `*quo`, which is behind a `&` reference
- --> $DIR/suggest-ref-mut.rs:25:22
+ --> $DIR/suggest-ref-mut.rs:23:22
|
LL | ref quo => { *quo = 32; },
| ^^^^^^^^^ `quo` is a `&` reference, so the data it refers to cannot be written
@@ -40,7 +40,7 @@ LL | ref quo => { *quo = 32; },
help: consider changing this to be a mutable reference
|
LL | ref mut quo => { *quo = 32; },
- | ~~~~~~~~~~~
+ | +++
error: aborting due to 4 previous errors
diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.fixed b/tests/ui/suggestions/type-ascription-instead-of-let.fixed
new file mode 100644
index 000000000..e3d03b6f2
--- /dev/null
+++ b/tests/ui/suggestions/type-ascription-instead-of-let.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+
+fn fun(x: i32) -> i32 { x }
+
+fn main() {
+ let _closure_annotated = |value: i32| -> i32 {
+ let temp: i32 = fun(5i32);
+ //~^ ERROR expected identifier, found `:`
+ temp + value + 1
+ };
+}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.rs b/tests/ui/suggestions/type-ascription-instead-of-let.rs
index 0e1c30750..6e1c86f96 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-let.rs
+++ b/tests/ui/suggestions/type-ascription-instead-of-let.rs
@@ -1,10 +1,11 @@
+// run-rustfix
+
fn fun(x: i32) -> i32 { x }
fn main() {
- let closure_annotated = |value: i32| -> i32 {
+ let _closure_annotated = |value: i32| -> i32 {
temp: i32 = fun(5i32);
- //~^ ERROR cannot find value `temp` in this scope
+ //~^ ERROR expected identifier, found `:`
temp + value + 1
- //~^ ERROR cannot find value `temp` in this scope
};
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.stderr b/tests/ui/suggestions/type-ascription-instead-of-let.stderr
index 92e4b5798..065b1f4d3 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-let.stderr
+++ b/tests/ui/suggestions/type-ascription-instead-of-let.stderr
@@ -1,18 +1,13 @@
-error[E0425]: cannot find value `temp` in this scope
- --> $DIR/type-ascription-instead-of-let.rs:5:9
+error: expected identifier, found `:`
+ --> $DIR/type-ascription-instead-of-let.rs:7:13
|
LL | temp: i32 = fun(5i32);
- | ^^^^
- | |
- | not found in this scope
- | help: maybe you meant to write an assignment here: `let temp`
-
-error[E0425]: cannot find value `temp` in this scope
- --> $DIR/type-ascription-instead-of-let.rs:7:9
+ | ^ expected identifier
+ |
+help: you might have meant to introduce a new binding
|
-LL | temp + value + 1
- | ^^^^ not found in this scope
+LL | let temp: i32 = fun(5i32);
+ | +++
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/suggestions/type-ascription-instead-of-method.fixed b/tests/ui/suggestions/type-ascription-instead-of-method.fixed
index 56b740b0d..02e316b26 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-method.fixed
+++ b/tests/ui/suggestions/type-ascription-instead-of-method.fixed
@@ -1,5 +1,5 @@
// run-rustfix
fn main() {
let _ = Box::new("foo".to_string());
- //~^ ERROR expected type, found
+ //~^ ERROR path separator must be a double colon
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-method.rs b/tests/ui/suggestions/type-ascription-instead-of-method.rs
index a603e09e7..6f893ee89 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-method.rs
+++ b/tests/ui/suggestions/type-ascription-instead-of-method.rs
@@ -1,5 +1,5 @@
// run-rustfix
fn main() {
let _ = Box:new("foo".to_string());
- //~^ ERROR expected type, found
+ //~^ ERROR path separator must be a double colon
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-method.stderr b/tests/ui/suggestions/type-ascription-instead-of-method.stderr
index 83bc33f41..b3799101c 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-method.stderr
+++ b/tests/ui/suggestions/type-ascription-instead-of-method.stderr
@@ -1,12 +1,10 @@
-error: expected type, found `"foo"`
- --> $DIR/type-ascription-instead-of-method.rs:3:21
+error: path separator must be a double colon
+ --> $DIR/type-ascription-instead-of-method.rs:3:16
|
LL | let _ = Box:new("foo".to_string());
- | - ^^^^^ expected type
- | |
- | help: maybe write a path separator here: `::`
+ | ^ help: use a double colon instead: `::`
|
- = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
+ = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: aborting due to previous error
diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed b/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed
index 787fcc120..4cec58be8 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed
+++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed
@@ -1,6 +1,6 @@
// run-rustfix
fn main() -> Result<(), ()> {
let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?;
- //~^ ERROR expected `::`, found `(`
+ //~^ ERROR expected one of
Ok(())
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.rs b/tests/ui/suggestions/type-ascription-instead-of-path-2.rs
index 934016b3b..5695d5a7f 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-path-2.rs
+++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.rs
@@ -1,6 +1,6 @@
// run-rustfix
fn main() -> Result<(), ()> {
let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
- //~^ ERROR expected `::`, found `(`
+ //~^ ERROR expected one of
Ok(())
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr
index 970b220b7..43d00591e 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr
+++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr
@@ -1,12 +1,14 @@
-error: expected `::`, found `(`
- --> $DIR/type-ascription-instead-of-path-2.rs:3:63
+error: expected one of `(`, `.`, `::`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/type-ascription-instead-of-path-2.rs:3:44
|
LL | let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
- | - ^ expected `::`
- | |
- | help: maybe write a path separator here: `::`
+ | ^ expected one of 7 possible tokens
|
- = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+help: maybe write a path separator here
+ |
+LL | let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?;
+ | ~~
error: aborting due to previous error
diff --git a/tests/ui/suggestions/type-ascription-instead-of-path.rs b/tests/ui/suggestions/type-ascription-instead-of-path.rs
index ce40b55f1..69647887a 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-path.rs
+++ b/tests/ui/suggestions/type-ascription-instead-of-path.rs
@@ -1,5 +1,4 @@
fn main() {
std:io::stdin();
- //~^ ERROR failed to resolve: use of undeclared crate or module `io`
- //~| ERROR expected value, found crate
+ //~^ ERROR path separator must be a double colon
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-path.stderr b/tests/ui/suggestions/type-ascription-instead-of-path.stderr
index 518660cfa..849630218 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-path.stderr
+++ b/tests/ui/suggestions/type-ascription-instead-of-path.stderr
@@ -1,18 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `io`
- --> $DIR/type-ascription-instead-of-path.rs:2:9
+error: path separator must be a double colon
+ --> $DIR/type-ascription-instead-of-path.rs:2:8
|
LL | std:io::stdin();
- | ^^ use of undeclared crate or module `io`
-
-error[E0423]: expected value, found crate `std`
- --> $DIR/type-ascription-instead-of-path.rs:2:5
+ | ^ help: use a double colon instead: `::`
|
-LL | std:io::stdin();
- | ^^^- help: maybe you meant to write a path separator here: `::`
- | |
- | not a value
+ = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0423, E0433.
-For more information about an error, try `rustc --explain E0423`.
diff --git a/tests/ui/suggestions/type-ascription-instead-of-variant.fixed b/tests/ui/suggestions/type-ascription-instead-of-variant.fixed
index b3247e128..04cb20686 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-variant.fixed
+++ b/tests/ui/suggestions/type-ascription-instead-of-variant.fixed
@@ -1,5 +1,5 @@
// run-rustfix
fn main() {
let _ = Option::Some("");
- //~^ ERROR expected type, found
+ //~^ ERROR path separator must be a double colon
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-variant.rs b/tests/ui/suggestions/type-ascription-instead-of-variant.rs
index 6fd2c1954..2cce69bfe 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-variant.rs
+++ b/tests/ui/suggestions/type-ascription-instead-of-variant.rs
@@ -1,5 +1,5 @@
// run-rustfix
fn main() {
let _ = Option:Some("");
- //~^ ERROR expected type, found
+ //~^ ERROR path separator must be a double colon
}
diff --git a/tests/ui/suggestions/type-ascription-instead-of-variant.stderr b/tests/ui/suggestions/type-ascription-instead-of-variant.stderr
index f59ba78d4..11d0f5f52 100644
--- a/tests/ui/suggestions/type-ascription-instead-of-variant.stderr
+++ b/tests/ui/suggestions/type-ascription-instead-of-variant.stderr
@@ -1,12 +1,10 @@
-error: expected type, found `""`
- --> $DIR/type-ascription-instead-of-variant.rs:3:25
+error: path separator must be a double colon
+ --> $DIR/type-ascription-instead-of-variant.rs:3:19
|
LL | let _ = Option:Some("");
- | - ^^ expected type
- | |
- | help: maybe write a path separator here: `::`
+ | ^ help: use a double colon instead: `::`
|
- = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
+ = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: aborting due to previous error