Lyricdev
GitHub

LYR-PAR0042

an attribute with no declaration to carry it

error ยท spec 11-metaprogramming

An attribute stands at the end of a file, before something that is no declaration, before an import, or before an extern block, whose functions carry their own.

Explanation

An attribute belongs to the declaration that follows it: a function, a type, a member, a binding, an alias, the module header. Before an import or with nothing after it, it would be lost without a word.

Put the attribute before the declaration it is for, or remove it.

Wrong

fn main(): void {
}

@Deprecated
@Deprecated
fn old(): void {
}

fn main(): void {
}