| Age | Commit message (Collapse) | Author | Lines |
|
Remove redundant check in `symlink_hard_link` test
We support macOS 10.12 and above, so it now always uses `linkat`, and so the check is redundant.
This was missed in #126351.
``@rustbot`` label O-macos
|
|
|
|
|
|
pointer -> reference
|
|
|
|
also add an explicit test for the fact that a Option<WidePtr> has padding when it is None
|
|
|
|
|
|
in this commit, `naked_asm!` is an alias for `asm!` with one difference: `options(noreturn)` is always enabled by `naked_asm!`. That makes it future-compatible for when `naked_asm!` starts disallowing `options(noreturn)` later.
|
|
Remove needless returns detected by clippy in libraries
|
|
const: make ptr.is_null() stop execution on ambiguity
This seems better than saying `false` -- saying `false` is in fact actively unsound if `NonNull` then uses this to permit putting this pointer inside of it, but at runtime it turns out to be null.
Part of https://github.com/rust-lang/rust/issues/74939
Cc ```@rust-lang/wg-const-eval```
|
|
make Result::copied unstably const
The corresponding `Option::copied` is unstably const, so seems reasonable to do the same here.
|
|
remove 'const' from 'Option::iter'
This is kind of pointless to be a `const fn` since you can't do anything with the iterator. It is also the only `const fn iter*` in the entire standard library. It probably got constified when `~const` traits got added everywhere, and then was forgotten to be de-constified when that was undone.
The rest of the const_option feature seems like it can reasonably be stabilized, but this one IMO should not be stabilized, and it's not worth creating a new tracking issue.
Cc https://github.com/rust-lang/rust/issues/67441
|
|
Use the same code as Solaris. I couldn't find any tests regarding this, but I
did test a stage0 build against my stack-exhaust-test binary [1]. Before:
```
running with use_stacker = No, new_thread = false, make_large_local = false
zsh: segmentation fault (core dumped) cargo run
```
After:
```
running with use_stacker = No, new_thread = false, make_large_local = false
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: IOT instruction (core dumped) cargo +stage0 run
```
Fixes #128568.
[1] https://github.com/sunshowers/stack-exhaust-test/
|
|
|
|
|
|
|
|
|
|
|
|
the '&' variants
|
|
better implementation of signed div_floor/ceil
Tracking issue for signed `div_floor`/`div_ceil`: https://github.com/rust-lang/rust/issues/88581.
This PR improves the implementation of those two functions by adding a better branchless algorithm. Side-by-side comparison of `i32::div_floor` on x86-64:
```asm
div_floor_new: div_floor_old:
push rax push rax
test esi, esi test esi, esi
je .LBB0_3 je .LBB1_6
mov eax, esi mov eax, esi
not eax not eax
lea ecx, [rdi - 2147483648] lea ecx, [rdi - 2147483648]
or ecx, eax or ecx, eax
je .LBB0_2 je .LBB1_7
mov eax, edi mov eax, edi
cdq cdq
idiv esi idiv esi
xor esi, edi test edx, edx
sar esi, 31 setg cl
test edx, edx test esi, esi
cmove esi, edx sets dil
add eax, esi test dil, cl
pop rcx jne .LBB1_4
ret test edx, edx
.LBB0_3: setns cl
lea rdi, [rip + .L__unnamed_1] test esi, esi
call qword ptr [rip + panic...] setle dl
.LBB0_2: or dl, cl
lea rdi, [rip + .L__unnamed_1] jne .LBB1_5
call qword ptr [rip + panic...] .LBB1_4:
dec eax
.LBB1_5:
pop rcx
ret
.LBB1_6:
lea rdi, [rip + .L__unnamed_2]
call qword ptr [rip + panic...]
.LBB1_7:
lea rdi, [rip + .L__unnamed_2]
call qword ptr [rip + panic...]
```
And on Aarch64:
```asm
_div_floor_new: _div_floor_old:
stp x29, x30, [sp, #-16]! stp x29, x30, [sp, #-16]!
mov x29, sp mov x29, sp
cbz w1, LBB0_4 cbz w1, LBB1_9
mov w8, #-2147483648 mov x8, x0
cmp w0, w8 mov w9, #-2147483648
b.ne LBB0_3 cmp w0, w9
cmn w1, #1 b.ne LBB1_3
b.eq LBB0_5 cmn w1, #1
LBB0_3: b.eq LBB1_10
sdiv w8, w0, w1 LBB1_3:
msub w9, w8, w1, w0 sdiv w0, w8, w1
eor w10, w1, w0 msub w8, w0, w1, w8
asr w10, w10, #31 tbz w1, #31, LBB1_5
cmp w9, #0 cmp w8, #0
csel w9, wzr, w10, eq b.gt LBB1_7
add w0, w9, w8 LBB1_5:
ldp x29, x30, [sp], #16 cmp w1, #1
ret b.lt LBB1_8
LBB0_4: tbz w8, #31, LBB1_8
adrp x0, l___unnamed_1@PAGE LBB1_7:
add x0, x0, l___unnamed_1@PAGEOFF sub w0, w0, #1
bl panic... LBB1_8:
LBB0_5: ldp x29, x30, [sp], #16
adrp x0, l___unnamed_1@PAGE ret
add x0, x0, l___unnamed_1@PAGEOFF LBB1_9:
bl panic... adrp x0, l___unnamed_2@PAGE
add x0, x0, l___unnamed_2@PAGEOFF
bl panic...
LBB1_10:
adrp x0, l___unnamed_2@PAGE
add x0, x0, l___unnamed_2@PAGEOFF
bl panic...
```
|
|
Break into the debugger (if attached) on panics (Windows, Linux, macOS, FreeBSD)
The developer experience for panics is to provide the backtrace and
exit the program. When running under debugger, that might be improved
by breaking into the debugger once the code panics thus enabling
the developer to examine the program state at the exact time when
the code panicked.
Let the developer catch the panic in the debugger if it is attached.
If the debugger is not attached, nothing changes. Providing this feature
inside the standard library facilitates better debugging experience.
Validated under Windows, Linux, macOS 14.6, and FreeBSD 13.3..14.1.
|
|
In https://github.com/rust-lang/rust/pull/124748, I mistakenly conflated
"not SjLj" to mean "ARM EHABI", which isn't true, watchOS armv7k
(specifically only that architecture) uses a third unwinding method
called "DWARF CFI".
|
|
|
|
|
|
Rollup of 10 pull requests
Successful merges:
- #126452 (Implement raw lifetimes and labels (`'r#ident`))
- #129555 (stabilize const_float_bits_conv)
- #129594 (explain the options bootstrap passes to curl)
- #129677 (Don't build by-move body when async closure is tainted)
- #129847 (Do not call query to compute coroutine layout for synthetic body of async closure)
- #129869 (add a few more crashtests)
- #130009 (rustdoc-search: allow trailing `Foo ->` arg search)
- #130046 (str: make as_mut_ptr and as_bytes_mut unstably const)
- #130047 (Win: Add dbghelp to the list of import libraries)
- #130059 (Remove the unused `llvm-skip-rebuild` option from x.py)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Win: Add dbghelp to the list of import libraries
This is used by the backtrace crate. But we use a submodule to include backtrace in std (rather than being a real crate) so we need to add the dependency here.
|
|
str: make as_mut_ptr and as_bytes_mut unstably const
`@rust-lang/libs-api` the corresponding non-mutable methods are already const fn, so this seems pretty trivial. I hope this is small enough that it does not need an ACP? :)
I would like to get these stabilized ASAP because I want to avoid people doing `s.as_ptr().cast_mut()`, which is UB if they ever write to it, but is already const-stable.
TODO: create a tracking issue.
|
|
stabilize const_float_bits_conv
This stabilizes `const_float_bits_conv`, and thus fixes https://github.com/rust-lang/rust/issues/72447. With https://github.com/rust-lang/rust/pull/128596 having landed, this is entirely a libs-only question now.
```rust
impl f32 {
pub const fn to_bits(self) -> u32;
pub const fn from_bits(v: u32) -> Self;
pub const fn to_be_bytes(self) -> [u8; 4];
pub const fn to_le_bytes(self) -> [u8; 4]
pub const fn to_ne_bytes(self) -> [u8; 4];
pub const fn from_be_bytes(bytes: [u8; 4]) -> Self;
pub const fn from_le_bytes(bytes: [u8; 4]) -> Self;
pub const fn from_ne_bytes(bytes: [u8; 4]) -> Self;
}
impl f64 {
pub const fn to_bits(self) -> u64;
pub const fn from_bits(v: u64) -> Self;
pub const fn to_be_bytes(self) -> [u8; 8];
pub const fn to_le_bytes(self) -> [u8; 8]
pub const fn to_ne_bytes(self) -> [u8; 8];
pub const fn from_be_bytes(bytes: [u8; 8]) -> Self;
pub const fn from_le_bytes(bytes: [u8; 8]) -> Self;
pub const fn from_ne_bytes(bytes: [u8; 8]) -> Self;
}
````
Cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
|
|
Bump boostrap compiler to new beta
Accidentally left some comments on the update cfgs commit directly xd
|
|
|
|
|
|
|
|
has to do for greater clarity
|
|
We support macOS 10.12 and above, so it now always uses linkat, so the
check is redundant.
This was missed in #126351.
|
|
|
|
|
|
Fix references to a nonexistent `consume` function in the doc comments
for `Peekable::next_if` and `Peekable::next_if_eq`.
|
|
|
|
|
|
|
|
previously this would cause an infinite loop due to it being
unable to read `n` bytes.
|
|
|
|
The existing phrasing implies that a notification must be received for `wait_while` to return. The phrasing is changed to better reflect the behavior.
|
|
r=workingjubilee
Inaccurate `{Path,OsStr}::to_string_lossy()` documentation
The documentation of `Path::to_string_lossy()` and `OsStr::to_string_lossy()` says the following:
> Any non-Unicode sequences are replaced with `U+FFFD REPLACEMENT CHARACTER`
which didn't immediately make sense to me. ("non-Unicode sequences"?)
Since both `to_string_lossy` functions eventually become just a call to `String::from_utf8_lossy`, I believe the documentation meant to say:
> Any *non-UTF-8* sequences are replaced with `U+FFFD REPLACEMENT CHARACTER`
This PR corrects this mistake in the documentation.
For the record, a similar quote can be found in the documentation of `String::from_utf8_lossy`:
> ... During this conversion, `from_utf8_lossy()` will replace any invalid UTF-8 sequences with `U+FFFD REPLACEMENT CHARACTER`, ...
|
|
Rollup of 11 pull requests
Successful merges:
- #128919 (Add an internal lint that warns when accessing untracked data)
- #129472 (fix ICE when `asm_const` and `const_refs_to_static` are combined)
- #129653 (clarify that addr_of creates read-only pointers)
- #129775 (bootstrap: Try to track down why `initial_libdir` sometimes fails)
- #129939 (explain why Rvalue::Len still exists)
- #129942 (copy rustc rustlib artifacts from ci-rustc)
- #129943 (use the bootstrapped compiler for `test-float-parse` test)
- #129944 (Add compat note for trait solver change)
- #129947 (Add digit separators in `Duration` examples)
- #129955 (Temporarily remove fmease from the review rotation)
- #129957 (forward linker option to lint-docs)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
The developer experience for panics is to provide the backtrace and
exit the program. When running under debugger, that might be improved
by breaking into the debugger once the code panics thus enabling
the developer to examine the program state at the exact time when
the code panicked.
Let the developer catch the panic in the debugger if it is attached.
If the debugger is not attached, nothing changes. Providing this feature
inside the standard library facilitates better debugging experience.
Validated under Windows, Linux, macOS 14.6, and FreeBSD 13.3..14.1.
|
|
|
|
r=tgross35
Add digit separators in `Duration` examples
``@rustbot`` label A-docs
|
|
clarify that addr_of creates read-only pointers
Stacked Borrows does make this UB, but Tree Borrows does not. This is tied up with https://github.com/rust-lang/rust/issues/56604 and other UCG discussions. Also see [this collection of links](https://github.com/Rust-for-Linux/linux/pull/950#discussion_r1104759431) where rustc treats `addr_of!` as a "non-mutating use".
So, let's better be careful for now.
|