Skip to content

Commit f1ea23e

Browse files
committedNov 9, 2017
Auto merge of #45725 - alexcrichton:std-less-rand, r=dtolnay
Working towards a libc-less (wasm32) libstd This is a series of commits I was able to extract from prepare to comiple libstd on a "bare libc-less" target, notably wasm32. The actual wasm32 bits I intend to send in a PR later, this is just some internal refactorings required for libstd to work with a `libc` that's empty and a few other assorted refactorings. No functional change should be included in this PR for users of libstd, this is intended to just be internal refactorings.
2 parents 98e791e + 5c3fe11 commit f1ea23e

Some content is hidden

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

68 files changed

+403
-4550
lines changed
 

‎src/Cargo.lock

+5-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/bootstrap/compile.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ impl Step for Std {
107107
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
108108
std_cargo(build, &compiler, target, &mut cargo);
109109
run_cargo(build,
110-
&mut cargo,
111-
&libstd_stamp(build, compiler, target));
110+
&mut cargo,
111+
&libstd_stamp(build, compiler, target));
112112

113113
builder.ensure(StdLink {
114114
compiler: builder.compiler(compiler.stage, build.build),
@@ -359,8 +359,8 @@ impl Step for Test {
359359
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build");
360360
test_cargo(build, &compiler, target, &mut cargo);
361361
run_cargo(build,
362-
&mut cargo,
363-
&libtest_stamp(build, compiler, target));
362+
&mut cargo,
363+
&libtest_stamp(build, compiler, target));
364364

365365
builder.ensure(TestLink {
366366
compiler: builder.compiler(compiler.stage, build.build),
@@ -866,12 +866,13 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
866866
// `std-<hash>.dll.lib` on Windows. The aforementioned methods only
867867
// split the file name by the last extension (`.lib`) while we need
868868
// to split by all extensions (`.dll.lib`).
869+
let expected_len = t!(filename.metadata()).len();
869870
let filename = filename.file_name().unwrap().to_str().unwrap();
870871
let mut parts = filename.splitn(2, '.');
871872
let file_stem = parts.next().unwrap().to_owned();
872873
let extension = parts.next().unwrap().to_owned();
873874

874-
toplevel.push((file_stem, extension));
875+
toplevel.push((file_stem, extension, expected_len));
875876
}
876877
}
877878

@@ -891,11 +892,12 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
891892
.map(|e| t!(e))
892893
.map(|e| (e.path(), e.file_name().into_string().unwrap(), t!(e.metadata())))
893894
.collect::<Vec<_>>();
894-
for (prefix, extension) in toplevel {
895-
let candidates = contents.iter().filter(|&&(_, ref filename, _)| {
895+
for (prefix, extension, expected_len) in toplevel {
896+
let candidates = contents.iter().filter(|&&(_, ref filename, ref meta)| {
896897
filename.starts_with(&prefix[..]) &&
897898
filename[prefix.len()..].starts_with("-") &&
898-
filename.ends_with(&extension[..])
899+
filename.ends_with(&extension[..]) &&
900+
meta.len() == expected_len
899901
});
900902
let max = candidates.max_by_key(|&&(_, _, ref metadata)| {
901903
FileTime::from_last_modification_time(metadata)

0 commit comments

Comments
 (0)
Please sign in to comment.