about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-06-22Auto merge of #51463 - estebank:error-codes, r=nikomatsakisbors-2/+8
Various changes to existing diagnostics * [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](https://github.com/rust-lang/rust/pull/51463/commits/23ae5af274defa9ff884f593e44a2bbcaf814a02): ``` error[E0697]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted ``` * [Add code to incorrect `pub` restriction error](https://github.com/rust-lang/rust/pull/51463/commits/e96fdea8a38f39f99f8b9a4000a689187a457e08) * [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](https://github.com/rust-lang/rust/pull/51463/commits/2cc7e5ed307aee936c20479cfdc7409d6b52a464): ``` error[E0277]: `W` does not have a constant size known at compile-time --> $DIR/unsized-enum2.rs:33:8 | LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type ``` ``` error[E0277]: `Foo` cannot be sent between threads safely --> $DIR/E0277-2.rs:26:5 | LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` ``` ``` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:16:7 | LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` ``` ``` error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:17:7 | LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` ``` ``` error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:16:19 | LL | struct WellFormed<Z = Foo<i32, i32>>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` note: required by `Foo` --> $DIR/type-check-defaults.rs:15:1 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` * [Add link to book for `Sized` errors](https://github.com/rust-lang/rust/pull/51463/commits/1244dc7c283323aea1a3457a4458d590a3e160c8): ``` error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: constant expressions must have a statically known size ``` * [Point to previous line for single expected token not found](https://github.com/rust-lang/rust/pull/51463/commits/48165168fb0f059d8536cd4a2276b609d4a7f721) (if the current token is in a different line)
2018-06-19Add message to `rustc_on_unimplemented` attributes in coreEsteban Küber-2/+8
2018-06-18Rename OOM to allocation errorSimon Sapin-17/+21
The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-16Auto merge of #51562 - SimonSapin:transparent, r=cramertjbors-1/+1
Stabilize #[repr(transparent)] Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-13Improve core::task::TaskObjJosef Reinhard Brandl-4/+4
2018-06-12Stabilize #[repr(transparent)]Simon Sapin-1/+1
Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-12Auto merge of #51241 - glandium:globalalloc, r=sfackler,SimonSapinbors-190/+127
Stabilize GlobalAlloc and #[global_allocator] This PR implements the changes discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-393263510 Fixes #49668 Fixes #27389 This does not change the default global allocator: #36963
2018-06-11More alloc docs tweaksSimon Sapin-2/+4
2018-06-11Stabilize alloc::oom (but not set_oom_hook or take_oom_hook)Simon Sapin-1/+1
2018-06-11Stabilize alloc free functions for the global allocators.Simon Sapin-4/+4
2018-06-11Stablize the alloc module without changing stability of its contents.Simon Sapin-6/+5
2018-06-11Document memory allocation APIsSimon Sapin-0/+65
Add some docs where they were missing, attempt to fix them where they were out of date.
2018-06-11Remove some unneeded castsSimon Sapin-3/+3
2018-06-11Remove the deprecated Heap type/constSimon Sapin-9/+0
2018-06-11Remove deprecated heap modulesSimon Sapin-118/+0
The heap.rs file was already unused.
2018-06-11Replace `impl GlobalAlloc for Global` with a set of free functionsMike Hommey-23/+25
2018-06-11Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAllocMike Hommey-47/+43
2018-06-11Auto merge of #51442 - tinaun:more-future-impls, r=cramertjbors-0/+19
[futures] add a few blanket impls to std these were defined in the futures crate, but with the core definitions moving to std these would need to move too.
2018-06-10Stabilize entry-or-defaultGuillaume Gomez-2/+1
2018-06-10Auto merge of #51320 - tmccombs:step-by, r=SimonSapinbors-1/+0
Stabilize Iterator::step_by Fixes #27741
2018-06-08addressed nitstinaun-21/+0
2018-06-08add a few blanket future impls to stdtinaun-0/+40
2018-06-06Auto merge of #51263 - cramertj:futures-in-core, r=aturonbors-0/+239
Add Future and task system to the standard library This adds preliminary versions of the `std::future` and `std::task` modules in order to unblock development of async/await (https://github.com/rust-lang/rust/issues/50547). These shouldn't be considered as final forms of these libraries-- design questions about the libraries should be left on https://github.com/rust-lang/rfcs/pull/2418. Once that RFC (or a successor) is merged, these APIs will be adjusted as necessary. r? @aturon
2018-06-06Add Future and task system to the standard libraryTaylor Cramer-0/+239
2018-06-03Reexport fmt::Alignment into stdGuillaume Gomez-0/+2
2018-06-02Stabilize Iterator::step_byThayne McCombs-1/+0
Fixes #27741
2018-06-02Rollup merge of #51312 - frewsxcv:clarify-hash-map-entry-get-mut, r=dtolnayMark Simulacrum-2/+15
Clarify the difference between get_mut and into_mut for OccupiedEntry The examples for both hash_map::OccupiedEntry::get_mut and hash_map::OccupiedEntry::into_mut were almost identical. This led to some confusion over the difference, namely why you would ever use get_mut when into_mut gives alonger lifetime. Reddit thread: https://www.reddit.com/r/rust/comments/8a5swr/why_does_hashmaps This commit adds two lines and a comment to the example, to show that the entry object can be re-used after calling get_mut. Closes https://github.com/rust-lang/rust/issues/49745
2018-06-02Rollup merge of #51306 - kennytm:impl-default-for-mut-str, r=SimonSapinMark Simulacrum-0/+1
impl Default for &mut str Rationale: There is already `impl Default for &mut [T]`. Note: This impl is insta-stable.
2018-06-02Copy changes from HashMap over to BTreeMap.Corey Farwell-2/+15
2018-06-02Rollup merge of #51147 - tmccombs:sliceindex, r=SimonSapinMark Simulacrum-2/+1
Stabilize SliceIndex trait. CC #35729 According to recommendations in https://github.com/rust-lang/rust/issues/35729#issuecomment-377784884
2018-06-03impl Default for &mut strkennytm-0/+1
2018-06-01incorporate changes from code reviewEmerentius-38/+46
further reduce unsafe fn calls reduce right drift assert! sufficient capacity
2018-06-01compacts join codeEmerentius-30/+14
2018-06-01add more join testsEmerentius-0/+22
old tests cover the new fast path of str joining already this adds tests for joining into Strings with long separators (>4 byte) and for joining into Vec<T>, T: Clone + !Copy. Vec<T: Copy> will be specialised when specialisation type inference bugs are fixed.
2018-06-01optimize joining and concatenation for slicesEmerentius-47/+113
for both Vec<T> and String - eliminates the boolean first flag in fn join() for String only - eliminates repeated bounds checks in join(), concat() - adds fast paths for small string separators up to a len of 4 bytes
2018-06-01Stabilize SliceIndex trait.Thayne McCombs-2/+1
Fixes #35729 According to recommendations in https://github.com/rust-lang/rust/issues/35729#issuecomment-377784884
2018-05-31Update `Arc` and `Rc` to use `NonNull::cast` to cast the inner pointersJeremy Fitzhardinge-17/+6
This avoids an `unsafe` block in each case.
2018-05-31Implement `downcast` for `Arc<Any + Send + Sync>`Jeremy Fitzhardinge-0/+64
We only need to implement it for `Any + Send + Sync` because in practice that's the only useful combination for `Arc` and `Any`. Implementation for #44608 under the `rc_downcast` feature.
2018-05-30Pass a `Layout` to `oom`Mike Hommey-82/+91
As discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-384893456 and subsequent, there are use-cases where the OOM handler needs to know the size of the allocation that failed. The alignment might also be a cause for allocation failure, so providing it as well can be useful.
2018-05-26Auto merge of #51082 - kennytm:rollup, r=kennytmbors-2/+4
Rollup of 11 pull requests Successful merges: - #50987 (Underline multiple suggested replacements in the same line) - #51014 (Add documentation about env! second argument) - #51034 (Remove unused lowering field and method) - #51047 (Use AllFacts from polonius-engine) - #51048 (Add more missing examples for Formatter) - #51056 (Mention and use `Once::new` instead of `ONCE_INIT`) - #51059 (What does an expression look like, that consists only of special characters?) - #51065 (Update nomicon link in transmute docs) - #51067 (Add inner links in documentation) - #51070 (Fail typecheck if we encounter a bogus break) - #51073 (Rename TokenStream::empty to TokenStream::new) Failed merges:
2018-05-26Rollup merge of #51067 - mcarton:patch-1, r=steveklabnikkennytm-2/+4
Add inner links in documentation From [this SO question](https://stackoverflow.com/q/50518757/2733851) it looks like this page isn't really clear. I personally do think this page is quite clear, the only think I could think of was adding some references.
2018-05-26Auto merge of #51041 - alexcrichton:better-unwind, r=nikomatsakisbors-0/+1
std: Ensure OOM is classified as `nounwind` OOM can't unwind today, and historically it's been optimized as if it can't unwind. This accidentally regressed with recent changes to the OOM handler, so this commit adds in a codegen test to assert that everything gets optimized away after the OOM function is approrpiately classified as nounwind Closes #50925
2018-05-25Auto merge of #51033 - coryshrmn:master, r=dtolnaybors-11/+11
stabilize RangeBounds collections_range #30877 The FCP for #30877 closed last month, with the decision to: 1. move from `collections::range::RangeArgument` to `ops::RangeBounds`, and 2. rename `start()` and `end()` to `start_bounds()` and `end_bounds()`. Simon Sapin already moved it to `ops::RangeBounds` in #49163. I renamed the functions, and removed the old `collections::range::RangeArgument` alias. This is my first Rust PR, please let me know if I can improve anything. This passes all tests for me, except the `clippy` tool (which uses `RangeArgument::start()`). I considered deprecating `start()` and `end()` instead of removing them, but the contribution guidelines indicate we can break `clippy` temporarily. I thought it was best to remove the functions, since we're worried about name collisions with `Range::start` and `end`. Closes #30877.
2018-05-25Add inner links in documentationMartin Carton-2/+4
From [this SO question](https://stackoverflow.com/q/50518757/2733851) it looks like this page isn't really clear. I personally do think this page is quite clear, the only think I could think of was adding some references.
2018-05-24std: Ensure OOM is classified as `nounwind`Alex Crichton-0/+1
OOM can't unwind today, and historically it's been optimized as if it can't unwind. This accidentally regressed with recent changes to the OOM handler, so this commit adds in a codegen test to assert that everything gets optimized away after the OOM function is approrpiately classified as nounwind Closes #50925
2018-05-24stabilize RangeBounds collections_range #30877Cory Sherman-11/+11
rename RangeBounds::start() -> start_bound() rename RangeBounds::end() -> end_bound()
2018-05-22Make `Unpin` safe to implementTaylor Cramer-1/+1
2018-05-23Rollup merge of #50945 - stjepang:stabilize-from-ref, r=SimonSapinkennytm-2/+2
Stabilize feature from_ref Function `from_ref_mut` is now renamed to `from_mut`, as discussed in #45703. Closes #45703. r? @SimonSapin
2018-05-21Auto merge of #49283 - varkor:combining-chars-escape_debug, r=SimonSapinbors-1/+17
Escape combining characters in char::Debug Although combining characters are technically printable, they make little sense to print on their own with `Debug`: it'd be better to escape them like non-printable characters. This is a breaking change, but I imagine the fact `escape_debug` is rare and almost certainly primarily used for debugging that this is an acceptable change. Resolves #41922. r? @alexcrichton cc @clarcharr
2018-05-21Avoid counting characters and add explanatory comment to testvarkor-1/+13