|
3 | 3 | use std::collections::HashMap; |
4 | 4 |
|
5 | 5 | use crate::compat::stable_mir; |
| 6 | +#[cfg(not(smir_has_raw_ptr_kind))] |
| 7 | +use stable_mir::mir::Mutability; |
6 | 8 | use stable_mir::mir::{ |
7 | | - BorrowKind, ConstOperand, Mutability, NonDivergingIntrinsic, Operand, Rvalue, Statement, |
8 | | - StatementKind, Terminator, TerminatorKind, |
| 9 | + BorrowKind, ConstOperand, NonDivergingIntrinsic, Operand, Rvalue, Statement, StatementKind, |
| 10 | + Terminator, TerminatorKind, |
9 | 11 | }; |
10 | 12 | use stable_mir::ty::{ConstantKind, IndexedVal, MirConst, Ty}; |
11 | 13 |
|
@@ -153,19 +155,25 @@ impl GraphContext { |
153 | 155 | } => format!("Ascribe {}.{}", place.label(), projections.base), |
154 | 156 | Coverage(_) => "Coverage".to_string(), |
155 | 157 | Intrinsic(intr) => format!("Intr: {}", self.render_intrinsic(intr)), |
156 | | - ConstEvalCounter {} => "ConstEvalCounter".to_string(), |
157 | | - Nop {} => "Nop".to_string(), |
| 158 | + ConstEvalCounter => "ConstEvalCounter".to_string(), |
| 159 | + Nop => "Nop".to_string(), |
158 | 160 | } |
159 | 161 | } |
160 | 162 |
|
161 | 163 | /// Render rvalue with context |
162 | 164 | pub fn render_rvalue(&self, v: &Rvalue) -> String { |
163 | 165 | use Rvalue::*; |
164 | 166 | match v { |
| 167 | + // In nightlies >= 2025-01-28, AddressOf's first field changed from |
| 168 | + // Mutability (Mut/Not) to RawPtrKind (Mut/Const/FakeForPtrMetadata). |
| 169 | + // See build.rs BREAKPOINTS table. |
| 170 | + #[cfg(not(smir_has_raw_ptr_kind))] |
165 | 171 | AddressOf(mutability, p) => match mutability { |
166 | 172 | Mutability::Not => format!("&raw {}", p.label()), |
167 | 173 | Mutability::Mut => format!("&raw mut {}", p.label()), |
168 | 174 | }, |
| 175 | + #[cfg(smir_has_raw_ptr_kind)] |
| 176 | + AddressOf(kind, p) => format!("&raw {:?} {}", kind, p.label()), |
169 | 177 | Aggregate(kind, operands) => { |
170 | 178 | let os: Vec<String> = operands.iter().map(|op| self.render_operand(op)).collect(); |
171 | 179 | format!("{} ({})", kind.label(), os.join(", ")) |
@@ -227,10 +235,10 @@ impl GraphContext { |
227 | 235 | match &term.kind { |
228 | 236 | Goto { .. } => "Goto".to_string(), |
229 | 237 | SwitchInt { discr, .. } => format!("SwitchInt {}", self.render_operand(discr)), |
230 | | - Resume {} => "Resume".to_string(), |
231 | | - Abort {} => "Abort".to_string(), |
232 | | - Return {} => "Return".to_string(), |
233 | | - Unreachable {} => "Unreachable".to_string(), |
| 238 | + Resume => "Resume".to_string(), |
| 239 | + Abort => "Abort".to_string(), |
| 240 | + Return => "Return".to_string(), |
| 241 | + Unreachable => "Unreachable".to_string(), |
234 | 242 | Drop { place, .. } => format!("Drop {}", place.label()), |
235 | 243 | Call { |
236 | 244 | func, |
|
0 commit comments