Rust errors / Names, paths and imports
Rust compiler error · checked with rustc 1.99.0
Rust error E0639: this error indicates that the struct, enum or enum variant cannot be instantiated from outside of the defining crate as it has been marked as `non_exhaustive` and as such more fields/variants may be added in future that could cause adverse side effects for this code
What it meansThis error indicates that the struct, enum or enum variant cannot be instantiated from outside of the defining crate as it has been marked as non_exhaustive and as such more fields/variants may be added in future that could cause adverse side effects for this code.
The compiler team's explanation
This error indicates that the struct, enum or enum variant cannot be instantiated from outside of the defining crate as it has been marked as non_exhaustive and as such more fields/variants may be added in future that could cause adverse side effects for this code.
Erroneous code example:
#[non_exhaustive]
pub struct NormalStruct {
pub first_field: u16,
pub second_field: u16,
}
let ns = NormalStruct { first_field: 640, second_field: 480 }; // error!
It is recommended that you look for a new function or equivalent in the crate's documentation.
From rustc --explain E0639 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0425cannot find value in this scope
- E0603is private
- E0432unresolved import
- E0005refutable pattern in local binding
- E0616field `x` of struct `Foo` is private
- E0624method `method` is private
- E0648`export_name` may not contain null characters
- E0710unknown tool name `clipp` found in scoped lint: `clipp::filter_map`
Up next
Often hit nextE0425: cannot find value in this scopeA related error from the same family.Read it next →Did this answer your question?