Skip to content

Commit 252b729

Browse files
pcwaltonhuonw
authored andcommitted
---
yaml --- r: 107847 b: refs/heads/dist-snap c: 8e52b85 h: refs/heads/master i: 107845: 5e6b696 107843: 7ed4224 107839: 51ba791 v: v3
1 parent b74822b commit 252b729

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+433
-276
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: 70c5a0fbf784d6a89b1c2c50f9fe83093bd21abc
9+
refs/heads/dist-snap: 8e52b85d5a6f6e3aaa2f15d7c1e907d0ce8589ee
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@ pub fn source_name(input: &Input) -> @str {
7474
pub fn default_configuration(sess: Session) ->
7575
ast::CrateConfig {
7676
let tos = match sess.targ_cfg.os {
77-
abi::OsWin32 => @"win32",
78-
abi::OsMacos => @"macos",
79-
abi::OsLinux => @"linux",
80-
abi::OsAndroid => @"android",
81-
abi::OsFreebsd => @"freebsd"
77+
abi::OsWin32 => InternedString::new("win32"),
78+
abi::OsMacos => InternedString::new("macos"),
79+
abi::OsLinux => InternedString::new("linux"),
80+
abi::OsAndroid => InternedString::new("android"),
81+
abi::OsFreebsd => InternedString::new("freebsd"),
8282
};
8383

8484
// ARM is bi-endian, however using NDK seems to default
8585
// to little-endian unless a flag is provided.
8686
let (end,arch,wordsz) = match sess.targ_cfg.arch {
87-
abi::X86 => (@"little", @"x86", @"32"),
88-
abi::X86_64 => (@"little", @"x86_64", @"64"),
89-
abi::Arm => (@"little", @"arm", @"32"),
90-
abi::Mips => (@"big", @"mips", @"32")
87+
abi::X86 => ("little", "x86", "32"),
88+
abi::X86_64 => ("little", "x86_64", "64"),
89+
abi::Arm => ("little", "arm", "32"),
90+
abi::Mips => ("big", "mips", "32")
9191
};
9292

9393
let fam = match sess.targ_cfg.os {
@@ -99,10 +99,11 @@ pub fn default_configuration(sess: Session) ->
9999
return ~[ // Target bindings.
100100
attr::mk_word_item(fam.clone()),
101101
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),
102+
mk(InternedString::new("target_family"), fam),
103+
mk(InternedString::new("target_arch"), InternedString::new(arch)),
104+
mk(InternedString::new("target_endian"), InternedString::new(end)),
105+
mk(InternedString::new("target_word_size"),
106+
InternedString::new(wordsz)),
106107
];
107108
}
108109

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

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,12 @@ pub fn building_library(options: &Options, crate: &ast::Crate) -> bool {
417417
}
418418
}
419419
match syntax::attr::first_attr_value_str_by_name(crate.attrs, "crate_type") {
420-
Some(s) => "lib" == s || "rlib" == s || "dylib" == s || "staticlib" == s,
420+
Some(s) => {
421+
s.equiv(&("lib")) ||
422+
s.equiv(&("rlib")) ||
423+
s.equiv(&("dylib")) ||
424+
s.equiv(&("staticlib"))
425+
}
421426
_ => false
422427
}
423428
}
@@ -437,14 +442,20 @@ pub fn collect_outputs(session: &Session,
437442
let mut iter = attrs.iter().filter_map(|a| {
438443
if a.name().equiv(&("crate_type")) {
439444
match a.value_str() {
440-
Some(n) if "rlib" == n => Some(OutputRlib),
441-
Some(n) if "dylib" == n => Some(OutputDylib),
442-
Some(n) if "lib" == n => Some(default_lib_output()),
443-
Some(n) if "staticlib" == n => Some(OutputStaticlib),
444-
Some(n) if "bin" == n => Some(OutputExecutable),
445+
Some(ref n) if n.equiv(&("rlib")) => Some(OutputRlib),
446+
Some(ref n) if n.equiv(&("dylib")) => Some(OutputDylib),
447+
Some(ref n) if n.equiv(&("lib")) => {
448+
Some(default_lib_output())
449+
}
450+
Some(ref n) if n.equiv(&("staticlib")) => {
451+
Some(OutputStaticlib)
452+
}
453+
Some(ref n) if n.equiv(&("bin")) => Some(OutputExecutable),
445454
Some(_) => {
446-
session.add_lint(lint::UnknownCrateType, ast::CRATE_NODE_ID,
447-
a.span, ~"invalid `crate_type` value");
455+
session.add_lint(lint::UnknownCrateType,
456+
ast::CRATE_NODE_ID,
457+
a.span,
458+
~"invalid `crate_type` value");
448459
None
449460
}
450461
_ => {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use syntax::fold::Folder;
2828
use syntax::fold;
2929
use syntax::opt_vec;
3030
use syntax::parse::token::InternedString;
31+
use syntax::parse::token;
3132
use syntax::print::pprust;
3233
use syntax::{ast, ast_util};
3334
use syntax::util::small_vector::SmallVector;
@@ -426,7 +427,8 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
426427
debug!("encoding {}", ast_util::path_name_i(path));
427428

428429
let name_lit: ast::Lit =
429-
nospan(ast::LitStr(ast_util::path_name_i(path).to_managed(), ast::CookedStr));
430+
nospan(ast::LitStr(token::intern_and_get_ident(
431+
ast_util::path_name_i(path)), ast::CookedStr));
430432

431433
let name_expr = @ast::Expr {
432434
id: ast::DUMMY_NODE_ID,

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use syntax::attr::AttrMetaMethods;
2727
use syntax::codemap::{Span, DUMMY_SP};
2828
use syntax::diagnostic::SpanHandler;
2929
use syntax::ext::base::{CrateLoader, MacroCrate};
30+
use syntax::parse::token::{IdentInterner, InternedString};
3031
use syntax::parse::token;
31-
use syntax::parse::token::IdentInterner;
3232
use syntax::crateid::CrateId;
3333
use syntax::visit;
3434

@@ -126,10 +126,8 @@ fn visit_crate(e: &Env, c: &ast::Crate) {
126126

127127
for a in c.attrs.iter().filter(|m| m.name().equiv(&("link_args"))) {
128128
match a.value_str() {
129-
Some(ref linkarg) => {
130-
cstore.add_used_link_args(*linkarg);
131-
}
132-
None => {/* fallthrough */ }
129+
Some(ref linkarg) => cstore.add_used_link_args(linkarg.get()),
130+
None => { /* fallthrough */ }
133131
}
134132
}
135133
}
@@ -214,9 +212,7 @@ fn visit_item(e: &Env, i: &ast::Item) {
214212
.to_owned_vec();
215213
for m in link_args.iter() {
216214
match m.value_str() {
217-
Some(linkarg) => {
218-
cstore.add_used_link_args(linkarg);
219-
}
215+
Some(linkarg) => cstore.add_used_link_args(linkarg.get()),
220216
None => { /* fallthrough */ }
221217
}
222218
}
@@ -238,12 +234,12 @@ fn visit_item(e: &Env, i: &ast::Item) {
238234
}).and_then(|a| a.value_str());
239235
let kind = match kind {
240236
Some(k) => {
241-
if "static" == k {
237+
if k.equiv(&("static")) {
242238
cstore::NativeStatic
243239
} else if e.sess.targ_cfg.os == abi::OsMacos &&
244-
"framework" == k {
240+
k.equiv(&("framework")) {
245241
cstore::NativeFramework
246-
} else if "framework" == k {
242+
} else if k.equiv(&("framework")) {
247243
e.sess.span_err(m.span,
248244
"native frameworks are only available \
249245
on OSX targets");
@@ -265,13 +261,13 @@ fn visit_item(e: &Env, i: &ast::Item) {
265261
e.sess.span_err(m.span,
266262
"#[link(...)] specified without \
267263
`name = \"foo\"`");
268-
@"foo"
264+
InternedString::new("foo")
269265
}
270266
};
271-
if n.is_empty() {
267+
if n.get().is_empty() {
272268
e.sess.span_err(m.span, "#[link(name = \"\")] given with empty name");
273269
} else {
274-
cstore.add_used_library(n.to_owned(), kind);
270+
cstore.add_used_library(n.get().to_owned(), kind);
275271
}
276272
}
277273
None => {}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::MetaItem] {
10501050
let nd = reader::get_doc(meta_item_doc, tag_meta_item_name);
10511051
let vd = reader::get_doc(meta_item_doc, tag_meta_item_value);
10521052
let n = token::intern_and_get_ident(nd.as_str_slice());
1053-
let v = vd.as_str_slice().to_managed();
1053+
let v = token::intern_and_get_ident(vd.as_str_slice());
10541054
// FIXME (#623): Should be able to decode MetaNameValue variants,
10551055
// but currently the encoder just drops them
10561056
items.push(attr::mk_name_value_item_str(n, v));

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,15 +1513,15 @@ fn encode_meta_item(ebml_w: &mut writer::Encoder, mi: @MetaItem) {
15131513
ebml_w.end_tag();
15141514
ebml_w.end_tag();
15151515
}
1516-
MetaNameValue(ref name, value) => {
1516+
MetaNameValue(ref name, ref value) => {
15171517
match value.node {
1518-
LitStr(value, _) => {
1518+
LitStr(ref value, _) => {
15191519
ebml_w.start_tag(tag_meta_item_name_value);
15201520
ebml_w.start_tag(tag_meta_item_name);
15211521
ebml_w.writer.write(name.get().as_bytes());
15221522
ebml_w.end_tag();
15231523
ebml_w.start_tag(tag_meta_item_value);
1524-
ebml_w.writer.write(value.as_bytes());
1524+
ebml_w.writer.write(value.get().as_bytes());
15251525
ebml_w.end_tag();
15261526
ebml_w.end_tag();
15271527
}
@@ -1563,7 +1563,7 @@ fn synthesize_crate_attrs(ecx: &EncodeContext,
15631563
attr::mk_attr(
15641564
attr::mk_name_value_item_str(
15651565
InternedString::new("crate_id"),
1566-
ecx.link_meta.crateid.to_str().to_managed()))
1566+
token::intern_and_get_ident(ecx.link_meta.crateid.to_str())))
15671567
}
15681568

15691569
let mut attrs = ~[];

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

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,14 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
214214

215215
type matrix = ~[~[@Pat]];
216216

217-
enum useful { useful(ty::t, ctor), useful_, not_useful }
217+
#[deriving(Clone)]
218+
enum useful {
219+
useful(ty::t, ctor),
220+
useful_,
221+
not_useful,
222+
}
218223

219-
#[deriving(Eq)]
224+
#[deriving(Clone, Eq)]
220225
enum ctor {
221226
single,
222227
variant(DefId),
@@ -261,15 +266,15 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
261266
val(const_bool(false)),
262267
0u, left_ty)
263268
}
264-
ref u => *u,
269+
ref u => (*u).clone(),
265270
}
266271
}
267272
ty::ty_enum(eid, _) => {
268273
for va in (*ty::enum_variants(cx.tcx, eid)).iter() {
269274
match is_useful_specialized(cx, m, v, variant(va.id),
270275
va.args.len(), left_ty) {
271276
not_useful => (),
272-
ref u => return *u,
277+
ref u => return (*u).clone(),
273278
}
274279
}
275280
not_useful
@@ -289,7 +294,7 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
289294
for n in iter::range(0u, max_len + 1) {
290295
match is_useful_specialized(cx, m, v, vec(n), n, left_ty) {
291296
not_useful => (),
292-
ref u => return *u,
297+
ref u => return (*u).clone(),
293298
}
294299
}
295300
not_useful
@@ -304,15 +309,15 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
304309
match is_useful(cx,
305310
&m.iter().filter_map(|r| default(cx, *r)).collect::<matrix>(),
306311
v.tail()) {
307-
useful_ => useful(left_ty, *ctor),
308-
ref u => *u,
312+
useful_ => useful(left_ty, (*ctor).clone()),
313+
ref u => (*u).clone(),
309314
}
310315
}
311316
}
312317
}
313318
Some(ref v0_ctor) => {
314319
let arity = ctor_arity(cx, v0_ctor, left_ty);
315-
is_useful_specialized(cx, m, v, *v0_ctor, arity, left_ty)
320+
is_useful_specialized(cx, m, v, (*v0_ctor).clone(), arity, left_ty)
316321
}
317322
}
318323
}
@@ -329,7 +334,7 @@ fn is_useful_specialized(cx: &MatchCheckCtxt,
329334
cx, &ms, specialize(cx, v, &ctor, arity, lty).unwrap());
330335
match could_be_useful {
331336
useful_ => useful(lty, ctor),
332-
ref u => *u,
337+
ref u => (*u).clone(),
333338
}
334339
}
335340

@@ -407,7 +412,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
407412
let r = pat_ctor_id(cx, r[0]);
408413
for id in r.iter() {
409414
if !found.contains(id) {
410-
found.push(*id);
415+
found.push((*id).clone());
411416
}
412417
}
413418
}
@@ -770,8 +775,8 @@ fn specialize(cx: &MatchCheckCtxt,
770775
}
771776
PatRange(lo, hi) => {
772777
let (c_lo, c_hi) = match *ctor_id {
773-
val(ref v) => (*v, *v),
774-
range(ref lo, ref hi) => (*lo, *hi),
778+
val(ref v) => ((*v).clone(), (*v).clone()),
779+
range(ref lo, ref hi) => ((*lo).clone(), (*hi).clone()),
775780
single => return Some(r.tail().to_owned()),
776781
_ => fail!("type error")
777782
};

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ use middle::ty;
1616
use middle::typeck::astconv;
1717
use middle;
1818

19-
use syntax::{ast, ast_map, ast_util};
20-
use syntax::visit;
21-
use syntax::visit::Visitor;
2219
use syntax::ast::*;
20+
use syntax::parse::token::InternedString;
21+
use syntax::visit::Visitor;
22+
use syntax::visit;
23+
use syntax::{ast, ast_map, ast_util};
2324

2425
use std::cell::RefCell;
2526
use std::hashmap::HashMap;
@@ -319,7 +320,7 @@ pub enum const_val {
319320
const_float(f64),
320321
const_int(i64),
321322
const_uint(u64),
322-
const_str(@str),
323+
const_str(InternedString),
323324
const_binary(@[u8]),
324325
const_bool(bool)
325326
}
@@ -508,7 +509,7 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
508509

509510
pub fn lit_to_const(lit: &Lit) -> const_val {
510511
match lit.node {
511-
LitStr(s, _) => const_str(s),
512+
LitStr(ref s, _) => const_str((*s).clone()),
512513
LitBinary(data) => const_binary(data),
513514
LitChar(n) => const_uint(n as u64),
514515
LitInt(n, _) => const_int(n),
@@ -530,7 +531,7 @@ pub fn compare_const_vals(a: &const_val, b: &const_val) -> Option<int> {
530531
(&const_int(a), &const_int(b)) => compare_vals(a, b),
531532
(&const_uint(a), &const_uint(b)) => compare_vals(a, b),
532533
(&const_float(a), &const_float(b)) => compare_vals(a, b),
533-
(&const_str(a), &const_str(b)) => compare_vals(a, b),
534+
(&const_str(ref a), &const_str(ref b)) => compare_vals(a, b),
534535
(&const_bool(a), &const_bool(b)) => compare_vals(a, b),
535536
_ => None
536537
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ use middle::ty::{BuiltinBound, BoundFreeze, BoundPod, BoundSend, BoundSized};
2626
use syntax::ast;
2727
use syntax::ast_util::local_def;
2828
use syntax::attr::AttrMetaMethods;
29-
use syntax::visit;
29+
use syntax::parse::token::InternedString;
3030
use syntax::visit::Visitor;
31+
use syntax::visit;
3132

3233
use std::hashmap::HashMap;
3334
use std::iter::Enumerate;
@@ -182,11 +183,11 @@ impl LanguageItemCollector {
182183
}
183184
}
184185

185-
pub fn extract(attrs: &[ast::Attribute]) -> Option<@str> {
186+
pub fn extract(attrs: &[ast::Attribute]) -> Option<InternedString> {
186187
for attribute in attrs.iter() {
187188
match attribute.name_str_pair() {
188-
Some((ref key, value)) if key.equiv(&("lang")) => {
189-
return Some(value);
189+
Some((ref key, ref value)) if key.equiv(&("lang")) => {
190+
return Some((*value).clone());
190191
}
191192
Some(..) | None => {}
192193
}

0 commit comments

Comments
 (0)