Lyricdev
GitHub

LYR-SEM0118

a visibility word on an interface member

error ยท spec 04-modules

A member of an interface carries 'pub' or 'internal', or 'private' on a requirement without a body.

Explanation

An interface's members are as visible as the interface itself: a member nobody could call through the interface would be no member of it, and a conformance is visible wherever its type and interface are. A word that changes nothing is refused rather than ignored. The one word a member takes is private, on a helper that has a body; a requirement is never private.

Drop the word.

Wrong

pub interface Shape {
    pub fn area(): int;
}

fn main(): void {
}
pub interface Shape {
    fn area(): int;
}

fn main(): void {
}