Skip to content

Commit 67fd09d

Browse files
committed
also query type_uninhabited_from
1 parent c19daa4 commit 67fd09d

File tree

5 files changed

+49
-40
lines changed

5 files changed

+49
-40
lines changed

compiler/rustc_lint/src/builtin.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,8 +2425,12 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
24252425
}
24262426

24272427
/// Determines whether the given type is inhabited. `None` means that we don't know.
2428-
fn ty_inhabited(ty: Ty<'_>) -> Option<bool> {
2428+
fn ty_inhabited<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<bool> {
24292429
use rustc_type_ir::sty::TyKind::*;
2430+
if !cx.tcx.type_uninhabited_from(cx.param_env.and(ty)).is_empty() {
2431+
// This is definitely uninhabited from some module.
2432+
return Some(false);
2433+
}
24302434
match ty.kind() {
24312435
Never => Some(false),
24322436
Int(_) | Uint(_) | Float(_) | Bool | Char | RawPtr(_) => Some(true),
@@ -2436,10 +2440,13 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
24362440
}
24372441
}
24382442
/// Determines whether a product type formed from a list of types is inhabited.
2439-
fn tys_inhabited<'tcx>(tys: impl Iterator<Item = Ty<'tcx>>) -> Option<bool> {
2443+
fn tys_inhabited<'tcx>(
2444+
cx: &LateContext<'tcx>,
2445+
tys: impl Iterator<Item = Ty<'tcx>>,
2446+
) -> Option<bool> {
24402447
let mut definitely_inhabited = true; // with no fields, we are definitely inhabited.
24412448
for ty in tys {
2442-
match ty_inhabited(ty) {
2449+
match ty_inhabited(cx, ty) {
24432450
// If any type is uninhabited, the product is uninhabited.
24442451
Some(false) => return Some(false),
24452452
// Otherwise go searching for a `None`.
@@ -2550,6 +2557,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
25502557
let span = cx.tcx.def_span(adt_def.did());
25512558
let mut potential_variants = adt_def.variants().iter().filter_map(|variant| {
25522559
let inhabited = tys_inhabited(
2560+
cx,
25532561
variant.fields.iter().map(|field| field.ty(cx.tcx, substs)),
25542562
);
25552563
let definitely_inhabited = match inhabited {

src/test/ui/consts/const-eval/ub-enum.32bit.stderr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: it is undefined behavior to use this value
2-
--> $DIR/ub-enum.rs:23:1
2+
--> $DIR/ub-enum.rs:24:1
33
|
44
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
55
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
1010
}
1111

1212
error: any use of this value will cause an error
13-
--> $DIR/ub-enum.rs:26:1
13+
--> $DIR/ub-enum.rs:27:1
1414
|
1515
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -22,7 +22,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
2222
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2323

2424
error: any use of this value will cause an error
25-
--> $DIR/ub-enum.rs:30:1
25+
--> $DIR/ub-enum.rs:31:1
2626
|
2727
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
2828
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -33,7 +33,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
3333
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
3434

3535
error[E0080]: it is undefined behavior to use this value
36-
--> $DIR/ub-enum.rs:43:1
36+
--> $DIR/ub-enum.rs:44:1
3737
|
3838
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
3939
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
@@ -44,7 +44,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
4444
}
4545

4646
error: any use of this value will cause an error
47-
--> $DIR/ub-enum.rs:45:1
47+
--> $DIR/ub-enum.rs:46:1
4848
|
4949
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
5050
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -55,7 +55,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
5555
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
5656

5757
error: any use of this value will cause an error
58-
--> $DIR/ub-enum.rs:49:1
58+
--> $DIR/ub-enum.rs:50:1
5959
|
6060
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -66,13 +66,13 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
6666
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
6767

6868
error[E0080]: evaluation of constant value failed
69-
--> $DIR/ub-enum.rs:59:42
69+
--> $DIR/ub-enum.rs:60:42
7070
|
7171
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
7272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
7373

7474
error: any use of this value will cause an error
75-
--> $DIR/ub-enum.rs:64:1
75+
--> $DIR/ub-enum.rs:65:1
7676
|
7777
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
7878
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -83,7 +83,7 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
8383
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
8484

8585
error[E0080]: it is undefined behavior to use this value
86-
--> $DIR/ub-enum.rs:82:1
86+
--> $DIR/ub-enum.rs:83:1
8787
|
8888
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
@@ -94,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
9494
}
9595

9696
error[E0080]: it is undefined behavior to use this value
97-
--> $DIR/ub-enum.rs:84:1
97+
--> $DIR/ub-enum.rs:85:1
9898
|
9999
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
100100
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
@@ -105,7 +105,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
105105
}
106106

107107
error[E0080]: it is undefined behavior to use this value
108-
--> $DIR/ub-enum.rs:92:1
108+
--> $DIR/ub-enum.rs:93:1
109109
|
110110
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
111111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
@@ -116,13 +116,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
116116
}
117117

118118
error[E0080]: evaluation of constant value failed
119-
--> $DIR/ub-enum.rs:97:77
119+
--> $DIR/ub-enum.rs:98:77
120120
|
121121
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
122122
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
123123

124124
error[E0080]: evaluation of constant value failed
125-
--> $DIR/ub-enum.rs:99:77
125+
--> $DIR/ub-enum.rs:100:77
126126
|
127127
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
128128
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
@@ -132,7 +132,7 @@ error: aborting due to 13 previous errors
132132
For more information about this error, try `rustc --explain E0080`.
133133
Future incompatibility report: Future breakage diagnostic:
134134
error: any use of this value will cause an error
135-
--> $DIR/ub-enum.rs:26:1
135+
--> $DIR/ub-enum.rs:27:1
136136
|
137137
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
138138
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -145,7 +145,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
145145

146146
Future breakage diagnostic:
147147
error: any use of this value will cause an error
148-
--> $DIR/ub-enum.rs:30:1
148+
--> $DIR/ub-enum.rs:31:1
149149
|
150150
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
151151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -158,7 +158,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
158158

159159
Future breakage diagnostic:
160160
error: any use of this value will cause an error
161-
--> $DIR/ub-enum.rs:45:1
161+
--> $DIR/ub-enum.rs:46:1
162162
|
163163
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
164164
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -171,7 +171,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
171171

172172
Future breakage diagnostic:
173173
error: any use of this value will cause an error
174-
--> $DIR/ub-enum.rs:49:1
174+
--> $DIR/ub-enum.rs:50:1
175175
|
176176
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
177177
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -184,7 +184,7 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
184184

185185
Future breakage diagnostic:
186186
error: any use of this value will cause an error
187-
--> $DIR/ub-enum.rs:64:1
187+
--> $DIR/ub-enum.rs:65:1
188188
|
189189
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
190190
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes

src/test/ui/consts/const-eval/ub-enum.64bit.stderr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: it is undefined behavior to use this value
2-
--> $DIR/ub-enum.rs:23:1
2+
--> $DIR/ub-enum.rs:24:1
33
|
44
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
55
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
1010
}
1111

1212
error: any use of this value will cause an error
13-
--> $DIR/ub-enum.rs:26:1
13+
--> $DIR/ub-enum.rs:27:1
1414
|
1515
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -22,7 +22,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
2222
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2323

2424
error: any use of this value will cause an error
25-
--> $DIR/ub-enum.rs:30:1
25+
--> $DIR/ub-enum.rs:31:1
2626
|
2727
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
2828
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -33,7 +33,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
3333
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
3434

3535
error[E0080]: it is undefined behavior to use this value
36-
--> $DIR/ub-enum.rs:43:1
36+
--> $DIR/ub-enum.rs:44:1
3737
|
3838
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
3939
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
@@ -44,7 +44,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
4444
}
4545

