mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Support CopyForDeref.
This commit is contained in:
parent
82f0468009
commit
b851e554dd
@ -119,6 +119,12 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
|
|||||||
self.assign_operand(state, target, operand);
|
self.assign_operand(state, target, operand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rvalue::CopyForDeref(rhs) => {
|
||||||
|
state.flood(target.as_ref(), self.map());
|
||||||
|
if let Some(target) = self.map.find(target.as_ref()) {
|
||||||
|
self.assign_operand(state, target, &Operand::Copy(*rhs));
|
||||||
|
}
|
||||||
|
}
|
||||||
Rvalue::Aggregate(kind, operands) => {
|
Rvalue::Aggregate(kind, operands) => {
|
||||||
// If we assign `target = Enum::Variant#0(operand)`,
|
// If we assign `target = Enum::Variant#0(operand)`,
|
||||||
// we must make sure that all `target as Variant#i` are `Top`.
|
// we must make sure that all `target as Variant#i` are `Top`.
|
||||||
|
@ -88,16 +88,20 @@
|
|||||||
_17 = deref_copy (*_16);
|
_17 = deref_copy (*_16);
|
||||||
StorageLive(_12);
|
StorageLive(_12);
|
||||||
_18 = deref_copy (*_16);
|
_18 = deref_copy (*_16);
|
||||||
_12 = ((*_18).0: S);
|
- _12 = ((*_18).0: S);
|
||||||
|
+ _12 = const S(1_i32);
|
||||||
StorageLive(_13);
|
StorageLive(_13);
|
||||||
_19 = deref_copy (*_16);
|
_19 = deref_copy (*_16);
|
||||||
_13 = ((*_19).1: u8);
|
- _13 = ((*_19).1: u8);
|
||||||
|
+ _13 = const 5_u8;
|
||||||
StorageLive(_14);
|
StorageLive(_14);
|
||||||
_20 = deref_copy (*_16);
|
_20 = deref_copy (*_16);
|
||||||
_14 = ((*_20).2: f32);
|
- _14 = ((*_20).2: f32);
|
||||||
|
+ _14 = const 7f32;
|
||||||
StorageLive(_15);
|
StorageLive(_15);
|
||||||
_21 = deref_copy (*_16);
|
_21 = deref_copy (*_16);
|
||||||
_15 = ((*_21).3: S);
|
- _15 = ((*_21).3: S);
|
||||||
|
+ _15 = const S(13_i32);
|
||||||
StorageDead(_16);
|
StorageDead(_16);
|
||||||
_0 = const ();
|
_0 = const ();
|
||||||
StorageDead(_15);
|
StorageDead(_15);
|
||||||
|
Loading…
Reference in New Issue
Block a user