| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
This method is complementary for the feature refcell_leak added in an
earlier PR. It allows reverting the effects of leaking a borrow guard by
statically proving that such a guard could not longer exist. This was
not added to the existing `get_mut` out of concern of impacting the
complexity of the otherwise pure pointer cast and because the name
`get_mut` poorly communicates the intent of resetting remaining borrows.
|
|
For all of the methods that pick off the first or last element, we can
use subslice patterns to implement them directly, rather than relying on
deeper indexing function calls. At a minimum, this means the generated
code will rely less on inlining for performance, but in some cases it
also optimizes better.
|
|
Stabilize assoc_int_consts associated int/float constants
The next step in RFC https://github.com/rust-lang/rfcs/pull/2700 (tracking issue #68490). Stabilizing the associated constants that were added in #68325.
* Stabilize all constants under the `assoc_int_consts` feature flag.
* Update documentation on old constants to say they are soft-deprecated and the new ones should be preferred.
* Update documentation examples to use new constants.
* Remove `uint_macro` and use `int_macro` for all integer types since the macros were identical anyway.
r? @LukasKalbertodt
|
|
|
|
use question mark operator in a few places.
|
|
|
|
Remove `usable_size` APIs
This removes the usable size APIs:
- remove `usable_size` (obv)
- change return type of allocating methods to include the allocated size
- remove `_excess` API
r? @Amanieu
closes rust-lang/wg-allocators#17
|
|
Improve documentation on iterators length
Attempts to resolve #66491. @the8472 does this help?
r? @steveklabnik
|
|
|
|
|
|
|
|
|
|
|
|
constify mem::forget
implements https://github.com/rust-lang/rust/issues/69616
|
|
Unrevert "Remove `checked_add` in `Layout::repeat`"
This reapplies @kraai's original `libcore::alloc::Layout::repeat` change from #67174 which was temporarily reverted in #69241. Now that the proper LLVM fix has been cherry-picked, we can unrevert the revert.
This change was originally reviewed by @hanna-kruppe on the initial PR.
cc @RalfJung
|
|
Add documentation to compiler intrinsics
This adds documentation to the compiler intrinsics having stable standard implementations.
Relates to #34338 (cc @bstrie)
r? @steveklabnik (for reassignment?)
|
|
|
|
|
|
|
|
|
|
improve transmute and Vec::from_raw_parts docs
I think this fixes https://github.com/rust-lang/rust/issues/64073. @Shnatsel please let me know if this is less confusing. :)
|
|
fix aliasing violation in align_to_mut
Fixes https://github.com/rust-lang/rust/issues/68549
I decided to add the testcase here to make it all one PR, but if you prefer I can also add that test case in the Miri repo instead.
|
|
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
|
|
|
|
|
|
Rollup of 6 pull requests
Successful merges:
- #69477 (docs: add mention of async blocks in move keyword docs)
- #69504 (Use assert_ne in hash tests)
- #69546 (use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.)
- #69551 (use is_empty() instead of len() == x to determine if structs are empty.)
- #69563 (Fix no_std detection for target triples)
- #69567 (use .to_string() instead of format!() macro to create strings)
Failed merges:
r? @ghost
|
|
|
|
use is_empty() instead of len() == x to determine if structs are empty.
|
|
Use assert_ne in hash tests
The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.
|
|
debug_assert a few more raw pointer methods
Makes progress for https://github.com/rust-lang/rust/issues/53871
|
|
|
|
|
|
note that find(f) is equivalent to filter(f).next() in the docs.
r? @ecstatic-morse
|
|
don't take redundant references to operands
|
|
|
|
|
|
|
|
|
|
clarify operator precedence
|
|
The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.
|
|
|
|
Miscellaneous cleanup to formatting
Each commit stands alone.
This pull request will also resolve #58320.
|
|
Add methods to 'leak' RefCell borrows as references with the lifetime of the original reference
Usually, references to the interior are only created by the `Deref` and
`DerefMut` impl of the guards `Ref` and `RefMut`. Note that `RefCell`
already has to cope with leaks of such guards which, when it occurs,
effectively makes it impossible to ever acquire a mutable guard or any
guard for `Ref` and `RefMut` respectively. It is already safe to use
this to create a reference to the inner of the ref cell that lives as
long as the reference to the `RefCell` itself, e.g.
```rust
fn leak(r: &RefCell<usize>) -> Option<&usize> {
let guard = r.try_borrow().ok()?;
let leaked = Box::leak(Box::new(guard));
Some(&*leaked)
}
```
The newly added methods allow the same reference conversion without an
indirection over a leaked allocation. It's placed on the `Ref`/`RefMut` to
compose with both borrow and try_borrow directly.
|
|
|
|
|
|
Add primitive module to libcore
This re-exports the primitive types from libcore at `core::primitive` to allow
macro authors to have a reliable location to use them from.
Fixes #44865
|