]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: borrowck: Execute only with CLI flag
authorJakub Dupak <dev@jakubdupak.com>
Thu, 19 Oct 2023 09:37:41 +0000 (11:37 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:09:26 +0000 (19:09 +0100)
gcc/rust/ChangeLog:

* lang.opt: CLI flag.
* rust-session-manager.cc (Session::compile_crate): Guard execution.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/lang.opt
gcc/rust/rust-session-manager.cc

index a02121fcf5c483e04550947ce4de7c03a02d09ef..9a89fab6cb114674eb2474d7777307daba23183c 100644 (file)
@@ -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.
index 8e69fc39aac55185ef2cf796314cc3ef2a66dbca..1d9529119474616fd941f1a02c118f330ada4df7 100644 (file)
@@ -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;