https://gcc.gnu.org/g:dd23e4f8b9c63974a589557791ec50c18e5e72d3
commit dd23e4f8b9c63974a589557791ec50c18e5e72d3 Author: Jakub Dupak <d...@jakubdupak.com> Date: Thu Oct 19 11:37:41 2023 +0200 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 <d...@jakubdupak.com> Diff: --- gcc/rust/lang.opt | 4 ++++ gcc/rust/rust-session-manager.cc | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt index 67285a6d92b2..83db5ec1711d 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 2843b7d25cf2..96d5f4729165 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -667,9 +667,12 @@ 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;