| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Rounds allocation layout up to a multiple of alignment
* Adds a convenience method `Layout::pad_to_align` to perform rounding
|
|
|
|
|
|
Add tracking issue for Layout methods (and some API changes)
These methods are already useful when used with the stable global allocator API (stabilized in #51241).
```rust
pub fn align_to(&self, align: usize) -> Result<Layout, LayoutErr>;
pub fn padding_needed_for(&self, align: usize) -> usize;
pub fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>;
pub fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutErr>;
pub fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutErr>;
pub fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutErr>;
pub fn array<T>(n: usize) -> Result<Layout, LayoutErr>;
```
cc #32838
r? @SimonSapin
|
|
Slight copy-editing for `std::cell::Cell` docs
Hopefully this is a bit more precise and also more correct English.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Correct alignment of atomic types and (re)add Atomic{I,U}128
This is a updated https://github.com/rust-lang/rust/pull/53514 to also make atomic types `repr(C)` as per comment in https://github.com/rust-lang/rust/pull/53514#issuecomment-431042767.
Fixes #39590
Closes #53514
r? @pnkfelix
|
|
|
|
|
|
Implement the rotate_left and rotate_right operations using
llvm.fshl and llvm.fshr if they are available (LLVM >= 7).
Originally I wanted to expose the funnel_shift_left and
funnel_shift_right intrinsics and implement rotate_left and
rotate_right on top of them. However, emulation of funnel
shifts requires emitting a conditional to check for zero shift
amount, which is not necessary for rotates. I was uncomfortable
doing that here, as I don't want to rely on LLVM to optimize
away that conditional (and for variable rotates, I'm not sure it
can). We should revisit that question when we raise our minimum
version requirement to LLVM 7 and don't need emulation code
anymore.
|
|
|
|
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write
```
impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {}
```
instead of
```
impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {}
```
this way the trait is really just a subset of `CoerceUnsized`.
The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too.
I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
|
|
tests were failing because I didn't wrap code snippets like in backticks. fixed that now, so hopefully tests will pass on travis
|
|
This will make receiver types like `Rc<Self>` and `Pin<&mut Self>`
object-safe.
|
|
This trait is more-or-less the reverse of CoerceUnsized, and will be
used for object-safety checks. Receiver types like `Rc` will have to
implement `CoerceSized` so that methods that use `Rc<Self>` as the
receiver will be considered object-safe.
|
|
Made doc example of `impl Default for …` use `-> Self` instead of explicit self type
There is no need to state the explicit type of `self`.
|
|
self type
|
|
* Also update the bootstrap compiler
* Update cargo to 1.32.0
* Clean out stage0 annotations
|
|
|
|
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
|
|
Make a bunch of trivial methods of NonNull be `#[inline]`
I was seeing super trivial methods not getting inlined in some of my builds, so I went ahead and just marked all the methods inline where it seemed appropriate.
r? @SimonSapin
|
|
Add ManuallyDrop::take
Tracking issue: #55422
Proposed in this form in https://internals.rust-lang.org/t/mini-rfc-manuallydrop-take/8679,
see that thread for some history.
A small convenience wrapper for `ManuallyDrop` that makes a pattern (taking ownership of the contained data in drop) more obvious.
|
|
Remove unnecessary mut in iterator.find_map documentation example, R…
Relates to #49098
Removes a mut that could induce newcomers to put a mut in their code that the compiler would comply about.
https://github.com/rust-lang/rust/pull/49098/files#r227422388
|
|
Add MaybeUninit::new
Sometimes it *is* initialized!
|
|
https://internals.rust-lang.org/t/mini-rfc-manuallydrop-take/8679
|
|
|
|
|
|
LLVM requires that atomic loads and stores be aligned to at least the size of the type.
|
|
Hopefully this is a bit more precise and also more correct English.
|