-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
default method of T that calls generic fn<S:T>(&S) on self does not work #7183
Comments
Part of #2794 as well. |
Note that this simpler test case should also work (when compiled via #[allow(default_methods)]
trait Speak { fn say(&self, s:&str); fn hi(&self) { hello(self); } }
fn hello<S:Speak>(s:&S) { s.say("hello"); } Its the same as the original code from the description, with the |
I have a fix for this that I will land soon. There will still be problems with self and supertraits, though. |
Handle write!(buf, "\n") case better Make `write!(buf, "\n")` suggest `writeln!(buf)` by removing the trailing comma from `writeln!(buf, )`. changelog: [`write_with_newline`] suggestion on only "\n" improved
If you try to implement a default method of trait
T
by calling out to a generic helper function with a type-parameter bounded byT
,rustc
claims that it cannot find an implementation of traitT
forSelf
. (Of course the default method is itself within traitT
, so any possible choice forSelf
should indeed implementT
.)Test case:
Transcript of
rustc
invocation:Discovered while prototyping the visit.rs refactoring (#7081); probably blocks it.
The text was updated successfully, but these errors were encountered: