From e02c5b5930c2c9ba3e5423fe12e2ef0155017297 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Thu, 30 May 2024 20:31:36 +0200
Subject: Merging upstream version 1.74.1+dfsg1.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 tests/ui/proc-macro/allowed-signatures.rs     |   2 +-
 tests/ui/proc-macro/auxiliary/api/mod.rs      |   1 +
 tests/ui/proc-macro/auxiliary/api/parse.rs    |   4 +
 tests/ui/proc-macro/auxiliary/print-tokens.rs |  16 ++++
 tests/ui/proc-macro/bad-projection.stderr     |   6 ++
 tests/ui/proc-macro/literal-to-string.rs      |  26 +++++++
 tests/ui/proc-macro/literal-to-string.stdout  | 107 ++++++++++++++++++++++++++
 7 files changed, 161 insertions(+), 1 deletion(-)
 create mode 100644 tests/ui/proc-macro/auxiliary/print-tokens.rs
 create mode 100644 tests/ui/proc-macro/literal-to-string.rs
 create mode 100644 tests/ui/proc-macro/literal-to-string.stdout

(limited to 'tests/ui/proc-macro')

diff --git a/tests/ui/proc-macro/allowed-signatures.rs b/tests/ui/proc-macro/allowed-signatures.rs
index 868508761..ce327901b 100644
--- a/tests/ui/proc-macro/allowed-signatures.rs
+++ b/tests/ui/proc-macro/allowed-signatures.rs
@@ -3,7 +3,7 @@
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
 extern crate proc_macro;
 use proc_macro::TokenStream;
 
diff --git a/tests/ui/proc-macro/auxiliary/api/mod.rs b/tests/ui/proc-macro/auxiliary/api/mod.rs
index 739c25132..3bea5d757 100644
--- a/tests/ui/proc-macro/auxiliary/api/mod.rs
+++ b/tests/ui/proc-macro/auxiliary/api/mod.rs
@@ -4,6 +4,7 @@
 #![crate_type = "proc-macro"]
 #![crate_name = "proc_macro_api_tests"]
 #![feature(proc_macro_span)]
+#![feature(proc_macro_byte_character)]
 #![deny(dead_code)] // catch if a test function is never called
 
 extern crate proc_macro;
