Skip to content

Commit c59cda6

Browse files
committed
---
yaml --- r: 146941 b: refs/heads/try2 c: 9bf62f7 h: refs/heads/master i: 146939: 971e532 v: v3
1 parent 1c8b8ac commit c59cda6

Some content is hidden

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

76 files changed

+1656
-998
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: a7b311ac614ea15f7261eb2ddca56072c18b3cba
8+
refs/heads/try2: 9bf62f71bc5e1844a2b63a77c2c0b4c1d67faf91
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiletest/compiletest.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ pub fn parse_config(args: ~[~str]) -> config {
103103
}
104104

105105
fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
106-
Path::new(m.opt_str(nm).unwrap())
106+
Path::init(m.opt_str(nm).unwrap())
107107
}
108108

109109
config {
110110
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
111111
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
112112
rustc_path: opt_path(matches, "rustc-path"),
113-
clang_path: matches.opt_str("clang-path").map(|s| Path::new(s)),
114-
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::new(s)),
113+
clang_path: matches.opt_str("clang-path").map(|s| Path::init(s)),
114+
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::init(s)),
115115
src_base: opt_path(matches, "src-base"),
116116
build_base: opt_path(matches, "build-base"),
117117
aux_base: opt_path(matches, "aux-base"),
@@ -124,10 +124,10 @@ pub fn parse_config(args: ~[~str]) -> config {
124124
} else {
125125
None
126126
},
127-
logfile: matches.opt_str("logfile").map(|s| Path::new(s)),
128-
save_metrics: matches.opt_str("save-metrics").map(|s| Path::new(s)),
127+
logfile: matches.opt_str("logfile").map(|s| Path::init(s)),
128+
save_metrics: matches.opt_str("save-metrics").map(|s| Path::init(s)),
129129
ratchet_metrics:
130-
matches.opt_str("ratchet-metrics").map(|s| Path::new(s)),
130+
matches.opt_str("ratchet-metrics").map(|s| Path::init(s)),
131131
ratchet_noise_percent:
132132
matches.opt_str("ratchet-noise-percent").and_then(|s| from_str::<f64>(s)),
133133
runtool: matches.opt_str("runtool"),

branches/try2/src/compiletest/header.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
160160

