Skip to content

Commit 085b115

Browse files
pcwaltonhuonw
authored andcommitted
---
yaml --- r: 107857 b: refs/heads/dist-snap c: a4dd3fe h: refs/heads/master i: 107855: b0c498a v: v3
1 parent 8f3ce86 commit 085b115

File tree

19 files changed

+131
-100
lines changed

19 files changed

+131
-100
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: 3c9e9d35ac0f6469e0eeffc5c497f4b3ed6f1f8a
9+
refs/heads/dist-snap: a4dd3fe2f2266c10ed0e3bc07a165c2f094e1c1b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl Visitor<()> for Context {
122122
}
123123
ast::ViewItemExternMod(..) => {
124124
for attr in i.attrs.iter() {
125-
if "phase" == attr.name() {
125+
if attr.name().get() == "phase"{
126126
self.gate_feature("phase", attr.span,
127127
"compile time crate loading is \
128128
experimental and possibly buggy");

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ use syntax::codemap;
1919
use syntax::fold::Folder;
2020
use syntax::fold;
2121
use syntax::opt_vec;
22+
use syntax::parse::token::InternedString;
23+
use syntax::parse::token;
2224
use syntax::util::small_vector::SmallVector;
2325

2426
pub static VERSION: &'static str = "0.10-pre";
@@ -56,11 +58,13 @@ struct StandardLibraryInjector {
5658
sess: Session,
5759
}
5860

59-
pub fn with_version(crate: &str) -> Option<(@str, ast::StrStyle)> {
61+
pub fn with_version(crate: &str) -> Option<(InternedString, ast::StrStyle)> {
6062
match option_env!("CFG_DISABLE_INJECT_STD_VERSION") {
6163
Some("1") => None,
6264
_ => {
63-
Some((format!("{}\\#{}", crate, VERSION).to_managed(),
65+
Some((token::intern_and_get_ident(format!("{}\\#{}",
66+
crate,
67+
VERSION)),
6468
ast::CookedStr))
6569
}
6670
}
@@ -73,9 +77,12 @@ impl fold::Folder for StandardLibraryInjector {
7377
with_version("std"),
7478
ast::DUMMY_NODE_ID),
7579
attrs: ~[
76-
attr::mk_attr(attr::mk_list_item(@"phase",
77-
~[attr::mk_word_item(@"syntax"),
78-
attr::mk_word_item(@"link")]))
80+
attr::mk_attr(attr::mk_list_item(
81+
InternedString::new("phase"),
82+
~[
83+
attr::mk_word_item(InternedString::new("syntax")),
84+
attr::mk_word_item(InternedString::new("link")
85+
)]))
7986
],
8087
vis: ast::Inherited,
8188
span: DUMMY_SP

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
235235
0u => d::early_error(demitter, "no input filename given"),
236236
1u => {
237237
let ifile = matches.free[0].as_slice();
238-
if "-" == ifile {
238+
if ifile == "-" {
239239
let src =
240240
str::from_utf8_owned(io::stdin().read_to_end()).unwrap();
241241
(d::StrInput(src), None)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn visit_crate(e: &Env, c: &ast::Crate) {
134134

135135
fn visit_view_item(e: &mut Env, i: &ast::ViewItem) {
136136
let should_load = i.attrs.iter().all(|attr| {
137-
"phase" != attr.name() ||
137+
attr.name().get() != "phase" ||
138138
attr.meta_item_list().map_or(false, |phases| {
139139
attr::contains_name(phases, "link")
140140
})
@@ -163,11 +163,11 @@ struct CrateInfo {
163163

164164
fn extract_crate_info(i: &ast::ViewItem) -> Option<CrateInfo> {
165165
match i.node {
166-
ast::ViewItemExternMod(ident, path_opt, id) => {
167-
let ident = token::ident_to_str(&ident);
166+
ast::ViewItemExternMod(ref ident, ref path_opt, id) => {
167+
let ident = token::ident_to_str(ident);
168168
debug!("resolving extern mod stmt. ident: {:?} path_opt: {:?}",
169169
ident, path_opt);
170-
let (name, version) = match path_opt {
170+
let (name, version) = match *path_opt {
171171
Some((ref path_str, _)) => {
172172
let crateid: Option<CrateId> = from_str(path_str.get());
173173
match crateid {

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,17 @@ use std::hashmap::HashMap;
7676
use std::libc::c_uint;
7777
use std::vec;
7878
use std::local_data;
79+
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
7980
use syntax::ast_map::{PathName, PathPrettyName, path_elem_to_str};
8081
use syntax::ast_util::{local_def, is_local};
81-
use syntax::attr;
82-
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
8382
use syntax::attr::AttrMetaMethods;
83+
use syntax::attr;
8484
use syntax::codemap::Span;
85-
use syntax::parse::token::{InternedString, special_idents};
85+
use syntax::parse::token::InternedString;
8686
use syntax::parse::token;
87-
use syntax::{ast, ast_util, ast_map};
88-
use syntax::attr::AttrMetaMethods;
89-
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
90-
use syntax::visit;
9187
use syntax::visit::Visitor;
9288
use syntax::visit;
93-
use syntax::{ast, ast_util, codemap, ast_map};
89+
use syntax::{ast, ast_util, ast_map};
9490

9591
pub use middle::trans::context::task_llcx;
9692

branches/dist-snap/src/librustc/middle/trans/glue.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use middle::trans::callee;
2525
use middle::trans::cleanup;
2626
use middle::trans::cleanup::CleanupMethods;
2727
use middle::trans::common::*;
28-
use middle::trans::datum::immediate_rvalue;
2928
use middle::trans::expr;
3029
use middle::trans::machine::*;
3130
use middle::trans::reflect;

branches/dist-snap/src/librustc/middle/trans/tvec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ pub fn trans_slice_vstore<'a>(
232232
match content_expr.node {
233233
ast::ExprLit(lit) => {
234234
match lit.node {
235-
ast::LitStr(s, _) => {
235+
ast::LitStr(ref s, _) => {
236236
return trans_lit_str(bcx,
237237
content_expr,
238-
(*s).clone(),
238+
s.clone(),
239239
dest)
240240
}
241241
_ => {}
@@ -340,12 +340,12 @@ pub fn trans_uniq_or_managed_vstore<'a>(bcx: &'a Block<'a>,
340340
match content_expr.node {
341341
ast::ExprLit(lit) => {
342342
match lit.node {
343-
ast::LitStr(s, _) => {
343+
ast::LitStr(ref s, _) => {
344344
let llptrval = C_cstr(bcx.ccx(), (*s).clone());
345345
let llptrval = PointerCast(bcx,
346346
llptrval,
347347
Type::i8p());
348-
let llsizeval = C_uint(bcx.ccx(), s.len());
348+
let llsizeval = C_uint(bcx.ccx(), s.get().len());
349349
let typ = ty::mk_str(bcx.tcx(), ty::vstore_uniq);
350350
let lldestval = rvalue_scratch_datum(bcx,
351351
typ,

branches/dist-snap/src/librustdoc/clean.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,13 @@ pub enum ViewItemInner {
10391039
impl Clean<ViewItemInner> for ast::ViewItem_ {
10401040
fn clean(&self) -> ViewItemInner {
10411041
match self {
1042-
&ast::ViewItemExternMod(ref i, ref p, ref id) =>
1043-
ExternMod(i.clean(), p.map(|(ref x, _)| x.to_owned()), *id),
1042+
&ast::ViewItemExternMod(ref i, ref p, ref id) => {
1043+
let string = match *p {
1044+
None => None,
1045+
Some((ref x, _)) => Some(x.get().to_owned()),
1046+
};
1047+
ExternMod(i.clean(), string, *id)
1048+
}
10441049
&ast::ViewItemUse(ref vp) => Import(vp.clean())
10451050
}
10461051
}

branches/dist-snap/src/librustpkg/util.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,14 @@ impl<'a> CrateInstaller<'a> {
472472

473473
match vi.node {
474474
// ignore metadata, I guess
475-
ast::ViewItemExternMod(lib_ident, path_opt, _) => {
476-
let lib_name = match path_opt {
477-
Some((p, _)) => p,
478-
None => self.sess.str_of(lib_ident)
475+
ast::ViewItemExternMod(ref lib_ident, ref path_opt, _) => {
476+
let lib_name = match *path_opt {
477+
Some((ref p, _)) => (*p).clone(),
478+
None => token::get_ident(lib_ident.name),
479479
};
480480
debug!("Finding and installing... {}", lib_name);
481-
let crate_id: CrateId = from_str(lib_name).expect("valid crate id");
481+
let crate_id: CrateId =
482+
from_str(lib_name.get()).expect("valid crate id");
482483
// Check standard Rust library path first
483484
let whatever = system_library(&self.context.sysroot_to_use(), &crate_id);
484485
debug!("system library returned {:?}", whatever);

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ext;
1616
use ext::expand;
1717
use parse;
1818
use parse::token;
19-
use parse::token::{InternedString, ident_to_str, intern, str_to_ident};
19+
use parse::token::{InternedString, intern, str_to_ident};
2020
use util::small_vector::SmallVector;
2121

2222
use std::hashmap::HashMap;
@@ -396,9 +396,6 @@ impl<'a> ExtCtxt<'a> {
396396
pub fn set_trace_macros(&mut self, x: bool) {
397397
self.trace_mac = x
398398
}
399-
pub fn str_of(&self, id: ast::Ident) -> @str {
400-
ident_to_str(&id)
401-
}
402399
pub fn ident_of(&self, st: &str) -> ast::Ident {
403400
str_to_ident(st)
404401
}
@@ -411,7 +408,7 @@ pub fn expr_to_str(cx: &ExtCtxt, expr: @ast::Expr, err_msg: &str)
411408
-> Option<(InternedString, ast::StrStyle)> {
412409
match expr.node {
413410
ast::ExprLit(l) => match l.node {
414-
ast::LitStr(s, style) => return Some(((*s).clone(), style)),
411+
ast::LitStr(ref s, style) => return Some(((*s).clone(), style)),
415412
_ => cx.span_err(l.span, err_msg)
416413
},
417414
_ => cx.span_err(expr.span, err_msg)
@@ -446,7 +443,8 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt,
446443
match tts[0] {
447444
ast::TTTok(_, token::LIT_STR(ident))
448445
| ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => {
449-
return Some(cx.str_of(ident).to_str())
446+
let interned_str = token::get_ident(ident.name);
447+
return Some(interned_str.get().to_str())
450448
}
451449
_ => cx.span_err(sp, format!("{} requires a string.", name)),
452450
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
3030
}
3131
} else {
3232
match *e {
33-
ast::TTTok(_, token::IDENT(ident,_)) => res_str.push_str(cx.str_of(ident)),
33+
ast::TTTok(_, token::IDENT(ident,_)) => {
34+
let interned_str = token::get_ident(ident.name);
35+
res_str.push_str(interned_str.get())
36+
}
3437
_ => {
3538
cx.span_err(sp, "concat_idents! requires ident args.");
3639
return MacResult::dummy_expr();

branches/dist-snap/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn encodable_substructure(cx: &ExtCtxt, trait_span: Span,
133133
..
134134
}) in fields.iter().enumerate() {
135135
let name = match name {
136-
Some(id) => token::get_ident(id),
136+
Some(id) => token::get_ident(id.name),
137137
None => {
138138
token::intern_and_get_ident(format!("_field{}", i))
139139
}
@@ -181,7 +181,7 @@ fn encodable_substructure(cx: &ExtCtxt, trait_span: Span,
181181

182182
let blk = cx.lambda_stmts_1(trait_span, stmts, blkarg);
183183
let name = cx.expr_str(trait_span,
184-
token::get_ident(variant.node.name));
184+
token::get_ident(variant.node.name.name));
185185
let call = cx.expr_method_call(trait_span, blkencoder,
186186
cx.ident_of("emit_enum_variant"),
187187
~[name,

branches/dist-snap/src/libsyntax/ext/deriving/to_str.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ fn to_str_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure)
6161
cx.expr_str_uniq(span, token::get_ident(name.name))
6262
} else {
6363
let buf = cx.ident_of("buf");
64-
let start = token::intern_and_get_ident(cx.str_of(name) + start);
64+
let interned_str = token::get_ident(name.name);
65+
let start =
66+
token::intern_and_get_ident(interned_str.get() + start);
6567
let init = cx.expr_str_uniq(span, start);
6668
let mut stmts = ~[cx.stmt_let(span, true, buf, init)];
6769
let push_str = cx.ident_of("push_str");
@@ -79,7 +81,8 @@ fn to_str_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure)
7981
match name {
8082
None => {}
8183
Some(id) => {
82-
let name = cx.str_of(id) + ": ";
84+
let interned_id = token::get_ident(id.name);
85+
let name = interned_id.get() + ": ";
8386
push(cx.expr_str(span,
8487
token::intern_and_get_ident(name)));
8588
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ pub fn expand_view_item(vi: &ast::ViewItem,
385385
fld: &mut MacroExpander)
386386
-> ast::ViewItem {
387387
let should_load = vi.attrs.iter().any(|attr| {
388-
"phase" == attr.name() &&
388+
attr.name().get() == "phase" &&
389389
attr.meta_item_list().map_or(false, |phases| {
390390
attr::contains_name(phases, "syntax")
391391
})
@@ -405,12 +405,12 @@ fn load_extern_macros(crate: &ast::ViewItem, fld: &mut MacroExpander) {
405405
ast::ViewItemExternMod(ref name, _, _) => token::ident_to_str(name),
406406
_ => unreachable!(),
407407
};
408-
let name = format!("<{} macros>", crate_name).to_managed();
408+
let name = format!("<{} macros>", crate_name);
409409

410410
let exported_macros = fld.cx.loader.get_exported_macros(cnum);
411411
for source in exported_macros.iter() {
412-
let item = parse::parse_item_from_source_str(name,
413-
source.to_managed(),
412+
let item = parse::parse_item_from_source_str(name.clone(),
413+
(*source).clone(),
414414
fld.cx.cfg(),
415415
fld.cx.parse_sess())
416416
.expect("expected a serialized item");

0 commit comments

Comments
 (0)