diff --git a/tests/ui/proc-macro/auxiliary/api/parse.rs b/tests/ui/proc-macro/auxiliary/api/parse.rs
index 27391f831..07c9f4649 100644
--- a/tests/ui/proc-macro/auxiliary/api/parse.rs
+++ b/tests/ui/proc-macro/auxiliary/api/parse.rs
@@ -29,12 +29,16 @@ fn test_display_literal() {
     assert_eq!(Literal::character('\'').to_string(), "'\\''");
     assert_eq!(Literal::character('"').to_string(), "'\"'");
     assert_eq!(Literal::character('\u{1}').to_string(), "'\\u{1}'");
+
+    assert_eq!(Literal::byte_character(b'a').to_string(), "b'a'");
+    assert_eq!(Literal::byte_character(0).to_string(), "b'\\x00'");
 }
 
 fn test_parse_literal() {
     assert_eq!("1".parse::<Literal>().unwrap().to_string(), "1");
     assert_eq!("1.0".parse::<Literal>().unwrap().to_string(), "1.0");
     assert_eq!("'a'".parse::<Literal>().unwrap().to_string(), "'a'");
+    assert_eq!("b'a'".parse::<Literal>().unwrap().to_string(), "b'a'");
     assert_eq!("\"\n\"".parse::<Literal>().unwrap().to_string(), "\"\n\"");
     assert_eq!("b\"\"".parse::<Literal>().unwrap().to_string(), "b\"\"");
     assert_eq!("r##\"\"##".parse::<Literal>().unwrap().to_string(), "r##\"\"##");
diff --git a/tests/ui/proc-macro/auxiliary/print-tokens.rs b/tests/ui/proc-macro/auxiliary/print-tokens.rs
new file mode 100644
index 000000000..3a5767edb
--- /dev/null
+++ b/tests/ui/proc-macro/auxiliary/print-tokens.rs
@@ -0,0 +1,16 @@
+// force-host
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::{TokenStream, TokenTree};
+
+#[proc_macro]
+pub fn print_tokens(input: TokenStream) -> TokenStream {
+    println!("{:#?}", input);
+    for token in input {
+        println!("{token}");
+    }
+    TokenStream::new()
+}
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index 8a8246376..8716defa1 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): Project` is not satisfied
    |
 LL | pub fn uwu() -> <() as Project>::Assoc {}
    |                 ^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()`
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/bad-projection.rs:9:1
+   |
+LL | trait Project {
+   | ^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/tests/ui/proc-macro/literal-to-string.rs b/tests/ui/proc-macro/literal-to-string.rs
new file mode 100644
index 000000000..494d17cbe
--- /dev/null
+++ b/tests/ui/proc-macro/literal-to-string.rs
@@ -0,0 +1,26 @@
+// check-pass
+// edition: 2021
+#![feature(c_str_literals)]
+
+// aux-build: print-tokens.rs
+extern crate print_tokens;
+
+fn main() {
+    print_tokens::print_tokens! {
+        1
+        17u8
+        42.
+        3.14f32
+        b'a'
+        b'\xFF'
+        'c'
+        '\x32'
+        "\"str\""
+        r#""raw" str"#
+        r###"very ##"raw"## str"###
+        b"\"byte\" str"
+        br#""raw" "byte" str"#
+        c"\"c\" str"
+        cr#""raw" "c" str"#
+    }
+}
diff --git a/tests/ui/proc-macro/literal-to-string.stdout b/tests/ui/proc-macro/literal-to-string.stdout
new file mode 100644
index 000000000..7b27fcf79
--- /dev/null
+++ b/tests/ui/proc-macro/literal-to-string.stdout
@@ -0,0 +1,107 @@
+TokenStream [
+    Literal {
+        kind: Integer,
+        symbol: "1",
+        suffix: None,
+        span: #0 bytes(172..173),
+    },
+    Literal {
+        kind: Integer,
+        symbol: "17",
+        suffix: Some("u8"),
+        span: #0 bytes(182..186),
+    },
+    Literal {
+        kind: Float,
+        symbol: "42.",
+        suffix: None,
+        span: #0 bytes(195..198),
+    },
+    Literal {
+        kind: Float,
+        symbol: "3.14",
+        suffix: Some("f32"),
+        span: #0 bytes(207..214),
+    },
+    Literal {
+        kind: Byte,
+        symbol: "a",
+        suffix: None,
+        span: #0 bytes(223..227),
+    },
+    Literal {
+        kind: Byte,
+        symbol: "\xFF",
+        suffix: None,
+        span: #0 bytes(236..243),
+    },
+    Literal {
+        kind: Char,
+        symbol: "c",
+        suffix: None,
+        span: #0 bytes(252..255),
+    },
+    Literal {
+        kind: Char,
+        symbol: "\x32",
+        suffix: None,
+        span: #0 bytes(264..270),
+    },
+    Literal {
+        kind: Str,
+        symbol: "\\"str\\"",
+        suffix: None,
+        span: #0 bytes(279..288),
+    },
+    Literal {
+        kind: StrRaw(1),
+        symbol: "\"raw\" str",
+        suffix: None,
+        span: #0 bytes(297..311),
+    },
+    Literal {
+        kind: StrRaw(3),
+        symbol: "very ##\"raw\"## str",
+        suffix: None,
+        span: #0 bytes(320..347),
+    },
+    Literal {
+        kind: ByteStr,
+        symbol: "\\"byte\\" str",
+        suffix: None,
+        span: #0 bytes(356..371),
+    },
+    Literal {
+        kind: ByteStrRaw(1),
+        symbol: "\"raw\" \"byte\" str",
+        suffix: None,
+        span: #0 bytes(380..402),
+    },
+    Literal {
+        kind: CStr,
+        symbol: "\\"c\\" str",
+        suffix: None,
+        span: #0 bytes(411..423),
+    },
+    Literal {
+        kind: CStrRaw(1),
+        symbol: "\"raw\" \"c\" str",
+        suffix: None,
+        span: #0 bytes(432..451),
+    },
+]
+1
+17u8
+42.
+3.14f32
+b'a'
+b'\xFF'
+'c'
+'\x32'
+"\"str\""
+r#""raw" str"#
+r###"very ##"raw"## str"###
+b"\"byte\" str"
+br#""raw" "byte" str"#
+c"\"c\" str"
+cr#""raw" "c" str"#
-- 
cgit v1.2.3