From 47364f64efa2242df2d1b16a0aa264ff64fd4a53 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Mon, 22 Oct 2018 19:15:25 +0200 Subject: [PATCH] Add a workaround for a rustc ICE --- components/script/build.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) } }