Skip to content
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

Rolling up PRs in the queue #22192

Merged
merged 40 commits into from
Feb 12, 2015
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
51ed1ec
lint: Deny #[no_mangle] const items
richo Feb 3, 2015
73d5d89
lint: Warn about no-mangled statics that are not exported
richo Feb 3, 2015
b6f55ef
lint: Document the why and how of the no_mangle const lint
richo Feb 3, 2015
73201fd
Make the live code analysis visit method declarations.
LeoTestard Feb 7, 2015
b24c6fd
fix and macro-ify map benches, fixes #22134
Gankra Feb 10, 2015
07f1d3d
Remove FIXME in librbml
steveklabnik Feb 11, 2015
c324a8a
Documentation fix for PathBuf#pop
ogham Feb 11, 2015
d8d3761
Tweak wording of copy_nonoverlapping_memory to remove misleading 'all…
huonw Feb 11, 2015
d428871
Forbid undefined names in macro use / macro reexport
kmcallister Feb 11, 2015
a941fdb
Fail nicely when copying artefacts fails
nagisa Feb 10, 2015
92b7222
openbsd don't support TLS
semarie Feb 11, 2015
f9a1087
Feature-gate the `#[unsafe_no_drop_flag]` attribute.
pnkfelix Feb 11, 2015
2af968e
Eliminate assoc type projection predicate candidate duplicates
edwardw Feb 11, 2015
2f48651
Revert #22051
nagisa Feb 11, 2015
d4985ac
Add read and write rights to group and other when creating file
GuillaumeGomez Feb 11, 2015
bbbb571
rustc: Fix a number of stability lint holes
alexcrichton Feb 10, 2015
a828e79
std: Tweak the std::env OsString/String interface
alexcrichton Feb 11, 2015
8b8331a
rollup merge of #21881: richo/lint-no-mangle-const
alexcrichton Feb 11, 2015
c9fdfdb
rollup merge of #22048: LeoTestard/impl-patterns-used
alexcrichton Feb 11, 2015
84e5c11
rollup merge of #22127: alexcrichton/stability-holes
alexcrichton Feb 11, 2015
18d31cc
rollup merge of #22150: nagisa/de-perm-frost
alexcrichton Feb 11, 2015
fcf679c
rollup merge of #22151: Gankro/macro-bench
alexcrichton Feb 11, 2015
92e7aeb
rollup merge of #22161: steveklabnik/close_2741
alexcrichton Feb 11, 2015
5e2b69c
rollup merge of #22162: ogham/patch-1
alexcrichton Feb 11, 2015
4876716
rollup merge of #22164: huonw/alloc--
alexcrichton Feb 11, 2015
7362bd5
rollup merge of #22167: kmcallister/undef-macro
alexcrichton Feb 11, 2015
5bcf2a9
rollup merge of #22177: semarie/openbsd-notls
alexcrichton Feb 11, 2015
76a3852
rollup merge of #22184: nagisa/revert-emissions
alexcrichton Feb 11, 2015
9675f51
rollup merge of #22185: edwardw/default-methods
alexcrichton Feb 11, 2015
43a2004
rollup merge of #22186: GuillaumeGomez/fix-fs
alexcrichton Feb 11, 2015
9492275
rollup merge of #22188: alexcrichton/envv2
alexcrichton Feb 11, 2015
aa0db17
rollup merge of #22178: pnkfelix/featuregate-unsafe-no-drop-flag
alexcrichton Feb 11, 2015
cf475e6
implement missing iterator traits for slice::Windows
dcrewi Feb 11, 2015
315730f
Test fixes and rebase conflicts
alexcrichton Feb 11, 2015
395709c
std: Add a `net` module for TCP/UDP
alexcrichton Feb 6, 2015
a105636
rollup merge of #22015: alexcrichton/netv2
alexcrichton Feb 11, 2015
adcda46
rollup merge of #22166: dcrewi/iter-impls-for-windows
alexcrichton Feb 11, 2015
d2f990f
More test fixes and rebase conflicts
alexcrichton Feb 11, 2015
18bafad
rollup merge of #22197: alexcrichton/do-not-link-plugins
alexcrichton Feb 12, 2015
fb1f4d1
Even more test fixes
alexcrichton Feb 12, 2015
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
4 changes: 1 addition & 3 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@
#![feature(collections)]
#![feature(int_uint)]
#![feature(io)]
#![feature(os)]
#![feature(path)]
#![feature(rustc_private)]
#![feature(slicing_syntax, unboxed_closures)]
@@ -48,8 +47,7 @@ pub mod common;
pub mod errors;

