Skip to content

Commit 4e83fea

Browse files
author
blake2-ppc
committed
---
yaml --- r: 81387 b: refs/heads/snap-stage3 c: 9ac175c h: refs/heads/master i: 81385: e562a15 81383: b918903 v: v3
1 parent 1ee7289 commit 4e83fea

Some content is hidden

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

45 files changed

+653
-1064
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bf6b198c7e842d588d403804a86c91ed06d5bf7a
4+
refs/heads/snap-stage3: 9ac175c503e0c839551868fa8d624943c3af9d99
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/time.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ pub fn now() -> Tm {
174174
at(get_time())
175175
}
176176

177+
/// Parses the time from the string according to the format string.
178+
pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
179+
do_strptime(s, format)
180+
}
181+
182+
/// Formats the time according to the format string.
183+
pub fn strftime(format: &str, tm: &Tm) -> ~str {
184+
do_strftime(format, tm)
185+
}
177186

178187
impl Tm {
179188
/// Convert time to the seconds from January 1, 1970
@@ -255,8 +264,7 @@ impl Tm {
255264
}
256265
}
257266

258-
/// Parses the time from the string according to the format string.
259-
pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
267+
fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
260268
fn match_str(s: &str, pos: uint, needle: &str) -> bool {
261269
let mut i = pos;
262270
for ch in needle.byte_iter() {
@@ -725,8 +733,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
725733
}
726734
}
727735

