Closed
Description
Currently the Self::
shorthand in the body of an impl is implemented by syntactic expansion in libsyntax. That leads to a bug if another item shadows the concrete type. E.g.,
struct Foo;
impl Foo {
fn foo() {}
fn bar() {
let Foo = ...;
Self::foo(); // Whoops!
}
}
The Self
on the commented line will cause an error in name resolution, since Self
ends up referring to the local variable Foo
, not the self type.