From 9234b51019f4045190c1ce5c22eda305bcfa4b6d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 5 Sep 2025 17:44:31 +0000 Subject: [PATCH 1/9] Upgrade to nightly-2025-09-02 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5513678e267..776da6fb915 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-08-29" +channel = "nightly-2025-09-02" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] From 284c95201cdb3410c5f23e9b4dad516df7adf25e Mon Sep 17 00:00:00 2001 From: Nico Lehmann Date: Mon, 8 Sep 2025 12:19:08 -0300 Subject: [PATCH 2/9] Update mir dumper --- crates/flux-config/src/flags.rs | 4 - crates/flux-config/src/lib.rs | 4 - crates/flux-driver/src/callbacks.rs | 13 +--- crates/flux-refineck/src/ghost_statements.rs | 77 +++++++++----------- 4 files changed, 34 insertions(+), 64 deletions(-) diff --git a/crates/flux-config/src/flags.rs b/crates/flux-config/src/flags.rs index 72755a151fa..70357fb00aa 100644 --- a/crates/flux-config/src/flags.rs +++ b/crates/flux-config/src/flags.rs @@ -48,8 +48,6 @@ pub struct Flags { pub dump_fhir: bool, /// Saves the the `fhir` (debugging) pub dump_rty: bool, - /// Saves the low-level MIR for each analyzed function (debugging) - pub dump_mir: bool, /// Optimistically keeps running flux even after errors are found to get as many errors as possible pub catch_bugs: bool, /// Whether verification for the current crate is enabled. If false (the default), `flux-driver` @@ -73,7 +71,6 @@ impl Default for Flags { dump_checker_trace: None, dump_fhir: false, dump_rty: false, - dump_mir: false, catch_bugs: false, pointer_width: PointerWidth::default(), include: None, @@ -104,7 +101,6 @@ pub(crate) static FLAGS: LazyLock = LazyLock::new(|| { "log-dir" => parse_path_buf(&mut flags.log_dir, value), "dump-constraint" => parse_bool(&mut flags.dump_constraint, value), "dump-checker-trace" => parse_opt_level(&mut flags.dump_checker_trace, value), - "dump-mir" => parse_bool(&mut flags.dump_mir, value), "dump-fhir" => parse_bool(&mut flags.dump_fhir, value), "dump-rty" => parse_bool(&mut flags.dump_rty, value), "catch-bugs" => parse_bool(&mut flags.catch_bugs, value), diff --git a/crates/flux-config/src/lib.rs b/crates/flux-config/src/lib.rs index 504fe490e59..fb42d4ad9d2 100644 --- a/crates/flux-config/src/lib.rs +++ b/crates/flux-config/src/lib.rs @@ -19,10 +19,6 @@ pub fn dump_checker_trace() -> Option { FLAGS.dump_checker_trace } -pub fn dump_mir() -> bool { - FLAGS.dump_mir -} - pub fn dump_constraint() -> bool { FLAGS.dump_constraint } diff --git a/crates/flux-driver/src/callbacks.rs b/crates/flux-driver/src/callbacks.rs index 8a0e44bfecf..882f04005a7 100644 --- a/crates/flux-driver/src/callbacks.rs +++ b/crates/flux-driver/src/callbacks.rs @@ -1,6 +1,6 @@ use std::path::Path; -use flux_common::{bug, cache::QueryCache, dbg, iter::IterExt, result::ResultExt}; +use flux_common::{bug, cache::QueryCache, iter::IterExt, result::ResultExt}; use flux_config::{self as config}; use flux_errors::FluxSession; use flux_infer::fixpoint_encoding::FixQueryCache; @@ -315,17 +315,6 @@ fn mir_borrowck<'tcx>( ConsumerOptions::RegionInferenceContext, ); for (def_id, body_with_facts) in bodies_with_facts { - if config::dump_mir() { - rustc_middle::mir::pretty::write_mir_fn( - tcx, - &body_with_facts.body, - &mut |_, _| Ok(()), - &mut dbg::writer_for_item(tcx, def_id.to_def_id(), "mir").unwrap(), - rustc_middle::mir::pretty::PrettyPrintMirOptions::from_cli(tcx), - ) - .unwrap(); - } - // SAFETY: This is safe because we are feeding in the same `tcx` that is // going to be used as a witness when pulling out the data. unsafe { diff --git a/crates/flux-refineck/src/ghost_statements.rs b/crates/flux-refineck/src/ghost_statements.rs index aa7f5a89af4..dfce46ca218 100644 --- a/crates/flux-refineck/src/ghost_statements.rs +++ b/crates/flux-refineck/src/ghost_statements.rs @@ -3,10 +3,9 @@ mod fold_unfold; mod points_to; -use std::{fmt, io, iter}; +use std::{fmt, iter}; -use flux_common::{bug, dbg}; -use flux_config as config; +use flux_common::bug; use flux_middle::{global_env::GlobalEnv, queries::QueryResult}; use flux_rustc_bridge::{ lowering, @@ -80,11 +79,8 @@ impl GhostStatements { points_to::add_ghost_statements(&mut stmts, genv, body.rustc_body(), fn_sig.as_ref())?; stmts.add_unblocks(genv.tcx(), &body); - if config::dump_mir() { - let mut writer = - dbg::writer_for_item(genv.tcx(), def_id.to_def_id(), "ghost.mir").unwrap(); - stmts.write_mir(genv.tcx(), &body, &mut writer).unwrap(); - } + stmts.dump_ghost_mir(genv.tcx(), &body); + Ok(stmts) }) } @@ -143,48 +139,41 @@ impl GhostStatements { } } - pub(crate) fn write_mir<'tcx, W: io::Write>( - &self, - tcx: TyCtxt<'tcx>, - body: &Body<'tcx>, - w: &mut W, - ) -> io::Result<()> { - use rustc_middle::mir::PassWhere; - rustc_middle::mir::pretty::write_mir_fn( - tcx, - body.inner(), - &mut |pass, w| { - match pass { - PassWhere::BeforeBlock(bb) if bb == START_BLOCK => { - for stmt in &self.at_start { - writeln!(w, " {stmt:?};")?; + pub(crate) fn dump_ghost_mir<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { + use rustc_middle::mir::{PassWhere, pretty::MirDumper}; + if let Some(dumper) = MirDumper::new(tcx, "ghost", body.inner()) { + dumper + .set_extra_data(&mut |pass, w| { + match pass { + PassWhere::BeforeBlock(bb) if bb == START_BLOCK => { + for stmt in &self.at_start { + writeln!(w, " {stmt:?};")?; + } } - } - PassWhere::BeforeLocation(location) => { - for stmt in self.statements_at(Point::BeforeLocation(location)) { - writeln!(w, " {stmt:?};")?; + PassWhere::BeforeLocation(location) => { + for stmt in self.statements_at(Point::BeforeLocation(location)) { + writeln!(w, " {stmt:?};")?; + } } - } - PassWhere::AfterTerminator(bb) => { - if let Some(map) = self.at_edge.get(&bb) { - writeln!(w)?; - for (target, stmts) in map { - write!(w, " -> {target:?} {{")?; - for stmt in stmts { - write!(w, "\n {stmt:?};")?; + PassWhere::AfterTerminator(bb) => { + if let Some(map) = self.at_edge.get(&bb) { + writeln!(w)?; + for (target, stmts) in map { + write!(w, " -> {target:?} {{")?; + for stmt in stmts { + write!(w, "\n {stmt:?};")?; + } + write!(w, "\n }}")?; } - write!(w, "\n }}")?; + writeln!(w)?; } - writeln!(w)?; } + _ => {} } - _ => {} - } - Ok(()) - }, - w, - rustc_middle::mir::pretty::PrettyPrintMirOptions::from_cli(tcx), - ) + Ok(()) + }) + .dump_mir(body.inner()); + } } } From 5626856ae83b3ffe8c8f210fe1cf46c13dd74114 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Sep 2025 15:26:33 +0000 Subject: [PATCH 3/9] Upgrade to nightly-2025-09-03 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 776da6fb915..fd399a87e4e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-02" +channel = "nightly-2025-09-03" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] From 57d069bed9d1ccdea13d52fa135d7f56050d6376 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Sep 2025 15:33:37 +0000 Subject: [PATCH 4/9] Upgrade to nightly-2025-09-04 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fd399a87e4e..33bc7b67cb2 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-03" +channel = "nightly-2025-09-04" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] From 3b347c9f3029a68cfb55d9bd8ef3d2734eaf0be9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Sep 2025 15:40:20 +0000 Subject: [PATCH 5/9] Upgrade to nightly-2025-09-05 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 33bc7b67cb2..32be5e63321 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-04" +channel = "nightly-2025-09-05" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] From a3751bbfca8dfa361681272341b159465f9b6c66 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Sep 2025 15:46:58 +0000 Subject: [PATCH 6/9] Upgrade to nightly-2025-09-06 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 32be5e63321..7db496b51db 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-05" +channel = "nightly-2025-09-06" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] From 73faf63dcd7a1a4d9070eb13e7b26f14d444876a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Sep 2025 15:53:47 +0000 Subject: [PATCH 7/9] Upgrade to nightly-2025-09-07 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7db496b51db..5d45a89c105 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-06" +channel = "nightly-2025-09-07" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] From 192519d143d7cce4b2d3cb6f67b5890ad963b1b3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Sep 2025 16:00:32 +0000 Subject: [PATCH 8/9] Upgrade to nightly-2025-09-08 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5d45a89c105..3e5ccff40e2 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-07" +channel = "nightly-2025-09-08" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"] From 06982d3f38a86efc22ae8ef3fa2515814f51ab67 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Sep 2025 21:02:55 +0000 Subject: [PATCH 9/9] Upgrade to nightly-2025-09-09 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3e5ccff40e2..969a0a4c1da 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-08" +channel = "nightly-2025-09-09" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"]