Skip to content

Commit 2cf703d

Browse files
authored
Update type_system.md with proper Enum name
1 parent 4259530 commit 2cf703d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/attributes/type_system.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ match message {
163163
}
164164
```
165165

166-
In Rust, casting non-exhaustive types from foreign crates is generally disallowed, except when dealing with enums that have no non-exhaustive variants.
166+
However, casting non-exhaustive types from foreign crates is generally disallowed, except when dealing with enums that have no non-exhaustive variants.
167167

168168
For example, the following enum can be cast because it doesn't contain any non-exhaustive variants:
169169
```rust, ignore
@@ -186,10 +186,10 @@ pub enum Example {
186186
```
187187

188188
```rust, ignore
189-
use othercrate::NonExhaustiveEnumVariants;
189+
use othercrate::EnumWithNonExhaustiveEnumVariants;
190190
191-
// cannot cast an enum with a non-exhaustive variant when it's defined in another crate
192-
let _ = NonExhaustiveEnum::default() as u8;
191+
// Error: cannot cast an enum with a non-exhaustive variant when it's defined in another crate
192+
let _ = EnumWithNonExhaustiveEnumVariants::default() as u8;
193193
```
194194

195195
Non-exhaustive types are always considered inhabited in downstream crates.

0 commit comments

Comments
 (0)