forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace suggest_constraining_param with suggest_restricting_param_bound
to fix incorrect suggestion for trait bounds involving binary operators. Fixes rust-lang#93927, rust-lang#92347, rust-lang#93744.
- Loading branch information
1 parent
18b53ce
commit 4d0fe27
Showing
9 changed files
with
80 additions
and
89 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
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,20 @@ | ||
// Regression test for #93927: suggested trait bound for T should be Eq, not PartialEq | ||
struct MyType<T>(T); | ||
|
||
impl<T> PartialEq for MyType<T> | ||
where | ||
T: Eq, | ||
{ | ||
fn eq(&self, other: &Self) -> bool { | ||
true | ||
} | ||
} | ||
|
||
fn cond<T: PartialEq>(val: MyType<T>) -> bool { | ||
val == val | ||
//~^ ERROR binary operation `==` cannot be applied to type `MyType<T>` | ||
} | ||
|
||
fn main() { | ||
cond(MyType(0)); | ||
} |
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,16 @@ | ||
error[E0369]: binary operation `==` cannot be applied to type `MyType<T>` | ||
--> $DIR/issue-93927.rs:14:9 | ||
| | ||
LL | val == val | ||
| --- ^^ --- MyType<T> | ||
| | | ||
| MyType<T> | ||
| | ||
help: consider further restricting this bound | ||
| | ||
LL | fn cond<T: PartialEq + std::cmp::Eq>(val: MyType<T>) -> bool { | ||
| ++++++++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0369`. |
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
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
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
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
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
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