Flood aggregate assignments with Top
.
This commit is contained in:
parent
650683756f
commit
7213eaa1c0
2 changed files with 5 additions and 3 deletions
|
@ -122,7 +122,10 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
|
||||||
) {
|
) {
|
||||||
match rvalue {
|
match rvalue {
|
||||||
Rvalue::Aggregate(kind, operands) => {
|
Rvalue::Aggregate(kind, operands) => {
|
||||||
state.flood_with(target.as_ref(), self.map(), FlatSet::Bottom);
|
// If we assign `target = Enum::Variant#0(operand)`,
|
||||||
|
// we must make sure that all `target as Variant#i` are `Top`.
|
||||||
|
state.flood(target.as_ref(), self.map());
|
||||||
|
|
||||||
if let Some(target_idx) = self.map().find(target.as_ref()) {
|
if let Some(target_idx) = self.map().find(target.as_ref()) {
|
||||||
let (variant_target, variant_index) = match **kind {
|
let (variant_target, variant_index) = match **kind {
|
||||||
AggregateKind::Tuple | AggregateKind::Closure(..) => {
|
AggregateKind::Tuple | AggregateKind::Closure(..) => {
|
||||||
|
|
|
@ -71,8 +71,7 @@
|
||||||
|
|
||||||
bb7: {
|
bb7: {
|
||||||
StorageLive(_9); // scope 2 at $DIR/enum.rs:+11:9: +11:10
|
StorageLive(_9); // scope 2 at $DIR/enum.rs:+11:9: +11:10
|
||||||
- _9 = _6; // scope 2 at $DIR/enum.rs:+11:13: +11:14
|
_9 = _6; // scope 2 at $DIR/enum.rs:+11:13: +11:14
|
||||||
+ _9 = const 0_u8; // scope 2 at $DIR/enum.rs:+11:13: +11:14
|
|
||||||
_0 = const (); // scope 0 at $DIR/enum.rs:+0:29: +12:2
|
_0 = const (); // scope 0 at $DIR/enum.rs:+0:29: +12:2
|
||||||
StorageDead(_9); // scope 2 at $DIR/enum.rs:+12:1: +12:2
|
StorageDead(_9); // scope 2 at $DIR/enum.rs:+12:1: +12:2
|
||||||
StorageDead(_6); // scope 1 at $DIR/enum.rs:+12:1: +12:2
|
StorageDead(_6); // scope 1 at $DIR/enum.rs:+12:1: +12:2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue