Commit Graph

67 Commits

Author SHA1 Message Date
Matthew Kraai
a983e0590a Remove checked_add in Layout::repeat 2019-12-09 06:49:37 -08:00
Mazdak Farrokhzad
fd78173484
Rollup merge of #67092 - kraai:us-to-is, r=jonas-schievink
Fix comment typos in src/libcore/alloc.rs
2019-12-06 23:27:05 +01:00
Matthew Kraai
292b998c64 Change "wth" to "with" in Layout::padding_needed_for comment 2019-12-06 07:59:13 -08:00
Matthew Kraai
a3c85770fb Change "us" to "is" in Layout::for_value comment 2019-12-06 07:35:30 -08:00
Matthew Kraai
0c4bc58cee Change "either" to "any" in Layout::from_size_align's docs 2019-12-06 07:06:03 -08:00
Christopher Durham
d1e53da809
Clarify Layout::pad_to_align safety comment 2019-11-25 16:39:24 -05:00
Christopher Durham
6773064b05
Remove unsafe in Layout::pad_to_align 2019-11-25 16:05:33 -05:00
Christopher Durham
b9da350b09
Fix typo
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-09 18:28:41 -05:00
Christopher Durham
183e61b661
Fix Layout::pad_to_align type mismatch 2019-11-09 15:28:32 -05:00
Christopher Durham
fd3594b9ee
Layout::pad_to_align is infallible 2019-11-09 15:19:09 -05:00
Oliver Scherer
02f9167f94 Have tidy ensure that we document all unsafe blocks in libcore 2019-11-06 11:04:42 +01:00
Mateusz Mikuła
f93032c818 Fix clippy::clone_on_copy warnings 2019-07-18 15:14:56 +02:00
Guillaume Gomez
4c1332afd9 Add missing links for CannotReallocInPlace type 2019-07-09 16:21:59 +02:00
Mazdak Farrokhzad
9389c69415
Rollup merge of #60947 - blkerby:global_alloc_typo, r=jonas-schievink
Fix typos in docs of GlobalAlloc
2019-05-19 02:31:46 +02:00
Brent Kerby
86cda2d48e Fix typos in docs of GlobalAlloc 2019-05-18 16:22:59 -06:00
Richard Wiedenhöft
a7a05203f1 Mark core::alloc::Layout::from_size_align_unchecked const 2019-05-14 09:40:10 +02:00
Mazdak Farrokhzad
dbfbadeac4 libcore: deny more... 2019-04-19 01:37:12 +02:00
Taiki Endo
360432f1e8 libcore => 2018 2019-04-18 14:47:35 +09:00
Mazdak Farrokhzad
4ca865e929 heading # Unsafety => # Safety in stdlib docs. 2019-02-25 08:01:35 +01:00
Alexander Regueiro
b87363e763 tests: doc comments 2019-02-10 23:42:32 +00:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Pietro Albini
17ae50765e
Rollup merge of #55844 - waywardmonkeys:typo-fixes, r=varkor
Fix documentation typos.
2018-11-11 00:21:25 +01:00
Bruce Mitchener
9b4d68e53b Fix documentation typos. 2018-11-10 19:31:49 +07:00
Murarth
317f494c72 Fix Rc/Arc allocation layout
* Rounds allocation layout up to a multiple of alignment
* Adds a convenience method `Layout::pad_to_align` to perform rounding
2018-11-08 11:50:02 -07:00
Amanieu d'Antras
02d50de63e Add a tracking issue for extra Layout methods 2018-11-06 20:36:43 +00:00
Amanieu d'Antras
de027b64f1 API changes as discussed in the comments 2018-11-06 17:21:13 +00:00
Amanieu d'Antras
94f3ce9def Add a comment about how Layout::extend matches the C struct layout 2018-11-06 17:21:13 +00:00
Matthias Krüger
4972beaf65 fix typos in various places 2018-10-23 15:56:25 +02:00
ljedrz
1667950d73 Remove explicit returns where unnecessary 2018-08-04 14:31:03 +02:00
Mark Rousskov
683a3db01f Switch to bootstrapping from 1.29 beta 2018-08-01 11:59:08 -06:00
Simon Sapin
239ec7d2dc Implement #[alloc_error_handler]
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-09 23:13:24 +02:00
Simon Sapin
b0547cea0a Move core::alloc::CollectionAllocErr to alloc::collections 2018-06-29 14:01:33 +02:00
Simon Sapin
1565fc2120 Document that Layout::from_size_align does not allow align=0
This was already implied since zero is not a power of two, but maybe
worth pointing out.
2018-06-27 15:07:42 +02:00
Simon Sapin
2b789bd057 Rename OOM to allocation error
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-18 21:41:24 +02:00
Simon Sapin
7f0d54d988 More alloc docs tweaks 2018-06-11 13:48:57 -07:00
Simon Sapin
9dcb64f346 Alloc docs teaks 2018-06-11 13:48:57 -07:00
Simon Sapin
bbaff036e7 Stablize the GlobalAlloc trait
Fixes https://github.com/rust-lang/rust/issues/49668
2018-06-11 13:48:39 -07:00
Simon Sapin
77606f20c9 Stabilize alloc::Layout (with only some of its methods) 2018-06-11 13:48:33 -07:00
Simon Sapin
75e17da873 Mark as permanently-unstable some implementation details 2018-06-11 13:48:27 -07:00
Simon Sapin
951bc28fd0 Stablize the alloc module without changing stability of its contents. 2018-06-11 13:48:25 -07:00
Simon Sapin
e9fd063edb Document memory allocation APIs
Add some docs where they were missing,
attempt to fix them where they were out of date.
2018-06-11 13:47:28 -07:00
Mike Hommey
f6ab74b8e7 Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAlloc 2018-06-11 13:47:23 -07:00
Mark Simulacrum
4ce7ef5f59
Rollup merge of #51226 - gnzlbg:nonzero_align, r=SimonSapin
Make Layout's align a NonZeroUsize

This PR makes the `Layout`'s align field a `NonZeroUsize` since it cannot ever be zero, not even while building a `Layout`. It also contains some drive-by minor cleanups over the docs and the code, like updating the documented error types, or using the `size()` and `align()` methods instead of accessing the fields directly (the latter was required for the `NonZeroUsize` change anyways).

r? @SimonSapin

cc @Amanieu
2018-06-02 19:55:06 -06:00
gnzlbg
2d7cd70b1a add missing inline's and optimizations 2018-06-02 16:46:25 +02:00
gnzlbg
6ff67ee0d7 remove debug_assert in padding_needed_for 2018-06-02 16:03:33 +02:00
Amanieu d'Antras
c6bebf4554 Simplify HashMap layout calculation by using Layout 2018-06-01 17:24:03 +01:00
gnzlbg
6c3ebcd223 make Layout's align a NonZeroUsize 2018-05-30 21:00:37 +02:00
Steven Fackler
9e8f683476 Remove Alloc::oom 2018-04-22 10:08:49 -07:00
Steven Fackler
e513c1bd31 Replace GlobalAlloc::oom with a lang item 2018-04-22 10:08:17 -07:00