E0150

A self or var self receiver on a function outside an impl or trait block.

Machine-applicable fix: none.

Example

This program fails with E0150.

fn size(self) -> Int {
    1
}

Fixed

The same program, fixed.

struct Box { n: Int }

impl Box {
    fn size(self) -> Int {
        1
    }
}

Listed in the checker notes. oskac explain E0150 prints this entry offline.

All error codes