You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to implement a trait, but accidentally implement a non-static method as static, rustc gives a error message for any use of self in the body of the function (with and without explicit self) rather than for the conflict in static-ness.
test-static-self.rs:7:8: 7:12 error: unresolved name: self
test-static-self.rs:7 self
^~~~
error: aborting due to previous error
Testcase:
traitA{fna(self) -> int;}implint:A{static fn a(self) -> int {self}}fnmain(){}
If there are no references to self in the body, rustc gives the more useful error: method 'a' is declared as static in its impl, but not in its trait.
The text was updated successfully, but these errors were encountered:
If you try to implement a trait, but accidentally implement a non-static method as static, rustc gives a error message for any use of
self
in the body of the function (with and without explicitself
) rather than for the conflict in static-ness.Testcase:
If there are no references to
self
in the body, rustc gives the more usefulerror: method 'a' is declared as static in its impl, but not in its trait
.The text was updated successfully, but these errors were encountered: