-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #84014 - estebank:cool-bears-hot-tip, r=varkor
Improve trait/impl method discrepancy errors * Use more accurate spans * Clean up some code by removing previous hack * Provide structured suggestions Structured suggestions are particularly useful for cases where arbitrary self types are used, like in custom `Future`s, because the way to write `self: Pin<&mut Self>` is not necessarily self-evident when first encountered.
- Loading branch information
Showing
17 changed files
with
258 additions
and
117 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::future::Future; | ||
use std::task::{Context, Poll}; | ||
|
||
fn main() {} | ||
|
||
struct MyFuture {} | ||
|
||
impl Future for MyFuture { | ||
type Output = (); | ||
fn poll(self, _: &mut Context<'_>) -> Poll<()> { | ||
//~^ ERROR method `poll` has an incompatible type for trait | ||
todo!() | ||
} | ||
} | ||
|
||
trait T { | ||
fn foo(self); | ||
fn bar(self) -> Option<()>; | ||
} | ||
|
||
impl T for MyFuture { | ||
fn foo(self: Box<Self>) {} | ||
//~^ ERROR method `foo` has an incompatible type for trait | ||
fn bar(self) {} | ||
//~^ ERROR method `bar` has an incompatible type for trait | ||
} |
Oops, something went wrong.