Rollup merge of #71810 - estebank:issue-71798, r=davidtwco

Do not try to find binop method on RHS `TyErr`

Fix #71798.
This commit is contained in:
Dylan DPC 2020-05-04 16:15:37 +02:00 committed by GitHub
commit 3f38b99a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -251,7 +251,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
Err(()) => {
// error types are considered "builtin"
if !lhs_ty.references_error() {
if !lhs_ty.references_error() && !rhs_ty.references_error() {
let source_map = self.tcx.sess.source_map();
match is_assign {
IsAssign::Yes => {

View File

@ -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
}

View File

@ -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`.