MCPcopy Create free account
hub / github.com/Rust-API/Rust-API-Bypass-Checker / visit_assert

Method visit_assert

src/analysis/mir_visitor/block_visitor.rs:1538–1569  ·  view source on GitHub ↗
(
        &mut self,
        cond: &mir::Operand<'tcx>,
        expected: bool,
        _msg: &mir::AssertMessage<'tcx>,
        target: mir::BasicBlock,
        _unwind: mir::UnwindAction,
    )

Source from the content-addressed store, hash-verified

1536 }
1537
1538 fn visit_assert(
1539 &mut self,
1540 cond: &mir::Operand<'tcx>,
1541 expected: bool,
1542 _msg: &mir::AssertMessage<'tcx>,
1543 target: mir::BasicBlock,
1544 _unwind: mir::UnwindAction,
1545 ) {
1546 let cond_value = if let Some(place) = cond.place() {
1547 self.body_visitor
1548 .place_to_abstract_value
1549 .get(&place)
1550 .cloned()
1551 .unwrap_or_else(|| self.visit_operand(cond))
1552 } else {
1553 self.visit_operand(cond)
1554 };
1555 if let Some(place) = cond.place() {
1556 self.body_visitor
1557 .place_to_abstract_value
1558 .insert(place, cond_value.clone());
1559 }
1560 let exit_condition = if expected {
1561 cond_value
1562 } else {
1563 cond_value.logical_not()
1564 };
1565 self.body_visitor
1566 .state
1567 .exit_conditions
1568 .insert(target, exit_condition);
1569 }
1570
1571 // fn visit_inline_asm(&mut self) {
1572 // let span = self.body_visitor.current_span;

Callers 1

visit_terminatorMethod · 0.80

Calls 4

visit_operandMethod · 0.80
getMethod · 0.45
insertMethod · 0.45
logical_notMethod · 0.45

Tested by

no test coverage detected