]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Supress error with proc macro crates
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 1 Aug 2023 16:32:46 +0000 (18:32 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:04:33 +0000 (19:04 +0100)
This error was emitted when a valid proc macro crate was loaded. Proc
macros do not contain any import data for now.

gcc/rust/ChangeLog:

* metadata/rust-imports.cc (Import::try_package_in_directory):
Remove error when some macro are found even if no import data is
available.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/metadata/rust-imports.cc

index fc6bcdb2d95cab58f61d8a305fa0310309188828..17451fbcb9baf0a3c56ed7a2ab439852e3491087 100644 (file)
@@ -174,9 +174,10 @@ Import::try_package_in_directory (const std::string &filename,
 
   close (fd);
 
-  rust_error_at (location,
-                "%s exists but does not contain any Rust export data",
-                found_filename.c_str ());
+  if (macros.empty ())
+    rust_error_at (location,
+                  "%s exists but does not contain any Rust export data",
+                  found_filename.c_str ());
 
   return std::make_pair (NULL, macros);
 }