https://gcc.gnu.org/g:c67b14ccc5b4ab16c237b448633a8e8718644153
commit c67b14ccc5b4ab16c237b448633a8e8718644153 Author: Arthur Cohen <arthur.co...@embecosm.com> Date: Sat Apr 6 23:23:39 2024 +0200 early: Do not emit errors for unresolved imports, store them instead gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Store errors for later. Diff: --- gcc/rust/resolve/rust-early-name-resolver-2.0.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc index 8bd351571fc3..6c5446a4f95e 100644 --- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc @@ -161,8 +161,9 @@ Early::build_import_mapping ( } if (!found) - rust_error_at (path.get_final_segment ().get_locus (), ErrorCode::E0433, - "unresolved import %qs", path.as_string ().c_str ()); + collect_error (Error (path.get_final_segment ().get_locus (), + ErrorCode::E0433, "unresolved import %qs", + path.as_string ().c_str ())); } } @@ -303,8 +304,9 @@ Early::visit_attributes (std::vector<AST::Attribute> &attrs) if (!definition.has_value ()) { // FIXME: Change to proper error message - rust_error_at (trait.get ().get_locus (), - "could not resolve trait"); + collect_error (Error (trait.get ().get_locus (), + "could not resolve trait %qs", + trait.get ().as_string ().c_str ())); continue; } @@ -326,8 +328,9 @@ Early::visit_attributes (std::vector<AST::Attribute> &attrs) if (!definition.has_value ()) { // FIXME: Change to proper error message - rust_error_at (attr.get_locus (), - "could not resolve attribute macro invocation"); + collect_error ( + Error (attr.get_locus (), + "could not resolve attribute macro invocation")); return; } auto pm_def = mappings.lookup_attribute_proc_macro_def (