]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: 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)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 19 Mar 2025 14:32:13 +0000 (15:32 +0100)
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 ac8eb940c8d5576e34d57ad4619c5deaa3473c35..47582a6f339a2f944f15201a7feeb59ca7dc99cf 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 (