diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 8aeab4073877..c674a18d1c92 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -877,6 +877,9 @@ Session::expansion (AST::Crate &crate) while (!fixed_point_reached && iterations < cfg.recursion_limit) { CfgStrip ().go (crate); + // Errors might happen during cfg strip pass + if (saw_errors ()) + break; auto ctx = Resolver2_0::NameResolutionContext ();