Skip to content

Commit b74822b

Browse files
pcwaltonhuonw
authored andcommitted
---
yaml --- r: 107846 b: refs/heads/dist-snap c: 70c5a0f h: refs/heads/master v: v3
1 parent 5e6b696 commit b74822b

File tree

37 files changed

+422
-295
lines changed

37 files changed

+422
-295
lines changed

[refs]

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

branches/dist-snap/src/libextra/ringbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
303303
&mut self.remaining2
304304
};
305305
self.nelts -= 1;
306-
Some(r.mut_shift_ref().unwrap().get_mut_ref())
306+
Some(r.mut_shift_ref().get_mut_ref())
307307
}
308308

309309
#[inline]
@@ -325,7 +325,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
325325
&mut self.remaining1
326326
};
327327
self.nelts -= 1;
328-
Some(r.mut_pop_ref().unwrap().get_mut_ref())
328+
Some(r.mut_pop_ref().get_mut_ref())
329329
}
330330
}
331331

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ use syntax::codemap;
4444
use syntax::diagnostic;
4545
use syntax::ext::base::CrateLoader;
4646
use syntax::parse;
47+
use syntax::parse::token::InternedString;
4748
use syntax::parse::token;
4849
use syntax::print::{pp, pprust};
4950
use syntax;
@@ -90,22 +91,23 @@ pub fn default_configuration(sess: Session) ->
9091
};
9192

9293
let fam = match sess.targ_cfg.os {
93-
abi::OsWin32 => @"windows",
94-
_ => @"unix"
94+
abi::OsWin32 => InternedString::new("windows"),
95+
_ => InternedString::new("unix")
9596
};
9697

9798
let mk = attr::mk_name_value_item_str;
9899
return ~[ // Target bindings.
99-
attr::mk_word_item(fam),
100-
mk(@"target_os", tos),
101-
mk(@"target_family", fam),
102-
mk(@"target_arch", arch),
103-
mk(@"target_endian", end),
104-
mk(@"target_word_size", wordsz),
100+
attr::mk_word_item(fam.clone()),
101+
mk(InternedString::new("target_os"), tos),
102+
mk(InternedString::new("target_family"), fam.get().to_managed()),
103+
mk(InternedString::new("target_arch"), arch),
104+
mk(InternedString::new("target_endian"), end),
105+
mk(InternedString::new("target_word_size"), wordsz),
105106
];
106107
}
107108

