about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-05-04 16:15:37 +0200
committerGitHub <noreply@github.com>2020-05-04 16:15:37 +0200
commit3f38b99a63efbd60afbe036289ddbed366d906bc (patch)
tree566bd652fbd48f37d695acc0a3e430397c886ba5 /src/test
parent35e77451055e0c0599c86af8e64784d33d2521dc (diff)
parent16a0349571248c70fce0f279b350f9fd617a52ab (diff)
downloadrust-3f38b99a63efbd60afbe036289ddbed366d906bc.tar.gz
rust-3f38b99a63efbd60afbe036289ddbed366d906bc.zip
Rollup merge of #71810 - estebank:issue-71798, r=davidtwco
Do not try to find binop method on RHS `TyErr`

Fix #71798.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/issues-71798.rs7
-rw-r--r--src/test/ui/issues-71798.stderr20
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/issues-71798.rs b/src/test/ui/issues-71798.rs
new file mode 100644
index 00000000000..08b10463d39
--- /dev/null
+++ b/src/test/ui/issues-71798.rs
@@ -0,0 +1,7 @@
+fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
+    *x //~^ ERROR the trait bound `u32: std::future::Future` is not satisfied
+}
+
+fn main() {
+    let _ = test_ref & u; //~ ERROR cannot find value `u` in this scope
+}
diff --git a/src/test/ui/issues-71798.stderr b/src/test/ui/issues-71798.stderr
new file mode 100644
index 00000000000..85da87914e7
--- /dev/null
+++ b/src/test/ui/issues-71798.stderr
@@ -0,0 +1,20 @@
+error[E0425]: cannot find value `u` in this scope
+  --> $DIR/issues-71798.rs:6:24
+   |
+LL |     let _ = test_ref & u;
+   |                        ^ not found in this scope
+
+error[E0277]: the trait bound `u32: std::future::Future` is not satisfied
+  --> $DIR/issues-71798.rs:1:25
+   |
+LL | fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
+   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `u32`
+LL |     *x
+   |     -- this returned value is of type `u32`
+   |
+   = note: the return type of a function must have a statically known size
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0425.
+For more information about an error, try `rustc --explain E0277`.