Skip to content

Upgrade z3 0.12.1 → 0.20#240

Open
ajpal wants to merge 3 commits into
mainfrom
fix-build
Open

Upgrade z3 0.12.1 → 0.20#240
ajpal wants to merge 3 commits into
mainfrom
fix-build

Conversation

@ajpal

@ajpal ajpal commented May 26, 2026

Copy link
Copy Markdown
Collaborator

(Code by Claude)

API migration:

  • Cargo feature static-link-z3 was renamed bundled.
  • AST types lost their lifetime parameter: z3::ast::Int<'a>z3::ast::Int
  • All AST constructors no longer take &Context: Int::from_i64(&ctx, 0)Int::from_i64(0) BV::new_const(&ctx, name, n)BV::new_const(name, n) Real::from_real(&ctx, 1, 2)Real::from_real(1, 2) Bool::from_bool(&ctx, true)Bool::from_bool(true)
  • Variadic ops drop the &Context argument: Int::add(&ctx, &[&a, &b])Int::add(&[a.clone(), b.clone()]) Same for Bool::and / Bool::or / Real::add / etc. The slice element bound changed to T: Into<Self> + Clone, so we clone where we previously passed &T.
  • Binops are now methods on the receiver instead of free functions: Int::lt(l, r)l.lt(r) Bool::ite(&cond, &a, &b)cond.ite(&a, &b)
  • Solver::new(&ctx)Solver::new() (no args).
  • Context::new(&cfg) is gone; wrap solver work in z3::with_z3_config(&cfg, || { ... }), which scopes a thread-local context for the closure body.
  • _eq is deprecated in favor of eq (still works with a warning).

API migration:
- Cargo feature `static-link-z3` was renamed `bundled`.
- AST types lost their lifetime parameter:
    `z3::ast::Int<'a>` → `z3::ast::Int`
- All AST constructors no longer take `&Context`:
    `Int::from_i64(&ctx, 0)` → `Int::from_i64(0)`
    `BV::new_const(&ctx, name, n)` → `BV::new_const(name, n)`
    `Real::from_real(&ctx, 1, 2)` → `Real::from_real(1, 2)`
    `Bool::from_bool(&ctx, true)` → `Bool::from_bool(true)`
- Variadic ops drop the `&Context` argument:
    `Int::add(&ctx, &[&a, &b])` → `Int::add(&[a.clone(), b.clone()])`
    Same for `Bool::and` / `Bool::or` / `Real::add` / etc.
    The slice element bound changed to `T: Into<Self> + Clone`,
    so we clone where we previously passed `&T`.
- Binops are now methods on the receiver instead of free functions:
    `Int::lt(l, r)` → `l.lt(r)`
    `Bool::ite(&cond, &a, &b)` → `cond.ite(&a, &b)`
- `Solver::new(&ctx)` → `Solver::new()` (no args).
- `Context::new(&cfg)` is gone; wrap solver work in
  `z3::with_z3_config(&cfg, || { ... })`, which scopes a
  thread-local context for the closure body.
- `_eq` is deprecated in favor of `eq` (still works with a warning).
@ajpal ajpal requested a review from chandrakananandi May 26, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant