summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/raw_identifiers.rs
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 /src/tools/rustfmt/tests/target/raw_identifiers.rs
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 'src/tools/rustfmt/tests/target/raw_identifiers.rs')
-rw-r--r--src/tools/rustfmt/tests/target/raw_identifiers.rs66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/raw_identifiers.rs b/src/tools/rustfmt/tests/target/raw_identifiers.rs
new file mode 100644
index 000000000..6ab0fdf05
--- /dev/null
+++ b/src/tools/rustfmt/tests/target/raw_identifiers.rs
@@ -0,0 +1,66 @@
+#![feature(custom_attribute)]
+#![feature(raw_identifiers)]
+#![feature(extern_types)]
+#![allow(invalid_type_param_default)]
+#![allow(unused_attributes)]
+
+use r#foo as r#alias_foo;
+
+// https://github.com/rust-lang/rustfmt/issues/3837
+pub(crate) static r#break: &'static str = "foo";
+
+fn main() {
+ #[r#attr]
+ r#foo::r#bar();
+
+ let r#local = r#Struct { r#field: () };
+ r#local.r#field = 1;
+ r#foo.r#barr();
+ let r#async = r#foo(r#local);
+ r#macro!();
+
+ if let r#sub_pat @ r#Foo(_) = r#Foo(3) {}
+
+ match r#async {
+ r#Foo | r#Bar => r#foo(),
+ }
+}
+
+fn r#bar<'a, r#T>(r#x: &'a r#T) {}
+
+mod r#foo {
+ pub fn r#bar() {}
+}
+
+enum r#Foo {
+ r#Bar {},
+}
+
+struct r#Struct {
+ r#field: r#FieldType,
+}
+
+trait r#Trait {
+ type r#Type;
+}
+
+impl r#Trait for r#Impl {
+ type r#Type = r#u32;
+ fn r#xxx(r#fjio: r#u32) {}
+}
+
+extern "C" {
+ type r#ccc;
+ static r#static_val: u32;
+}
+
+macro_rules! r#macro {
+ () => {};
+}
+
+macro_rules! foo {
+ ($x:expr) => {
+ let r#catch = $x + 1;
+ println!("{}", r#catch);
+ };
+}