You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#99965 - RalfJung:ctfe-number-prov, r=eddyb
allow numbers with provenance within CTFE execution
This effectively reverts rust-lang#97684 for CTFE.
Undoes the diagnostic changes that are tracked in rust-lang#99923, only for beta.
(On master this patch wouldn't apply any more, `enforce_number_no_provenance` is gone with rust-lang#99644 since the interpreter engine is not supposed to ever have provenance on integers.)
The test changes are an exact un-do of rust-lang#97684. However there is still some risk here since this exact code is not what has been battle-tested.
r? `@Mark-Simulacrum`
error[E0080]: it is undefined behavior to use this value
2
+
--> $DIR/ref_to_int_match.rs:25:1
3
3
|
4
4
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
5
-
| --------------------------^^^^^^^^^^^^^^^^---
6
-
| |
7
-
| unable to turn pointer into raw bytes
5
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc3, but expected plain (non-pointer) bytes
8
6
|
9
-
= note: `#[deny(const_err)]` on by default
10
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11
-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
7
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
8
+
= note: the raw bytes of the constant (size: 4, align: 4) {
9
+
╾─alloc3──╼ │ ╾──╼
10
+
}
12
11
13
12
error: could not evaluate constant pattern
14
13
--> $DIR/ref_to_int_match.rs:7:14
@@ -24,3 +23,4 @@ LL | 10..=BAR => {},
24
23
25
24
error: aborting due to 3 previous errors
26
25
26
+
For more information about this error, try `rustc --explain E0080`.
error[E0080]: it is undefined behavior to use this value
2
+
--> $DIR/ref_to_int_match.rs:25:1
3
3
|
4
4
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
5
-
| --------------------------^^^^^^^^^^^^^^^^---
6
-
| |
7
-
| unable to turn pointer into raw bytes
5
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc3, but expected plain (non-pointer) bytes
8
6
|
9
-
= note: `#[deny(const_err)]` on by default
10
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11
-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
7
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
8
+
= note: the raw bytes of the constant (size: 8, align: 8) {
9
+
╾───────alloc3────────╼ │ ╾──────╼
10
+
}
12
11
13
12
error: could not evaluate constant pattern
14
13
--> $DIR/ref_to_int_match.rs:7:14
@@ -24,3 +23,4 @@ LL | 10..=BAR => {},
24
23
25
24
error: aborting due to 3 previous errors
26
25
26
+
For more information about this error, try `rustc --explain E0080`.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
16
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered pointer to alloc9, but expected plain (non-pointer) bytes
17
17
|
18
-
= note: `#[deny(const_err)]` on by default
19
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
20
-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
18
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
19
+
= note: the raw bytes of the constant (size: 4, align: 4) {
20
+
╾─alloc9──╼ │ ╾──╼
21
+
}
21
22
22
-
error: any use of this value will cause an error
23
+
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
27
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0.<enum-tag>: encountered pointer to alloc13, but expected plain (non-pointer) bytes
27
28
|
28
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
29
-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
29
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
30
+
= note: the raw bytes of the constant (size: 4, align: 4) {
31
+
╾─alloc13─╼ │ ╾──╼
32
+
}
30
33
31
34
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
49
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered pointer to alloc19, but expected plain (non-pointer) bytes
47
50
|
48
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
49
-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
51
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
52
+
= note: the raw bytes of the constant (size: 4, align: 4) {
53
+
╾─alloc19─╼ │ ╾──╼
54
+
}
50
55
51
-
error: any use of this value will cause an error
52
-
--> $DIR/ub-enum.rs:49:1
56
+
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
60
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0.<enum-tag>: encountered pointer to alloc23, but expected plain (non-pointer) bytes
56
61
|
57
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
58
-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
62
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
63
+
= note: the raw bytes of the constant (size: 4, align: 4) {
64
+
╾─alloc23─╼ │ ╾──╼
65
+
}
59
66
60
67
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected initialized bytes
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
82
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered pointer to alloc30, but expected plain (non-pointer) bytes
76
83
|
77
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
78
-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
84
+
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
85
+
= note: the raw bytes of the constant (size: 4, align: 4) {
86
+
╾─alloc30─╼ │ ╾──╼
87
+
}
79
88
80
89
error[E0080]: it is undefined behavior to use this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(B)>.0: encountered a value of the never type `!`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
0 commit comments