E4225#
Compiler diagnostic name: constr_any_pattern_not_suberror.
The wildcard constructor pattern Type::_ does not name a usable suberror
type.
This pattern stands for all visible constructors of one suberror type. The named type must therefore be a suberror with at least one constructor, and its constructors must be visible at the pattern's use site. It cannot be an ordinary enum, struct, built-in type, empty suberror, or opaque suberror whose constructors are unavailable.
Erroneous example#
///|
enum Status {
Ready
Busy
}
///|
pub fn is_status(error : Error) -> Bool {
match error {
Status::_ => true
_ => false
}
}
Suggestion#
Name a visible, non-empty suberror type. If the value is not an error, use that type's ordinary patterns instead.
///|
priv suberror StatusError {
NotReady
Busy
}
///|
pub fn is_status_error(error : Error) -> Bool {
match error {
StatusError::_ => true
_ => false
}
}