- 16 5月, 2014 8 次提交
-
-
由 Daniel Micay 提交于
pthread_yield is non-standard, while sched_yield is POSIX The Linux documentation recommends using the standard function. This is the only feature we're currently using that's present in glibc but not in musl.
-
由 Alex Crichton 提交于
-
由 Aaron Turon 提交于
Previously, the `from_bits` function in the `std::bitflags::bitflags` macro was marked as unsafe, as it did not check that the bits being converted actually corresponded to flags. This patch changes the function to check against the full set of possible flags and return an `Option` which is `None` if a non-flag bit is set. It also adds a `from_bits_truncate` function which simply zeros any bits not corresponding to a flag. This addresses the concern raised in https://github.com/mozilla/rust/pull/13897
-
由 Kevin Ballard 提交于
If a vector element fails in Drop, Vec needs to make sure it doesn't try to re-drop any elements it already dropped.
-
由 Corey Richardson 提交于
Fixes #14188
-
由 Brian Anderson 提交于
After discussion with Alex, we think the proper policy is for dtors to not fail. This is consistent with C++. BufferedWriter already does this, so this patch modifies TempDir to not fail in the dtor, adding a `close` method for handling errors on destruction.
-
由 Alex Crichton 提交于
The current suite of benchmarks for the standard distribution take a significant amount of time to run, but it's unclear whether we're gaining any benefit from running them. Some specific pain points: * No one is looking at the data generated by the benchmarks. We have no graphs or analysis of what's happening, so all the data is largely being cast into the void. * No benchmark has ever uncovered a bug, they have always run successfully. * Benchmarks not only take a significant amount of time to run, but also take a significant amount of time to compile. I don't think we should mitigate this for now because it's useful to ensure that they do indeed still compile. This commit disables --bench test runs by default as part of `make check`, flipping the NO_BENCH environment variable to a PLEASE_BENCH variable which will manually enable benchmarking. If and when a dedicated bot is set up for benchmarking, this flag can be enabled on that bot.
-
由 bors 提交于
This allows writing a regex to filter tests more precisely, rather than having to list long paths e.g. ``` $ ./stdtest-x86_64-unknown-linux-gnu 'vec.*clone' running 2 tests test vec::tests::test_clone ... ok test vec::tests::test_clone_from ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured ``` The regex change is fully backwards compatible, since test names are Rust identifiers + `:`, and hence not special regex characters. (See commits for details.)
-
- 15 5月, 2014 32 次提交
-
-
由 bors 提交于
## Process API The existing APIs for spawning processes took strings for the command and arguments, but the underlying system may not impose utf8 encoding, so this is overly limiting. The assumption we actually want to make is just that the command and arguments are viewable as [u8] slices with no interior NULLs, i.e., as CStrings. The ToCStr trait is a handy bound for types that meet this requirement (such as &str and Path). However, since the commands and arguments are often a mixture of strings and paths, it would be inconvenient to take a slice with a single T: ToCStr bound. So this patch revamps the process creation API to instead use a builder-style interface, called `Command`, allowing arguments to be added one at a time with differing ToCStr implementations for each. The initial cut of the builder API has some drawbacks that can be addressed once issue #13851 (libstd as a facade) is closed. These are detailed as FIXMEs. ## Dynamic library API `std::unstable::dynamic_library::open_external` currently takes a `Path`, but because `Paths` produce normalized strings, this can change the semantics of lookups in a given environment. This patch generalizes the function to take a `ToCStr`-bounded type, which includes both `Path`s and `str`s. ## ToCStr API Adds ToCStr impl for &Path and ~str. This is a stopgap until DST (#12938) lands. Until DST lands, we cannot decompose &str into & and str, so we cannot usefully take ToCStr arguments by reference (without forcing an additional & around &str). So we are instead temporarily adding an instance for &Path and ~str, so that we can take ToCStr as owned. When DST lands, the &Path instance should be removed, the string instances should be revisted, and arguments bound by ToCStr should be passed by reference. FIXMEs have been added accordingly. ## Tickets closed Closes #11650. Closes #7928.
-
由 bors 提交于
-
由 Huon Wilson 提交于
The compiler needs to be opening e.g. libregex in the correct directory, which requires getting these in the right order.
-
由 Huon Wilson 提交于
Previously the longer hand-written usage string was never being printed: theoretically it was trying to detect when precisely `--help` was passed (but not `-h`), but the getopts framework was considering a check for the presence of `-h` to be a check for that of `--help` too, i.e. the code was always going through the `-h` path. This changes it to print the extended usage for both `-h` and `--help`, meaning that it does actually appear correctly.
-
由 Huon Wilson 提交于
This is fully backwards compatible, since test names are Rust identifiers + `:`, and hence not special regex characters. Fixes #2866.
-
由 Huon Wilson 提交于
This is far cheaper than the `.to_str` technique that was used previously.
-
由 bors 提交于
Submitting PR again, because I cannot reopen #13349, and github does not attach new patch to that PR. ======= Optimize `Once::doit`: perform optimistic check that initializtion is already completed. `load` is much cheaper than `fetch_add` at least on x86_64. Verified with this test: ``` static mut o: one::Once = one::ONCE_INIT; unsafe { loop { let start = time::precise_time_ns(); let iters = 50000000u64; for _ in range(0, iters) { o.doit(|| { println!("once!"); }); } let end = time::precise_time_ns(); let ps_per_iter = 1000 * (end - start) / iters; println!("{} ps per iter", ps_per_iter); // confuse the optimizer o.doit(|| { println!("once!"); }); } } ``` Test executed on Mac, Intel Core i7 2GHz. Result is: * 20ns per iteration without patch * 4ns per iteration with this patch applied Once.doit could be even faster (800ps per iteration), if `doit` function was split into a pair of `doit`/`doit_slow`, and `doit` marked as `#[inline]` like this: ``` #[inline(always)] pub fn doit(&self, f: ||) { if self.cnt.load(atomics::SeqCst) < 0 { return } self.doit_slow(f); } fn doit_slow(&self, f: ||) { ... } ```
-
由 bors 提交于
Teach SVH computation to ignore more implementation artifacts. In particular, this version of strict version hash (SVH) works much like the deriving(Hash)-based implementation did, except that it deliberately: 1. skips over content known not affect the generated crates, and, 2. uses a content-based hash for names instead of using the value of the `Name` index itself, which can differ depending on the order in which strings are interned (which in turn is affected by e.g. the presence of `--cfg` options on the command line). Fix #14132.
-
由 Felix S. Klock II 提交于
(Only after adding the tests did I realize that this is not really a special case at the AST level; as far as the visitor is concerned, `int` and `i32` and `i64` are just idents.)
-
由 Felix S. Klock II 提交于
Namely: non-pub `use` declarations *are* significant to the SVH computation, since they can change which traits are part of the method resolution step, and thus affect which methods get called from the (potentially inlined) code.
-
由 Felix S. Klock II 提交于
-
由 Felix S. Klock II 提交于
In particular, this version of strict version hash (SVH) works much like the deriving(Hash)-based implementation did, except that uses a content-based hash that filters rustc implementation artifacts and surface syntax artifacts. Fix #14132.
-
由 Felix S. Klock II 提交于
drive-by: added some doc.
-
由 bors 提交于
Instead of just blindly printing arg[0], use a constant string. Partial fix for #13582
-
由 Aaron Turon 提交于
`std::unstable::dynamic_library::open_external` currently takes a `Path`, but because `Paths` produce normalized strings, this can change the semantics of lookups in a given environment. This patch generalizes the function to take a `ToCStr`-bounded type, which includes both `Path`s and `str`s. Closes #11650.
-
由 Aaron Turon 提交于
The existing APIs for spawning processes took strings for the command and arguments, but the underlying system may not impose utf8 encoding, so this is overly limiting. The assumption we actually want to make is just that the command and arguments are viewable as [u8] slices with no interior NULLs, i.e., as CStrings. The ToCStr trait is a handy bound for types that meet this requirement (such as &str and Path). However, since the commands and arguments are often a mixture of strings and paths, it would be inconvenient to take a slice with a single T: ToCStr bound. So this patch revamps the process creation API to instead use a builder-style interface, called `Command`, allowing arguments to be added one at a time with differing ToCStr implementations for each. The initial cut of the builder API has some drawbacks that can be addressed once issue #13851 (libstd as a facade) is closed. These are detailed as FIXMEs. Closes #11650. [breaking-change]
-
由 Aaron Turon 提交于
This is a stopgap until DST (#12938) lands. Until DST lands, we cannot decompose &str into & and str, so we cannot usefully take ToCStr arguments by reference (without forcing an additional & around &str). So we are instead temporarily adding an instance for &Path and StrBuf, so that we can take ToCStr as owned. When DST lands, the &Path instance should be removed, the string instances should be revisted, and arguments bound by ToCStr should be passed by reference. FIXMEs have been added accordingly.
-
由 bors 提交于
Also Show, which is useful in assertions. Fixes #14074
-
由 bors 提交于
r? @brson
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-
由 Patrick Walton 提交于
-