summaryrefslogtreecommitdiffstats
path: root/vendor/cstr/tests/compile_fail
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/cstr/tests/compile_fail
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/cstr/tests/compile_fail')
-rw-r--r--vendor/cstr/tests/compile_fail/empty.rs5
-rw-r--r--vendor/cstr/tests/compile_fail/empty.stderr7
-rw-r--r--vendor/cstr/tests/compile_fail/interior-nul.rs5
-rw-r--r--vendor/cstr/tests/compile_fail/interior-nul.stderr5
-rw-r--r--vendor/cstr/tests/compile_fail/non-str.rs7
-rw-r--r--vendor/cstr/tests/compile_fail/non-str.stderr17
-rw-r--r--vendor/cstr/tests/compile_fail/trash-after.rs5
-rw-r--r--vendor/cstr/tests/compile_fail/trash-after.stderr5
8 files changed, 56 insertions, 0 deletions
diff --git a/vendor/cstr/tests/compile_fail/empty.rs b/vendor/cstr/tests/compile_fail/empty.rs
new file mode 100644
index 000000000..0ac967273
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/empty.rs
@@ -0,0 +1,5 @@
+use cstr::cstr;
+
+fn main() {
+ let _foo = cstr!();
+}
diff --git a/vendor/cstr/tests/compile_fail/empty.stderr b/vendor/cstr/tests/compile_fail/empty.stderr
new file mode 100644
index 000000000..738692f22
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/empty.stderr
@@ -0,0 +1,7 @@
+error: unexpected end of input, expected one of: byte string literal, string literal, identifier
+ --> $DIR/empty.rs:4:16
+ |
+4 | let _foo = cstr!();
+ | ^^^^^^^
+ |
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/cstr/tests/compile_fail/interior-nul.rs b/vendor/cstr/tests/compile_fail/interior-nul.rs
new file mode 100644
index 000000000..a6876aeb1
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/interior-nul.rs
@@ -0,0 +1,5 @@
+use cstr::cstr;
+
+fn main() {
+ let _foo = cstr!("foo\0bar");
+}
diff --git a/vendor/cstr/tests/compile_fail/interior-nul.stderr b/vendor/cstr/tests/compile_fail/interior-nul.stderr
new file mode 100644
index 000000000..0c6ced1a4
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/interior-nul.stderr
@@ -0,0 +1,5 @@
+error: nul byte found in the literal
+ --> $DIR/interior-nul.rs:4:22
+ |
+4 | let _foo = cstr!("foo\0bar");
+ | ^^^^^^^^^^
diff --git a/vendor/cstr/tests/compile_fail/non-str.rs b/vendor/cstr/tests/compile_fail/non-str.rs
new file mode 100644
index 000000000..172b14559
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/non-str.rs
@@ -0,0 +1,7 @@
+use cstr::cstr;
+
+fn main() {
+ let _foo = cstr!(1);
+ let _foo = cstr!(("a"));
+ let _foo = cstr!(&1);
+}
diff --git a/vendor/cstr/tests/compile_fail/non-str.stderr b/vendor/cstr/tests/compile_fail/non-str.stderr
new file mode 100644
index 000000000..bbbf7e716
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/non-str.stderr
@@ -0,0 +1,17 @@
+error: expected one of: byte string literal, string literal, identifier
+ --> $DIR/non-str.rs:4:22
+ |
+4 | let _foo = cstr!(1);
+ | ^
+
+error: expected one of: byte string literal, string literal, identifier
+ --> $DIR/non-str.rs:5:22
+ |
+5 | let _foo = cstr!(("a"));
+ | ^^^^^
+
+error: expected one of: byte string literal, string literal, identifier
+ --> $DIR/non-str.rs:6:22
+ |
+6 | let _foo = cstr!(&1);
+ | ^
diff --git a/vendor/cstr/tests/compile_fail/trash-after.rs b/vendor/cstr/tests/compile_fail/trash-after.rs
new file mode 100644
index 000000000..5e4f7c3f0
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/trash-after.rs
@@ -0,0 +1,5 @@
+use cstr::cstr;
+
+fn main() {
+ let _foo = cstr!("foo" + "bar");
+}
diff --git a/vendor/cstr/tests/compile_fail/trash-after.stderr b/vendor/cstr/tests/compile_fail/trash-after.stderr
new file mode 100644
index 000000000..d6bb1530a
--- /dev/null
+++ b/vendor/cstr/tests/compile_fail/trash-after.stderr
@@ -0,0 +1,5 @@
+error: unexpected token
+ --> $DIR/trash-after.rs:4:28
+ |
+4 | let _foo = cstr!("foo" + "bar");
+ | ^