Skip to content

Commit 953638f

Browse files
committed
---
yaml --- r: 95103 b: refs/heads/dist-snap c: eafbcfb h: refs/heads/master i: 95101: e7276ff 95099: a647fea 95095: 639d826 95087: cf51d41 95071: d87cad2 95039: efa6863 94975: 1fc2bcc v: v3
1 parent 96c6afa commit 953638f

File tree

5 files changed

+36
-17
lines changed

5 files changed

+36
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 24a253778aa26222cae97e3b57f85e5054a39977
9+
refs/heads/dist-snap: eafbcfb73cad912a0b2c2ec24f028257e5f2f999
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/tutorial-rustpkg.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ This makes sense, as we haven't gotten it from anywhere yet! Luckily for us,
3535
used like this:
3636

3737
~~~ {.notrust}
38-
$ rustpkg install PKG_ID
38+
$ rustpkg install pkg_id
3939
~~~
4040

41-
This will install a package named `PKG_ID` into your current Rust environment.
42-
I called it `PKG_ID` in this example because `rustpkg` calls this a 'package
41+
This will install a package named 'pkg_id' into your current Rust environment.
42+
I called it 'pkg_id' in this example because `rustpkg` calls this a 'package
4343
identifier.' When using it with an external package like this, it's often a
4444
URI fragment. You see, Rust has no central authority for packages. You can
4545
build your own `hello` library if you want, and that's fine. We'd both host

branches/dist-snap/src/libsyntax/ext/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ pub fn std_macros() -> @str {
821821
if lvl <= __log_level() {
822822
format_args!(|args| {
823823
::std::logging::log(lvl, args)
824-
}, \"{}\", fmt!(\"%?\", $arg))
824+
}, \"{}\", fmt!(\"{:?}\", $arg))
825825
}
826826
});
827827
($lvl:expr, $($arg:expr),+) => ({

branches/dist-snap/src/libsyntax/ext/format.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,17 @@ impl Context {
319319
}
320320
}
321321

322+
/// These attributes are applied to all statics that this syntax extension
323+
/// will generate.
324+
fn static_attrs(&self) -> ~[ast::Attribute] {
325+
// Flag statics as `address_insignificant` so LLVM can merge duplicate
326+
// globals as much as possible (which we're generating a whole lot of).
327+
let unnamed = self.ecx.meta_word(self.fmtsp, @"address_insignificant");
328+
let unnamed = self.ecx.attribute(self.fmtsp, unnamed);
329+
330+
return ~[unnamed];
331+
}
332+
322333
/// Translate a `parse::Piece` to a static `rt::Piece`
323334
fn trans_piece(&mut self, piece: &parse::Piece) -> @ast::Expr {
324335
let sp = self.fmtsp;
@@ -444,14 +455,9 @@ impl Context {
444455
~[]
445456
), None);
446457
let st = ast::item_static(ty, ast::MutImmutable, method);
447-
let static_name = self.ecx.ident_of(format!("__static_method_{}",
458+
let static_name = self.ecx.ident_of(format!("__STATIC_METHOD_{}",
448459
self.method_statics.len()));
449-
// Flag these statics as `address_insignificant` so LLVM can
450-
// merge duplicate globals as much as possible (which we're
451-
// generating a whole lot of).
452-
let unnamed = self.ecx.meta_word(self.fmtsp, @"address_insignificant");
453-
let unnamed = self.ecx.attribute(self.fmtsp, unnamed);
454-
let item = self.ecx.item(sp, static_name, ~[unnamed], st);
460+
let item = self.ecx.item(sp, static_name, self.static_attrs(), st);
455461
self.method_statics.push(item);
456462
self.ecx.expr_ident(sp, static_name)
457463
};
@@ -572,11 +578,9 @@ impl Context {
572578
);
573579
let ty = self.ecx.ty(self.fmtsp, ty);
574580
let st = ast::item_static(ty, ast::MutImmutable, fmt);
575-
let static_name = self.ecx.ident_of("__static_fmtstr");
576-
// see above comment for `address_insignificant` and why we do it
577-
let unnamed = self.ecx.meta_word(self.fmtsp, @"address_insignificant");
578-
let unnamed = self.ecx.attribute(self.fmtsp, unnamed);
579-
let item = self.ecx.item(self.fmtsp, static_name, ~[unnamed], st);
581+
let static_name = self.ecx.ident_of("__STATIC_FMTSTR");
582+
let item = self.ecx.item(self.fmtsp, static_name,
583+
self.static_attrs(), st);
580584
let decl = respan(self.fmtsp, ast::DeclItem(item));
581585
lets.push(@respan(self.fmtsp, ast::StmtDecl(@decl, ast::DUMMY_NODE_ID)));
582586

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[deny(non_uppercase_statics)];
12+
13+
pub fn main() {
14+
println!("I generate statics with {0, select, other{#}}", "weird names");
15+
}

0 commit comments

Comments
 (0)