4646
error: any use of this value will cause an error
47-
--> $DIR/ub-enum.rs:45:1
47+
--> $DIR/ub-enum.rs:46:1
4848
|
4949
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
5050
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -55,7 +55,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
5555
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
5656

5757
error: any use of this value will cause an error
58-
--> $DIR/ub-enum.rs:49:1
58+
--> $DIR/ub-enum.rs:50:1
5959
|
6060
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -66,13 +66,13 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
6666
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
6767

6868
error[E0080]: evaluation of constant value failed
69-
--> $DIR/ub-enum.rs:59:42
69+
--> $DIR/ub-enum.rs:60:42
7070
|
7171
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
7272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
7373

7474
error: any use of this value will cause an error
75-
--> $DIR/ub-enum.rs:64:1
75+
--> $DIR/ub-enum.rs:65:1
7676
|
7777
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
7878
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -83,7 +83,7 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
8383
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
8484

8585
error[E0080]: it is undefined behavior to use this value
86-
--> $DIR/ub-enum.rs:82:1
86+
--> $DIR/ub-enum.rs:83:1
8787
|
8888
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
@@ -94,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
9494
}
9595

9696
error[E0080]: it is undefined behavior to use this value
97-
--> $DIR/ub-enum.rs:84:1
97+
--> $DIR/ub-enum.rs:85:1
9898
|
9999
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
100100
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
@@ -105,7 +105,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
105105
}
106106

