diff --git a/components/script/build.rs b/components/script/build.rs index d801137c59c..6bce87d65b5 100644 --- a/components/script/build.rs +++ b/components/script/build.rs @@ -79,9 +79,10 @@ struct Bytes<'a>(&'a str); impl<'a> fmt::Debug for Bytes<'a> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("b\"")?; - formatter.write_str(self.0)?; - formatter.write_str("\" as &'static [u8]") + // https://github.com/rust-lang/rust/issues/55223 + // should technically be just `write!(formatter, "b\"{}\"", self.0) + // but the referenced issue breaks promotion in the surrounding code + write!(formatter, "{{ const FOO: &[u8] = b\"{}\"; FOO }}", self.0) } }