We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8d28c49 + bce9bb3 commit e647eb1Copy full SHA for e647eb1
src/attributes/type_system.md
@@ -127,6 +127,14 @@ match message {
127
}
128
```
129
130
+It's also not allowed to cast non-exhaustive types from foreign crates.
131
+```rust, ignore
132
+use othercrate::NonExhaustiveEnum;
133
+
134
+// Cannot cast a non-exhaustive enum outside of its defining crate.
135
+let _ = NonExhaustiveEnum::default() as u8;
136
+```
137
138
Non-exhaustive types are always considered inhabited in downstream crates.
139
140
[_MetaWord_]: ../attributes.md#meta-item-attribute-syntax
0 commit comments