Skip to content

Commit

Permalink
Allow merging of statics generated by format!()
Browse files Browse the repository at this point in the history
  • Loading branch information
dotdash committed Jul 21, 2014
1 parent f15d6d2 commit 1654f08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libsyntax/ext/format.rs
Expand Up @@ -316,14 +316,19 @@ impl<'a, 'b> Context<'a, 'b> {
/// These attributes are applied to all statics that this syntax extension
/// will generate.
fn static_attrs(&self) -> Vec<ast::Attribute> {
// Flag statics as `inline` so LLVM can merge duplicate globals as much
// as possible (which we're generating a whole lot of).
let unnamed = self.ecx.meta_word(self.fmtsp, InternedString::new("inline"));
let unnamed = self.ecx.attribute(self.fmtsp, unnamed);

// Do not warn format string as dead code
let dead_code = self.ecx.meta_word(self.fmtsp,
InternedString::new("dead_code"));
let allow_dead_code = self.ecx.meta_list(self.fmtsp,
InternedString::new("allow"),
vec!(dead_code));
let allow_dead_code = self.ecx.attribute(self.fmtsp, allow_dead_code);
return vec!(allow_dead_code);
return vec!(unnamed, allow_dead_code);
}

fn rtpath(&self, s: &str) -> Vec<ast::Ident> {
Expand Down

5 comments on commit 1654f08

@bors
Copy link
Contributor

@bors bors commented on 1654f08 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at dotdash@1654f08

@bors
Copy link
Contributor

@bors bors commented on 1654f08 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging dotdash/rust/unnamed_fmtstr = 1654f08 into auto

@bors
Copy link
Contributor

@bors bors commented on 1654f08 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotdash/rust/unnamed_fmtstr = 1654f08 merged ok, testing candidate = 62f1bb0

@bors
Copy link
Contributor

@bors bors commented on 1654f08 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 62f1bb0

Please sign in to comment.