Friday, June 20, 2014

Rust Note 1: Found Self in Ident Position

If you're anything like me, you know what it's like to wrestle with new technology. No documentation, no guidance, no hope. This series is an attempt to document the pitfalls of the Rust programming language. In the first quickfix, we will fix the "Found Self in Ident Position" error.

Example code:     fn rest(&self) -> self;
Fixed code:          fn rest(&self) -> Self;

Explanation
The return type is affected by the case of the letter, much like Haskell's types. In most "self in ident position" cases, you just need to swap the case.

No comments:

Post a Comment