| Age | Commit message (Collapse) | Author | Lines |
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
detect incompatible CI LLVM options more precisely
Previously, the logic here was simply checking whether the option was set in `config.toml`. This approach was not manageable in our CI runners as we set so many options in config.toml. In reality, those values are not incompatible since they are usually the same value used to generate the CI llvm. Now, the new logic compares the configuration values with the values used to generate the CI llvm, so we get more precise results and make the process more manageable.
Fixes #129153
|
|
Correctly handle stability of `#[diagnostic]` attributes
This commit changes the way we treat the stability of attributes in the
`#[diagnostic]` namespace. Instead of relaying on ad-hoc checks to
ensure at call side that a certain attribute is really usable at that
location it centralises the logic to one place. For diagnostic
attributes comming from other crates it just skips serializing
attributes that are not stable and that do not have the corresponding
feature enabled. For attributes from the current crate we can just use
the feature information provided by `TyCtx`.
r? `@compiler-errors`
|
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
Previously, the logic here was simply checking whether the option was set in `config.toml`.
This approach was not manageable in our CI runners as we set so many options in config.toml.
In reality, those values are not incompatible since they are usually the same value used to generate
the CI llvm. Now, the new logic compares the configuration values with the values used to generate
the CI llvm, so we get more precise results and make the process more manageable.
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
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.
|
|
Split x86_64-msvc-ext into two jobs
This is an attempt to mitigate (but not resolve) the high failure rate of the x86_64-msvc-ext builder. The theory being that doing less makes it less likely to fail. But this may not work as having an extra job that may fail might be worse.
try-job: x86_64-msvc-ext
try-job: x86_64-msvc-ext2
|
|
r=petrochenkov
Fix double handling in `collect_tokens`
Double handling of AST nodes can occur in `collect_tokens`. This is when an inner call to `collect_tokens` produces an AST node, and then an outer call to `collect_tokens` produces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegates `HasTokens` and `HasAttrs` to the expression. It will also happen more after #124141.
This PR fixes some double handling cases that cause problems, including #129166.
r? `@petrochenkov`
|
|
Supress niches in coroutines to avoid aliasing violations
As mentioned [here](https://github.com/rust-lang/rust/issues/63818#issuecomment-2264915918), using niches in fields of coroutines that are referenced by other fields is unsound: the discriminant accesses violate the aliasing requirements of the reference pointing to the relevant field. This issue causes [Miri errors in practice](https://github.com/rust-lang/miri/issues/3780).
The "obvious" fix for this is to suppress niches in coroutines. That's what this PR does. However, we have several tests explicitly ensuring that we *do* use niches in coroutines. So I see two options:
- We guard this behavior behind a `-Z` flag (that Miri will set by default). There is no known case of these aliasing violations causing miscompilations. But absence of evidence is not evidence of absence...
- (What this PR does right now.) We temporarily adjust the coroutine layout logic and the associated tests until the proper fix lands. The "proper fix" here is to wrap fields that other fields can point to in [`UnsafePinned`](https://github.com/rust-lang/rust/issues/125735) and make `UnsafePinned` suppress niches; that would then still permit using niches of *other* fields (those that never get borrowed). However, I know that coroutine sizes are already a problem, so I am not sure if this temporary size regression is acceptable.
`@compiler-errors` any opinion? Also who else should be Cc'd here?
|
|
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
|
|
Remove the unused `llvm-skip-rebuild` option from x.py
Fixes #130039
|
|
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.
|
|
r=lolbinarycat,GuillaumeGomez
rustdoc-search: allow trailing `Foo ->` arg search
Fixes #129710
|
|
add a few more crashtests
Added them for #123629, #127033 and #129372.
|
|
Do not call query to compute coroutine layout for synthetic body of async closure
There is code in the MIR validator that attempts to prevent query cycles when inlining a coroutine into itself, and will use the coroutine layout directly from the body when it detects that's the same coroutine as the one that's being validated. After #128506, this logic didn't take into account the fact that the coroutine def id will differ if it's the "by-move body" of an async closure. This PR implements that.
Fixes #129811
|
|
Don't build by-move body when async closure is tainted
Fixes #129676
See explanation in the ui test.
|
|
explain the options bootstrap passes to curl
also fixes a discrepancy where the rust side doesn't use -L
docs are only on the rust side, since duplicated prose has a tendancy to get out-of-sync, and also because there are talks of removing the python script all together eventually.
|
|
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`
|
|
Implement raw lifetimes and labels (`'r#ident`)
This PR does two things:
1. Reserve lifetime prefixes, e.g. `'prefix#lt` in edition 2021.
2. Implements raw lifetimes, e.g. `'r#async` in edition 2021.
This PR additionally extends the `keyword_idents_2024` lint to also check lifetimes.
cc `@traviscross`
r? parser
|
|
Bump boostrap compiler to new beta
Accidentally left some comments on the update cfgs commit directly xd
|
|
|
|
Delegation: support generics in associated delegation items
This is a continuation of https://github.com/rust-lang/rust/pull/125929.
[design](https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md)
Generic parameters inheritance was implemented in all contexts. Generic arguments are not yet supported.
r? `@petrochenkov`
|
|
|
|
Rollup of 9 pull requests
Successful merges:
- #128871 (bypass linker configuration and cross target check for specific commands)
- #129468 ([testsuite][cleanup] Remove all usages of `dont_merge` hack to avoid function merging)
- #129614 (Adjust doc comment of Condvar::wait_while)
- #129840 (Implement suggestions for `elided_named_lifetimes`)
- #129891 (Do not request sanitizers for naked functions)
- #129899 (Add Suggestions for Misspelled Keywords)
- #129940 (s390x: Fix a regression related to backchain feature)
- #129987 (Don't store region in `CapturedPlace`)
- #130054 (Add missing quotation marks)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
|
|
bypass linker configuration and cross target check for specific commands
Avoids configuring the linker and checking cross-target-specific tools unless necessary.
Resolves #128180
cc `@ChrisDenton`
|
|
|
|
Add missing quotation marks
|
|
Don't store region in `CapturedPlace`
It's not necessary anymore, since we erase all regions in writeback anyways.
|
|
s390x: Fix a regression related to backchain feature
In #127506, we introduced a new IBM Z-specific target feature, `backchain`.
This particular `target-feature` was available as a function-level attribute in LLVM 17 and below, so some hacks were used to avoid blowing up LLVM when querying the supported LLVM features.
This led to an unfortunate regression where `cfg!(target-feature = "backchain")` will always return true.
This pull request aims to fix this issue, and a test has been introduced to ensure it will never happen again.
Fixes #129927.
r? `@RalfJung`
|
|
Add Suggestions for Misspelled Keywords
Fixes #97793
This PR detects misspelled keywords using two heuristics:
1. Lowercasing the unexpected identifier.
2. Using edit distance to find a keyword similar to the unexpected identifier.
However, it does not detect each and every misspelled keyword to
minimize false positives and ambiguities. More details about the
implementation can be found in the comments.
|
|
Do not request sanitizers for naked functions
Naked functions can only contain inline asm, so any instrumentation inserted by sanitizers is illegal. Don't request it.
Fixes https://github.com/rust-lang/rust/issues/129224.
|
|
r=cjgillot
Implement suggestions for `elided_named_lifetimes`
A follow-up to #129207, as per https://github.com/rust-lang/rust/pull/129207#issuecomment-2308992849.
r? cjgillot
I will probably squash this a bit, but later.
`@rustbot` label +A-lint
|
|
Adjust doc comment of Condvar::wait_while
The existing phrasing implies that a notification must be received for `wait_while` to return. The phrasing is changed to make no such implication.
|
|
r=Mark-Simulacrum
[testsuite][cleanup] Remove all usages of `dont_merge` hack to avoid function merging
Resolves #129438
The `-Zmerge-functions=disabled` compile flag exists for this purpose.
|
|
bypass linker configuration and cross target check for specific commands
Avoids configuring the linker and checking cross-target-specific tools unless necessary.
Resolves #128180
cc `@ChrisDenton`
|
|
|
|
This PR detects misspelled keywords using two heuristics:
1. Lowercasing the unexpected identifier.
2. Using edit distance to find a keyword similar to the unexpected identifier.
However, it does not detect each and every misspelled keyword to
minimize false positives and ambiguities. More details about the
implementation can be found in the comments.
|
|
Apple: Refactor deployment target version parsing
Refactor deployment target parsing to make it easier to do https://github.com/rust-lang/rust/pull/129342 (I wanted to make sure of all the places that `std::env::var` is called).
Specifically, my goal was to minimize the amount of target-specific configuration, so to that end I renamed the `opts` function that generates the `TargetOptions` to `base`, and made it return the LLVM target and `target_arch` too. In the future, I would like to move even more out of the target files and into `spec::apple`, as it makes it easier for me to maintain.
For example, this fixed a bug in `aarch64-apple-watchos`, which wasn't passing the deployment target as part of the LLVM triple. This (probably) fixes https://github.com/rust-lang/rust/issues/123582 and fixes https://github.com/rust-lang/rust/issues/107630.
We also now parse the patch version of deployment targets, allowing the user to specify e.g. `MACOSX_DEPLOYMENT_TARGET=10.12.6`.
Finally, this fixes the LLVM target name for visionOS, it should be `*-apple-xros` and not `*-apple-visionos`.
Since I have changed all the Apple targets here, I smoke-tested my changes by running the following:
```console
# Build each target
./x build library --target="aarch64-apple-darwin,aarch64-apple-ios,aarch64-apple-ios-macabi,aarch64-apple-ios-sim,aarch64-apple-tvos,aarch64-apple-tvos-sim,aarch64-apple-visionos,aarch64-apple-visionos-sim,aarch64-apple-watchos,aarch64-apple-watchos-sim,arm64_32-apple-watchos,arm64e-apple-ios,armv7k-apple-watchos,armv7s-apple-ios,i386-apple-ios,x86_64-apple-darwin,x86_64-apple-ios,x86_64-apple-ios-macabi,x86_64-apple-tvos,x86_64-apple-watchos-sim,x86_64h-apple-darwin"
# Test that we can still at least link basic projects
cargo new foobar && cd foobar && cargo +stage1 build --target=aarch64-apple-darwin --target=aarch64-apple-ios --target=aarch64-apple-ios-macabi --target=aarch64-apple-ios-sim --target=aarch64-apple-tvos --target=aarch64-apple-tvos-sim --target=aarch64-apple-visionos --target=aarch64-apple-visionos-sim --target=aarch64-apple-watchos --target=aarch64-apple-watchos-sim --target=arm64_32-apple-watchos --target=armv7s-apple-ios --target=i386-apple-ios --target=x86_64-apple-darwin --target=x86_64-apple-ios --target=x86_64-apple-ios-macabi --target=x86_64-apple-tvos --target=x86_64-apple-watchos-sim --target=x86_64h-apple-darwin
```
I couldn't build for the `arm64e-apple-darwin` target, the `armv7k-apple-watchos` and `arm64e-apple-ios` targets failed to link, and I know that the `i686-apple-darwin` target requires a bit of setup, but all of this is as it was before this PR.
r? thomcc
CC `@BlackHoleFox`
I would recommend using `rollup=never` when merging this, in case we need to bisect this later.
|
|
Signed-off-by: cuishuang <imcusg@gmail.com>
|
|
|
|
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates
The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates)
r? `@lcnr`
|