diff options
| author | bors <bors@rust-lang.org> | 2014-07-05 03:16:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-05 03:16:50 +0000 |
| commit | 29d6a8ecc6f43bac7171267993ef07dfdf528281 (patch) | |
| tree | 0257e896e9af3512f31e30519270bdeb22b545f4 /src/libstd | |
| parent | 9f2a43c1b518a674ef4bb368732ee8dac3c1f779 (diff) | |
| parent | cc13f9bae8b4175513375f9de66f198a706c67d3 (diff) | |
| download | rust-29d6a8ecc6f43bac7171267993ef07dfdf528281.tar.gz rust-29d6a8ecc6f43bac7171267993ef07dfdf528281.zip | |
auto merge of #15425 : jbclements/rust/hygiene-for-3-kinds-of-args, r=cmr
This pull request adds hygiene for 3 kinds of argument bindings: - arguments to item fns, - arguments to `ExprFnBlock`s, and - arguments to `ExprProc`s It also adds a bunch of unit tests, fixes a few macro uses to be non-capturing, and has a few cleanup items. local `make check` succeeds.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/extensions.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index 277aca2332d..ca3eee01575 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -508,14 +508,15 @@ mod bench { use prelude::*; use self::test::Bencher; + // why is this a macro? wouldn't an inlined function work just as well? macro_rules! u64_from_be_bytes_bench_impl( - ($size:expr, $stride:expr, $start_index:expr) => + ($b:expr, $size:expr, $stride:expr, $start_index:expr) => ({ use super::u64_from_be_bytes; let data = Vec::from_fn($stride*100+$start_index, |i| i as u8); let mut sum = 0u64; - b.iter(|| { + $b.iter(|| { let mut i = $start_index; while i < data.len() { sum += u64_from_be_bytes(data.as_slice(), i, $size); @@ -527,31 +528,31 @@ mod bench { #[bench] fn u64_from_be_bytes_4_aligned(b: &mut Bencher) { - u64_from_be_bytes_bench_impl!(4, 4, 0); + u64_from_be_bytes_bench_impl!(b, 4, 4, 0); } #[bench] fn u64_from_be_bytes_4_unaligned(b: &mut Bencher) { - u64_from_be_bytes_bench_impl!(4, 4, 1); + u64_from_be_bytes_bench_impl!(b, 4, 4, 1); } #[bench] fn u64_from_be_bytes_7_aligned(b: &mut Bencher) { - u64_from_be_bytes_bench_impl!(7, 8, 0); + u64_from_be_bytes_bench_impl!(b, 7, 8, 0); } #[bench] fn u64_from_be_bytes_7_unaligned(b: &mut Bencher) { - u64_from_be_bytes_bench_impl!(7, 8, 1); + u64_from_be_bytes_bench_impl!(b, 7, 8, 1); } #[bench] fn u64_from_be_bytes_8_aligned(b: &mut Bencher) { - u64_from_be_bytes_bench_impl!(8, 8, 0); + u64_from_be_bytes_bench_impl!(b, 8, 8, 0); } #[bench] fn u64_from_be_bytes_8_unaligned(b: &mut Bencher) { - u64_from_be_bytes_bench_impl!(8, 8, 1); + u64_from_be_bytes_bench_impl!(b, 8, 8, 1); } } |
