summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-3348-c-string-literals
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfcs/rfc-3348-c-string-literals')
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs14
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs3
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr25
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs16
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr31
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rsbin760 -> 623 bytes
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderrbin4477 -> 674 bytes
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs3
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr38
9 files changed, 42 insertions, 88 deletions
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs
new file mode 100644
index 000000000..0907061d6
--- /dev/null
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs
@@ -0,0 +1,14 @@
+// force-host
+// edition: 2018
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+use std::str::FromStr;
+
+#[proc_macro]
+pub fn number_of_tokens(_: TokenStream) -> TokenStream {
+ TokenStream::from_str("c\"\"").unwrap().into_iter().count().to_string().parse().unwrap()
+}
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs
index 3fc5fd481..503739600 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs
@@ -1,5 +1,4 @@
-// FIXME(c_str_literals): This should be `run-pass`
-// known-bug: #113333
+// run-pass
// edition: 2021
#![feature(c_str_literals)]
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr
deleted file mode 100644
index 571c319d8..000000000
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: prefix `c` is unknown
- --> $DIR/basic.rs:8:27
- |
-LL | assert_eq!(b"test\0", c"test".to_bytes_with_nul());
- | ^ unknown prefix
- |
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
- |
-LL | assert_eq!(b"test\0", c "test".to_bytes_with_nul());
- | +
-
-error: no rules expected the token `"test"`
- --> $DIR/basic.rs:8:28
- |
-LL | assert_eq!(b"test\0", c"test".to_bytes_with_nul());
- | -^^^^^
- | |
- | no rules expected this token in macro call
- | help: missing comma here
- |
- = note: while trying to match sequence start
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs
new file mode 100644
index 000000000..b3557c71b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs
@@ -0,0 +1,16 @@
+// even if this crate is edition 2021, proc macros compiled using older
+// editions should still be able to observe the pre-2021 token behavior
+//
+// adapted from tests/ui/rust-2021/reserved-prefixes-via-macro.rs
+
+// edition: 2021
+// check-pass
+
+// aux-build: count.rs
+extern crate count;
+
+const _: () = {
+ assert!(count::number_of_tokens!() == 2);
+};
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr
index 8de36ca4a..ea666e433 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr
@@ -1,32 +1,21 @@
-error: prefix `c` is unknown
+error[E0658]: `c".."` literals are experimental
--> $DIR/gate.rs:10:5
|
LL | c"foo";
- | ^ unknown prefix
+ | ^^^^^^
|
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
- |
-LL | c "foo";
- | +
+ = note: see issue #105723 <https://github.com/rust-lang/rust/issues/105723> for more information
+ = help: add `#![feature(c_str_literals)]` to the crate attributes to enable
-error: prefix `c` is unknown
+error[E0658]: `c".."` literals are experimental
--> $DIR/gate.rs:13:8
|
LL | m!(c"test");
- | ^ unknown prefix
- |
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
+ | ^^^^^^^
|
-LL | m!(c "test");
- | +
-
-error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"foo"`
- --> $DIR/gate.rs:10:6
- |
-LL | c"foo";
- | ^^^^^ expected one of 8 possible tokens
+ = note: see issue #105723 <https://github.com/rust-lang/rust/issues/105723> for more information
+ = help: add `#![feature(c_str_literals)]` to the crate attributes to enable
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs
index 96945f125..369173e23 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs
Binary files differ
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr
index 2226c7aa6..82d9f9cb3 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr
Binary files differ
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs
index 066505c23..380445d7a 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs
@@ -1,5 +1,4 @@
-// FIXME(c_str_literals): This should be `run-pass`
-// known-bug: #113333
+// run-pass
// edition: 2021
#![feature(c_str_literals)]
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr
deleted file mode 100644
index 47361fb61..000000000
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr
+++ /dev/null
@@ -1,38 +0,0 @@
-error: prefix `c` is unknown
- --> $DIR/non-ascii.rs:9:9
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | ^ unknown prefix
- |
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
- |
-LL | c "\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | +
-
-error: out of range hex escape
- --> $DIR/non-ascii.rs:9:11
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | ^^^^ must be a character in the range [\x00-\x7f]
-
-error: out of range hex escape
- --> $DIR/non-ascii.rs:9:15
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | ^^^^ must be a character in the range [\x00-\x7f]
-
-error: no rules expected the token `"\xEF\x80🦀\u{1F980}"`
- --> $DIR/non-ascii.rs:9:10
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | -^^^^^^^^^^^^^^^^^^^^
- | |
- | no rules expected this token in macro call
- | help: missing comma here
- |
-note: while trying to match `,`
- --> $SRC_DIR/core/src/macros/mod.rs:LL:COL
-
-error: aborting due to 4 previous errors
-