]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
early: Do not emit errors for unresolved imports, store them instead
authorArthur Cohen <arthur.cohen@embecosm.com>
Sat, 6 Apr 2024 21:23:39 +0000 (23:23 +0200)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Thu, 26 Sep 2024 22:48:32 +0000 (22:48 +0000)
gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Store errors for later.

gcc/rust/resolve/rust-early-name-resolver-2.0.cc

index 8bd351571fc3ae38497b7cace6e8299f3abe2e57..6c5446a4f95eef51db88dc0153180eb0f55b2fc5 100644 (file)
@@ -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 (