about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2018-03-27Rollup merge of #49399 - ehuss:termcolor-update, r=alexcrichtonkennytm-6/+6
Fix diagnostic colors on Windows 10 console. This updates termcolor to pick up BurntSushi/ripgrep#867. Fixes #49322.
2018-03-27Rollup merge of #49395 - petrochenkov:obsolete, r=alexcrichtonkennytm-74/+0
libsyntax: Remove obsolete.rs This little piece of infra is obsolete (ha-ha) and is unlikely to be used in the future, even if new obsolete syntax appears.
2018-03-27Rollup merge of #49381 - withoutboats:str_unicode, r=SimonSapinkennytm-2/+42
Add is_whitespace and is_alphanumeric to str. The other methods from `UnicodeStr` are already stable inherent methods on str, but these have not been included. r? @SimonSapin
2018-03-27Rollup merge of #49369 - petrochenkov:rprint, r=oli-obkkennytm-12/+19
Fix pretty-printing for raw identifiers
2018-03-27Rollup merge of #49333 - GuillaumeGomez:link-assoc-const, r=QuietMisdreavuskennytm-8/+32
Fix impl assoc constant link not working Fixes #49323. r? @QuietMisdreavus
2018-03-27Rollup merge of #49223 - GuillaumeGomez:propose-variant-for-E0599, r=cramertjkennytm-2/+19
Propose a variant if it is an enum for E0599 Fixes #49192.
2018-03-27Rollup merge of #48639 - varkor:sort_by_key-cached, r=blusskennytm-13/+111
Add slice::sort_by_cached_key as a memoised sort_by_key At present, `slice::sort_by_key` calls its key function twice for each comparison that is made. When the key function is expensive (which can often be the case when `sort_by_key` is chosen over `sort_by`), this can lead to very suboptimal behaviour. To address this, I've introduced a new slice method, `sort_by_cached_key`, which has identical semantic behaviour to `sort_by_key`, except that it guarantees the key function will only be called once per element. Where there are `n` elements and the key function is `O(m)`: - `slice::sort_by_cached_key` time complexity is `O(m n log m n)`, compared to `slice::sort_by_key`'s `O(m n + n log n)`. - `slice::sort_by_cached_key` space complexity remains at `O(n + m)`. (Technically, it now reserves a slice of size `n`, whereas before it reserved a slice of size `n/2`.) `slice::sort_unstable_by_key` has not been given an analogue, as it is important that unstable sorts are in-place, which is not a property that is guaranteed here. However, this also means that `slice::sort_unstable_by_key` is likely to be slower than `slice::sort_by_cached_key` when the key function does not have negligible complexity. We might want to explore this trade-off further in the future. Benchmarks (for a vector of 100 `i32`s): ``` # Lexicographic: `|x| x.to_string()` test bench_sort_by_key ... bench: 112,638 ns/iter (+/- 19,563) test bench_sort_by_cached_key ... bench: 15,038 ns/iter (+/- 4,814) # Identity: `|x| *x` test bench_sort_by_key ... bench: 1,346 ns/iter (+/- 238) test bench_sort_by_cached_key ... bench: 1,839 ns/iter (+/- 765) # Power: `|x| x.pow(31)` test bench_sort_by_key ... bench: 3,624 ns/iter (+/- 738) test bench_sort_by_cached_key ... bench: 1,997 ns/iter (+/- 311) # Abs: `|x| x.abs()` test bench_sort_by_key ... bench: 1,546 ns/iter (+/- 174) test bench_sort_by_cached_key ... bench: 1,668 ns/iter (+/- 790) ``` (So it seems functions that are single operations do perform slightly worse with this method, but for pretty much any more complex key, you're better off with this optimisation.) I've definitely found myself using expensive keys in the past and wishing this optimisation was made (e.g. for https://github.com/rust-lang/rust/pull/47415). This feels like both desirable and expected behaviour, at the small cost of slightly more stack allocation and minute degradation in performance for extremely trivial keys. Resolves #34447.
2018-03-27Auto merge of #49249 - gnzlbg:simd_minmax, r=alexcrichtonbors-1/+148
implement minmax intrinsics This adds the `simd_{fmin,fmax}` intrinsics, which do a vertical (lane-wise) `min`/`max` for floating point vectors that's equivalent to Rust's `min`/`max` for `f32`/`f64`. It might make sense to make `{f32,f64}::{min,max}` use the `minnum` and `minmax` intrinsics as well. --- ~~HELP: I need some help with these. Either I should go to sleep or there must be something that I must be missing. AFAICT I am calling the `maxnum` builder correctly, yet rustc/LLVM seem to insert a call to `llvm.minnum` there instead...~~ EDIT: Rust's LLVM version is too old :/
2018-03-26Fix diagnostic colors on Windows 10 console.Eric Huss-6/+6
This updates termcolor to pick up BurntSushi/ripgrep#867. Fixes #49322.
2018-03-27libsyntax: Remove obsolete.rsVadim Petrochenkov-74/+0
2018-03-26Remove mentions of unstable sort_by_cached key from stable documentationvarkor-8/+0
2018-03-26Auto merge of #49053 - alexcrichton:fail-if-build-cargo-twice, r=Mark-Simulacrumbors-238/+347
rustbuild: Fail the build if we build Cargo twice This commit updates the `ToolBuild` step to stream Cargo's JSON messages, parse them, and record all libraries built. If we build anything twice (aka Cargo) it'll most likely happen due to dependencies being recompiled which is caught by this check.
2018-03-27Fix pretty-printing for raw identifiersVadim Petrochenkov-12/+19
2018-03-26rustbuild: Fail the build if we build Cargo twiceAlex Crichton-238/+347
This commit updates the `ToolBuild` step to stream Cargo's JSON messages, parse them, and record all libraries built. If we build anything twice (aka Cargo) it'll most likely happen due to dependencies being recompiled which is caught by this check.
2018-03-26Auto merge of #49101 - mark-i-m:stabilize_i128, r=nagisabors-300/+105
Stabilize 128-bit integers :tada: cc #35118 EDIT: This should be merged only after the following have been merged: - [x] https://github.com/rust-lang-nursery/compiler-builtins/pull/236 - [x] https://github.com/rust-lang/book/pull/1230
2018-03-26Auto merge of #49379 - TimNN:rollup, r=TimNNbors-37/+181
Rollup of 7 pull requests - Successful merges: #48693, #48932, #49103, #49170, #49187, #49346, #49353 - Failed merges:
2018-03-26Remove unnecessary trait import.boats-2/+0
2018-03-26fix last two tidyMark Mansi-13/+2
2018-03-26did i get it right now?Mark Mansi-0/+0
2018-03-26Update to master of libcompiler_builtinsMark Mansi-0/+0
2018-03-26Remove library feature testMark Mansi-17/+0
2018-03-26Fix e0658 ui testMark Mansi-7/+12
2018-03-26update testMark Mansi-7/+7
2018-03-26Fix a few more unstables that I missedMark Mansi-2/+2
2018-03-26Fix a few moreMark Mansi-4/+4
2018-03-26Fix missed i128 feature gatesMark Mansi-66/+19
2018-03-26remove unneeded importMark Mansi-1/+1
2018-03-26Rename unstable book correctlyMark Mansi-3/+3
2018-03-26Rename unstable-book chapterMark Mansi-0/+0
2018-03-26Stabilize i128 feature tooMark Mansi-29/+21
2018-03-26Update nightly bookMark Mansi-13/+6
2018-03-26Stabilize i128_typeMark Mansi-147/+37
2018-03-26Add is_whitespace and is_alphanumeric to str.boats-0/+42
The other methods from `UnicodeStr` are already stable inherent methods on str, but these have not been included.
2018-03-26Rollup merge of #49353 - chisophugis:patch-1, r=Mark-SimulacrumTim Neumann-5/+5
Fix confusing doc for `scan` The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state". I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.
2018-03-26Rollup merge of #49346 - Diggsey:hashmap-get-pair, r=Mark-SimulacrumTim Neumann-0/+55
Implement get_key_value for HashMap, BTreeMap Fixes #43143 Follow up from #46992
2018-03-26Rollup merge of #49187 - alexcrichton:no-cross-docs, r=kennytmTim Neumann-26/+33
rustbuild: Disable docs on cross-compiled builds This commit disables building documentation on cross-compiled compilers, for example ARM/MIPS/PowerPC/etc. Currently I believe we're not getting much use out of these documentation artifacts and they often take 10-15 minutes total to build as it requires building rustdoc/rustbook and then also generating all the documentation, especially for the reference and the book itself. In an effort to cut down on the amount of work that we're doing on dist CI builders in light of recent timeouts this was some relatively low hanging fruit to cut which in theory won't have much impact on the ecosystem in the hopes that the documentation isn't used too heavily anyway. While initial analysis in #48827 showed only shaving 5 minutes off local builds the same 5 minute conclusion was drawn from #48826 which ended up having nearly a half-hour impact on the bots. In that sense I'm hoping that we can land this and test out what happens on CI to see how it affects timing. Note that all tier 1 platforms, Windows, Mac, and Linux, will continue to generate documentation.
2018-03-26Rollup merge of #49170 - steveklabnik:gh49127, r=nagisaTim Neumann-2/+5
Clarify AcqRel's docs This implied things that are not true. Fixes #49127
2018-03-26Rollup merge of #49103 - glandium:uninitialized, r=cramertjTim Neumann-1/+1
Use an uninitialized buffer in GenericRadix::fmt_int, like in Display::fmt for numeric types The code using a slice of that buffer is only ever going to use bytes that are subsequently initialized.
2018-03-26Rollup merge of #48932 - Phlosioneer:43601-document-opaque-size, r=KodrAusTim Neumann-0/+24
Document when types have OS-dependent sizes As per issue #43601, types that can change size depending on the target operating system should say so in their documentation. I used this template when adding doc comments: ``` The size of a(n) <name> struct may vary depending on the target operating system, and may change between Rust releases. ``` For enums, I used "instance" instead of "struct". I added documentation to these types: ``` - std::time::Instant (contains sys::time::Instant) - std::time::SystemTime (contains sys::time::SystemTime) - std::io::StdinRaw (contains sys::stdio::Stdin) - std::io::StdoutRaw (contains sys::stdio::Stdout) - std::io::Stderr (contains sys::stdio::Stderr) - std::net::addr::SocketAddrV4 (contains sys::net::netc::sockaddr_in) - std::net::addr::SocketAddrV6 (contains sys::net::netc::sockaddr_in6) - std::net::addr::SocketAddr (contains std::net::addr::SocketAddrV4 and SocketAddrV6) - std::net::ip::Ipv4Addr (contains sys::net::netc::in_addr) - std::net::ip::Ipv6Addr (contains sys::net::netc::in6_addr) - std::net::ip::IpAddr (contains std::net::ip::Ipv4Addr and Ipv6Addr) ``` I also found that these types varied in size; however, I don't think they need documentation, as it's already fairly obvious that they change based on different OS's: ``` - std::fs::DirBuilder (contains sys::fs::DirBuilder) - std::fs::FileType (contains sys::fs::FileType) - std::fs::Permissions (contains sys::fs::FilePermissions) - std::fs::OpenOptions (contains sys::fs::OpenOptions) - std::fs::DirEntry (contains sys::fs::DirEntry) - std::fs::ReadDir (contains sys::fs::ReadDir) - std::fs::Metadata (contains sys::fs::FileAttr) - std::fs::File (contains sys::fs::File) - std::process::Child (contains sys::process::Process) - std::process::ChildStdin (contains sys::process::AnonPipe) - std::process::ChildStdout (contains sys::process::AnonPipe) - std::process::ChildStderr (contains sys::process::AnonPipe) - std::process::Command (contains sys::process::Command) - std::process::Stdio (contains sys::process::Stdio) - std::process::ExitStatus (contains sys::process::ExitStatus) - std::process::Output (contains std::process::ExitStatus) - std::sys_common::condvar::Condvar (contains sys::condvar::Condvar) - std::sys_common::mutex::Mutex (contains sys::mutex::Mutex) - std::sys_common::net::LookupHost (contains sys::net::netc::addrinfo) - std::sys_common::net::TcpStream (contains sys::net::Socket) - std::sys_common::net::TcpListener (contains sys::net::Socket) - std::sys_common::net::UdpSocket (contains sys::net::Socket) - std::sys_common::remutex::ReentrantMutex (contains sys::mutex::ReentrantMutex) - std::sys_common::rwlock::RWLock (contains sys::rwlock::RWLock) - std::sys_common::thread_local::Key (contains sys::thread_local::Key) ``` Maybe we should just put a comment about the size of structs in the module-level docs for `fs`, `process`, and `sys_common`? If anyone can think of other types that can change size, comment below. I'm also open to changing the wording. closes #43601.
2018-03-26Rollup merge of #48693 - vorner:doc-name-resolution, r=petrochenkovTim Neumann-3/+58
Some comments and documentation for name resolution crate Hello I'm trying to get a grasp of how the name resolution crate works, as part of helping with https://github.com/rust-lang-nursery/rustc-guide/issues/16. Not that I'd be succeeding much, but as I was reading the code, I started to put some notes into it, to help me understand. I guess I didn't get very far yet, but I'd like to share what I have, in case it might be useful for someone else. I hope these are correct (even if incomplete), but I'll be glad for a fast check in case I put something misleading there.
2018-03-26Auto merge of #48346 - emilio:pgo, r=alexcrichtonbors-10/+212
Add basic PGO support. This PR adds two mutually exclusive options for profile usage and generation using LLVM's instruction profile generation (the same as clang uses), `-C pgo-use` and `-C pgo-gen`. See each commit for details.
2018-03-26Auto merge of #49255 - cramertj:stable-impl-trait, r=nikomatsakisbors-361/+87
Stabilize impl Trait Blocked on: - [x] https://github.com/rust-lang/rust/pull/49041 and - [ ] completion of FCP in https://github.com/rust-lang/rust/issues/34511#issuecomment-373207183 (3 days from now). I have not yet done any docs work for this-- I probably won't get to it until this weekend (might be a project for the flight to the all-hands).
2018-03-26Stabilize conservative_impl_traitTaylor Cramer-258/+77
2018-03-26fix testsgnzlbg-2/+3
2018-03-26set min-llvm-version 6.0, ignore-emscriptengnzlbg-0/+4
2018-03-26properly handle the case when LLVM does not have min/maxnumgnzlbg-2/+6
2018-03-26require llvm 6gnzlbg-2/+17
2018-03-26add testsgnzlbg-0/+95
2018-03-26implement minmax intrinsicsgnzlbg-1/+29
2018-03-25rustbuild: Disable docs on cross-compiled buildsAlex Crichton-26/+33
This commit disables building documentation on cross-compiled compilers, for example ARM/MIPS/PowerPC/etc. Currently I believe we're not getting much use out of these documentation artifacts and they often take 10-15 minutes total to build as it requires building rustdoc/rustbook and then also generating all the documentation, especially for the reference and the book itself. In an effort to cut down on the amount of work that we're doing on dist CI builders in light of recent timeouts this was some relatively low hanging fruit to cut which in theory won't have much impact on the ecosystem in the hopes that the documentation isn't used too heavily anyway. While initial analysis in #48827 showed only shaving 5 minutes off local builds the same 5 minute conclusion was drawn from #48826 which ended up having nearly a half-hour impact on the bots. In that sense I'm hoping that we can land this and test out what happens on CI to see how it affects timing. Note that all tier 1 platforms, Windows, Mac, and Linux, will continue to generate documentation.