aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCohenArthur <arthur.cohen@epita.fr>2021-08-25 13:48:10 +0200
committerCohenArthur <arthur.cohen@epita.fr>2021-08-25 14:18:00 +0200
commit5b509a775f91da0678875ac381a655fd2ba1fd48 (patch)
tree99a97342bbcb3724406c64156fea7cb9dcca44c1
parent40042ce11fc5d7f62e31be99e82bf6a0db83234a (diff)
downloadgcc-5b509a775f91da0678875ac381a655fd2ba1fd48.zip
gcc-5b509a775f91da0678875ac381a655fd2ba1fd48.tar.gz
gcc-5b509a775f91da0678875ac381a655fd2ba1fd48.tar.bz2
modules: Add test case for #[path] modules
-rw-r--r--gcc/testsuite/rust/compile/extern_mod2.rs14
-rw-r--r--gcc/testsuite/rust/compile/modules/valid_path.rs1
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/extern_mod2.rs b/gcc/testsuite/rust/compile/extern_mod2.rs
new file mode 100644
index 0000000..67c8a13
--- /dev/null
+++ b/gcc/testsuite/rust/compile/extern_mod2.rs
@@ -0,0 +1,14 @@
+#[path = "modules/valid_path.rs"]
+mod not_a_valid_path;
+
+#[path] // { dg-error "path attributes must contain a filename" }
+mod error; // { dg-error "no candidate found for module error" }
+
+// This is "valid", and should only error out when parsing
+// the file
+// FIXME: Add a dg-error directive on the `mod another_error` line once module expansion
+// is added
+#[path = "not_a_valid_file.rs"]
+mod another_error;
+
+fn main() {}
diff --git a/gcc/testsuite/rust/compile/modules/valid_path.rs b/gcc/testsuite/rust/compile/modules/valid_path.rs
new file mode 100644
index 0000000..6a1519c
--- /dev/null
+++ b/gcc/testsuite/rust/compile/modules/valid_path.rs
@@ -0,0 +1 @@
+fn unused() {}