Skip to content

Commit

Permalink
add comment in lifetime_emit
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhance committed Jan 10, 2024
1 parent 1416870 commit af8caed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/rust_verify/src/lifetime_emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub(crate) fn encode_id(kind: IdKind, rename_count: usize, raw_id: &String) -> S
IdKind::Fun => format!("f{}_{}", rename_count, raw_id),
IdKind::Local => format!("x{}_{}", rename_count, vir::def::user_local_name(raw_id)),
IdKind::Builtin => raw_id.clone(),

// Numeric fields need to be emitted as numeric fields.
// Non-numeric fields need to be unique-ified to avoid conflict with method names.
// Therefore, we only use the rename_count for non-numeric fields.
IdKind::Field if raw_id.bytes().nth(0).unwrap().is_ascii_digit() => raw_id.clone(),
IdKind::Field => format!("y{}_{}", rename_count, vir::def::user_local_name(raw_id)),
}
Expand Down

0 comments on commit af8caed

Please sign in to comment.