Skip to content

Working towards a libc-less (wasm32) libstd #45725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ impl Step for Std {
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
std_cargo(build, &compiler, target, &mut cargo);
run_cargo(build,
&mut cargo,
&libstd_stamp(build, compiler, target));
&mut cargo,
&libstd_stamp(build, compiler, target));

builder.ensure(StdLink {
compiler: builder.compiler(compiler.stage, build.build),
Expand Down Expand Up @@ -359,8 +359,8 @@ impl Step for Test {
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build");
test_cargo(build, &compiler, target, &mut cargo);
run_cargo(build,
&mut cargo,
&libtest_stamp(build, compiler, target));
&mut cargo,
&libtest_stamp(build, compiler, target));

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

toplevel.push((file_stem, extension));
toplevel.push((file_stem, extension, expected_len));
}
}

Expand All @@ -891,11 +892,12 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
.map(|e| t!(e))
.map(|e| (e.path(), e.file_name().into_string().unwrap(), t!(e.metadata())))
.collect::<Vec<_>>();
for (prefix, extension) in toplevel {
let candidates = contents.iter().filter(|&&(_, ref filename, _)| {
for (prefix, extension, expected_len) in toplevel {
let candidates = contents.iter().filter(|&&(_, ref filename, ref meta)| {
filename.starts_with(&prefix[..]) &&
filename[prefix.len()..].starts_with("-") &&
filename.ends_with(&extension[..])
filename.ends_with(&extension[..]) &&
meta.len() == expected_len
});
let max = candidates.max_by_key(|&&(_, _, ref metadata)| {
FileTime::from_last_modification_time(metadata)
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,6 @@ impl Step for Src {
"src/liblibc",
"src/libpanic_abort",
"src/libpanic_unwind",
"src/librand",
"src/librustc_asan",
"src/librustc_lsan",
"src/librustc_msan",
Expand Down
5 changes: 0 additions & 5 deletions src/doc/unstable-book/src/library-features/rand.md

This file was deleted.

3 changes: 3 additions & 0 deletions src/liballoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ path = "lib.rs"
core = { path = "../libcore" }
std_unicode = { path = "../libstd_unicode" }

[dev-dependencies]
rand = "0.3"

[[test]]
name = "collectionstests"
path = "../liballoc/tests/lib.rs"
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
extern crate std;
#[cfg(test)]
extern crate test;
#[cfg(test)]
extern crate rand;

extern crate std_unicode;

Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,10 +1269,11 @@ unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {}

#[cfg(test)]
mod tests {
use std::__rand::{thread_rng, Rng};
use std::thread;
use std::vec::Vec;

use rand::{thread_rng, Rng};

use super::{LinkedList, Node};

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#![feature(unicode)]

extern crate std_unicode;
extern crate rand;

use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/tests/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

use std::cmp::Ordering::{Equal, Greater, Less};
use std::mem;
use std::__rand::{Rng, thread_rng};
use std::rc::Rc;

use rand::{Rng, thread_rng};

fn square(n: usize) -> usize {
n * n
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test = false
bench = false

[dev-dependencies]
rand = { path = "../librand" }
rand = "0.3"

[[test]]
name = "coretests"
Expand Down
3 changes: 1 addition & 2 deletions src/libcore/tests/num/flt2dec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

use std::prelude::v1::*;
use std::{str, mem, i16, f32, f64, fmt};
use std::__rand as rand;
use rand::{Rand, XorShiftRng};
use rand::{self, Rand, XorShiftRng};
use rand::distributions::{IndependentSample, Range};

use core::num::flt2dec::{decode, DecodableFloat, FullDecoded, Decoded};
Expand Down
12 changes: 0 additions & 12 deletions src/librand/Cargo.toml

This file was deleted.

Loading