Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not try to find binop method on RHS TyErr #71810

Merged
merged 1 commit into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/issues-71798.rs
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 20 additions & 0 deletions src/test/ui/issues-71798.stderr
Original file line number Diff line number Diff line change
@@ -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`.