File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
rustc_codegen_ssa/src/traits
rustc_const_eval/src/interpret Expand file tree Collapse file tree 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;
55pub trait ConstMethods < ' tcx > : BackendTypes {
66 // Constant constructors
77 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.
810 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.
915 fn const_poison ( & self , t : Self :: Type ) -> Self :: Value ;
1016 fn const_int ( & self , t : Self :: Type , i : i64 ) -> Self :: Value ;
1117 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> {
3131 /// A pair of two scalar value (must have `ScalarPair` ABI where both fields are
3232 /// `Scalar::Initialized`).
3333 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.
3535 Uninit ,
3636}
3737
You can’t perform that action at this time.
0 commit comments