diff --git a/src/items.rs b/src/items.rs index e10265df0effe..fadf53a57fd1a 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 275d9515a92e6..6ab0fdf053bcc 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();