summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2018-12-03Rollup merge of #56419 - mark-i-m:remove-try, r=Centrilkennytm-5/+5
Remove some uses of try!
2018-12-02Auto merge of #56275 - RalfJung:win-mutex, r=SimonSapinbors-0/+6
use MaybeUninit instead of mem::uninitialized for Windows Mutex I hope this builds, I do not have a Windows machine to test...
2018-12-02let FIXME refer to tracking issueRalf Jung-2/+2
2018-12-01remove some uses of try!Mark Mansi-5/+5
2018-12-01Auto merge of #56165 - RalfJung:drop-glue-type, r=eddyb,nikomatsakisbors-2/+12
drop glue takes in mutable references, it should reflect that in its type When drop glue begins, it should retag, like all functions taking references do. But to do that, it needs to take the reference at a proper type: `&mut T`, not `*mut T`. Failing to retag can mean that the memory the reference points to remains frozen, and `EscapeToRaw` on a frozen location is a NOP, meaning later mutations cause a Stacked Borrows violation. Cc @nikomatsakis @Gankro because Stacked Borrows Cc @eddyb for the changes to miri argument passing (the intention is to allow passing `*mut [u8]` when `&mut [u8]` is expected and vice versa)
2018-12-01Rollup merge of #55011 - vi:panic_immediate_abort, r=alexcrichtonkennytm-3/+25
Add libstd Cargo feature "panic_immediate_abort" It stop asserts and panics from libstd to automatically include string output and formatting code. Use case: developing static executables smaller than 50 kilobytes, where usual formatting code is excessive while keeping debuggability in debug mode. May resolve #54981.
2018-12-01Rollup merge of #56355 - Zoxc:inline-things, r=michaelwoeristerkennytm-0/+1
Add inline attributes and add unit to CommonTypes
2018-12-01Rollup merge of #56216 - SimonSapin:array-tryfrom-slice, r=withoutboatskennytm-0/+87
Add TryFrom<&[T]> for [T; $N] where T: Copy `TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`. Also add doc examples doing just that.
2018-11-30Fix exceeding line width limitVitaly _Vi Shukela-1/+2
2018-11-30panic_immediate_abort: Fix issues from reviewVitaly _Vi Shukela-7/+6
2018-11-30Add libstd and libcore Cargo features "panic_immediate_abort"Vitaly _Vi Shukela-3/+25
It stop asserts and panics from libstd to automatically include string output and formatting code. Use case: developing static executables smaller than 50 kilobytes, where usual formatting code is excessive while keeping debuggability in debug mode. May resolve #54981.
2018-11-29Add inline attributes and add unit to CommonTypesJohn Kåre Alsaker-0/+1
2018-11-29Auto merge of #49878 - dlrobertson:va_list_pt0, r=eddybbors-0/+185
libcore: Add VaList and variadic arg handling intrinsics ## Summary - Add intrinsics for `va_start`, `va_end`, `va_copy`, and `va_arg`. - Add `core::va_list::VaList` to `libcore`. Part 1 of (at least) 3 for #44930 Comments and critiques are very much welcomed 😄
2018-11-29Rollup merge of #56273 - GuillaumeGomez:iterator-fnmut-missing-link, ↵Guillaume Gomez-1/+2
r=steveklabnik Add missing doc link r? @steveklabnik
2018-11-29Rollup merge of #56236 - frewsxcv:frewsxcv-unsafe-unsafe, r=cramertjGuillaume Gomez-5/+2
Remove unsafe `unsafe` inner function. Within this `Iterator` implementation, a function `unsafe_get` is defined which unsafely allows _unchecked_ indexing of any element in a slice. This should be marked as _unsafe_, but it is not. To address this issue, I removed that inner function.
2018-11-29Rollup merge of #56023 - vorner:doc/atomic-ordering-strip, r=@stjepangGuillaume Gomez-7/+9
atomic::Ordering: Get rid of misleading parts of intro Remove the parts of atomic::Ordering's intro that wrongly claimed that SeqCst prevents all reorderings around it. Closes #55196 This is a (minimal) alternative to #55233. I also wonder if it would be worth adding at least some warnings that atomics are often a footgun/hard to use correctly, similarly like `mem::transmute` or other functions have.
2018-11-28put the MaybeUninit inside the UnsafeCellRalf Jung-3/+0
2018-11-27remove uses of feature gateMark Mansi-1/+0
2018-11-27add comments explaining our uses of get_ref/get_mut for MaybeUninitRalf Jung-0/+9
2018-11-27Add missing doc linkGuillaume Gomez-1/+2
2018-11-26libcore: Add va_list lang item and intrinsicsDan Robertson-0/+185
- Add the llvm intrinsics used to manipulate a va_list. - Add the va_list lang item in order to allow implementing VaList in libcore.
2018-11-26Auto merge of #54668 - RalfJung:use-maybe-uninit, r=SimonSapinbors-52/+53
Use MaybeUninit in libcore All code by @japaric. This re-submits the second half of https://github.com/rust-lang/rust/pull/53508 (the first half is at https://github.com/rust-lang/rust/pull/54667). This is likely the one containing the perf regression.
2018-11-26Remove unsafe `unsafe` inner function.Corey Farwell-5/+2
Within this `Iterator` implementation, a function `unsafe_get` is defined which unsafely allows _unchecked_ indexing of any element in a slice. This should be marked as _unsafe_, but it is not. To address this issue, I removed that inner function.
2018-11-26Auto merge of #55705 - ethanboxx:master, r=SimonSapinbors-1/+24
Make `ParseIntError` and `IntErrorKind` fully public Why would you write nice error types if I can't read them? # Why It can be useful to use `match` with errors produced when parsing strings to int. This would be useful for the `.err_match()` function in my [new crate](https://crates.io/crates/read_input). --- I could also do this for `ParseFloatError` if people think it is a good idea. I am new around hear so please tell me if I am getting anything wrong.
2018-11-25Add TryFrom<&[T]> for [T; $N] where T: CopySimon Sapin-0/+87
`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`. Also add doc examples doing just that.
2018-11-25fix missing borrowEthan Brierley-1/+1
2018-11-25Use a reference rather than take ownershipEthan Brierley-1/+1
2018-11-25Rollup merge of #56207 - SimonSapin:int_to_from_bytes, r=nagisaPietro Albini-36/+12
Stabilize the int_to_from_bytes feature Fixes #52963 FCP to merge completed: https://github.com/rust-lang/rust/issues/52963#issuecomment-416548327
2018-11-25Rollup merge of #56101 - frewsxcv:frewsxcv-dyn, r=steveklabnikPietro Albini-1/+1
Incorporate `dyn` into more comments and docs. r? @rust-lang/docs
2018-11-25Stabilize the int_to_from_bytes featureSimon Sapin-36/+12
Fixes #52963
2018-11-23use more inlining, and force some of itRalf Jung-4/+13
2018-11-23use MaybeUninit in core::ptr::swap_nonoverlapping_bytesRalf Jung-4/+4
Code by @japaric, I just split it into individual commits
2018-11-23use MaybeUninit in core::ptr::swapRalf Jung-8/+5
Code by @japaric, I just split it into individual commits
2018-11-23use MaybeUninit in core::ptr::{read,read_unaligned}Ralf Jung-7/+7
Code by @japaric, I just split it into individual commits
2018-11-23use MaybeUninit in core::slice::rotateRalf Jung-9/+3
Code by @japaric, I just split it into individual commits
2018-11-23use MaybeUninit in core::slice::sortRalf Jung-7/+7
Code by @japaric, I just split it into individual commits
2018-11-23use MaybeUninit in core::fmtRalf Jung-13/+14
Code by @japaric, I just split it into individual commits
2018-11-23Merge branch 'master' into frewsxcv-dynCorey Farwell-36/+146
2018-11-24Rollup merge of #56162 - adrianheine:patch-1, r=withoutboatskennytm-4/+2
std::str Adapt documentation to reality
2018-11-24Rollup merge of #55869 - SimonSapin:iterate, r=alexcrichtonkennytm-2/+177
Add std::iter::unfold This adds an **unstable** ~`std::iter::iterate`~ `std::iter::unfold` function and ~`std::iter::Iterate`~ `std::iter::Unfold` type that trivially wrap a ~`FnMut() -> Option<T>`~ `FnMut(&mut State) -> Option<T>` closure to create an iterator. ~Iterator state can be kept in the closure’s environment or captures.~ This is intended to help reduce amount of boilerplate needed when defining an iterator that is only created in one place. Compare the existing example of the `std::iter` module: (explanatory comments elided) ```rust struct Counter { count: usize, } impl Counter { fn new() -> Counter { Counter { count: 0 } } } impl Iterator for Counter { type Item = usize; fn next(&mut self) -> Option<usize> { self.count += 1; if self.count < 6 { Some(self.count) } else { None } } } ``` … with the same algorithm rewritten to use this new API: ```rust fn counter() -> impl Iterator<Item=usize> { std::iter::unfold(0, |count| { *count += 1; if *count < 6 { Some(*count) } else { None } }) } ``` ----- This also add unstable `std::iter::successors` which takes an (optional) initial item and a closure that takes an item and computes the next one (its successor). ```rust let powers_of_10 = successors(Some(1_u16), |n| n.checked_mul(10)); assert_eq!(powers_of_10.collect::<Vec<_>>(), &[1, 10, 100, 1_000, 10_000]); ```
2018-11-24Rollup merge of #55838 - dralley:fix-cfg-step, r=Kimundikennytm-4/+4
Fix #[cfg] for step impl on ranges ```#[cfg(target_pointer_witdth = ...)]``` is misspelled
2018-11-22drop glue takes in mutable references, it should reflect that in its typeRalf Jung-2/+12
2018-11-22std::str Adapt documentation to realityAdrian Heine né Lang-4/+2
2018-11-22Auto merge of #56155 - GuillaumeGomez:rollup, r=GuillaumeGomezbors-13/+118
Rollup of 11 pull requests Successful merges: - #55367 (lint if a private item has doctests) - #55485 (Return &T / &mut T in ManuallyDrop Deref(Mut) impl) - #55784 (Clarifying documentation for collections::hash_map::Entry::or_insert) - #55961 (Fix VecDeque pretty-printer) - #55980 (Suggest on closure args count mismatching with pipe span) - #56002 (fix #55972: Erroneous self arguments on bare functions emit subpar compilation error) - #56063 (Update any.rs documentation using keyword dyn) - #56067 (Add SGX target to rustc) - #56078 (Fix error message for `-C panic=xxx`.) - #56106 (Remove some incorrect doc comments) - #56126 (core/benches/num: Add `from_str/from_str_radix()` benchmarks) Failed merges: r? @ghost
2018-11-22Rollup merge of #56126 - Turbo87:bench-parse, r=alexcrichtonGuillaume Gomez-0/+105
core/benches/num: Add `from_str/from_str_radix()` benchmarks This was extracted from #55973 /cc @alexcrichton
2018-11-22Rollup merge of #56063 - 0xrgb:patch-1, r=joshtriplettGuillaume Gomez-11/+11
Update any.rs documentation using keyword dyn This will fix #56062.
2018-11-22Rollup merge of #55485 - petertodd:2018-10-manuallydrop-deref, r=TimNNGuillaume Gomez-2/+2
Return &T / &mut T in ManuallyDrop Deref(Mut) impl Without this change the generated documentation looks like this: fn deref(&self) -> &<ManuallyDrop<T> as Deref>::Target Returning the actual type directly makes the generated docs more clear: fn deref(&self) -> &T Basically, compare how the impl for `Box<T>` and `ManuallyDrop<T>` looks in this screenshot: ![rust docs for ManuallyDrop as Deref](https://user-images.githubusercontent.com/7042/47673083-fc9dc280-db89-11e8-89b0-c6bde663feef.png)
2018-11-22Auto merge of #53918 - Havvy:doc-sort-by, r=GuillaumeGomezbors-0/+16
Doc total order requirement of sort(_unstable)_by I took the definition of what a total order is from the Ord trait docs. I specifically put "elements of the slice" because if you have a slice of f64s, but know none are NaN, then sorting by partial ord is total in this case. I'm not sure if I should give such an example in the docs or not. r? @GuillaumeGomez
2018-11-21update various stdlib docsSteve Klabnik-20/+9
2018-11-21core/benches/num: Add `from_str/from_str_radix()` benchmarksTobias Bieniek-0/+105