107107
error[E0080]: it is undefined behavior to use this value
108-
--> $DIR/ub-enum.rs:92:1
108+
--> $DIR/ub-enum.rs:93:1
109109
|
110110
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
111111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
@@ -116,13 +116,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
116116
}
117117

118118
error[E0080]: evaluation of constant value failed
119-
--> $DIR/ub-enum.rs:97:77
119+
--> $DIR/ub-enum.rs:98:77
120120
|
121121
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
122122
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
123123

124124
error[E0080]: evaluation of constant value failed
125-
--> $DIR/ub-enum.rs:99:77
125+
--> $DIR/ub-enum.rs:100:77
126126
|
127127
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
128128
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
@@ -132,7 +132,7 @@ error: aborting due to 13 previous errors
132132
For more information about this error, try `rustc --explain E0080`.
133133
Future incompatibility report: Future breakage diagnostic:
134134
error: any use of this value will cause an error
135-
--> $DIR/ub-enum.rs:26:1
135+
--> $DIR/ub-enum.rs:27:1
136136
|
137137
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
138138
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -145,7 +145,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
145145

146146
Future breakage diagnostic:
147147
error: any use of this value will cause an error
148-
--> $DIR/ub-enum.rs:30:1
148+
--> $DIR/ub-enum.rs:31:1
149149
|
150150
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
151151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -158,7 +158,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
158158

159159
Future breakage diagnostic:
160160
error: any use of this value will cause an error
161-
--> $DIR/ub-enum.rs:45:1
161+
--> $DIR/ub-enum.rs:46:1
162162
|
163163
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
164164
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -171,7 +171,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
171171

172172
Future breakage diagnostic:
173173
error: any use of this value will cause an error
174-
--> $DIR/ub-enum.rs:49:1
174+
--> $DIR/ub-enum.rs:50:1
175175
|
176176
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
177177
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -184,7 +184,7 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
184184

185185
Future breakage diagnostic:
186186
error: any use of this value will cause an error
187-
--> $DIR/ub-enum.rs:64:1
187+
--> $DIR/ub-enum.rs:65:1
188188
|
189189
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
190190
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes

src/test/ui/consts/const-eval/ub-enum.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// stderr-per-bitwidth
22
#![feature(never_type)]
3+
#![allow(invalid_value)]
34

45
use std::mem;
56

src/test/ui/lint/invalid_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ enum OneFruitNonZero {
4141

4242
enum TwoUninhabited {
4343
A(!),
44-
B(!),
44+
B(Void),
4545
}
4646

4747
#[allow(unused)]

0 commit comments

Comments
 (0)