summaryrefslogtreecommitdiffstats
path: root/tests/ui/coercion
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/coercion')
-rw-r--r--tests/ui/coercion/coerce-block-tail-83783.fixed13
-rw-r--r--tests/ui/coercion/coerce-block-tail-83783.rs2
-rw-r--r--tests/ui/coercion/coerce-block-tail-83783.stderr4
3 files changed, 18 insertions, 1 deletions
diff --git a/tests/ui/coercion/coerce-block-tail-83783.fixed b/tests/ui/coercion/coerce-block-tail-83783.fixed
new file mode 100644
index 000000000..0df0a64ac
--- /dev/null
+++ b/tests/ui/coercion/coerce-block-tail-83783.fixed
@@ -0,0 +1,13 @@
+// run-rustfix
+// edition:2018
+fn _consume_reference<T: ?Sized>(_: &T) {}
+
+async fn _foo() {
+ _consume_reference::<i32>(&Box::new(7_i32));
+ _consume_reference::<i32>(&*async { Box::new(7_i32) }.await);
+ //~^ ERROR mismatched types
+ _consume_reference::<[i32]>(&vec![7_i32]);
+ _consume_reference::<[i32]>(&async { vec![7_i32] }.await);
+}
+
+fn main() { }
diff --git a/tests/ui/coercion/coerce-block-tail-83783.rs b/tests/ui/coercion/coerce-block-tail-83783.rs
index 18c8ae3bb..ee6036b4d 100644
--- a/tests/ui/coercion/coerce-block-tail-83783.rs
+++ b/tests/ui/coercion/coerce-block-tail-83783.rs
@@ -1,4 +1,4 @@
-// check-fail
+// run-rustfix
// edition:2018
fn _consume_reference<T: ?Sized>(_: &T) {}
diff --git a/tests/ui/coercion/coerce-block-tail-83783.stderr b/tests/ui/coercion/coerce-block-tail-83783.stderr
index d556d013b..da3c38777 100644
--- a/tests/ui/coercion/coerce-block-tail-83783.stderr
+++ b/tests/ui/coercion/coerce-block-tail-83783.stderr
@@ -6,6 +6,10 @@ LL | _consume_reference::<i32>(&async { Box::new(7_i32) }.await);
|
= note: expected type `i32`
found struct `Box<i32>`
+help: consider unboxing the value
+ |
+LL | _consume_reference::<i32>(&*async { Box::new(7_i32) }.await);
+ | +
error: aborting due to previous error