-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #136027 - estebank:issue-135989, r=compiler-errors
Skip suggestions in `derive`d code Do not suggest ``` help: use parentheses to call these | 5 | (callback: Rc<dyn Fn()>)(), | + +++ ``` Skip all "call function for this binop" suggestions when in a derive context. Fix #135989.
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use std::rc::Rc; | ||
|
||
#[derive(PartialEq)] //~ NOTE in this expansion | ||
pub struct Function { | ||
callback: Rc<dyn Fn()>, //~ ERROR binary operation `==` cannot be applied to type `Rc<dyn Fn()>` | ||
} | ||
|
||
fn main() {} |
14 changes: 14 additions & 0 deletions
14
tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0369]: binary operation `==` cannot be applied to type `Rc<dyn Fn()>` | ||
--> $DIR/do-not-suggest-calling-fn-in-derive-macro.rs:5:5 | ||
| | ||
LL | #[derive(PartialEq)] | ||
| --------- in this derive macro expansion | ||
LL | pub struct Function { | ||
LL | callback: Rc<dyn Fn()>, | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0369`. |