summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
commit631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch)
treea1b87c8f8cad01cf18f7c5f57a08f102771ed303 /tests/ui/suggestions
parentAdding debian version 1.69.0+dfsg1-1. (diff)
downloadrustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz
rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/suggestions')
-rw-r--r--tests/ui/suggestions/bad-infer-in-trait-impl.rs10
-rw-r--r--tests/ui/suggestions/bad-infer-in-trait-impl.stderr14
-rw-r--r--tests/ui/suggestions/chain-method-call-mutation-in-place.rs6
-rw-r--r--tests/ui/suggestions/chain-method-call-mutation-in-place.stderr37
-rw-r--r--tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr3
-rw-r--r--tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs5
-rw-r--r--tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr9
-rw-r--r--tests/ui/suggestions/core-std-import-order-issue-83564.stderr4
-rw-r--r--tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs16
-rw-r--r--tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr22
-rw-r--r--tests/ui/suggestions/derive-macro-missing-bounds.stderr3
-rw-r--r--tests/ui/suggestions/derive-trait-for-method-call.stderr9
-rw-r--r--tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr4
-rw-r--r--tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr17
-rw-r--r--tests/ui/suggestions/import-trait-for-method-call.stderr2
-rw-r--r--tests/ui/suggestions/invalid-bin-op.stderr3
-rw-r--r--tests/ui/suggestions/issue-107860.rs6
-rw-r--r--tests/ui/suggestions/issue-107860.stderr12
-rw-r--r--tests/ui/suggestions/issue-108470.fixed29
-rw-r--r--tests/ui/suggestions/issue-108470.rs29
-rw-r--r--tests/ui/suggestions/issue-108470.stderr27
-rw-r--r--tests/ui/suggestions/issue-109291.rs4
-rw-r--r--tests/ui/suggestions/issue-109291.stderr12
-rw-r--r--tests/ui/suggestions/issue-109396.rs12
-rw-r--r--tests/ui/suggestions/issue-109396.stderr34
-rw-r--r--tests/ui/suggestions/issue-109436.rs13
-rw-r--r--tests/ui/suggestions/issue-109436.stderr15
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.stderr6
-rw-r--r--tests/ui/suggestions/issue-97760.stderr4
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed2
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs2
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr6
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs2
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr6
-rw-r--r--tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed2
-rw-r--r--tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs2
-rw-r--r--tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr2
-rw-r--r--tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed2
-rw-r--r--tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs2
-rw-r--r--tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr2
-rw-r--r--tests/ui/suggestions/multiline-multipart-suggestion.rs19
-rw-r--r--tests/ui/suggestions/multiline-multipart-suggestion.stderr46
-rw-r--r--tests/ui/suggestions/mut-borrow-needed-by-trait.stderr10
-rw-r--r--tests/ui/suggestions/no-extern-crate-in-type.stderr2
-rw-r--r--tests/ui/suggestions/raw-name-use-suggestion.stderr2
-rw-r--r--tests/ui/suggestions/ref-pattern-binding.stderr20
-rw-r--r--tests/ui/suggestions/suggest-pin-macro.rs23
-rw-r--r--tests/ui/suggestions/suggest-pin-macro.stderr19
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.rs11
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.stderr11
-rw-r--r--tests/ui/suggestions/suggest-tryinto-edition-change.stderr14
-rw-r--r--tests/ui/suggestions/use-placement-resolve.stderr2
-rw-r--r--tests/ui/suggestions/use-placement-typeck.stderr2
53 files changed, 496 insertions, 82 deletions
diff --git a/tests/ui/suggestions/bad-infer-in-trait-impl.rs b/tests/ui/suggestions/bad-infer-in-trait-impl.rs
new file mode 100644
index 000000000..87db2636f
--- /dev/null
+++ b/tests/ui/suggestions/bad-infer-in-trait-impl.rs
@@ -0,0 +1,10 @@
+trait Foo {
+ fn bar();
+}
+
+impl Foo for () {
+ fn bar(s: _) {}
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/bad-infer-in-trait-impl.stderr b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr
new file mode 100644
index 000000000..418690ff8
--- /dev/null
+++ b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr
@@ -0,0 +1,14 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
+ --> $DIR/bad-infer-in-trait-impl.rs:6:15
+ |
+LL | fn bar(s: _) {}
+ | ^ not allowed in type signatures
+ |
+help: use type parameters instead
+ |
+LL | fn bar<T>(s: T) {}
+ | +++ ~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/tests/ui/suggestions/chain-method-call-mutation-in-place.rs b/tests/ui/suggestions/chain-method-call-mutation-in-place.rs
index cb92ab87a..7a4c74796 100644
--- a/tests/ui/suggestions/chain-method-call-mutation-in-place.rs
+++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.rs
@@ -1,4 +1,8 @@
-fn main() {}
+fn main() {
+ let x: Vec<i32> = vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i); //~ ERROR mismatched types
+ vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i).sort(); //~ ERROR no method named `sort` found for unit type `()` in the current scope
+}
+
fn foo(mut s: String) -> String {
s.push_str("asdf") //~ ERROR mismatched types
}
diff --git a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
index 11d9b8391..128160f10 100644
--- a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
+++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
@@ -1,5 +1,33 @@
error[E0308]: mismatched types
- --> $DIR/chain-method-call-mutation-in-place.rs:3:5
+ --> $DIR/chain-method-call-mutation-in-place.rs:2:23
+ |
+LL | let x: Vec<i32> = vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i);
+ | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec<i32>`, found `()`
+ | |
+ | expected due to this
+ |
+ = note: expected struct `Vec<i32>`
+ found unit type `()`
+note: method `sort_by_key` modifies its receiver in-place, it is not meant to be used in method chains.
+ --> $DIR/chain-method-call-mutation-in-place.rs:2:71
+ |
+LL | let x: Vec<i32> = vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i);
+ | ^^^^^^^^^^^ this call modifies its receiver in-place
+
+error[E0599]: no method named `sort` found for unit type `()` in the current scope
+ --> $DIR/chain-method-call-mutation-in-place.rs:3:72
+ |
+LL | vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i).sort();
+ | ^^^^ method not found in `()`
+ |
+note: method `sort_by_key` modifies its receiver in-place, it is not meant to be used in method chains.
+ --> $DIR/chain-method-call-mutation-in-place.rs:3:53
+ |
+LL | vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i).sort();
+ | ^^^^^^^^^^^ this call modifies its receiver in-place
+
+error[E0308]: mismatched types
+ --> $DIR/chain-method-call-mutation-in-place.rs:7:5
|
LL | fn foo(mut s: String) -> String {
| ------ expected `String` because of return type
@@ -7,7 +35,7 @@ LL | s.push_str("asdf")
| ^^^^^^^^^^^^^^^^^^ expected `String`, found `()`
|
note: method `push_str` modifies its receiver in-place
- --> $DIR/chain-method-call-mutation-in-place.rs:3:7
+ --> $DIR/chain-method-call-mutation-in-place.rs:7:7
|
LL | s.push_str("asdf")
| - ^^^^^^^^ this call modifies `s` in-place
@@ -15,6 +43,7 @@ LL | s.push_str("asdf")
| you probably want to use this value after calling the method...
= note: ...instead of the `()` output of method `push_str`
-error: aborting due to previous error
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0308`.
+Some errors have detailed explanations: E0308, E0599.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
index 45593035b..0716005c6 100644
--- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
+++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
@@ -35,7 +35,8 @@ LL | t.clone()
| ^
help: consider annotating `Foo` with `#[derive(Clone)]`
|
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Foo;
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs
index 15f08486f..af47ba8ba 100644
--- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs
+++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs
@@ -2,10 +2,9 @@ fn main() {
let A = 3;
//~^ ERROR refutable pattern in local binding
//~| patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered
- //~| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
+ //~| missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable
//~| HELP introduce a variable instead
- //~| SUGGESTION a_var
+ //~| SUGGESTION A_var
const A: i32 = 2;
- //~^ constant defined here
}
diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr
index 1c1cab25f..9ee3e6eb2 100644
--- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr
+++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr
@@ -5,12 +5,11 @@ LL | let A = 3;
| ^
| |
| patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered
- | missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
- | help: introduce a variable instead: `a_var`
-...
-LL | const A: i32 = 2;
- | ------------ constant defined here
+ | missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable
+ | help: introduce a variable instead: `A_var`
|
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `i32`
error: aborting due to previous error
diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
index e4e1fc591..48ee44a74 100644
--- a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
+++ b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
@@ -6,9 +6,9 @@ LL | let _x = NonZeroU32::new(5).unwrap();
|
help: consider importing one of these items
|
-LL | use core::num::NonZeroU32;
+LL + use core::num::NonZeroU32;
|
-LL | use std::num::NonZeroU32;
+LL + use std::num::NonZeroU32;
|
error: aborting due to previous error
diff --git a/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs
new file mode 100644
index 000000000..e56c8622e
--- /dev/null
+++ b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs
@@ -0,0 +1,16 @@
+trait Foo
+where
+ for<'a> &'a Self: Bar,
+{
+}
+
+impl Foo for () {}
+
+trait Bar {}
+
+impl Bar for &() {}
+
+fn foo<T: Foo>() {}
+//~^ ERROR the trait bound `for<'a> &'a T: Bar` is not satisfied
+
+fn main() {}
diff --git a/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr
new file mode 100644
index 000000000..2298e7f4e
--- /dev/null
+++ b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr
@@ -0,0 +1,22 @@
+error[E0277]: the trait bound `for<'a> &'a T: Bar` is not satisfied
+ --> $DIR/correct-binder-for-arbitrary-bound-sugg.rs:13:11
+ |
+LL | fn foo<T: Foo>() {}
+ | ^^^ the trait `for<'a> Bar` is not implemented for `&'a T`
+ |
+note: required by a bound in `Foo`
+ --> $DIR/correct-binder-for-arbitrary-bound-sugg.rs:3:23
+ |
+LL | trait Foo
+ | --- required by a bound in this trait
+LL | where
+LL | for<'a> &'a Self: Bar,
+ | ^^^ required by this bound in `Foo`
+help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
+ |
+LL | fn foo<T: Foo>() where for<'a> &'a T: Bar {}
+ | ++++++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
index 79036279d..c3f305c17 100644
--- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr
+++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
@@ -11,7 +11,8 @@ LL | struct Outer<T>(Inner<T>);
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `a::Inner<T>` with `#[derive(Debug)]`
|
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct Inner<T>(T);
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
diff --git a/tests/ui/suggestions/derive-trait-for-method-call.stderr b/tests/ui/suggestions/derive-trait-for-method-call.stderr
index 924b26a8c..e2db0da74 100644
--- a/tests/ui/suggestions/derive-trait-for-method-call.stderr
+++ b/tests/ui/suggestions/derive-trait-for-method-call.stderr
@@ -32,7 +32,8 @@ note: the trait `Default` must be implemented
--> $SRC_DIR/core/src/default.rs:LL:COL
help: consider annotating `Enum` with `#[derive(Clone)]`
|
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | enum Enum {
|
error[E0599]: the method `test` exists for struct `Foo<Struct, CloneStruct>`, but its trait bounds were not satisfied
@@ -67,11 +68,13 @@ LL | impl<X: Clone + Default + , Y: Clone + Default> Foo<X, Y> {
| unsatisfied trait bound introduced here
help: consider annotating `CloneStruct` with `#[derive(Default)]`
|
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct CloneStruct {
|
help: consider annotating `Struct` with `#[derive(Clone, Default)]`
|
-LL | #[derive(Clone, Default)]
+LL + #[derive(Clone, Default)]
+LL | struct Struct {
|
error[E0599]: the method `test` exists for struct `Foo<Vec<Enum>, Instant>`, but its trait bounds were not satisfied
diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr
index 4658ecb3a..85fbb8b88 100644
--- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr
+++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr
@@ -10,9 +10,9 @@ LL | banana::Chaenomeles.pick()
= help: items from traits can only be used if the trait is in scope
help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
|
-LL | use banana::Apple;
+LL + use banana::Apple;
|
-LL | use banana::Peach;
+LL + use banana::Peach;
|
error: aborting due to previous error
diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
index 90ea06239..0232d4c8d 100644
--- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
+++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
@@ -50,7 +50,8 @@ LL | Pin::new(x)
| |
| required by a bound introduced by this call
|
- = note: consider using `Box::pin`
+ = note: consider using the `pin!` macro
+ consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required by a bound in `Pin::<P>::new`
--> $SRC_DIR/core/src/pin.rs:LL:COL
@@ -62,25 +63,23 @@ LL | Pin::new(Box::new(x))
| |
| required by a bound introduced by this call
|
- = note: consider using `Box::pin`
+ = note: consider using the `pin!` macro
+ consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required by a bound in `Pin::<P>::new`
--> $SRC_DIR/core/src/pin.rs:LL:COL
error[E0308]: mismatched types
--> $DIR/expected-boxed-future-isnt-pinned.rs:28:5
|
+LL | fn zap() -> BoxFuture<'static, i32> {
+ | ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
LL | / async {
LL | | 42
LL | | }
- | | ^
- | | |
- | |_____expected `Pin<Box<...>>`, found `async` block
- | arguments to this function are incorrect
+ | |_____^ expected `Pin<Box<...>>`, found `async` block
|
- = note: expected struct `Pin<Box<dyn Future<Output = i32> + Send>>`
+ = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]`
-note: function defined here
- --> $SRC_DIR/core/src/future/mod.rs:LL:COL
help: you need to pin and box this expression
|
LL ~ Box::pin(async {
diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr
index f159b51a2..3f54daf13 100644
--- a/tests/ui/suggestions/import-trait-for-method-call.stderr
+++ b/tests/ui/suggestions/import-trait-for-method-call.stderr
@@ -10,7 +10,7 @@ LL | h.finish()
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
-LL | use std::hash::Hasher;
+LL + use std::hash::Hasher;
|
error[E0599]: the method `as_ref` exists for reference `&dyn Bar`, but its trait bounds were not satisfied
diff --git a/tests/ui/suggestions/invalid-bin-op.stderr b/tests/ui/suggestions/invalid-bin-op.stderr
index 08502dfeb..e291cedb8 100644
--- a/tests/ui/suggestions/invalid-bin-op.stderr
+++ b/tests/ui/suggestions/invalid-bin-op.stderr
@@ -13,7 +13,8 @@ LL | struct S<T>(T);
| ^^^^^^^^^^^ must implement `PartialEq<_>`
help: consider annotating `S<T>` with `#[derive(PartialEq)]`
|
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct S<T>(T);
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
diff --git a/tests/ui/suggestions/issue-107860.rs b/tests/ui/suggestions/issue-107860.rs
new file mode 100644
index 000000000..a6449cd44
--- /dev/null
+++ b/tests/ui/suggestions/issue-107860.rs
@@ -0,0 +1,6 @@
+// edition: 2021
+
+async fn str<T>(T: &str) -> &str { &str }
+//~^ ERROR mismatched types
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-107860.stderr b/tests/ui/suggestions/issue-107860.stderr
new file mode 100644
index 000000000..92e3cf8c4
--- /dev/null
+++ b/tests/ui/suggestions/issue-107860.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-107860.rs:3:36
+ |
+LL | async fn str<T>(T: &str) -> &str { &str }
+ | ^^^^ expected `&str`, found `&fn(&str) -> ... {str::<...>}`
+ |
+ = note: expected reference `&str`
+ found reference `&for<'a> fn(&'a str) -> impl Future<Output = &'a str> {str::<_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/suggestions/issue-108470.fixed b/tests/ui/suggestions/issue-108470.fixed
new file mode 100644
index 000000000..9d15c4a8f
--- /dev/null
+++ b/tests/ui/suggestions/issue-108470.fixed
@@ -0,0 +1,29 @@
+// run-rustfix
+#![allow(dead_code)]
+
+struct Foo {
+ t: Thing
+}
+
+#[derive(Clone)]
+struct Thing;
+
+fn test_clone() {
+ let t = &Thing;
+ let _f = Foo {
+ t: t.clone() //~ ERROR mismatched types
+ };
+}
+
+struct Bar {
+ t: bool
+}
+
+fn test_is_some() {
+ let t = Option::<i32>::Some(1);
+ let _f = Bar {
+ t: t.is_some() //~ ERROR mismatched types
+ };
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-108470.rs b/tests/ui/suggestions/issue-108470.rs
new file mode 100644
index 000000000..bda39085d
--- /dev/null
+++ b/tests/ui/suggestions/issue-108470.rs
@@ -0,0 +1,29 @@
+// run-rustfix
+#![allow(dead_code)]
+
+struct Foo {
+ t: Thing
+}
+
+#[derive(Clone)]
+struct Thing;
+
+fn test_clone() {
+ let t = &Thing;
+ let _f = Foo {
+ t //~ ERROR mismatched types
+ };
+}
+
+struct Bar {
+ t: bool
+}
+
+fn test_is_some() {
+ let t = Option::<i32>::Some(1);
+ let _f = Bar {
+ t //~ ERROR mismatched types
+ };
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-108470.stderr b/tests/ui/suggestions/issue-108470.stderr
new file mode 100644
index 000000000..4e561eca7
--- /dev/null
+++ b/tests/ui/suggestions/issue-108470.stderr
@@ -0,0 +1,27 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-108470.rs:14:9
+ |
+LL | t
+ | ^ expected `Thing`, found `&Thing`
+ |
+help: consider using clone here
+ |
+LL | t: t.clone()
+ | +++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-108470.rs:25:9
+ |
+LL | t
+ | ^ expected `bool`, found `Option<i32>`
+ |
+ = note: expected type `bool`
+ found enum `Option<i32>`
+help: use `Option::is_some` to test if the `Option` has a value
+ |
+LL | t: t.is_some()
+ | +++++++++++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/suggestions/issue-109291.rs b/tests/ui/suggestions/issue-109291.rs
new file mode 100644
index 000000000..1947b16a3
--- /dev/null
+++ b/tests/ui/suggestions/issue-109291.rs
@@ -0,0 +1,4 @@
+fn main() {
+ println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture());
+ //~^ ERROR no function or associated item name
+}
diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr
new file mode 100644
index 000000000..4ef5948d9
--- /dev/null
+++ b/tests/ui/suggestions/issue-109291.stderr
@@ -0,0 +1,12 @@
+error[E0599]: no function or associated item named `forced_capture` found for struct `Backtrace` in the current scope
+ --> $DIR/issue-109291.rs:2:65
+ |
+LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture());
+ | ^^^^^^^^^^^^^^
+ | |
+ | function or associated item not found in `Backtrace`
+ | help: there is an associated function with a similar name: `force_capture`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/suggestions/issue-109396.rs b/tests/ui/suggestions/issue-109396.rs
new file mode 100644
index 000000000..b6c464d45
--- /dev/null
+++ b/tests/ui/suggestions/issue-109396.rs
@@ -0,0 +1,12 @@
+fn main() {
+ {
+ let mut mutex = std::mem::zeroed(
+ //~^ ERROR this function takes 0 arguments but 4 arguments were supplied
+ file.as_raw_fd(),
+ //~^ ERROR expected value, found macro `file`
+ 0,
+ 0,
+ 0,
+ );
+ }
+}
diff --git a/tests/ui/suggestions/issue-109396.stderr b/tests/ui/suggestions/issue-109396.stderr
new file mode 100644
index 000000000..d4956872a
--- /dev/null
+++ b/tests/ui/suggestions/issue-109396.stderr
@@ -0,0 +1,34 @@
+error[E0423]: expected value, found macro `file`
+ --> $DIR/issue-109396.rs:5:13
+ |
+LL | file.as_raw_fd(),
+ | ^^^^ not a value
+
+error[E0061]: this function takes 0 arguments but 4 arguments were supplied
+ --> $DIR/issue-109396.rs:3:25
+ |
+LL | let mut mutex = std::mem::zeroed(
+ | ^^^^^^^^^^^^^^^^
+LL |
+LL | file.as_raw_fd(),
+ | ---------------- unexpected argument
+LL |
+LL | 0,
+ | - unexpected argument of type `{integer}`
+LL | 0,
+ | - unexpected argument of type `{integer}`
+LL | 0,
+ | - unexpected argument of type `{integer}`
+ |
+note: function defined here
+ --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+help: remove the extra arguments
+ |
+LL - file.as_raw_fd(),
+LL + );
+ |
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0061, E0423.
+For more information about an error, try `rustc --explain E0061`.
diff --git a/tests/ui/suggestions/issue-109436.rs b/tests/ui/suggestions/issue-109436.rs
new file mode 100644
index 000000000..e45ee5991
--- /dev/null
+++ b/tests/ui/suggestions/issue-109436.rs
@@ -0,0 +1,13 @@
+struct Foo;
+struct Bar;
+
+impl From<&Foo> for Bar {
+ fn from(foo: &Foo) -> Bar {
+ Bar
+ }
+}
+
+fn main() {
+ let foo = Foo;
+ let b: Bar = foo.into(); //~ ERROR E0277
+}
diff --git a/tests/ui/suggestions/issue-109436.stderr b/tests/ui/suggestions/issue-109436.stderr
new file mode 100644
index 000000000..48518b33d
--- /dev/null
+++ b/tests/ui/suggestions/issue-109436.stderr
@@ -0,0 +1,15 @@
+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`
+ |
+ = note: required for `Foo` to implement `Into<Bar>`
+help: consider borrowing here
+ |
+LL | let b: Bar = (&foo).into();
+ | ++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr
index c20cc8164..4de9da89c 100644
--- a/tests/ui/suggestions/issue-84973-blacklist.stderr
+++ b/tests/ui/suggestions/issue-84973-blacklist.stderr
@@ -27,7 +27,8 @@ LL | fn f_clone<T: Clone>(t: T) {}
| ^^^^^ required by this bound in `f_clone`
help: consider annotating `S` with `#[derive(Clone)]`
|
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct S;
|
error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` cannot be unpinned
@@ -38,7 +39,8 @@ LL | f_unpin(static || { yield; });
| |
| required by a bound introduced by this call
|
- = note: consider using `Box::pin`
+ = note: consider using the `pin!` macro
+ consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required by a bound in `f_unpin`
--> $DIR/issue-84973-blacklist.rs:8:15
|
diff --git a/tests/ui/suggestions/issue-97760.stderr b/tests/ui/suggestions/issue-97760.stderr
index bbcc3693f..5415c247c 100644
--- a/tests/ui/suggestions/issue-97760.stderr
+++ b/tests/ui/suggestions/issue-97760.stderr
@@ -1,8 +1,8 @@
error[E0277]: `<impl IntoIterator as IntoIterator>::Item` doesn't implement `std::fmt::Display`
- --> $DIR/issue-97760.rs:4:20
+ --> $DIR/issue-97760.rs:4:19
|
LL | println!("{x}");
- | ^ `<impl IntoIterator as IntoIterator>::Item` cannot be formatted with the default formatter
+ | ^^^ `<impl IntoIterator as IntoIterator>::Item` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `<impl IntoIterator as IntoIterator>::Item`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed
index 304360d48..47b35b412 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed
@@ -7,7 +7,7 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}
-#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type
+#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K: Copy + Debug>{
pub loc: Vector2<K>,
pub size: Vector2<K>
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs
index 14e1fbb33..771e9105c 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs
@@ -7,7 +7,7 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}
-#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type
+#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K: Copy>{
pub loc: Vector2<K>,
pub size: Vector2<K>
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr
index faf730a5c..09696e061 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr
@@ -1,4 +1,4 @@
-error[E0204]: the trait `Copy` may not be implemented for this type
+error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-derive-copy-impl-3.rs:10:17
|
LL | #[derive(Debug, Copy, Clone)]
@@ -6,16 +6,12 @@ LL | #[derive(Debug, Copy, Clone)]
LL | pub struct AABB<K: Copy>{
LL | pub loc: Vector2<K>,
| ------------------- this field does not implement `Copy`
-LL | pub size: Vector2<K>
- | -------------------- this field does not implement `Copy`
|
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
--> $DIR/missing-bound-in-derive-copy-impl-3.rs:12:14
|
LL | pub loc: Vector2<K>,
| ^^^^^^^^^^
-LL | pub size: Vector2<K>
- | ^^^^^^^^^^
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs
index 52163bddd..9c7b7ba09 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs
@@ -6,7 +6,7 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}
-#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type
+#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K>{
pub loc: Vector2<K>,
pub size: Vector2<K>
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr
index 11bc54099..8585fe47b 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr
@@ -1,4 +1,4 @@
-error[E0204]: the trait `Copy` may not be implemented for this type
+error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-derive-copy-impl.rs:9:17
|
LL | #[derive(Debug, Copy, Clone)]
@@ -6,16 +6,12 @@ LL | #[derive(Debug, Copy, Clone)]
LL | pub struct AABB<K>{
LL | pub loc: Vector2<K>,
| ------------------- this field does not implement `Copy`
-LL | pub size: Vector2<K>
- | -------------------- this field does not implement `Copy`
|
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
--> $DIR/missing-bound-in-derive-copy-impl.rs:11:14
|
LL | pub loc: Vector2<K>,
| ^^^^^^^^^^
-LL | pub size: Vector2<K>
- | ^^^^^^^^^^
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K`
|
diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed
index 691e7553a..f32c61a99 100644
--- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed
+++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed
@@ -14,6 +14,6 @@ impl<T: std::fmt::Display> Clone for OnlyCopyIfDisplay<T> {
impl<T: std::fmt::Display> Copy for OnlyCopyIfDisplay<T> {}
impl<S: std::fmt::Display> Copy for Wrapper<OnlyCopyIfDisplay<S>> {}
-//~^ ERROR the trait `Copy` may not be implemented for this type
+//~^ ERROR the trait `Copy` cannot be implemented for this type
fn main() {}
diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs
index e3185e7ef..d7725f4a3 100644
--- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs
+++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs
@@ -14,6 +14,6 @@ impl<T: std::fmt::Display> Clone for OnlyCopyIfDisplay<T> {
impl<T: std::fmt::Display> Copy for OnlyCopyIfDisplay<T> {}
impl<S> Copy for Wrapper<OnlyCopyIfDisplay<S>> {}
-//~^ ERROR the trait `Copy` may not be implemented for this type
+//~^ ERROR the trait `Copy` cannot be implemented for this type
fn main() {}
diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr
index 9e6f0d9eb..856d8db38 100644
--- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr
+++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr
@@ -1,4 +1,4 @@
-error[E0204]: the trait `Copy` may not be implemented for this type
+error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-manual-copy-impl-2.rs:16:18
|
LL | struct Wrapper<T>(T);
diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed
index 32a7215c5..1139b3153 100644
--- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed
+++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed
@@ -4,6 +4,6 @@
struct Wrapper<T>(T);
impl<S: Copy> Copy for Wrapper<S> {}
-//~^ ERROR the trait `Copy` may not be implemented for this type
+//~^ ERROR the trait `Copy` cannot be implemented for this type
fn main() {}
diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs
index c688f4d41..19549248e 100644
--- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs
+++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs
@@ -4,6 +4,6 @@
struct Wrapper<T>(T);
impl<S> Copy for Wrapper<S> {}
-//~^ ERROR the trait `Copy` may not be implemented for this type
+//~^ ERROR the trait `Copy` cannot be implemented for this type
fn main() {}
diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr
index fe2d133c8..ec3e4f23a 100644
--- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr
+++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr
@@ -1,4 +1,4 @@
-error[E0204]: the trait `Copy` may not be implemented for this type
+error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-manual-copy-impl.rs:6:18
|
LL | struct Wrapper<T>(T);
diff --git a/tests/ui/suggestions/multiline-multipart-suggestion.rs b/tests/ui/suggestions/multiline-multipart-suggestion.rs
new file mode 100644
index 000000000..77d0322d0
--- /dev/null
+++ b/tests/ui/suggestions/multiline-multipart-suggestion.rs
@@ -0,0 +1,19 @@
+// compile-flags: --error-format=human --color=always
+// ignore-windows
+
+fn short(foo_bar: &Vec<&i32>) -> &i32 { //~ ERROR missing lifetime specifier
+ &12
+}
+
+fn long( //~ ERROR missing lifetime specifier
+ foo_bar: &Vec<&i32>,
+ something_very_long_so_that_the_line_will_wrap_around__________: i32,
+) -> &i32 {
+ &12
+}
+
+fn long2( //~ ERROR missing lifetime specifier
+ foo_bar: &Vec<&i32>) -> &i32 {
+ &12
+}
+fn main() {}
diff --git a/tests/ui/suggestions/multiline-multipart-suggestion.stderr b/tests/ui/suggestions/multiline-multipart-suggestion.stderr
new file mode 100644
index 000000000..045a86b4f
--- /dev/null
+++ b/tests/ui/suggestions/multiline-multipart-suggestion.stderr
@@ -0,0 +1,46 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/multiline-multipart-suggestion.rs:4:34
+ |
+LL | fn short(foo_bar: &Vec<&i32>) -> &i32 {
+ |  ---------- ^ expected named lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from
+help: consider introducing a named lifetime parameter
+ |
+LL | fn short<'a>(foo_bar: &'a Vec<&'a i32>) -> &'a i32 {
+ | ++++ ++ ++ ++
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/multiline-multipart-suggestion.rs:11:6
+ |
+LL |  foo_bar: &Vec<&i32>,
+ |  ----------
+LL |  something_very_long_so_that_the_line_will_wrap_around__________: i32,
+LL | ) -> &i32 {
+ |  ^ expected named lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from
+help: consider introducing a named lifetime parameter
+ |
+LL ~ fn long<'a>(
+LL ~  foo_bar: &'a Vec<&'a i32>,
+LL |  something_very_long_so_that_the_line_will_wrap_around__________: i32,
+LL ~ ) -> &'a i32 {
+ |
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/multiline-multipart-suggestion.rs:16:29
+ |
+LL |  foo_bar: &Vec<&i32>) -> &i32 {
+ |  ---------- ^ expected named lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from
+help: consider introducing a named lifetime parameter
+ |
+LL ~ fn long2<'a>(
+LL ~  foo_bar: &'a Vec<&'a i32>) -> &'a i32 {
+ |
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr b/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr
index 6910b77d9..94710f450 100644
--- a/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr
+++ b/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr
@@ -21,18 +21,22 @@ note: required by a bound in `BufWriter`
--> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn Write>`, but its trait bounds were not satisfied
- --> $DIR/mut-borrow-needed-by-trait.rs:21:5
+ --> $DIR/mut-borrow-needed-by-trait.rs:21:14
|
LL | writeln!(fp, "hello world").unwrap();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds
+ | ---------^^---------------- method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds
--> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
|
= note: doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write`
|
+note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
+ --> $DIR/mut-borrow-needed-by-trait.rs:21:14
+ |
+LL | writeln!(fp, "hello world").unwrap();
+ | ^^
= note: the following trait bounds were not satisfied:
`&dyn std::io::Write: std::io::Write`
which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
- = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/no-extern-crate-in-type.stderr b/tests/ui/suggestions/no-extern-crate-in-type.stderr
index 876eef2b6..68100e56c 100644
--- a/tests/ui/suggestions/no-extern-crate-in-type.stderr
+++ b/tests/ui/suggestions/no-extern-crate-in-type.stderr
@@ -6,7 +6,7 @@ LL | type Output = Option<Foo>;
|
help: consider importing this struct
|
-LL | use foo::Foo;
+LL + use foo::Foo;
|
error: aborting due to previous error
diff --git a/tests/ui/suggestions/raw-name-use-suggestion.stderr b/tests/ui/suggestions/raw-name-use-suggestion.stderr
index 95c26b9ad..fb070ffc3 100644
--- a/tests/ui/suggestions/raw-name-use-suggestion.stderr
+++ b/tests/ui/suggestions/raw-name-use-suggestion.stderr
@@ -28,7 +28,7 @@ LL | r#break();
|
help: consider importing this function
|
-LL | use foo::r#break;
+LL + use foo::r#break;
|
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/ref-pattern-binding.stderr b/tests/ui/suggestions/ref-pattern-binding.stderr
index 7b1942593..69ce5d440 100644
--- a/tests/ui/suggestions/ref-pattern-binding.stderr
+++ b/tests/ui/suggestions/ref-pattern-binding.stderr
@@ -2,9 +2,8 @@ error: borrow of moved value
--> $DIR/ref-pattern-binding.rs:10:9
|
LL | let _moved @ ref _from = String::from("foo");
- | ------^^^---------
- | | |
- | | value borrowed here after move
+ | ^^^^^^ --------- value borrowed here after move
+ | |
| value moved into `_moved` here
| move occurs because `_moved` has type `String` which does not implement the `Copy` trait
|
@@ -17,27 +16,24 @@ error: cannot move out of value because it is borrowed
--> $DIR/ref-pattern-binding.rs:11:9
|
LL | let ref _moved @ _from = String::from("foo");
- | ----------^^^-----
- | | |
- | | value is moved into `_from` here
+ | ^^^^^^^^^^ ----- value is moved into `_from` here
+ | |
| value is borrowed by `_moved` here
error: cannot move out of value because it is borrowed
--> $DIR/ref-pattern-binding.rs:15:9
|
LL | let ref _moved @ S { f } = S { f: String::from("foo") };
- | ----------^^^^^^^-^^
- | | |
- | | value is moved into `f` here
+ | ^^^^^^^^^^ - value is moved into `f` here
+ | |
| value is borrowed by `_moved` here
error: borrow of moved value
--> $DIR/ref-pattern-binding.rs:18:9
|
LL | let _moved @ S { ref f } = S { f: String::from("foo") };
- | ------^^^^^^^-----^^
- | | |
- | | value borrowed here after move
+ | ^^^^^^ ----- value borrowed here after move
+ | |
| value moved into `_moved` here
| move occurs because `_moved` has type `S` which does not implement the `Copy` trait
|
diff --git a/tests/ui/suggestions/suggest-pin-macro.rs b/tests/ui/suggestions/suggest-pin-macro.rs
new file mode 100644
index 000000000..f5b962159
--- /dev/null
+++ b/tests/ui/suggestions/suggest-pin-macro.rs
@@ -0,0 +1,23 @@
+use std::pin::Pin;
+use std::marker::PhantomPinned;
+
+#[derive(Debug)]
+struct Test {
+ _marker: PhantomPinned,
+}
+impl Test {
+ fn new() -> Self {
+ Test {
+ _marker: PhantomPinned, // This makes our type `!Unpin`
+ }
+ }
+}
+
+fn dummy(_: &mut Test) {}
+
+pub fn main() {
+ let mut test1 = Test::new();
+ let mut test1 = unsafe { Pin::new_unchecked(&mut test1) };
+
+ dummy(test1.get_mut()); //~ ERROR E0277
+}
diff --git a/tests/ui/suggestions/suggest-pin-macro.stderr b/tests/ui/suggestions/suggest-pin-macro.stderr
new file mode 100644
index 000000000..1220cf650
--- /dev/null
+++ b/tests/ui/suggestions/suggest-pin-macro.stderr
@@ -0,0 +1,19 @@
+error[E0277]: `PhantomPinned` cannot be unpinned
+ --> $DIR/suggest-pin-macro.rs:22:17
+ |
+LL | dummy(test1.get_mut());
+ | ^^^^^^^ within `Test`, the trait `Unpin` is not implemented for `PhantomPinned`
+ |
+ = note: consider using the `pin!` macro
+ consider using `Box::pin` if you need to access the pinned value outside of the current scope
+note: required because it appears within the type `Test`
+ --> $DIR/suggest-pin-macro.rs:5:8
+ |
+LL | struct Test {
+ | ^^^^
+note: required by a bound in `Pin::<&'a mut T>::get_mut`
+ --> $SRC_DIR/core/src/pin.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.rs b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
new file mode 100644
index 000000000..459b94f94
--- /dev/null
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
@@ -0,0 +1,11 @@
+// edition: 2021
+
+// Make sure we don't ICE when suggesting a return type
+// for an async fn that has late-bound vars...
+
+async fn ice(_: &i32) {
+ true
+ //~^ ERROR mismatched types
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
new file mode 100644
index 000000000..bff864b22
--- /dev/null
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
@@ -0,0 +1,11 @@
+error[E0308]: mismatched types
+ --> $DIR/suggest-ret-on-async-w-late.rs:7:5
+ |
+LL | async fn ice(_: &i32) {
+ | - help: try adding a return type: `-> bool`
+LL | true
+ | ^^^^ expected `()`, found `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr
index 018083f9e..671f5efdd 100644
--- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr
+++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr
@@ -8,9 +8,9 @@ LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap();
= note: 'core::convert::TryFrom' is included in the prelude starting in Edition 2021
help: consider importing one of these items
|
-LL | use core::convert::TryFrom;
+LL + use core::convert::TryFrom;
|
-LL | use std::convert::TryFrom;
+LL + use std::convert::TryFrom;
|
error[E0433]: failed to resolve: use of undeclared type `TryInto`
@@ -23,9 +23,9 @@ LL | let _i: i16 = TryInto::try_into(0_i32).unwrap();
= note: 'core::convert::TryInto' is included in the prelude starting in Edition 2021
help: consider importing one of these items
|
-LL | use core::convert::TryInto;
+LL + use core::convert::TryInto;
|
-LL | use std::convert::TryInto;
+LL + use std::convert::TryInto;
|
error[E0433]: failed to resolve: use of undeclared type `FromIterator`
@@ -42,9 +42,9 @@ LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]);
| ~~~~~~~~~~~~
help: consider importing one of these items
|
-LL | use core::iter::FromIterator;
+LL + use core::iter::FromIterator;
|
-LL | use std::iter::FromIterator;
+LL + use std::iter::FromIterator;
|
error[E0599]: no method named `try_into` found for type `i32` in the current scope
@@ -60,7 +60,7 @@ LL | let _i: i16 = 0_i32.try_into().unwrap();
= note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
-LL | use std::convert::TryInto;
+LL + use std::convert::TryInto;
|
error: aborting due to 4 previous errors
diff --git a/tests/ui/suggestions/use-placement-resolve.stderr b/tests/ui/suggestions/use-placement-resolve.stderr
index 9da9e8e27..77724e7e2 100644
--- a/tests/ui/suggestions/use-placement-resolve.stderr
+++ b/tests/ui/suggestions/use-placement-resolve.stderr
@@ -6,7 +6,7 @@ LL | fn foobar<T: Debug>(x: T) {}
|
help: consider importing this trait instead
|
-LL | use std::fmt::Debug;
+LL + use std::fmt::Debug;
|
error: aborting due to previous error
diff --git a/tests/ui/suggestions/use-placement-typeck.stderr b/tests/ui/suggestions/use-placement-typeck.stderr
index 3b2749773..e900e12b7 100644
--- a/tests/ui/suggestions/use-placement-typeck.stderr
+++ b/tests/ui/suggestions/use-placement-typeck.stderr
@@ -13,7 +13,7 @@ LL | pub struct S;
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
-LL | use m::Foo;
+LL + use m::Foo;
|
error: aborting due to previous error