We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 76016c6 + dcab860 commit 65bf656Copy full SHA for 65bf656
src/items/enumerations.md
@@ -196,6 +196,24 @@ enum OverflowingDiscriminantError2 {
196
}
197
```
198
199
+r[items.enum.discriminant.restrictions.generics]
200
+Explicit enum discriminant initializers may not use generic parameters from the enclosing enum.
201
+
202
+```rust,compile_fail
203
+#[repr(u32)]
204
+enum E<'a, T, const N: u32> {
205
+ Lifetime(&'a T) = {
206
+ let a: &'a (); // ERROR.
207
+ 1
208
+ },
209
+ Type(T) = {
210
+ let x: T; // ERROR.
211
+ 2
212
213
+ Const = N, // ERROR.
214
+}
215
+```
216
217
### Accessing discriminant
218
219
#### Via `mem::discriminant`
0 commit comments