diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/wrong_parsing.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/wrong_parsing.rs new file mode 100644 index 0000000000000..c5aaa16af0cb1 --- /dev/null +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/wrong_parsing.rs @@ -0,0 +1,17 @@ +// force-host +// no-prefer-dynamic +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::{TokenStream, TokenTree}; + +#[proc_macro] +pub fn repro(input: TokenStream) -> TokenStream { + for token in input { + if let TokenTree::Literal(literal) = token { + assert!(format!("{}", literal).contains(&"c\""), "panic on: `{}`", literal); + } + } + TokenStream::new() +} diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-issue-112820-spans.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-issue-112820-spans.rs new file mode 100644 index 0000000000000..2a4af32f46f2f --- /dev/null +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-issue-112820-spans.rs @@ -0,0 +1,14 @@ +// edition: 2021 +// known-bug: #112820 +// +// aux-build: count.rs +#![feature(c_str_literals)] + +// aux-build: wrong_parsing.rs +extern crate wrong_parsing; + +const _: () = { + wrong_parsing::repro!(c"cstr"); +}; + +fn main() {} diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-issue-112820-spans.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-issue-112820-spans.stderr new file mode 100644 index 0000000000000..1bf0aee144288 --- /dev/null +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-issue-112820-spans.stderr @@ -0,0 +1,10 @@ +error: proc macro panicked + --> $DIR/edition-issue-112820-spans.rs:11:5 + | +LL | wrong_parsing::repro!(c"cstr"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: message: panic on: `cstr` + +error: aborting due to previous error +