about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-07-30Remove the unstable std_unicode crate, deprecated since 1.27Simon Sapin-1/+0
Its former contents are now in libcore.
2018-07-30Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and ↵Colin Finck-14/+466
port libstd to it. As a start, the port uses the simplest possible configuration (no jemalloc, abort on panic) and makes use of existing Unix-specific code wherever possible. It adds targets for x86_64 (current main HermitCore platform) and aarch64 (HermitCore platform under development). Together with the patches to "liblibc" and "llvm", this enables HermitCore applications to be written in Rust.
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-1/+1
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-30Don't commit thread stack on WindowsXidorn Quan-1/+4
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-11/+8
Replace push loops with extend() where possible Or set the vector capacity where I couldn't do it. According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop: 10 elements (6.1 times faster): ``` test bench_extension ... bench: 75 ns/iter (+/- 23) test bench_push_loop ... bench: 458 ns/iter (+/- 142) ``` 100 elements (11.12 times faster): ``` test bench_extension ... bench: 87 ns/iter (+/- 26) test bench_push_loop ... bench: 968 ns/iter (+/- 3,528) ``` 1000 elements (11.04 times faster): ``` test bench_extension ... bench: 311 ns/iter (+/- 9) test bench_push_loop ... bench: 3,436 ns/iter (+/- 233) ``` Seems like a good idea to use `extend` as much as possible.
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-11/+8
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-2/+2
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-29Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakisbors-2/+1
Misc cleanups
2018-07-28Don't format!() string literalsljedrz-1/+1
2018-07-28Rollup merge of #52759 - stjepang:impl-send-sync-for-joinhandle, r=TimNNkennytm-0/+5
Impl Send & Sync for JoinHandle This is just a cosmetic change - it slightly relaxes and clarifies the public API without effectively promising any new guarantees. Currently we have [these auto trait implementations](https://doc.rust-lang.org/nightly/std/thread/struct.JoinHandle.html#synthetic-implementations): ```rust impl<T: Send> Send for JoinHandle<T> {} impl<T: Sync> Sync for JoinHandle<T> {} ``` Bound `T: Send` doesn't make much sense because `JoinHandle<T>` can be created only when `T: Send`. Note that [`JoinHandle::<T>::join`](https://doc.rust-lang.org/nightly/std/thread/struct.JoinHandle.html#method.join) doesn't require `T: Send` so why should the `Send` impl? And the `Sync` impl doesn't need `T: Sync` because `JoinHandle<T>` cannot even share `T` - it can only send it to the thread that calls `join`.
2018-07-27Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrumbors-116/+116
Rollup of bare_trait_objects PRs All deny attributes were moved into bootstrap so they can be disabled with a line of config. Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free. r? @Mark-Simulacrum cc @ljedrz @kennytm
2018-07-27Use str::repeatShotaro Yamada-2/+1
2018-07-27Fix wsAleksey Kladov-1/+1
2018-07-27Clarify thread::park semanticsAleksey Kladov-1/+4
2018-07-27Prefer to_string() to format!()ljedrz-2/+2
2018-07-27Add stability attributesStjepan Glavina-0/+2
2018-07-27Impl Send & Sync for JoinHandleStjepan Glavina-0/+3
2018-07-26State default capacity for BufReader/BufWriterJonathan Behrens-2/+4
2018-07-25Deny bare_trait_objects globallyTatsuyuki Ishi-1/+0
2018-07-25Merge remote-tracking branches 'ljedrz/dyn_libcore', 'ljedrz/dyn_libstd' and ↵Tatsuyuki Ishi-114/+115
'ljedrz/dyn_libterm' into dyn-rollup
2018-07-25Add missing dynTatsuyuki Ishi-2/+2
2018-07-24Rollup merge of #52658 - Wallacoloo:topics/use-option-methods, r=cramertjMark Rousskov-13/+6
Prefer `Option::map`/etc over `match` wherever it improves clarity This isn't intended to change behavior anywhere. A lot of times statements like `match x { None => None, Some(y) => [...] }` can be rewritten using `Option::map` or `Option::and_then` in a way that preserves or improves clarity, so that's what I've done here. I think it's particularly valuable to keep things in `libcore` and `libstd` pretty/idiomatic since it's not uncommon to follow the `[src]` links when browsing the rust-lang.org docs for std/core. If there's any concern about pushing style-based changes though, I'll happily back out the non-std/core commits here.
2018-07-24Rollup merge of #52656 - jD91mZM2:stablize-uds, r=alexcrichtonMark Rousskov-1/+41
Stablize Redox Unix Sockets I don't know if I did this correctly, but I basically spammed the `#[stable]` attribute everywhere :^)
2018-07-24Auto merge of #52646 - ljedrz:single_char_pattern, r=michaelwoeristerbors-3/+3
Change single char str patterns to chars A `char` is faster.
2018-07-23libstd: Prefer `Option::map`/etc over `match` where applicableColin Wallace-13/+6
2018-07-24Stablize Redox Unix SocketsjD91mZM2-1/+41
2018-07-24Rollup merge of #52548 - tko:cursor-doc, r=sfacklerkennytm-8/+9
Cursor: update docs to clarify Cursor only works with in-memory buffers Reduce misconceptions about Cursor being more general than it really is. Fixes: #52470
2018-07-23Seperate summaries from rest of the commentMarkus Wein-0/+2
2018-07-23Change single char str patterns to charsljedrz-3/+3
2018-07-23Rollup merge of #52582 - felixrabe:patch-2, r=pietroalbinikennytm-1/+1
Typo
2018-07-23Rollup merge of #52581 - petrochenkov:bmacrodoc, r=alexcrichtonkennytm-17/+17
Avoid using `#[macro_export]` for documenting builtin macros Use a special `rustc_*` attribute instead. cc https://github.com/rust-lang/rust/pull/52234
2018-07-22Auto merge of #52394 - estebank:println, r=oli-obkbors-4/+18
Improve suggestion for missing fmt str in println Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal. Fix #52347.
2018-07-21fix tidy ~ againEsteban Küber-13/+0
2018-07-21Don't use the new `eprintln` for stage0 and stage1Esteban Küber-2/+2
I'm not entirely sure why (or if) this is needed.
2018-07-21Change `eprintln!()`Esteban Küber-2/+9
Address #30143 as well. `writeln!()` hasn't been changed.
2018-07-21Gate `format_args_nll` behind feature flagEsteban Küber-1/+1
2018-07-21TypoFelix Rabe-1/+1
2018-07-21Auto merge of #52535 - alexcrichton:update-stdsimd, r=Mark-Simulacrumbors-4/+0
Update stdsimd to undo an accidental stabilization Closes #52403
2018-07-20Update stdsimd to undo an accidental stabilizationAlex Crichton-4/+0
Closes #52403
2018-07-21Avoid using `#[macro_export]` for documenting builtin macrosVadim Petrochenkov-17/+17
2018-07-19rework printlnEsteban Küber-2/+24
2018-07-19Same change as `println` for `eprintln`Esteban Küber-2/+1
2018-07-19review comments: modify note wording and change `println`Esteban Küber-8/+1
- Don't print the newline on its own to avoid the possibility of printing it out of order due to `stdout` locking. - Modify wording of `concat!()` with non-literals to not mislead into believing that only `&str` literals are accepted. - Add test for `concat!()` with non-literals.
2018-07-19Improve suggestion for missing fmt str in printlnEsteban Küber-2/+8
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal.
2018-07-20Auto merge of #52349 - RalfJung:once, r=alexcrichtonbors-2/+10
sync::Once use release-acquire access modes Nothing here makes a case distinction like "this happened before OR after that". All we need is to get happens-before edges whenever we see that the state/signal has been changed. Release-acquire is good enough for that.
2018-07-19Cursor: update docs to clarify Cursor only works with in-memory buffersTommi Komulainen-8/+9
Reduce misconceptions about Cursor being more general than it really is. Fixes: #52470
2018-07-19Rollup merge of #51628 - euclio:line-writer, r=frewsxcvkennytm-10/+23
use checked write in `LineWriter` example The example was wrong because it didn't check the return value of `write()`, and it didn't flush the buffer before comparing the contents of the file. Fixes #51621.
2018-07-17sync::Once: Use Acquire on the hot path, and explain why we don't use it ↵Ralf Jung-2/+10
elsewhere
2018-07-17Fix doc comment: use `?` instead of `.unwrap()`Felix Rabe-1/+1
2018-07-16Document From conversions for CString and CStrMarkus Wein-0/+25