728-
/// Formats the time according to the format string.
729-
pub fn strftime(format: &str, tm: &Tm) -> ~str {
736+
fn do_strftime(format: &str, tm: &Tm) -> ~str {
730737
fn days_in_year(year: int) -> i32 {
731738
if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) {
732739
366 /* Days in a leap year */

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,9 +1007,9 @@ pub fn link_args(sess: Session,
10071007
continue;
10081008
}
10091009
let dir = cratepath.dirname();
1010-
if dir != ~"" { args.push(~"-L" + dir); }
1010+
if !dir.is_empty() { args.push("-L" + dir); }
10111011
let libarg = unlib(sess.targ_cfg, cratepath.filestem().unwrap().to_owned());
1012-
args.push(~"-l" + libarg);
1012+
args.push("-l" + libarg);
10131013
}
10141014

10151015
let ula = cstore::get_used_link_args(cstore);
@@ -1032,12 +1032,12 @@ pub fn link_args(sess: Session,
10321032
// forces to make sure that library can be found at runtime.
10331033

10341034
for path in sess.opts.addl_lib_search_paths.iter() {
1035-
args.push(~"-L" + path.to_str());
1035+
args.push("-L" + path.to_str());
10361036
}
10371037

10381038
let rustpath = filesearch::rust_path();
10391039
for path in rustpath.iter() {
1040-
args.push(~"-L" + path.to_str());
1040+
args.push("-L" + path.to_str());
10411041
}
10421042

10431043
// The names of the extern libraries
@@ -1050,7 +1050,7 @@ pub fn link_args(sess: Session,
10501050
// On mac we need to tell the linker to let this library
10511051
// be rpathed
10521052
if sess.targ_cfg.os == session::OsMacos {
1053-
args.push(~"-Wl,-install_name,@rpath/"
1053+
args.push("-Wl,-install_name,@rpath/"
10541054
+ output.filename().unwrap());
10551055
}
10561056
}

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

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub enum input {
131131

132132
pub fn phase_1_parse_input(sess: Session, cfg: ast::CrateConfig, input: &input)
133133
-> ast::Crate {
134-
time(sess.time_passes(), ~"parsing", (), |_| {
134+
time(sess.time_passes(), "parsing", (), |_| {
135135
match *input {
136136
file_input(ref file) => {
137137
parse::parse_crate_from_file(&(*file), cfg.clone(), sess.parse_sess)
@@ -167,29 +167,29 @@ pub fn phase_2_configure_and_expand(sess: Session,
167167
// mod bar { macro_rules! baz!(() => {{}}) }
168168
//
169169
// baz! should not use this definition unless foo is enabled.
170-
crate = time(time_passes, ~"std macros injection", crate, |crate|
170+
crate = time(time_passes, "std macros injection", crate, |crate|
171171
syntax::ext::expand::inject_std_macros(sess.parse_sess,
172172
cfg.clone(),
173173
crate));
174174

175-
crate = time(time_passes, ~"configuration 1", crate, |crate|
175+
crate = time(time_passes, "configuration 1", crate, |crate|
176176
front::config::strip_unconfigured_items(crate));
177177

178-
crate = time(time_passes, ~"expansion", crate, |crate|
178+
crate = time(time_passes, "expansion", crate, |crate|
179179
syntax::ext::expand::expand_crate(sess.parse_sess, cfg.clone(),
180180
crate));
181181

182182
// strip again, in case expansion added anything with a #[cfg].
183-
crate = time(time_passes, ~"configuration 2", crate, |crate|
183+
crate = time(time_passes, "configuration 2", crate, |crate|
184184
front::config::strip_unconfigured_items(crate));
185185

186-
crate = time(time_passes, ~"maybe building test harness", crate, |crate|
186+
crate = time(time_passes, "maybe building test harness", crate, |crate|
187187
front::test::modify_for_testing(sess, crate));
188188

189-
crate = time(time_passes, ~"std injection", crate, |crate|
189+
crate = time(time_passes, "std injection", crate, |crate|
190190
front::std_inject::maybe_inject_libstd_ref(sess, crate));
191191

192-
crate = time(time_passes, ~"assigning node ids", crate, |crate|
192+
crate = time(time_passes, "assigning node ids", crate, |crate|
193193
front::assign_node_ids::assign_node_ids(sess, crate));
194194

195195
return crate;
@@ -211,37 +211,37 @@ pub fn phase_3_run_analysis_passes(sess: Session,
211211

212212
let time_passes = sess.time_passes();
213213

214-
let ast_map = time(time_passes, ~"ast indexing", (), |_|
214+
let ast_map = time(time_passes, "ast indexing", (), |_|
215215
syntax::ast_map::map_crate(sess.diagnostic(), crate));
216216

217-
time(time_passes, ~"external crate/lib resolution", (), |_|
217+
time(time_passes, "external crate/lib resolution", (), |_|
218218
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
219219
sess.filesearch,
220220
session::sess_os_to_meta_os(sess.targ_cfg.os),
221221
sess.opts.is_static,
222222
token::get_ident_interner()));
223223

224-
let lang_items = time(time_passes, ~"language item collection", (), |_|
224+
let lang_items = time(time_passes, "language item collection", (), |_|
225225
middle::lang_items::collect_language_items(crate, sess));
226226

227227
let middle::resolve::CrateMap {
228228
def_map: def_map,
229229
exp_map2: exp_map2,
230230
trait_map: trait_map
231231
} =
232-
time(time_passes, ~"resolution", (), |_|
232+
time(time_passes, "resolution", (), |_|
233233
middle::resolve::resolve_crate(sess, lang_items, crate));
234234

235-
time(time_passes, ~"looking for entry point", (),
235+
time(time_passes, "looking for entry point", (),
236236
|_| middle::entry::find_entry_point(sess, crate, ast_map));
237237

238-
let freevars = time(time_passes, ~"freevar finding", (), |_|
238+
let freevars = time(time_passes, "freevar finding", (), |_|
239239
freevars::annotate_freevars(def_map, crate));
240240

241-
let region_map = time(time_passes, ~"region resolution", (), |_|
241+
let region_map = time(time_passes, "region resolution", (), |_|
242242
middle::region::resolve_crate(sess, def_map, crate));
243243

244-
let rp_set = time(time_passes, ~"region parameterization inference", (), |_|
244+
let rp_set = time(time_passes, "region parameterization inference", (), |_|
245245
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
246246

247247
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
@@ -252,53 +252,53 @@ pub fn phase_3_run_analysis_passes(sess: Session,
252252
ty_cx, trait_map, crate);
253253

254254
// These next two const passes can probably be merged
255-
time(time_passes, ~"const marking", (), |_|
255+
time(time_passes, "const marking", (), |_|
256256
middle::const_eval::process_crate(crate, ty_cx));
257257

258-
time(time_passes, ~"const checking", (), |_|
258+
time(time_passes, "const checking", (), |_|
259259
middle::check_const::check_crate(sess, crate, ast_map, def_map,
260260
method_map, ty_cx));
261261

262262
let exported_items =
263-
time(time_passes, ~"privacy checking", (), |_|
263+
time(time_passes, "privacy checking", (), |_|
264264
middle::privacy::check_crate(ty_cx, &method_map, &exp_map2, crate));
265265

266-
time(time_passes, ~"effect checking", (), |_|
266+
time(time_passes, "effect checking", (), |_|
267267
middle::effect::check_crate(ty_cx, method_map, crate));
268268

269-
time(time_passes, ~"loop checking", (), |_|
269+
time(time_passes, "loop checking", (), |_|
270270
middle::check_loop::check_crate(ty_cx, crate));
271271

272-
time(time_passes, ~"stack checking", (), |_|
272+
time(time_passes, "stack checking", (), |_|
273273
middle::stack_check::stack_check_crate(ty_cx, crate));
274274

275275
let middle::moves::MoveMaps {moves_map, moved_variables_set,
276276
capture_map} =
277-
time(time_passes, ~"compute moves", (), |_|
277+
time(time_passes, "compute moves", (), |_|
278278
middle::moves::compute_moves(ty_cx, method_map, crate));
279279

280-
time(time_passes, ~"match checking", (), |_|
280+
time(time_passes, "match checking", (), |_|
281281
middle::check_match::check_crate(ty_cx, method_map,
282282
moves_map, crate));
283283

284-
time(time_passes, ~"liveness checking", (), |_|
284+
time(time_passes, "liveness checking", (), |_|
285285
middle::liveness::check_crate(ty_cx, method_map,
286286
capture_map, crate));
287287

288288
let (root_map, write_guard_map) =
289-
time(time_passes, ~"borrow checking", (), |_|
289+
time(time_passes, "borrow checking", (), |_|
290290
middle::borrowck::check_crate(ty_cx, method_map,
291291
moves_map, moved_variables_set,
292292
capture_map, crate));
293293

294-
time(time_passes, ~"kind checking", (), |_|
294+
time(time_passes, "kind checking", (), |_|
295295
kind::check_crate(ty_cx, method_map, crate));
296296

297297
let reachable_map =
298-
time(time_passes, ~"reachability checking", (), |_|
298+
time(time_passes, "reachability checking", (), |_|
299299
reachable::find_reachable(ty_cx, method_map, crate));
300300

301-
time(time_passes, ~"lint checking", (), |_|
301+
time(time_passes, "lint checking", (), |_|
302302
lint::check_crate(ty_cx, crate));
303303

304304
CrateAnalysis {
@@ -328,7 +328,7 @@ pub fn phase_4_translate_to_llvm(sess: Session,
328328
crate: ast::Crate,
329329
analysis: &CrateAnalysis,
330330
outputs: &OutputFilenames) -> CrateTranslation {
331-
time(sess.time_passes(), ~"translation", crate, |crate|
331+
time(sess.time_passes(), "translation", crate, |crate|
332332
trans::base::trans_crate(sess, crate, analysis,
333333
&outputs.obj_filename))
334334
}
@@ -349,7 +349,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
349349
let output_type = link::output_type_assembly;
350350
let asm_filename = outputs.obj_filename.with_filetype("s");
351351

352-
time(sess.time_passes(), ~"LLVM passes", (), |_|
352+
time(sess.time_passes(), "LLVM passes", (), |_|
353353
link::write::run_passes(sess,
354354
trans.context,
355355
trans.module,
@@ -363,7 +363,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
363363
os::remove_file(&asm_filename);
364364
}
365365
} else {
366-
time(sess.time_passes(), ~"LLVM passes", (), |_|
366+
time(sess.time_passes(), "LLVM passes", (), |_|
367367
link::write::run_passes(sess,
368368
trans.context,
369369
trans.module,
@@ -377,7 +377,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
377377
pub fn phase_6_link_output(sess: Session,
378378
trans: &CrateTranslation,
379379
outputs: &OutputFilenames) {
380-
time(sess.time_passes(), ~"linking", (), |_|
380+
time(sess.time_passes(), "linking", (), |_|
381381
link::link_binary(sess,
382382
&outputs.obj_filename,
383383
&outputs.out_filename,
@@ -596,12 +596,12 @@ pub fn build_target_config(sopts: @session::options,
596596
-> @session::config {
597597
let os = match get_os(sopts.target_triple) {
598598
Some(os) => os,
599-
None => early_error(demitter, ~"unknown operating system")
599+
None => early_error(demitter, "unknown operating system")
600600
};
601601
let arch = match get_arch(sopts.target_triple) {
602602
Some(arch) => arch,
603603
None => early_error(demitter,
604-
~"unknown architecture: " + sopts.target_triple)
604+
"unknown architecture: " + sopts.target_triple)
605605
};
606606
let (int_type, uint_type) = match arch {
607607
abi::X86 => (ast::ty_i32, ast::ty_u32),
@@ -686,7 +686,7 @@ pub fn build_session_options(binary: @str,
686686
let mut this_bit = 0u;
687687
for tuple in debug_map.iter() {
688688
let (name, bit) = match *tuple { (ref a, _, b) => (a, b) };
689-
if name == debug_flag { this_bit = bit; break; }
689+
if *name == *debug_flag { this_bit = bit; break; }
690690
}
691691
if this_bit == 0u {
692692
early_error(demitter, format!("unknown debug flag: {}", *debug_flag))
@@ -726,7 +726,7 @@ pub fn build_session_options(binary: @str,
726726
No
727727
} else if matches.opt_present("O") {
728728
if matches.opt_present("opt-level") {
729-
early_error(demitter, ~"-O and --opt-level both provided");
729+
early_error(demitter, "-O and --opt-level both provided");
730730
}
731731
Default
732732
} else if matches.opt_present("opt-level") {
@@ -736,7 +736,7 @@ pub fn build_session_options(binary: @str,
736736
~"2" => Default,
737737
~"3" => Aggressive,
738738
_ => {
739-
early_error(demitter, ~"optimization level needs to be between 0-3")
739+
early_error(demitter, "optimization level needs to be between 0-3")
740740
}
741741
}
742742
} else { No }
@@ -1030,7 +1030,7 @@ pub fn build_output_filenames(input: &input,
10301030
}
10311031
}
10321032

1033-
pub fn early_error(emitter: @diagnostic::Emitter, msg: ~str) -> ! {
1033+
pub fn early_error(emitter: @diagnostic::Emitter, msg: &str) -> ! {
10341034
emitter.emit(None, msg, diagnostic::fatal);
10351035
fail2!();
10361036
}

0 commit comments

Comments
 (0)