161161
fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> {
162162
match parse_name_value_directive(line, ~"pp-exact") {
163-
Some(s) => Some(Path::new(s)),
163+
Some(s) => Some(Path::init(s)),
164164
None => {
165165
if parse_name_directive(line, "pp-exact") {
166-
testfile.filename().map(|s| Path::new(s))
166+
testfile.filename().map(|s| Path::init(s))
167167
} else {
168168
None
169169
}

branches/try2/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) {
4545
// We're going to be dumping a lot of info. Start on a new line.
4646
print!("\n\n");
4747
}
48-
let testfile = Path::new(testfile);
48+
let testfile = Path::init(testfile);
4949
debug!("running {}", testfile.display());
5050
let props = load_props(&testfile);
5151
debug!("loaded props");
@@ -852,7 +852,7 @@ fn aux_output_dir_name(config: &config, testfile: &Path) -> Path {
852852
}
853853

854854
fn output_testname(testfile: &Path) -> Path {
855-
Path::new(testfile.filestem().unwrap())
855+
Path::init(testfile.filestem().unwrap())
856856
}
857857

858858
fn output_base_name(config: &config, testfile: &Path) -> Path {

branches/try2/src/libextra/glob.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> GlobIterator {
9090

9191
// calculate root this way to handle volume-relative Windows paths correctly
9292
let mut root = os::getcwd();
93-
let pat_root = Path::new(pattern).root_path();
93+
let pat_root = Path::init(pattern).root_path();
9494
if pat_root.is_some() {
9595
if check_windows_verbatim(pat_root.get_ref()) {
9696
// XXX: How do we want to handle verbatim paths? I'm inclined to return nothing,
@@ -766,9 +766,9 @@ mod test {
766766

767767
#[test]
768768
fn test_matches_path() {
769-
// on windows, (Path::new("a/b").as_str().unwrap() == "a\\b"), so this
769+
// on windows, (Path::init("a/b").as_str().unwrap() == "a\\b"), so this
770770
// tests that / and \ are considered equivalent on windows
771-
assert!(Pattern::new("a/b").matches_path(&Path::new("a/b")));
771+
assert!(Pattern::new("a/b").matches_path(&Path::init("a/b")));
772772
}
773773
}
774774

branches/try2/src/libextra/terminfo/searcher.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~Path> {
2929

3030
// Find search directory
3131
match getenv("TERMINFO") {
32-
Some(dir) => dirs_to_search.push(Path::new(dir)),
32+
Some(dir) => dirs_to_search.push(Path::init(dir)),
3333
None => {
3434
if homedir.is_some() {
3535
// ncurses compatability;
@@ -38,17 +38,17 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~Path> {
3838
match getenv("TERMINFO_DIRS") {
3939
Some(dirs) => for i in dirs.split(':') {
4040
if i == "" {
41-
dirs_to_search.push(Path::new("/usr/share/terminfo"));
41+
dirs_to_search.push(Path::init("/usr/share/terminfo"));
4242
} else {
43-
dirs_to_search.push(Path::new(i.to_owned()));
43+
dirs_to_search.push(Path::init(i.to_owned()));
4444
}
4545
},
4646
// Found nothing, use the default paths
4747
// /usr/share/terminfo is the de facto location, but it seems
4848
// Ubuntu puts it in /lib/terminfo
4949
None => {
50-
dirs_to_search.push(Path::new("/usr/share/terminfo"));
51-
dirs_to_search.push(Path::new("/lib/terminfo"));
50+
dirs_to_search.push(Path::init("/usr/share/terminfo"));
51+
dirs_to_search.push(Path::init("/lib/terminfo"));
5252
}
5353
}
5454
}

branches/try2/src/libextra/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,20 @@ pub fn parse_opts(args: &[~str]) -> Option<OptRes> {
276276
let run_ignored = matches.opt_present("ignored");
277277

278278
let logfile = matches.opt_str("logfile");
279-
let logfile = logfile.map(|s| Path::new(s));
279+
let logfile = logfile.map(|s| Path::init(s));
280280

281281
let run_benchmarks = matches.opt_present("bench");
282282
let run_tests = ! run_benchmarks ||
283283
matches.opt_present("test");
284284

285285
let ratchet_metrics = matches.opt_str("ratchet-metrics");
286-
let ratchet_metrics = ratchet_metrics.map(|s| Path::new(s));
286+
let ratchet_metrics = ratchet_metrics.map(|s| Path::init(s));
287287

288288
let ratchet_noise_percent = matches.opt_str("ratchet-noise-percent");
289289
let ratchet_noise_percent = ratchet_noise_percent.map(|s| from_str::<f64>(s).unwrap());
290290

291291
let save_metrics = matches.opt_str("save-metrics");
292-
let save_metrics = save_metrics.map(|s| Path::new(s));
292+
let save_metrics = save_metrics.map(|s| Path::init(s));
293293

294294
let test_shard = matches.opt_str("test-shard");
295295
let test_shard = opt_shard(test_shard);

branches/try2/src/librustc/back/rpath.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> ~str {
148148
let install_prefix = env!("CFG_PREFIX");
149149

150150
let tlib = filesearch::relative_target_lib_path(target_triple);
151-
let mut path = Path::new(install_prefix);
151+
let mut path = Path::init(install_prefix);
152152
path.push(&tlib);
153153
let path = os::make_absolute(&path);
154154
// FIXME (#9639): This needs to handle non-utf8 paths
@@ -183,7 +183,7 @@ mod test {
183183
#[test]
184184
fn test_prefix_rpath() {
185185
let res = get_install_prefix_rpath("triple");
186-
let mut d = Path::new(env!("CFG_PREFIX"));
186+
let mut d = Path::init(env!("CFG_PREFIX"));
187187
d.push("lib/rustc/triple/lib");
188188
debug!("test_prefix_path: {} vs. {}",
189189
res,
@@ -194,7 +194,7 @@ mod test {
194194
#[test]
195195
fn test_prefix_rpath_abs() {
196196
let res = get_install_prefix_rpath("triple");
197-
assert!(Path::new(res).is_absolute());
197+
assert!(Path::init(res).is_absolute());
198198
}
199199
200200
#[test]
@@ -218,7 +218,7 @@ mod test {
218218
fn test_rpath_relative() {
219219
let o = abi::OsLinux;
220220
let res = get_rpath_relative_to_output(o,
221-
&Path::new("bin/rustc"), &Path::new("lib/libstd.so"));
221+
&Path::init("bin/rustc"), &Path::init("lib/libstd.so"));
222222
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
223223
}
224224
@@ -227,7 +227,7 @@ mod test {
227227
fn test_rpath_relative() {
228228
let o = abi::OsFreebsd;
229229
let res = get_rpath_relative_to_output(o,
230-
&Path::new("bin/rustc"), &Path::new("lib/libstd.so"));
230+
&Path::init("bin/rustc"), &Path::init("lib/libstd.so"));
231231
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
232232
}
233233
@@ -236,15 +236,15 @@ mod test {
236236
fn test_rpath_relative() {
237237
let o = abi::OsMacos;
238238
let res = get_rpath_relative_to_output(o,
239-
&Path::new("bin/rustc"),
240-
&Path::new("lib/libstd.so"));
239+
&Path::init("bin/rustc"),
240+
&Path::init("lib/libstd.so"));
241241
assert_eq!(res.as_slice(), "@loader_path/../lib");
242242
}
243243
244244
#[test]
245245
fn test_get_absolute_rpath() {
246-
let res = get_absolute_rpath(&Path::new("lib/libstd.so"));
247-
let lib = os::make_absolute(&Path::new("lib"));
246+
let res = get_absolute_rpath(&Path::init("lib/libstd.so"));
247+
let lib = os::make_absolute(&Path::init("lib"));
248248
debug!("test_get_absolute_rpath: {} vs. {}",
249249
res.to_str(), lib.display());
250250

branches/try2/src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ pub fn build_session_options(binary: @str,
719719
} else if matches.opt_present("emit-llvm") {
720720
link::output_type_bitcode
721721
} else { link::output_type_exe };
722-
let sysroot_opt = matches.opt_str("sysroot").map(|m| @Path::new(m));
722+
let sysroot_opt = matches.opt_str("sysroot").map(|m| @Path::init(m));
723723
let target = matches.opt_str("target").unwrap_or(host_triple());
724724
let target_cpu = matches.opt_str("target-cpu").unwrap_or(~"generic");
725725
let target_feature = matches.opt_str("target-feature").unwrap_or(~"");
@@ -753,7 +753,7 @@ pub fn build_session_options(binary: @str,
753753
let statik = debugging_opts & session::statik != 0;
754754

755755
let addl_lib_search_paths = matches.opt_strs("L").map(|s| {
756-
Path::new(s.as_slice())
756+
Path::init(s.as_slice())
757757
}).move_iter().collect();
758758
let linker = matches.opt_str("linker");
759759
let linker_args = matches.opt_strs("link-args").flat_map( |a| {

branches/try2/src/librustc/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,16 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
248248
let src = str::from_utf8(io::stdin().read_to_end());
249249
str_input(src.to_managed())
250250
} else {
251-
file_input(Path::new(ifile))
251+
file_input(Path::init(ifile))
252252
}
253253
}
254254
_ => early_error(demitter, "multiple input filenames provided")
255255
};
256256

257257
let sopts = build_session_options(binary, matches, demitter);
258258
let sess = build_session(sopts, demitter);
259-
let odir = matches.opt_str("out-dir").map(|o| Path::new(o));
260-
let ofile = matches.opt_str("o").map(|o| Path::new(o));
259+
let odir = matches.opt_str("out-dir").map(|o| Path::init(o));
260+
let ofile = matches.opt_str("o").map(|o| Path::init(o));
261261
let cfg = build_configuration(sess);
262262
let pretty = matches.opt_default("pretty", "normal").map(|a| {
263263
parse_pretty(sess, a)

branches/try2/src/librustc/metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn visit_view_item(e: @mut Env, i: &ast::view_item) {
143143
let meta_items = match path_opt {
144144
None => meta_items.clone(),
145145
Some((p, _path_str_style)) => {
146-
let p_path = Path::new(p);
146+
let p_path = Path::init(p);
147147
match p_path.filestem_str() {
148148
None|Some("") =>
149149
e.diag.span_bug(i.span, "Bad package path in `extern mod` item"),
@@ -275,7 +275,7 @@ fn resolve_crate(e: @mut Env,
275275
};
276276
let (lident, ldata) = loader::load_library_crate(&load_ctxt);
277277

278-
let cfilename = Path::new(lident);
278+
let cfilename = Path::init(lident);
279279
let cdata = ldata;
280280

281281
let attrs = decoder::get_crate_attributes(cdata);

branches/try2/src/librustc/metadata/filesearch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub fn search(filesearch: @FileSearch, pick: pick) {
145145

146146
pub fn relative_target_lib_path(target_triple: &str) -> Path {
147147
let dir = libdir();
148-
let mut p = Path::new(dir.as_slice());
148+
let mut p = Path::init(dir.as_slice());
149149
assert!(p.is_relative());
150150
p.push("rustc");
151151
p.push(target_triple);
@@ -199,7 +199,7 @@ pub fn rust_path() -> ~[Path] {
199199
Some(env_path) => {
200200
let env_path_components: ~[&str] =
201201
env_path.split_str(PATH_ENTRY_SEPARATOR).collect();
202-
env_path_components.map(|&s| Path::new(s))
202+
env_path_components.map(|&s| Path::init(s))
203203
}
204204
None => ~[]
205205
};

branches/try2/src/librustc/middle/lang_items.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,18 @@ pub enum LangItem {
8282
OpaqueStructLangItem, // 38
8383

8484
EventLoopFactoryLangItem, // 39
85+
86+
TypeIdLangItem, // 40
8587
}
8688

8789
pub struct LanguageItems {
88-
items: [Option<ast::DefId>, ..40]
90+
items: [Option<ast::DefId>, ..41]
8991
}
9092

9193
impl LanguageItems {
9294
pub fn new() -> LanguageItems {
9395
LanguageItems {
94-
items: [ None, ..40 ]
96+
items: [ None, ..41 ]
9597
}
9698
}
9799

@@ -148,6 +150,8 @@ impl LanguageItems {
148150

149151
39 => "event_loop_factory",
150152

153+
40 => "type_id",
154+
151155
_ => "???"
152156
}
153157
}
@@ -298,6 +302,9 @@ impl LanguageItems {
298302
pub fn event_loop_factory(&self) -> Option<ast::DefId> {
299303
self.items[EventLoopFactoryLangItem as uint]
300304
}
305+
pub fn type_id(&self) -> Option<ast::DefId> {
306+
self.items[TypeIdLangItem as uint]
307+
}
301308
}
302309

303310
struct LanguageItemCollector {
@@ -382,6 +389,7 @@ impl LanguageItemCollector {
382389
item_refs.insert("ty_visitor", TyVisitorTraitLangItem as uint);
383390
item_refs.insert("opaque", OpaqueStructLangItem as uint);
384391
item_refs.insert("event_loop_factory", EventLoopFactoryLangItem as uint);
392+
item_refs.insert("type_id", TypeIdLangItem as uint);
385393

386394
LanguageItemCollector {
387395
session: session,

branches/try2/src/librustc/middle/trans/controlflow.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn trans_if(bcx: @mut Block,
7777
return with_scope(bcx, thn.info(), "if_true_then", |bcx| {
7878
let bcx_out = trans_block(bcx, thn, dest);
7979
debuginfo::clear_source_location(bcx.fcx);
80-
trans_block_cleanups(bcx_out, block_cleanups(bcx))
80+
bcx_out
8181
})
8282
} else {
8383
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx } ;
@@ -90,9 +90,9 @@ pub fn trans_if(bcx: @mut Block,
9090
elexpr.info(),
9191
"if_false_then",
9292
|bcx| {
93-
let bcx_out = trans_if_else(bcx, elexpr, dest);
93+
let bcx_out = trans_if_else(bcx, elexpr, dest, false);
9494
debuginfo::clear_source_location(bcx.fcx);
95-
trans_block_cleanups(bcx_out, block_cleanups(bcx))
95+
bcx_out
9696
})
9797
}
9898
// if false { .. }
@@ -116,7 +116,7 @@ pub fn trans_if(bcx: @mut Block,
116116
let (else_bcx_in, next_bcx) = match els {
117117
Some(elexpr) => {
118118
let else_bcx_in = scope_block(bcx, elexpr.info(), "else");
119-
let else_bcx_out = trans_if_else(else_bcx_in, elexpr, dest);
119+
let else_bcx_out = trans_if_else(else_bcx_in, elexpr, dest, true);
120120
(else_bcx_in, join_blocks(bcx, [then_bcx_out, else_bcx_out]))
121121
}
122122
_ => {
@@ -138,7 +138,7 @@ pub fn trans_if(bcx: @mut Block,
138138

139139
// trans `else [ if { .. } ... | { .. } ]`
140140
fn trans_if_else(else_bcx_in: @mut Block, elexpr: @ast::Expr,
141-
dest: expr::Dest) -> @mut Block {
141+
dest: expr::Dest, cleanup: bool) -> @mut Block {
142142
let else_bcx_out = match elexpr.node {
143143
ast::ExprIf(_, _, _) => {
144144
let elseif_blk = ast_util::block_from_expr(elexpr);
@@ -150,8 +150,12 @@ pub fn trans_if(bcx: @mut Block,
150150
// would be nice to have a constraint on ifs
151151
_ => else_bcx_in.tcx().sess.bug("strange alternative in if")
152152
};
153-
debuginfo::clear_source_location(else_bcx_in.fcx);
154-
trans_block_cleanups(else_bcx_out, block_cleanups(else_bcx_in))
153+
if cleanup {
154+
debuginfo::clear_source_location(else_bcx_in.fcx);
155+
trans_block_cleanups(else_bcx_out, block_cleanups(else_bcx_in))
156+
} else {
157+
else_bcx_out
158+
}
155159
}
156160
}
157161

0 commit comments

Comments
 (0)