Skip to content

Commit 473ff86

Browse files
committed
---
yaml --- r: 108899 b: refs/heads/dist-snap c: 5f64adc h: refs/heads/master i: 108897: e77f0f5 108895: 81a0192 v: v3
1 parent 5791348 commit 473ff86

Some content is hidden

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

108 files changed

+2114
-1544
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: 438893b36fe241b37eb76250f7c38ac8832f5706
9+
refs/heads/dist-snap: 5f64adc44b1245ba644f66c29d6bbc5c940422c9
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/back/archive.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use metadata::filesearch;
1616
use lib::llvm::{ArchiveRef, llvm};
1717

1818
use std::cast;
19+
use std::vec_ng::Vec;
1920
use std::io::fs;
2021
use std::io;
2122
use std::libc;
@@ -41,7 +42,7 @@ fn run_ar(sess: Session, args: &str, cwd: Option<&Path>,
4142
paths: &[&Path]) -> ProcessOutput {
4243
let ar = get_ar_prog(sess);
4344

44-
let mut args = ~[args.to_owned()];
45+
let mut args = vec!(args.to_owned());
4546
let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
4647
args.extend(&mut paths);
4748
debug!("{} {}", ar, args.connect(" "));
@@ -89,17 +90,25 @@ impl Archive {
8990
}
9091

9192
/// Read a file in the archive
92-
pub fn read(&self, file: &str) -> ~[u8] {
93+
pub fn read(&self, file: &str) -> Vec<u8> {
9394
// Apparently if "ar p" is used on windows, it generates a corrupt file
9495
// which has bad headers and LLVM will immediately choke on it
9596
if cfg!(windows) && cfg!(windows) { // FIXME(#10734) double-and
9697
let loc = TempDir::new("rsar").unwrap();
9798
let archive = os::make_absolute(&self.dst);
9899
run_ar(self.sess, "x", Some(loc.path()), [&archive,
99100
&Path::new(file)]);
100-
fs::File::open(&loc.path().join(file)).read_to_end().unwrap()
101+
let result: Vec<u8> =
102+
fs::File::open(&loc.path().join(file)).read_to_end()
103+
.unwrap()
104+
.move_iter()
105+
.collect();
106+
result
101107
} else {
102-
run_ar(self.sess, "p", None, [&self.dst, &Path::new(file)]).output
108+
run_ar(self.sess,
109+
"p",
110+
None,
111+
[&self.dst, &Path::new(file)]).output.move_iter().collect()
103112
}
104113
}
105114

@@ -119,11 +128,11 @@ impl Archive {
119128
lto: bool) -> io::IoResult<()> {
120129
let object = format!("{}.o", name);
121130
let bytecode = format!("{}.bc", name);
122-
let mut ignore = ~[METADATA_FILENAME, bytecode.as_slice()];
131+
let mut ignore = vec!(METADATA_FILENAME, bytecode.as_slice());
123132
if lto {
124133
ignore.push(object.as_slice());
125134
}
126-
self.add_archive(rlib, name, ignore)
135+
self.add_archive(rlib, name, ignore.as_slice())
127136
}
128137

129138
/// Adds an arbitrary file to this archive
@@ -143,7 +152,7 @@ impl Archive {
143152
}
144153

145154
/// Lists all files in an archive
146-
pub fn files(&self) -> ~[~str] {
155+
pub fn files(&self) -> Vec<~str> {
147156
let output = run_ar(self.sess, "t", None, [&self.dst]);
148157
let output = str::from_utf8(output.output).unwrap();
149158
// use lines_any because windows delimits output with `\r\n` instead of
@@ -168,7 +177,7 @@ impl Archive {
168177
// all SYMDEF files as these are just magical placeholders which get
169178
// re-created when we make a new archive anyway.
170179
let files = try!(fs::readdir(loc.path()));
171-
let mut inputs = ~[];
180+
let mut inputs = Vec::new();
172181
for file in files.iter() {
173182
let filename = file.filename_str().unwrap();
174183
if skip.iter().any(|s| *s == filename) { continue }
@@ -182,7 +191,7 @@ impl Archive {
182191
if inputs.len() == 0 { return Ok(()) }
183192

184193
// Finally, add all the renamed files to this archive
185-
let mut args = ~[&self.dst];
194+
let mut args = vec!(&self.dst);
186195
args.extend(&mut inputs.iter());
187196
run_ar(self.sess, "r", None, args.as_slice());
188197
Ok(())

branches/dist-snap/src/librustc/back/arm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use syntax::abi;
1515

1616
pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::t {
1717
let cc_args = if target_triple.contains("thumb") {
18-
~[~"-mthumb"]
18+
vec!(~"-mthumb")
1919
} else {
20-
~[~"-marm"]
20+
vec!(~"-marm")
2121
};
2222
return target_strs::t {
2323
module_asm: ~"",

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

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use std::str;
3434
use std::io;
3535
use std::io::Process;
3636
use std::io::fs;
37+
use std::vec_ng::Vec;
3738
use flate;
3839
use serialize::hex::ToHex;
3940
use extra::tempfile::TempDir;
@@ -106,6 +107,7 @@ pub mod write {
106107
use std::io::Process;
107108
use std::libc::{c_uint, c_int};
108109
use std::str;
110+
use std::vec_ng::Vec;
109111

110112
// On android, we by default compile for armv7 processors. This enables
111113
// things like double word CAS instructions (rather than emulating them)
@@ -222,7 +224,7 @@ pub mod write {
222224

223225
if sess.lto() {
224226
time(sess.time_passes(), "all lto passes", (), |()|
225-
lto::run(sess, llmod, tm, trans.reachable));
227+
lto::run(sess, llmod, tm, trans.reachable.as_slice()));
226228

227229
if sess.opts.cg.save_temps {
228230
output.with_extension("lto.bc").with_c_str(|buf| {
@@ -363,8 +365,8 @@ pub mod write {
363365
let vectorize_slp = !sess.opts.cg.no_vectorize_slp &&
364366
sess.opts.optimize == session::Aggressive;
365367

366-
let mut llvm_c_strs = ~[];
367-
let mut llvm_args = ~[];
368+
let mut llvm_c_strs = Vec::new();
369+
let mut llvm_args = Vec::new();
368370
{
369371
let add = |arg: &str| {
370372
let s = arg.to_c_str();
@@ -781,8 +783,8 @@ fn remove(sess: Session, path: &Path) {
781783
pub fn link_binary(sess: Session,
782784
trans: &CrateTranslation,
783785
outputs: &OutputFilenames,
784-
id: &CrateId) -> ~[Path] {
785-
let mut out_filenames = ~[];
786+
id: &CrateId) -> Vec<Path> {
787+
let mut out_filenames = Vec::new();
786788
let crate_types = sess.crate_types.borrow();
787789
for &crate_type in crate_types.get().iter() {
788790
let out_file = link_binary_output(sess, trans, crate_type, outputs, id);
@@ -931,7 +933,8 @@ fn link_rlib(sess: Session,
931933
// the same filename for metadata (stomping over one another)
932934
let tmpdir = TempDir::new("rustc").expect("needs a temp dir");
933935
let metadata = tmpdir.path().join(METADATA_FILENAME);
934-
match fs::File::create(&metadata).write(trans.metadata) {
936+
match fs::File::create(&metadata).write(trans.metadata
937+
.as_slice()) {
935938
Ok(..) => {}
936939
Err(e) => {
937940
sess.err(format!("failed to write {}: {}",
@@ -1035,7 +1038,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
10351038
// Invoke the system linker
10361039
debug!("{} {}", cc_prog, cc_args.connect(" "));
10371040
let prog = time(sess.time_passes(), "running linker", (), |()|
1038-
Process::output(cc_prog, cc_args));
1041+
Process::output(cc_prog, cc_args.as_slice()));
10391042
match prog {
10401043
Ok(prog) => {
10411044
if !prog.status.success() {
@@ -1071,15 +1074,15 @@ fn link_args(sess: Session,
10711074
dylib: bool,
10721075
tmpdir: &Path,
10731076
obj_filename: &Path,
1074-
out_filename: &Path) -> ~[~str] {
1077+
out_filename: &Path) -> Vec<~str> {
10751078

10761079
// The default library location, we need this to find the runtime.
10771080
// The location of crates will be determined as needed.
10781081
// FIXME (#9639): This needs to handle non-utf8 paths
10791082
let lib_path = sess.filesearch.get_target_lib_path();
10801083
let stage: ~str = ~"-L" + lib_path.as_str().unwrap();
10811084

1082-
let mut args = ~[stage];
1085+
let mut args = vec!(stage);
10831086

10841087
// FIXME (#9639): This needs to handle non-utf8 paths
10851088
args.push_all([
@@ -1198,7 +1201,7 @@ fn link_args(sess: Session,
11981201
// where extern libraries might live, based on the
11991202
// addl_lib_search_paths
12001203
if !sess.opts.cg.no_rpath {
1201-
args.push_all(rpath::get_rpath_flags(sess, out_filename));
1204+
args.push_all(rpath::get_rpath_flags(sess, out_filename).as_slice());
12021205
}
12031206

12041207
// Stack growth requires statically linking a __morestack function
@@ -1210,7 +1213,7 @@ fn link_args(sess: Session,
12101213

12111214
// Finally add all the linker arguments provided on the command line along
12121215
// with any #[link_args] attributes found inside the crate
1213-
args.push_all(sess.opts.cg.link_args);
1216+
args.push_all(sess.opts.cg.link_args.as_slice());
12141217
let used_link_args = sess.cstore.get_used_link_args();
12151218
let used_link_args = used_link_args.borrow();
12161219
for arg in used_link_args.get().iter() {
@@ -1230,7 +1233,7 @@ fn link_args(sess: Session,
12301233
// Also note that the native libraries linked here are only the ones located
12311234
// in the current crate. Upstream crates with native library dependencies
12321235
// may have their native library pulled in above.
1233-
fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
1236+
fn add_local_native_libraries(args: &mut Vec<~str> , sess: Session) {
12341237
let addl_lib_search_paths = sess.opts.addl_lib_search_paths.borrow();
12351238
for path in addl_lib_search_paths.get().iter() {
12361239
// FIXME (#9639): This needs to handle non-utf8 paths
@@ -1263,7 +1266,7 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
12631266
// Rust crates are not considered at all when creating an rlib output. All
12641267
// dependencies will be linked when producing the final output (instead of
12651268
// the intermediate rlib version)
1266-
fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
1269+
fn add_upstream_rust_crates(args: &mut Vec<~str> , sess: Session,
12671270
dylib: bool, tmpdir: &Path) {
12681271

12691272
// As a limitation of the current implementation, we require that everything
@@ -1347,7 +1350,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
13471350
// returning `None` if not all libraries could be found with that
13481351
// preference.
13491352
fn get_deps(cstore: &cstore::CStore, preference: cstore::LinkagePreference)
1350-
-> Option<~[(ast::CrateNum, Path)]>
1353+
-> Option<Vec<(ast::CrateNum, Path)> >
13511354
{
13521355
let crates = cstore.get_used_crates(preference);
13531356
if crates.iter().all(|&(_, ref p)| p.is_some()) {
@@ -1358,8 +1361,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
13581361
}
13591362

13601363
// Adds the static "rlib" versions of all crates to the command line.
1361-
fn add_static_crates(args: &mut ~[~str], sess: Session, tmpdir: &Path,
1362-
crates: ~[(ast::CrateNum, Path)]) {
1364+
fn add_static_crates(args: &mut Vec<~str> , sess: Session, tmpdir: &Path,
1365+
crates: Vec<(ast::CrateNum, Path)> ) {
13631366
for (cnum, cratepath) in crates.move_iter() {
13641367
// When performing LTO on an executable output, all of the
13651368
// bytecode from the upstream libraries has already been
@@ -1405,8 +1408,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
14051408
}
14061409

14071410
// Same thing as above, but for dynamic crates instead of static crates.
1408-
fn add_dynamic_crates(args: &mut ~[~str], sess: Session,
1409-
crates: ~[(ast::CrateNum, Path)]) {
1411+
fn add_dynamic_crates(args: &mut Vec<~str> , sess: Session,
1412+
crates: Vec<(ast::CrateNum, Path)> ) {
14101413
// If we're performing LTO, then it should have been previously required
14111414
// that all upstream rust dependencies were available in an rlib format.
14121415
assert!(!sess.lto());
@@ -1440,7 +1443,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
14401443
// generic function calls a native function, then the generic function must
14411444
// be instantiated in the target crate, meaning that the native symbol must
14421445
// also be resolved in the target crate.
1443-
fn add_upstream_native_libraries(args: &mut ~[~str], sess: Session) {
1446+
fn add_upstream_native_libraries(args: &mut Vec<~str> , sess: Session) {
14441447
let cstore = sess.cstore;
14451448
cstore.iter_crate_data(|cnum, _| {
14461449
let libs = csearch::get_native_libraries(cstore, cnum);

branches/dist-snap/src/librustc/back/mips.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use back::target_strs;
1212
use driver::session::sess_os_to_meta_os;
1313
use metadata::loader::meta_section_name;
14+
use std::vec_ng::Vec;
1415
use syntax::abi;
1516

1617
pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::t {
@@ -63,6 +64,6 @@ pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::
6364

6465
target_triple: target_triple,
6566

66-
cc_args: ~[],
67+
cc_args: Vec::new(),
6768
};
6869
}

0 commit comments

Comments
 (0)