108-
pub fn append_configuration(cfg: &mut ast::CrateConfig, name: @str) {
109+
pub fn append_configuration(cfg: &mut ast::CrateConfig,
110+
name: InternedString) {
109111
if !cfg.iter().any(|mi| mi.name() == name) {
110112
cfg.push(attr::mk_word_item(name))
111113
}
@@ -118,9 +120,15 @@ pub fn build_configuration(sess: Session) ->
118120
let default_cfg = default_configuration(sess);
119121
let mut user_cfg = sess.opts.cfg.clone();
120122
// If the user wants a test runner, then add the test cfg
121-
if sess.opts.test { append_configuration(&mut user_cfg, @"test") }
123+
if sess.opts.test {
124+
append_configuration(&mut user_cfg, InternedString::new("test"))
125+
}
122126
// If the user requested GC, then add the GC cfg
123-
append_configuration(&mut user_cfg, if sess.opts.gc { @"gc" } else { @"nogc" });
127+
append_configuration(&mut user_cfg, if sess.opts.gc {
128+
InternedString::new("gc")
129+
} else {
130+
InternedString::new("nogc")
131+
});
124132
return vec::append(user_cfg, default_cfg);
125133
}
126134

branches/dist-snap/src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ pub fn collect_outputs(session: &Session,
435435
}
436436
let mut base = session.opts.outputs.clone();
437437
let mut iter = attrs.iter().filter_map(|a| {
438-
if "crate_type" == a.name() {
438+
if a.name().equiv(&("crate_type")) {
439439
match a.value_str() {
440440
Some(n) if "rlib" == n => Some(OutputRlib),
441441
Some(n) if "dylib" == n => Some(OutputDylib),

branches/dist-snap/src/librustc/front/feature_gate.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl Visitor<()> for Context {
135135

136136
fn visit_item(&mut self, i: &ast::Item, _:()) {
137137
for attr in i.attrs.iter() {
138-
if "thread_local" == attr.name() {
138+
if attr.name().equiv(&("thread_local")) {
139139
self.gate_feature("thread_local", i.span,
140140
"`#[thread_local]` is an experimental feature, and does not \
141141
currently handle destructors. There is no corresponding \
@@ -258,7 +258,9 @@ pub fn check_crate(sess: Session, crate: &ast::Crate) {
258258
};
259259

260260
for attr in crate.attrs.iter() {
261-
if "feature" != attr.name() { continue }
261+
if !attr.name().equiv(&("feature")) {
262+
continue
263+
}
262264

263265
match attr.meta_item_list() {
264266
None => {
@@ -268,14 +270,16 @@ pub fn check_crate(sess: Session, crate: &ast::Crate) {
268270
Some(list) => {
269271
for &mi in list.iter() {
270272
let name = match mi.node {
271-
ast::MetaWord(word) => word,
273+
ast::MetaWord(ref word) => (*word).clone(),
272274
_ => {
273-
sess.span_err(mi.span, "malformed feature, expected \
274-
just one word");
275+
sess.span_err(mi.span,
276+
"malformed feature, expected just \
277+
one word");
275278
continue
276279
}
277280
};
278-
match KNOWN_FEATURES.iter().find(|& &(n, _)| n == name) {
281+
match KNOWN_FEATURES.iter()
282+
.find(|& &(n, _)| name.equiv(&n)) {
279283
Some(&(name, Active)) => { cx.features.push(name); }
280284
Some(&(_, Removed)) => {
281285
sess.span_err(mi.span, "feature has been removed");

branches/dist-snap/src/librustc/front/test.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use syntax::ext::base::ExtCtxt;
2727
use syntax::fold::Folder;
2828
use syntax::fold;
2929
use syntax::opt_vec;
30+
use syntax::parse::token::InternedString;
3031
use syntax::print::pprust;
3132
use syntax::{ast, ast_util};
3233
use syntax::util::small_vector::SmallVector;
@@ -132,7 +133,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
132133
if !cx.sess.building_library.get() {
133134
@ast::Item {
134135
attrs: item.attrs.iter().filter_map(|attr| {
135-
if "main" != attr.name() {
136+
if attr.name().equiv(&("main")) {
136137
Some(*attr)
137138
} else {
138139
None
@@ -248,7 +249,7 @@ fn is_bench_fn(i: @ast::Item) -> bool {
248249
fn is_ignored(cx: &TestCtxt, i: @ast::Item) -> bool {
249250
i.attrs.iter().any(|attr| {
250251
// check ignore(cfg(foo, bar))
251-
"ignore" == attr.name() && match attr.meta_item_list() {
252+
attr.name().equiv(&("ignore")) && match attr.meta_item_list() {
252253
Some(ref cfgs) => attr::test_cfg(cx.config, cfgs.iter().map(|x| *x)),
253254
None => true
254255
}
@@ -330,8 +331,9 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::Item {
330331
let item_ = ast::ItemMod(testmod);
331332

332333
// This attribute tells resolve to let us call unexported functions
334+
let resolve_unexported_str = InternedString::new("!resolve_unexported");
333335
let resolve_unexported_attr =
334-
attr::mk_attr(attr::mk_word_item(@"!resolve_unexported"));
336+
attr::mk_attr(attr::mk_word_item(resolve_unexported_str));
335337

336338
let item = ast::Item {
337339
ident: cx.sess.ident_of("__test"),

branches/dist-snap/src/librustc/metadata/common.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ pub static tag_items_data_item_variant: uint = 0x0eu;
3535

3636
pub static tag_items_data_parent_item: uint = 0x0fu;
3737

38-
pub static tag_items_data_item_is_tuple_struct_ctor: uint = 0x10u;
39-
4038
pub static tag_index: uint = 0x11u;
4139

4240
pub static tag_index_buckets: uint = 0x12u;

branches/dist-snap/src/librustc/metadata/creader.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct Env {
124124
fn visit_crate(e: &Env, c: &ast::Crate) {
125125
let cstore = e.sess.cstore;
126126

127-
for a in c.attrs.iter().filter(|m| "link_args" == m.name()) {
127+
for a in c.attrs.iter().filter(|m| m.name().equiv(&("link_args"))) {
128128
match a.value_str() {
129129
Some(ref linkarg) => {
130130
cstore.add_used_link_args(*linkarg);
@@ -206,7 +206,11 @@ fn visit_item(e: &Env, i: &ast::Item) {
206206
// First, add all of the custom link_args attributes
207207
let cstore = e.sess.cstore;
208208
let link_args = i.attrs.iter()
209-
.filter_map(|at| if "link_args" == at.name() {Some(at)} else {None})
209+
.filter_map(|at| if at.name().equiv(&("link_args")) {
210+
Some(at)
211+
} else {
212+
None
213+
})
210214
.to_owned_vec();
211215
for m in link_args.iter() {
212216
match m.value_str() {
@@ -220,13 +224,17 @@ fn visit_item(e: &Env, i: &ast::Item) {
220224
// Next, process all of the #[link(..)]-style arguments
221225
let cstore = e.sess.cstore;
222226
let link_args = i.attrs.iter()
223-
.filter_map(|at| if "link" == at.name() {Some(at)} else {None})
227+
.filter_map(|at| if at.name().equiv(&("link")) {
228+
Some(at)
229+
} else {
230+
None
231+
})
224232
.to_owned_vec();
225233
for m in link_args.iter() {
226234
match m.meta_item_list() {
227235
Some(items) => {
228236
let kind = items.iter().find(|k| {
229-
"kind" == k.name()
237+
k.name().equiv(&("kind"))
230238
}).and_then(|a| a.value_str());
231239
let kind = match kind {
232240
Some(k) => {
@@ -249,7 +257,7 @@ fn visit_item(e: &Env, i: &ast::Item) {
249257
None => cstore::NativeUnknown
250258
};
251259
let n = items.iter().find(|n| {
252-
"name" == n.name()
260+
n.name().equiv(&("name"))
253261
}).and_then(|a| a.value_str());
254262
let n = match n {
255263
Some(n) => n,

branches/dist-snap/src/librustc/metadata/decoder.rs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -980,26 +980,9 @@ pub fn get_static_methods_if_impl(intr: @IdentInterner,
980980
return Some(static_impl_methods);
981981
}
982982

983-
/// If node_id is the constructor of a tuple struct, retrieve the NodeId of
984-
/// the actual type definition, otherwise, return None
985-
pub fn get_tuple_struct_definition_if_ctor(cdata: Cmd,
986-
node_id: ast::NodeId) -> Option<ast::NodeId> {
987-
let item = lookup_item(node_id, cdata.data());
988-
let mut ret = None;
989-
reader::tagged_docs(item, tag_items_data_item_is_tuple_struct_ctor, |_| {
990-
ret = Some(item_reqd_and_translated_parent_item(cdata.cnum, item));
991-
false
992-
});
993-
ret.map(|x| x.node)
994-
}
995-
996983
pub fn get_item_attrs(cdata: Cmd,
997984
node_id: ast::NodeId,
998985
f: |~[@ast::MetaItem]|) {
999-
// The attributes for a tuple struct are attached to the definition, not the ctor;
1000-
// we assume that someone passing in a tuple struct ctor is actually wanting to
1001-
// look at the definition
1002-
let node_id = get_tuple_struct_definition_if_ctor(cdata, node_id).unwrap_or(node_id);
1003986
let item = lookup_item(node_id, cdata.data());
1004987
reader::tagged_docs(item, tag_attributes, |attributes| {
1005988
reader::tagged_docs(attributes, tag_attribute, |attribute| {
@@ -1059,14 +1042,14 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::MetaItem] {
10591042
let mut items: ~[@ast::MetaItem] = ~[];
10601043
reader::tagged_docs(md, tag_meta_item_word, |meta_item_doc| {
10611044
let nd = reader::get_doc(meta_item_doc, tag_meta_item_name);
1062-
let n = nd.as_str_slice().to_managed();
1045+
let n = token::intern_and_get_ident(nd.as_str_slice());
10631046
items.push(attr::mk_word_item(n));
10641047
true
10651048
});
10661049
reader::tagged_docs(md, tag_meta_item_name_value, |meta_item_doc| {
10671050
let nd = reader::get_doc(meta_item_doc, tag_meta_item_name);
10681051
let vd = reader::get_doc(meta_item_doc, tag_meta_item_value);
1069-
let n = nd.as_str_slice().to_managed();
1052+
let n = token::intern_and_get_ident(nd.as_str_slice());
10701053
let v = vd.as_str_slice().to_managed();
10711054
// FIXME (#623): Should be able to decode MetaNameValue variants,
10721055
// but currently the encoder just drops them
@@ -1075,7 +1058,7 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::MetaItem] {
10751058
});
10761059
reader::tagged_docs(md, tag_meta_item_list, |meta_item_doc| {
10771060
let nd = reader::get_doc(meta_item_doc, tag_meta_item_name);
1078-
let n = nd.as_str_slice().to_managed();
1061+
let n = token::intern_and_get_ident(nd.as_str_slice());
10791062
let subitems = get_meta_items(meta_item_doc);
10801063
items.push(attr::mk_list_item(n, subitems));
10811064
true

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,28 @@ use middle::ty;
2121
use middle::typeck;
2222
use middle;
2323

24+
use extra::serialize::Encodable;
2425
use std::cast;
2526
use std::cell::{Cell, RefCell};
2627
use std::hashmap::{HashMap, HashSet};
2728
use std::io::MemWriter;
2829
use std::str;
2930
use std::vec;
30-
31-
use extra::serialize::Encodable;
32-
3331
use syntax::abi::AbiSet;
3432
use syntax::ast::*;
3533
use syntax::ast;
3634
use syntax::ast_map;
3735
use syntax::ast_util::*;
38-
use syntax::attr;
36+
use syntax::ast_util;
3937
use syntax::attr::AttrMetaMethods;
38+
use syntax::attr;
4039
use syntax::codemap;
4140
use syntax::diagnostic::SpanHandler;
41+
use syntax::parse::token::InternedString;
4242
use syntax::parse::token::special_idents;
43-
use syntax::ast_util;
43+
use syntax::parse::token;
4444
use syntax::visit::Visitor;
4545
use syntax::visit;
46-
use syntax::parse::token;
4746
use syntax;
4847
use writer = extra::ebml::writer;
4948

@@ -778,12 +777,6 @@ fn encode_info_for_struct_ctor(ecx: &EncodeContext,
778777
encode_symbol(ecx, ebml_w, ctor_id);
779778
}
780779

781-
// indicate that this is a tuple struct ctor, because downstream users will normally want
782-
// the tuple struct definition, but without this there is no way for them to tell that
783-
// they actually have a ctor rather than a normal function
784-
ebml_w.start_tag(tag_items_data_item_is_tuple_struct_ctor);
785-
ebml_w.end_tag();
786-
787780
ebml_w.end_tag();
788781
}
789782

@@ -1513,19 +1506,19 @@ fn write_i64(writer: &mut MemWriter, &n: &i64) {
15131506

15141507
fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @MetaItem) {
15151508
match mi.node {
1516-
MetaWord(name) => {
1509+
MetaWord(ref name) => {
15171510
ebml_w.start_tag(tag_meta_item_word);
15181511
ebml_w.start_tag(tag_meta_item_name);
1519-
ebml_w.writer.write(name.as_bytes());
1512+
ebml_w.writer.write(name.get().as_bytes());
15201513
ebml_w.end_tag();
15211514
ebml_w.end_tag();
15221515
}
1523-
MetaNameValue(name, value) => {
1516+
MetaNameValue(ref name, value) => {
15241517
match value.node {
15251518
LitStr(value, _) => {
15261519
ebml_w.start_tag(tag_meta_item_name_value);
15271520
ebml_w.start_tag(tag_meta_item_name);
1528-
ebml_w.writer.write(name.as_bytes());
1521+
ebml_w.writer.write(name.get().as_bytes());
15291522
ebml_w.end_tag();
15301523
ebml_w.start_tag(tag_meta_item_value);
15311524
ebml_w.writer.write(value.as_bytes());
@@ -1535,10 +1528,10 @@ fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @MetaItem) {
15351528
_ => {/* FIXME (#623): encode other variants */ }
15361529
}
15371530
}
1538-
MetaList(name, ref items) => {
1531+
MetaList(ref name, ref items) => {
15391532
ebml_w.start_tag(tag_meta_item_list);
15401533
ebml_w.start_tag(tag_meta_item_name);
1541-
ebml_w.writer.write(name.as_bytes());
1534+
ebml_w.writer.write(name.get().as_bytes());
15421535
ebml_w.end_tag();
15431536
for inner_item in items.iter() {
15441537
encode_meta_item(ebml_w, *inner_item);
@@ -1569,13 +1562,13 @@ fn synthesize_crate_attrs(ecx: &EncodeContext,
15691562

15701563
attr::mk_attr(
15711564
attr::mk_name_value_item_str(
1572-
@"crate_id",
1565+
InternedString::new("crate_id"),
15731566
ecx.link_meta.crateid.to_str().to_managed()))
15741567
}
15751568

15761569
let mut attrs = ~[];
15771570
for attr in crate.attrs.iter() {
1578-
if "crate_id" != attr.name() {
1571+
if !attr.name().equiv(&("crate_id")) {
15791572
attrs.push(*attr);
15801573
}
15811574
}

branches/dist-snap/src/librustc/middle/lang_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl LanguageItemCollector {
185185
pub fn extract(attrs: &[ast::Attribute]) -> Option<@str> {
186186
for attribute in attrs.iter() {
187187
match attribute.name_str_pair() {
188-
Some((key, value)) if "lang" == key => {
188+
Some((ref key, value)) if key.equiv(&("lang")) => {
189189
return Some(value);
190190
}
191191
Some(..) | None => {}

0 commit comments

Comments
 (0)