aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-10-26 12:45:35 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2020-11-05 21:24:20 +0200
commit7860a6aeab9514391f02923a7f6357f094c8af68 (patch)
tree57e7b9bf1f89ab5e5d1133a97a550ea237527046 /test cases
parentbe2c1a43000db0a84a76522b23b80d597e08f663 (diff)
downloadmeson-7860a6aeab9514391f02923a7f6357f094c8af68.zip
meson-7860a6aeab9514391f02923a7f6357f094c8af68.tar.gz
meson-7860a6aeab9514391f02923a7f6357f094c8af68.tar.bz2
rust: implement support for --edition
Using the std option, so now `rust_std=..` will work. I've chosen to use "std" even though rust calls these "editions", as meson refers to language versions as "standards", which makes meson feel more uniform, and be less surprising. Fixes: #5100
Diffstat (limited to 'test cases')
-rw-r--r--test cases/rust/10 language stds/2015.rs3
-rw-r--r--test cases/rust/10 language stds/2018.rs9
-rw-r--r--test cases/rust/10 language stds/meson.build18
3 files changed, 30 insertions, 0 deletions
diff --git a/test cases/rust/10 language stds/2015.rs b/test cases/rust/10 language stds/2015.rs
new file mode 100644
index 0000000..4d28c57
--- /dev/null
+++ b/test cases/rust/10 language stds/2015.rs
@@ -0,0 +1,3 @@
+trait Foo {
+ fn foo(&self, Box<dyn Foo>);
+}
diff --git a/test cases/rust/10 language stds/2018.rs b/test cases/rust/10 language stds/2018.rs
new file mode 100644
index 0000000..4009154
--- /dev/null
+++ b/test cases/rust/10 language stds/2018.rs
@@ -0,0 +1,9 @@
+const fn foo(x: i32) -> i32 {
+ return x + 1;
+}
+
+const VALUE: i32 = foo(-1);
+
+pub fn main() {
+ std::process::exit(VALUE);
+}
diff --git a/test cases/rust/10 language stds/meson.build b/test cases/rust/10 language stds/meson.build
new file mode 100644
index 0000000..9944339
--- /dev/null
+++ b/test cases/rust/10 language stds/meson.build
@@ -0,0 +1,18 @@
+project('rust std options', 'rust')
+
+# this only works in 2018
+new = executable(
+ 'new',
+ '2018.rs',
+ override_options : ['rust_std=2018'],
+)
+
+# this only works in 2015
+old = static_library(
+ 'old',
+ '2015.rs',
+ override_options : ['rust_std=2015'],
+)
+
+
+test('2018 std', new)