From ed697c93479502ced4bd10d083237f0a05d263b1 Mon Sep 17 00:00:00 2001 From: Caleb Cartwright Date: Sat, 5 Oct 2019 12:34:48 -0500 Subject: [PATCH] fix: support raw prefix identifiers in statics --- src/items.rs | 2 +- tests/target/raw_identifiers.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/items.rs b/src/items.rs index e10265df0eff..fadf53a57fd1 100644 --- a/src/items.rs +++ b/src/items.rs @@ -1722,7 +1722,7 @@ fn rewrite_static( static_parts.defaultness.map_or("", format_defaultness), static_parts.prefix, format_mutability(static_parts.mutability), - static_parts.ident, + rewrite_ident(context, static_parts.ident), colon, ); // 2 = " =".len() diff --git a/tests/target/raw_identifiers.rs b/tests/target/raw_identifiers.rs index 275d9515a92e..6ab0fdf053bc 100644 --- a/tests/target/raw_identifiers.rs +++ b/tests/target/raw_identifiers.rs @@ -6,6 +6,9 @@ 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();