From: Jakub Dupak Date: Thu, 19 Oct 2023 09:37:41 +0000 (+0200) Subject: gccrs: borrowck: Execute only with CLI flag X-Git-Tag: basepoints/gcc-15~2061 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f6161e47fbfee41a3d22de21ce58efe5be01d90;p=thirdparty%2Fgcc.git gccrs: borrowck: Execute only with CLI flag gcc/rust/ChangeLog: * lang.opt: CLI flag. * rust-session-manager.cc (Session::compile_crate): Guard execution. Signed-off-by: Jakub Dupak --- diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt index a02121fcf5c4..9a89fab6cb11 100644 --- a/gcc/rust/lang.opt +++ b/gcc/rust/lang.opt @@ -202,4 +202,8 @@ frust-name-resolution-2.0 Rust Var(flag_name_resolution_2_0) Use the temporary and experimental name resolution pipeline instead of the stable one +frust-borrowcheck +Rust Var(flag_borrowcheck) +Use the WIP borrow checker. + ; This comment is to ensure we retain the blank line above. diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 8e69fc39aac5..1d9529119474 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -583,9 +583,11 @@ void Session::compile_crate(const char *filename) { if (last_step == CompileOptions::CompileStep::BorrowCheck) return; - const bool dump_bir = - options.dump_option_enabled(CompileOptions::DumpOption::BIR_DUMP); - HIR::BorrowChecker(dump_bir).go(hir); + if (flag_borrowcheck) { + const bool dump_bir = + options.dump_option_enabled(CompileOptions::DumpOption::BIR_DUMP); + HIR::BorrowChecker(dump_bir).go(hir); + } if (saw_errors()) return;