| Age | Commit message (Collapse) | Author | Lines |
|
- As explained in the comment inside mod_inv, it is valid to work mod
`usize::max_value()` right until the end.
|
|
- When calculating the inverse, it's enough to work `mod a/g` instead
of `mod a`.
|
|
- Stopping condition inside mod_inv can be >= instead of >
- Remove intrinsics::unchecked_rem, we are working modulu powers-of-2 so
we can simply mask
|
|
Stabilize ptr::slice_from_raw_parts[_mut]
Closes #36925, the tracking issue.
Initial impl: #60667
r? @rust-lang/libs
In addition to stabilizing, I've adjusted the example of `ptr::slice_from_raw_parts` to use `slice_from_raw_parts` instead of `slice_from_raw_parts_mut`, which was unnecessary for the example as written.
|
|
|
|
|
|
|
|
The as_ref method already has a Null-unchecked version section, its
example is a modification of the example in the main as_ref section.
Similarly the example in this commit is a modification of the example
in main as_mut section.
|
|
|
|
|
|
Require issue = "none" over issue = "0" in unstable attributes
These changes make the use of `issue = "none"` required in unstable attributes throughout the compiler.
Notes:
- #66299 is now in beta so `issue = "none"` is accepted.
- The `tidy` tool now fails on `issue = "0"`.
- Tests that used `issue = "0"` were changed to use `issue = "none"`, except for _one_ that asserts `issue = "0"` can still be used.
- The compiler still allows `issue = "0"` because some submodules require it, this could be disallowed once these are updated.
Resolves #41260
r? @varkor
|
|
Make ptr::slice_from_raw_parts a const fn available under a feature flag
A first step in the direction of https://github.com/rust-lang/rust/issues/67456 .
This makes `ptr::slice_from_raw_parts` and `ptr::slice_from_raw_parts_mut` available as a const fn under a feature flag.
|
|
|
|
|
|
and the other with mut ptr
|
|
|
|
functions with a `const` modifier
|
|
|
|
|
|
Rephrase docs in for ptr
These methods can be supplied with NULL just fine, this is the whole point of `Option<&T>` return type.
|
|
|
|
|
|
This commit applies rustfmt with default settings to files in
src/libcore *that are not involved in any currently open PR* to minimize
merge conflicts. The list of files involved in open PRs was determined
by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8
With the list of files from the script in `outstanding_files`, the
relevant commands were:
$ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018
$ rg libcore outstanding_files | xargs git checkout --
Repeating this process several months apart should get us coverage of
most of the rest of libcore.
|
|
|
|
Have tidy ensure that we document all `unsafe` blocks in libcore
cc @rust-lang/libs
I documented a few and added ignore flags on the other files. We can incrementally document the files, but won't regress any files this way.
|
|
|
|
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
|
|
|
|
|
|
Make <*const/mut T>::offset_from `const fn`
This reenables offset_of cc @mjbshaw after https://github.com/rust-lang/rust/pull/63075 broke it
|
|
|
|
|
|
|
|
|
|
Co-Authored-By: Ralf Jung <post@ralfj.de>
|
|
Co-Authored-By: Ralf Jung <post@ralfj.de>
|
|
|
|
Improve pointer offset method docs
Cc @rkruppe @gnzlbg
|
|
|
|
|
|
|
|
|
|
Remove mentions of removed `offset_to` method from `align_offset` docs
The `offset_to` method was deleted in https://github.com/rust-lang/rust/pull/52814.
The replacement for the removed method is `wrapping_offset_from`. However, neither method takes an `usize` as argument, so I don't think that it makes sense to mention them.
|
|
|
|
fakenine:normalize_use_of_backticks_compiler_messages_p9, r=Centril
normalize use of backticks in compiler messages for libcore/ptr
https://github.com/rust-lang/rust/issues/60532
|
|
https://github.com/rust-lang/rust/issues/60532
|
|
The `align_offset` method returns an `usize`, so using `add` makes more sense than using `offset`, which takes an `isize`.
|
|
FCP: https://github.com/rust-lang/rust/issues/60602#issuecomment-511146402
|
|
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
|
|
Clarify unaligned fields in ptr::{read,write}_unaligned
r? @RalfJung
|