E4193#
Compiler diagnostic name: declare_body_not_empty.
Declaration body is not empty.
A declaration describes an item without providing its implementation body. For
function declarations, the declaration must not contain a { ... } block. For
type declarations, the declared type must be abstract rather than a concrete
struct, enum, or tuple struct definition.
Erroneous example#
#declaration_only
fn declared_answer() -> Int {
42
}
The #declaration_only attribute marks declared_answer as a declaration, but
the function still provides an implementation body.
Suggestion#
Remove the declaration marker when the item is already implemented, or keep the declaration body empty and provide a matching implementation elsewhere.
fn declared_answer() -> Int {
42
}