File tree 2 files changed +7
-1
lines changed
rustc_codegen_ssa/src/traits
rustc_const_eval/src/interpret
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,13 @@ use rustc_target::abi;
5
5
pub trait ConstMethods < ' tcx > : BackendTypes {
6
6
// Constant constructors
7
7
fn const_null ( & self , t : Self :: Type ) -> Self :: Value ;
8
+ /// Generate an uninitialized value (matching uninitialized memory in MIR).
9
+ /// Whether memory is initialized or not is tracked byte-for-byte.
8
10
fn const_undef ( & self , t : Self :: Type ) -> Self :: Value ;
11
+ /// Generate a fake value. Poison always affects the entire value, even if just a single byte is
12
+ /// poison. This can only be used in codepaths that are already UB, i.e., UB-free Rust code
13
+ /// (including code that e.g. copies uninit memory with `MaybeUninit`) can never encounter a
14
+ /// poison value.
9
15
fn const_poison ( & self , t : Self :: Type ) -> Self :: Value ;
10
16
fn const_int ( & self , t : Self :: Type , i : i64 ) -> Self :: Value ;
11
17
fn const_uint ( & self , t : Self :: Type , i : u64 ) -> Self :: Value ;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ pub enum Immediate<Prov: Provenance = AllocId> {
31
31
/// A pair of two scalar value (must have `ScalarPair` ABI where both fields are
32
32
/// `Scalar::Initialized`).
33
33
ScalarPair ( Scalar < Prov > , Scalar < Prov > ) ,
34
- /// A value of fully uninitialized memory. Can have and size and layout.
34
+ /// A value of fully uninitialized memory. Can have arbitrary size and layout.
35
35
Uninit ,
36
36
}
37
37
You can’t perform that action at this time.
0 commit comments