pub fn main() {
let args = env::args().map(|s| s.into_string().unwrap()).collect();;
let config = parse_config(args);
let config = parse_config(env::args().collect());

if config.valgrind_path.is_none() && config.force_valgrind {
panic!("Can't find Valgrind to run Valgrind tests");
2 changes: 1 addition & 1 deletion src/compiletest/util.rs
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ pub fn make_new_path(path: &str) -> String {

// Windows just uses PATH as the library search path, so we have to
// maintain the current value while adding our own
match env::var_string(lib_path_env_var()) {
match env::var(lib_path_env_var()) {
Ok(curr) => {
format!("{}{}{}", path, path_div(), curr)
}
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@
#![feature(box_syntax)]
#![feature(optin_builtin_traits)]
#![feature(unboxed_closures)]
#![feature(unsafe_no_drop_flag)]
#![feature(core)]
#![feature(hash)]
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
198 changes: 105 additions & 93 deletions src/libcollections/bench.rs
Original file line number Diff line number Diff line change
@@ -8,103 +8,115 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use prelude::*;
use std::rand;
use std::rand::Rng;
use test::{Bencher, black_box};

pub fn insert_rand_n<M, I, R>(n: usize,
map: &mut M,
b: &mut Bencher,
mut insert: I,
mut remove: R) where
I: FnMut(&mut M, usize),
R: FnMut(&mut M, usize),
{
// setup
let mut rng = rand::weak_rng();

for _ in 0..n {
insert(map, rng.gen::<usize>() % n);
}

// measure
b.iter(|| {
let k = rng.gen::<usize>() % n;
insert(map, k);
remove(map, k);
});
black_box(map);
macro_rules! map_insert_rand_bench {
($name: ident, $n: expr, $map: ident) => (
#[bench]
pub fn $name(b: &mut ::test::Bencher) {
use std::rand;
use std::rand::Rng;
use test::black_box;

let n: usize = $n;
let mut map = $map::new();
// setup
let mut rng = rand::weak_rng();

for _ in 0..n {
let i = rng.gen() % n;
map.insert(i, i);
}

// measure
b.iter(|| {
let k = rng.gen() % n;
map.insert(k, k);
map.remove(&k);
});
black_box(map);
}
)
}

pub fn insert_seq_n<M, I, R>(n: usize,
map: &mut M,
b: &mut Bencher,
mut insert: I,
mut remove: R) where
I: FnMut(&mut M, usize),
R: FnMut(&mut M, usize),
{
// setup
for i in 0..n {
insert(map, i * 2);
}

// measure
let mut i = 1;
b.iter(|| {
insert(map, i);
remove(map, i);
i = (i + 2) % n;
});
black_box(map);
macro_rules! map_insert_seq_bench {
($name: ident, $n: expr, $map: ident) => (
#[bench]
pub fn $name(b: &mut ::test::Bencher) {
use test::black_box;

let mut map = $map::new();
let n: usize = $n;
// setup
for i in 0..n {
map.insert(i * 2, i * 2);
}

// measure
let mut i = 1;
b.iter(|| {
map.insert(i, i);
map.remove(&i);
i = (i + 2) % n;
});
black_box(map);
}
)
}

pub fn find_rand_n<M, T, I, F>(n: usize,
map: &mut M,
b: &mut Bencher,
mut insert: I,
mut find: F) where
I: FnMut(&mut M, usize),
F: FnMut(&M, usize) -> T,
{
// setup
let mut rng = rand::weak_rng();
let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect();

for k in &keys {
insert(map, *k);
}

rng.shuffle(&mut keys);

// measure
let mut i = 0;
b.iter(|| {
let t = find(map, keys[i]);
i = (i + 1) % n;
black_box(t);
})
macro_rules! map_find_rand_bench {
($name: ident, $n: expr, $map: ident) => (
#[bench]
pub fn $name(b: &mut ::test::Bencher) {
use std::rand;
use std::iter::IteratorExt;
use std::rand::Rng;
use test::black_box;
use vec::Vec;

let mut map = $map::new();
let n: usize = $n;

// setup
let mut rng = rand::weak_rng();
let mut keys: Vec<_> = (0..n).map(|_| rng.gen() % n).collect();

for &k in &keys {
map.insert(k, k);
}

rng.shuffle(&mut keys);

// measure
let mut i = 0;
b.iter(|| {
let t = map.get(&keys[i]);
i = (i + 1) % n;
black_box(t);
})
}
)
}

pub fn find_seq_n<M, T, I, F>(n: usize,
map: &mut M,
b: &mut Bencher,
mut insert: I,
mut find: F) where
I: FnMut(&mut M, usize),
F: FnMut(&M, usize) -> T,
{
// setup
for i in 0..n {
insert(map, i);
}

// measure
let mut i = 0;
b.iter(|| {
let x = find(map, i);
i = (i + 1) % n;
black_box(x);
})
macro_rules! map_find_seq_bench {
($name: ident, $n: expr, $map: ident) => (
#[bench]
pub fn $name(b: &mut ::test::Bencher) {
use test::black_box;

let mut map = $map::new();
let n: usize = $n;

// setup
for i in 0..n {
map.insert(i, i);
}

// measure
let mut i = 0;
b.iter(|| {
let x = map.get(&i);
i = (i + 1) % n;
black_box(x);
})
}
)
}
72 changes: 8 additions & 64 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
@@ -1843,74 +1843,18 @@ mod bench {
use test::{Bencher, black_box};

use super::BTreeMap;
use bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};

#[bench]
pub fn insert_rand_100(b: &mut Bencher) {
let mut m = BTreeMap::new();
insert_rand_n(100, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.remove(&i); });
}

#[bench]
pub fn insert_rand_10_000(b: &mut Bencher) {
let mut m = BTreeMap::new();
insert_rand_n(10_000, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.remove(&i); });
}

// Insert seq
#[bench]
pub fn insert_seq_100(b: &mut Bencher) {
let mut m = BTreeMap::new();
insert_seq_n(100, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.remove(&i); });
}

#[bench]
pub fn insert_seq_10_000(b: &mut Bencher) {
let mut m = BTreeMap::new();
insert_seq_n(10_000, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.remove(&i); });
}
map_insert_rand_bench!{insert_rand_100, 100, BTreeMap}
map_insert_rand_bench!{insert_rand_10_000, 10_000, BTreeMap}

// Find rand
#[bench]
pub fn find_rand_100(b: &mut Bencher) {
let mut m = BTreeMap::new();
find_rand_n(100, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.get(&i); });
}

#[bench]
pub fn find_rand_10_000(b: &mut Bencher) {
let mut m = BTreeMap::new();
find_rand_n(10_000, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.get(&i); });
}
map_insert_seq_bench!{insert_seq_100, 100, BTreeMap}
map_insert_seq_bench!{insert_seq_10_000, 10_000, BTreeMap}

// Find seq
#[bench]
pub fn find_seq_100(b: &mut Bencher) {
let mut m = BTreeMap::new();
find_seq_n(100, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.get(&i); });
}
map_find_rand_bench!{find_rand_100, 100, BTreeMap}
map_find_rand_bench!{find_rand_10_000, 10_000, BTreeMap}

#[bench]
pub fn find_seq_10_000(b: &mut Bencher) {
let mut m = BTreeMap::new();
find_seq_n(10_000, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.get(&i); });
}
map_find_seq_bench!{find_seq_100, 100, BTreeMap}
map_find_seq_bench!{find_seq_10_000, 10_000, BTreeMap}

fn bench_iter(b: &mut Bencher, size: i32) {
let mut map = BTreeMap::<i32, i32>::new();
2 changes: 1 addition & 1 deletion src/libcollections/fmt.rs
Original file line number Diff line number Diff line change
@@ -401,7 +401,7 @@
//! them with the same character. For example, the `{` character is escaped with
//! `{{` and the `}` character is escaped with `}}`.

#![unstable(feature = "std_misc")]
#![stable(feature = "rust1", since = "1.0.0")]

pub use core::fmt::{Formatter, Result, Writer, rt};
pub use core::fmt::{Show, String, Octal, Binary};
8 changes: 5 additions & 3 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
@@ -27,10 +27,12 @@
#![feature(box_patterns)]
#![feature(core)]
#![feature(hash)]
#![feature(slicing_syntax)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unsafe_destructor, slicing_syntax)]
#![feature(unsafe_destructor)]
#![feature(unsafe_no_drop_flag)]
#![cfg_attr(test, feature(rand, rustc_private, test))]
#![cfg_attr(test, allow(deprecated))] // rand

@@ -65,6 +67,8 @@ pub use alloc::boxed;
#[macro_use]
mod macros;

#[cfg(test)] #[macro_use] mod bench;

pub mod binary_heap;
mod bit;
mod btree;
@@ -102,8 +106,6 @@ pub mod btree_set {
}


#[cfg(test)] mod bench;

// FIXME(#14344) this shouldn't be necessary
#[doc(hidden)]
pub fn fixme_14344_be_sure_to_link_to_collections() {}
12 changes: 12 additions & 0 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
@@ -2508,6 +2508,18 @@ mod tests {
let wins: &[&[_]] = &[&[1,2,3], &[2,3,4]];
assert_eq!(v.windows(3).collect::<Vec<_>>(), wins);
assert!(v.windows(6).next().is_none());

let wins: &[&[_]] = &[&[3,4], &[2,3], &[1,2]];
assert_eq!(v.windows(2).rev().collect::<Vec<&[_]>>(), wins);
let mut it = v.windows(2);
assert_eq!(it.indexable(), 3);
let win: &[_] = &[1,2];
assert_eq!(it.idx(0).unwrap(), win);
let win: &[_] = &[2,3];
assert_eq!(it.idx(1).unwrap(), win);
let win: &[_] = &[3,4];
assert_eq!(it.idx(2).unwrap(), win);
assert_eq!(it.idx(3), None);
}

#[test]
Loading