| Age | Commit message (Collapse) | Author | Lines |
|
Fix doc for read&write unaligned in zst operation
### PR Description
This PR addresses an inconsistency in the Rust documentation regarding `read_unaligned ` and `write_unaligned` on zero-sized types (ZSTs). The current documentation for [pointer validity](https://doc.rust-lang.org/nightly/std/ptr/index.html#safety) states that for zero-sized types (ZSTs), null pointers are valid:
> For zero-sized types (ZSTs), every pointer is valid, including the null pointer.
However, there is an inconsistency in the documentation for the unaligned read operation in the function [ptr::read_unaligned](https://doc.rust-lang.org/nightly/std/ptr/fn.read_unaligned.html)(as well as `write_unaligned`), which states:
> Note that even if T has size 0, the pointer must be non-null.
This change is also supported by [PR #134912](https://github.com/rust-lang/rust/pull/134912)
> the _unaligned method docs should be fixed.
|
|
Avoid short writes in LineWriter
If the bytes written to `LineWriter` contains at least one new line but doesn't end in a new line (e.g. `"abc\ndef"`) then we:
- write up to the last new line direct to the underlying `Writer`.
- copy as many of the remaining bytes as will fit into our internal buffer.
That last step is inefficient if the remaining bytes are larger than our buffer. It will needlessly split the bytes in two, requiring at least two writes to the underlying `Writer` (one to flush the buffer, one more to write the rest). This PR skips the extra buffering if the remaining bytes are larger than the buffer.
|
|
ptr docs: make it clear that we are talking only about memory accesses
This should make it harder to take this sentence out of context and misunderstand it.
|
|
Make slice::as_flattened_mut unstably const
Tracking issue: https://github.com/rust-lang/rust/issues/95629
Unblocked by const_mut_refs being stabilized: https://github.com/rust-lang/rust/pull/129195
|
|
|
|
stabilize const_swap
libs-api FCP passed in https://github.com/rust-lang/rust/issues/83163.
However, I only just realized that this actually involves an intrinsic. The intrinsic could be implemented entirely with existing stable const functionality, but we choose to make it a primitive to be able to detect more UB. So nominating for `@rust-lang/lang` to make sure they are aware; I leave it up to them whether they want to FCP this.
While at it I also renamed the intrinsic to make the "nonoverlapping" constraint more clear.
Fixes #83163
|
|
|
|
Tracking issue: https://github.com/rust-lang/rust/issues/95629
Unblocked by const_mut_refs being stabilized: https://github.com/rust-lang/rust/pull/129195
|
|
Currently `logspace` does a lossy cast from `F::Int` to `usize`. This
could be problematic in the rare cases that this is called with a step
count exceeding what is representable in `usize`.
Resolve this by instead adding bounds so the float's integer type itself
can be iterated.
|
|
It is currently getting the default of 1 or 2. Since this operation
should always be infinite precision, no deviation is allowed.
|
|
The comment says that the expression involves no function call, but
that was only true for the example above, the example here _does_
contain a function call.
|
|
Fix typos
Hello, I fix some typos in docs and comments. Thank you very much.
|
|
Fix sentence fragment in `pin` module docs
Looks like this was inadvertently dropped in 8241ca60. Restore the words from before that commit.
|
|
Signed-off-by: calciumbe <192480234+calciumbe@users.noreply.github.com>
|
|
docs: inline `alloc::ffi::c_str` types to `alloc::ffi`
like https://github.com/rust-lang/rust/pull/134791 but for `alloc`
r? ``@tgross35`` ``@notriddle``
|
|
|
|
|
|
Rather than passing names or identifiers, just pass `CheckCtx` in a few
more places.
|
|
These are used more places than just test traits, so this new module
should be a better home. `run_cfg` will also be expanded in the near
future.
|
|
Introduce new API to iterate the function list and associate items with
their `MathOp`.
|
|
These allow for more convenient printing, as well as storage in map
types.
|
|
These types from `libm-macros` provide a way to get information about an
operation at runtime, rather than only being encoded in the type system.
Include the file and reexport relevant types.
|
|
This will enable us to `include!` the file to access these types in
`libm-test`, rather than somehow reproducing the types as part of the
macro. Ideally `libm-test` would just `use` the types from `libm-macros`
but proc macro crates cannot currently export anything else.
This also adjusts naming to closer match the scheme described in
`libm_test::op`.
|
|
For visualization, add a simple script for generating scatter plots and
a binary (via examples) to plot the inputs given various domains.
|
|
|
|
Introduce a generator that will tests various points of interest
including zeros, infinities, and NaNs.
|
|
Create a type representing a function's domain and a test that does a
logarithmic sweep of points within the domain.
|
|
|
|
Introduce `f8`, which is an 8-bit float compliant with IEEE-754. This
type is useful for testing since it is easily possible to enumerate all
values.
|
|
|
|
Add a constant for negative pi and provide a standalone const
`from_bits`, which can be combined with what we already had in
`hex_float`. Also provide another default method to reduce what needs to
be provided by the macro.
|
|
Since these add new API but do not affect runtime, we can enable it for
all tests that run with nightly.
|
|
In preparation of adding routines from these two types, duplicate the
`compiler-builtins` configuration here.
|
|
Add generic versions of `abs` and `copysign`, which will provide an
entrypoint for adding `f16` and `f128`. Since this implementation is
identical to the existing type-specific implementations, make use of it
for `f32` and `f64`.
|
|
GitHub will be upgrading the `-latest` tags of these images in the near
future. Change all images to specify the latest version.
|
|
Looks like this was inadvertently dropped in 8241ca60. Restore the words from before that commit.
|
|
|
|
Unify fs::copy and io::copy on Linux
Currently, `fs::copy` first tries a regular file copy (via copy_file_range) and then falls back to userspace read/write copying. We should use `io::copy` instead as it tries copy_file_range, sendfile, and splice before falling back to userspace copying. This was discovered here: https://github.com/SUPERCILEX/fuc/issues/40
Perf impact: `fs::copy` will now have two additional statx calls to decide which syscall to use. I wonder if we should get rid of the statx calls and only continue down the next fallback when the relevant syscalls say the FD isn't supported.
|
|
Update `compiler-builtins` to 0.1.140
Nothing significant here, just syncing the following small changes:
- https://github.com/rust-lang/compiler-builtins/pull/727
- https://github.com/rust-lang/compiler-builtins/pull/730
- https://github.com/rust-lang/compiler-builtins/pull/736
- https://github.com/rust-lang/compiler-builtins/pull/737
|
|
|
|
Fix typos
This PR focuses on correcting typos and improving clarity in documentation files. Thank you.
|
|
Co-authored-by: David Tolnay <dtolnay@gmail.com>
|
|
Nothing significant here, just syncing the following small changes:
- https://github.com/rust-lang/compiler-builtins/pull/727
- https://github.com/rust-lang/compiler-builtins/pull/730
- https://github.com/rust-lang/compiler-builtins/pull/736
- https://github.com/rust-lang/compiler-builtins/pull/737
|
|
Provides unstable `T::from_ascii()` and `T::from_ascii_radix()` for integer
types `T`, as drafted in tracking issue #134821.
To deduplicate documentation without additional macros, implementations of
`isize` and `usize` no longer delegate to equivalent integer types.
After #132870 they are inlined anyway.
|
|
Add a compiler intrinsic to back `bigint_helper_methods`
cc https://github.com/rust-lang/rust/issues/85532
This adds a new `carrying_mul_add` intrinsic, to implement `wide_mul` and `carrying_mul`.
It has fallback MIR for all types -- including `u128`, which isn't currently supported on nightly -- so that it'll continue to work on all backends, including CTFE.
Then it's overridden in `cg_llvm` to use wider intermediate types, including `i256` for `u128::carrying_mul`.
|
|
|
|
Including implementing it for `u128`, so it can be defined in `uint_impl!`.
This way it works for all backends, including CTFE.
|
|
Signed-off-by: chloefeal <188809157+chloefeal@users.noreply.github.com>
|
|
Rollup of 8 pull requests
Successful merges:
- #134606 (ptr::copy: fix docs for the overlapping case)
- #134622 (Windows: Use WriteFile to write to a UTF-8 console)
- #134759 (compiletest: Remove the `-test` suffix from normalize directives)
- #134787 (Spruce up the docs of several queries related to the type/trait system and const eval)
- #134806 (rustdoc: use shorter paths as preferred canonical paths)
- #134815 (Sort triples by name in platform_support.md)
- #134816 (tools: fix build failure caused by PR #134420)
- #134819 (Fix mistake in windows file open)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Fix mistake in windows file open
In #134722 this should have been `c::FileAllocationInfo` not `c::FileEndOfFileInfo`. Oops.
|