Closed
Description
Code
struct A;
impl A {
fn banana(&mut self) {
fn peach(this: &Self) {
}
}
}
Error
error[E0401]: can't use type parameters from outer function
--> src/main.rs:9:25
|
7 | impl A {
| ---- `Self` type implicitely declared here, on the `impl`
8 | fn banana(&mut self) {
9 | fn peach(this: &Self) {
| ----- ^^^^ use of type variable from outer function
| |
| help: try using a local type parameter instead: `peach<Self>`
It seems that the help message is trying to suggest to introduce a local type parameter, but is worded rather poorly, as if suggesting to use a peach<Self>
(e.g. this: &peach<Self>
?).
Perhaps rewording the help message to explicitly say "introduce" rather than "use" would be better, but even then Self
is a keyword, and cannot be introduced as a local generic parameter anyway.