Correct rust code block in *Dataflow Analysis*
This commit is contained in:
parent
f8fae75c0c
commit
91f2d11e9c
|
|
@ -127,16 +127,18 @@ value will be `true`, since our analysis is done as soon as we determine that
|
||||||
`transmute` has been called. Our join operator will just be the boolean OR (`||`)
|
`transmute` has been called. Our join operator will just be the boolean OR (`||`)
|
||||||
operator. We use OR and not AND because of this case:
|
operator. We use OR and not AND because of this case:
|
||||||
|
|
||||||
```
|
```rust
|
||||||
|
# unsafe fn example(some_cond: bool) {
|
||||||
let x = if some_cond {
|
let x = if some_cond {
|
||||||
std::mem::transmute<i32, u32>(0_i32); // transmute was called!
|
std::mem::transmute::<i32, u32>(0_i32) // transmute was called!
|
||||||
} else {
|
} else {
|
||||||
1_u32; // transmute was not called
|
1_u32 // transmute was not called
|
||||||
};
|
};
|
||||||
|
|
||||||
// Has transmute been called by this point? We conservatively approximate that
|
// Has transmute been called by this point? We conservatively approximate that
|
||||||
// as yes, and that is why we use the OR operator.
|
// as yes, and that is why we use the OR operator.
|
||||||
println!("x: {}", x);
|
println!("x: {}", x);
|
||||||
|
# }
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inspecting the Results of a Dataflow Analysis
|
## Inspecting the Results of a Dataflow Analysis
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue