Detect double reference when applying binary op#38617
Conversation
|
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
|
Thanks also to @rkruppe for providing the lion's share of the review effort here. |
|
@bors r=pnkfelix |
|
📌 Commit 98218b3 has been approved by |
|
@bors r- Travis failed and it looks legit (but trivial to fix) |
```rust
let vr = v.iter().filter(|x| {
x % 2 == 0
});
```
will now yield the following compiler output:
```bash
ERROR binary operation `%` cannot be applied to type `&&_`
NOTE this is a reference of a reference to a type that `%` can be applied to,
you need to dereference this variable once for this operation to work
NOTE an implementation of `std::ops::Rem` might be missing for `&&_`
```
The first NOTE is new.
Bug rust-lang#33877
98218b3 to
a5e1ff6
Compare
… deref. drive-by: fix merge conflict; fix test expected error output post rebase.
a5e1ff6 to
b8669df
Compare
|
@bors r=pnkfelix |
|
📌 Commit 98218b3 has been approved by |
|
@bors rollup |
Detect double reference when applying binary op
``` rust
let vr = v.iter().filter(|x| {
x % 2 == 0
});
```
will now yield the following compiler output:
``` bash
ERROR binary operation `%` cannot be applied to type `&&_`
NOTE this is a reference of a reference to a type that `%` can be applied to,
you need to dereference this variable once for this operation to work
NOTE an implementation of `std::ops::Rem` might be missing for `&&_`
```
The first NOTE is new.
Fix rust-lang#33877
----
Thanks to @estebank for providing the original PR rust-lang#34420 (of which this is a tweaked rebase).
|
💡 This pull request was already approved, no need to approve it again.
|
|
🙀 |
|
💡 This pull request was already approved, no need to approve it again.
|
|
🙀 |
|
@bors r- |
|
@bors r+ rollup |
|
📌 Commit 98218b3 has been approved by |
|
@bors r- |
|
🙀 |
Detect double reference when applying binary op
``` rust
let vr = v.iter().filter(|x| {
x % 2 == 0
});
```
will now yield the following compiler output:
``` bash
ERROR binary operation `%` cannot be applied to type `&&_`
NOTE this is a reference of a reference to a type that `%` can be applied to,
you need to dereference this variable once for this operation to work
NOTE an implementation of `std::ops::Rem` might be missing for `&&_`
```
The first NOTE is new.
Fix rust-lang#33877
----
Thanks to @estebank for providing the original PR rust-lang#34420 (of which this is a tweaked rebase).
will now yield the following compiler output:
The first NOTE is new.
Fix #33877
Thanks to @estebank for providing the original PR #34420 (of which this is a tweaked rebase).