about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
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
2018-07-16Document From conversions for OsString and OsStrMarkus Wein-0/+21
2018-07-14Rollup merge of #52156 - zajlerke:update-deprecation-notice, r=Kimundikennytm-10/+30
Update std::ascii::ASCIIExt deprecation notes Fixes #52085
2018-07-13Fix redox libstd leftoverTatsuyuki Ishi-2/+2
2018-07-13Auto merge of #52281 - cramertj:fast-tls, r=alexcrichtonbors-6/+1
Use fast TLS on Fuchsia I'm not sure why Fuchsia was separated here, but we provide these symbols, and tests are passing in QEMU with this change. cc @raphlinus. r? @alexcrichton
2018-07-12Rollup merge of #52298 - RalfJung:dirs, r=Mark-Simulacrumkennytm-1/+1
make reference to dirs crate clickable in terminals Currently I have to copy-paste the link; with this change I can just click it right in my terminal window.
2018-07-12Rollup merge of #52277 - kraai:patch-2, r=kennytmkennytm-1/+1
Uncapitalize "If"
2018-07-12Rollup merge of #51912 - mbrubeck:more_box_slice_clone, r=alexcrichtonkennytm-0/+24
impl Clone for Box<CStr>, Box<OsStr>, Box<Path> Implements #51908.
2018-07-12make reference to dirs crate clickable in terminalsRalf Jung-1/+1
2018-07-11Use fast TLS on FuchsiaTaylor Cramer-6/+1
2018-07-11Uncapitalize "If"Matt Kraai-1/+1
2018-07-11simplify assertionsAndy Russell-5/+4
2018-07-11Rollup merge of #52239 - CAD97:patch-1, r=alexcrichtonMark Rousskov-6/+6
Remove sync::Once::call_once 'static bound See https://internals.rust-lang.org/t/sync-once-per-instance/7918 for more context. Suggested r is @alexcrichton, the one who added the `'static` bound back in 2014. I don't want to officially r? though, if the system would even let me. I'd rather let the system choose the appropriate member since it knows more than I do. `git blame` history for `sync::Once::call_once`'s signature: - [std: Second pass stabilization of sync](https://github.com/rust-lang/rust/commit/f3a7ec7028c76b3a1c6051131328f372b068e33a) (Dec 2014) ```diff - pub fn doit<F>(&'static self, f: F) where F: FnOnce() { + #[stable] + pub fn call_once<F>(&'static self, f: F) where F: FnOnce() { ``` - [libstd: use unboxed closures](https://github.com/rust-lang/rust/commit/cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b) (Dec 2014) ```diff - pub fn doit(&'static self, f: ||) { + pub fn doit<F>(&'static self, f: F) where F: FnOnce() { ``` - [std: Rewrite the `sync` module](https://github.com/rust-lang/rust/commit/71d4e77db8ad4b6d821da7e5d5300134ac95974e) (Nov 2014) ```diff - pub fn doit(&self, f: ||) { + pub fn doit(&'static self, f: ||) { ``` > ```text > The second layer is the layer provided by `std::sync` which is intended to be > the thinnest possible layer on top of `sys_common` which is entirely safe to > use. There are a few concerns which need to be addressed when making these > system primitives safe: > > * Once used, the OS primitives can never be **moved**. This means that they > essentially need to have a stable address. The static primitives use > `&'static self` to enforce this, and the non-static primitives all use a > `Box` to provide this guarantee. > ``` The author of this diff is @alexcrichton. `sync::Once` now contains only a pointer to (privately hidden) `Waiter`s, which are all stack-allocated. The `'static` bound to `sync::Once` is thus unnecessary to guarantee that any OS primitives are non-relocatable. As the `'static` bound is not required for `sync::Once`'s operation, removing it is strictly more useful. As an example, it allows attaching a one-time operation to instances rather than only to global singletons.
2018-07-11Auto merge of #51553 - jD91mZM2:uds, r=sfacklerbors-1/+740
Unix sockets on redox This is done using the ipcd daemon. It's not exactly like unix sockets because there is not actually a physical file for the path, but it's close enough for a basic implementation :) This allows mio-uds and tokio-uds to work with a few modifications as well, which is exciting!
2018-07-11Add missing dyn in testsljedrz-9/+9
2018-07-10remove sync::Once::call_once 'staticChristopher Durham-6/+6
- [std: Rewrite the `sync` modulehttps://github.com/rust-lang/rust/commit/71d4e77db8ad4b6d821da7e5d5300134ac95974e) (Nov 2014) ```diff - pub fn doit(&self, f: ||) { + pub fn doit(&'static self, f: ||) { ``` > ```text > The second layer is the layer provided by `std::sync` which is intended to be > the thinnest possible layer on top of `sys_common` which is entirely safe to > use. There are a few concerns which need to be addressed when making these > system primitives safe: > > * Once used, the OS primitives can never be **moved**. This means that they > essentially need to have a stable address. The static primitives use > `&'static self` to enforce this, and the non-static primitives all use a > `Box` to provide this guarantee. > ``` The author of this diff is @alexcrichton. `sync::Once` contains only a pointer to (privately hidden) `Waiter`s, which are all stack-allocated. The `'static` bound to `sync::Once` is thus unnecessary to guarantee that any OS primitives are non-relocatable. See https://internals.rust-lang.org/t/sync-once-per-instance/7918 for more context.
2018-07-10Add missing `dyn` for cloudabi, redox, unix and wasmljedrz-7/+7
2018-07-10Deny bare trait objects in `src/libstd`.ljedrz-98/+99
2018-07-09Implement #[alloc_error_handler]Simon Sapin-2/+4
This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the alloc crate without the std crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
2018-07-09Remove `extern` on the `pub fn rust_oom` lang item in libstd, to match ABI ↵Simon Sapin-1/+1
of the declaration in liballoc This turned out to be important on Windows. Calling `handle_alloc_error(Layout::new::<[u8; 42]>())` caused: ``` Exception thrown at 0x00007FF7C70DC399 in a.exe: 0xC0000005: Access violation reading location 0x000000000000002A. ``` 0x2A equals 42, so it looks like the `Layout::size` field of type `usize` was interpreted as a pointer to read from.
2018-07-09Auto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichtonbors-16/+42
Add the `alloc::prelude` module It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`. Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example. This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480.