33596 Commits

Author SHA1 Message Date
bors
986b8f29da Auto merge of #133436 - nnethercote:rm-NtVis-NtTy, r=petrochenkov
Remove `NtVis` and `NtTy`

The next part of #124141. The first actual remove of `Nonterminal` variants. `NtVis` is a simple case that doesn't get much use, but `NtTy` is more complex.

r? `@petrochenkov`
2025-02-22 06:09:14 +00:00
Josh Rotenberg
255ac6797c toc for other editors 2025-02-21 20:40:19 -08:00
bors
8bf5f0b08a Auto merge of #137348 - compiler-errors:span-trim, r=estebank
More sophisticated span trimming for suggestions

Previously #136958 only cared about prefixes or suffixes. Now it detects more cases where a suggestion is "sandwiched" by unchanged code on the left or the right. Would be cool if we could detect several insertions, like `ACE` going to `ABCDE`, extracting `B` and `D`, but that seems unwieldy.

r? `@estebank`
2025-02-21 23:59:08 +00:00
andylokandy
b59b04ffe2 fix 2025-02-21 21:31:23 +08:00
andylokandy
03c24d7c28 feat: update insta inline snapshot when clicks 'Update Test' runnable 2025-02-21 21:18:20 +08:00
bors
67f407c372 Auto merge of #137192 - kornelski:windows-tls-lto, r=ChrisDenton
Remove obsolete Windows ThinLTO+TLS workaround

The bug #109797 has been fixed by #129079, so this workaround is no longer needed.
2025-02-21 11:43:00 +00:00
Jubilee Young
eb4c00e9c7 rust-analyzer: use new function in (incorrect) layout computation
This is only to fix the build.
2025-02-20 19:55:29 -08:00
bors
6d727b5e35 Auto merge of #137346 - workingjubilee:rollup-sxu05ms, r=workingjubilee
Rollup of 12 pull requests

Successful merges:

 - #131651 (Create a generic AVR target: avr-none)
 - #134340 (Stabilize `num_midpoint_signed` feature)
 - #136473 (infer linker flavor by linker name if it's sufficiently specific)
 - #136608 (Pass through of target features to llvm-bitcode-linker and handling them)
 - #136985 (Do not ignore uninhabited types for function-call ABI purposes. (Remove BackendRepr::Uninhabited))
 - #137270 (Fix `*-win7-windows-msvc` target since 26eeac1a1e9fe46ffd80dd0d3dafdd2c2a644306)
 - #137312 (Update references to cc_detect.rs)
 - #137318 (Workaround Cranelift not yet properly supporting vectors smaller than 128bit)
 - #137322 (Update docs for default features of wasm targets)
 - #137324 (Make x86 QNX target name consistent with other Rust targets)
 - #137338 (skip submodule updating logics on tarballs)
 - #137340 (Add a notice about missing GCC sources into source tarballs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-21 00:16:10 +00:00
Jubilee
a8c7bd233e
Rollup merge of #137340 - Kobzol:bootstrap-dir-check, r=onur-ozkan
Add a notice about missing GCC sources into source tarballs

I didn't use `.gitkeep`, because that would be a hidden file that might not be noticed, whereas we want to let people inspecting the archive know why the sources are missing.

Inspired by https://github.com/rust-lang/rust/issues/137332.

r? `@onur-ozkan`
2025-02-20 14:58:22 -08:00
Jubilee
f17545c054
Rollup merge of #137338 - onur-ozkan:137332, r=Kobzol
skip submodule updating logics on tarballs

Running submodule logic on tarballs isn't necessary since git isn't available there.

Fixes #137332
2025-02-20 14:58:21 -08:00
Jubilee
caecb759b4
Rollup merge of #137324 - flba-eb:rename_qnx_target_name_i586, r=workingjubilee
Make x86 QNX target name consistent with other Rust targets

Rename target to be consistent with other Rust targets: Use `i686` instead of `i586`
See also
- #136495
- #109173

CC: `@jonathanpallant` `@japaric` `@gh-tr` `@samkearney`
2025-02-20 14:58:21 -08:00
Jubilee
ddd55fc3cc
Rollup merge of #137322 - alexcrichton:update-wasm-docs, r=jieyouxu
Update docs for default features of wasm targets

LLVM 20 enabled the `nontrapping-fptoint` and `bulk-memory` features by default, so this updates the corresponding documentation for the `wasm32-*` targets (which all point to `wasm32-unknown-unknown`).

Closes #137315 with a doc update for the doc part.
2025-02-20 14:58:20 -08:00
Jubilee
d7f663746e
Rollup merge of #137318 - bjorn3:cg_clif_abi_workaround, r=workingjubilee
Workaround Cranelift not yet properly supporting vectors smaller than 128bit

While it would technically be possible to workaround this in cg_clif, it quickly becomes very messy and would likely cause correctness issues. Working around it in rustc instead is much simper and won't have any negative impact for code running on stable as vectors smaller than 128bit can only be made on nightly using core::simd or #[repr(simd)].
2025-02-20 14:58:19 -08:00
Jubilee
01695669c9
Rollup merge of #137312 - jmqd:master, r=clubby789
Update references to cc_detect.rs

The locations of these file references have since been changed.
This is a simple change to update the references to this `cc_detect.rs`
file.
2025-02-20 14:58:19 -08:00
Jubilee
1030828ab1
Rollup merge of #137270 - QianNangong:master, r=ChrisDenton
Fix `*-win7-windows-msvc` target since 26eeac1a1e9fe46ffd80dd0d3dafdd2c2a644306

That commit make it failed to build `std` with `*-win7-windows-msvc` so fix it.
2025-02-20 14:58:18 -08:00
Jubilee
7cd34e76de
Rollup merge of #136985 - zachs18:backend-repr-remove-uninhabited, r=workingjubilee
Do not ignore uninhabited types for function-call ABI purposes. (Remove BackendRepr::Uninhabited)

Accepted MCP: https://github.com/rust-lang/compiler-team/issues/832

Fixes #135802

Do not consider the inhabitedness of a type for function call ABI purposes.

* Remove the [`rustc_abi::BackendRepr::Uninhabited`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.BackendRepr.html) variant
  * Instead calculate the `BackendRepr` of uninhabited types "normally" (as though they were not uninhabited "at the top level", but still considering inhabitedness of variants to determine enum layout, etc)
* Add an `uninhabited: bool` field to [`rustc_abi::LayoutData`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/struct.LayoutData.html) so inhabitedness of a `LayoutData` can still be queried when necessary (e.g. when determining if an enum variant needs a tag value allocated to it).

This should not affect type layouts (size/align/field offset); this should only affect function call ABI, and only of uninhabited types.

cc ``@RalfJung``
2025-02-20 14:58:18 -08:00
Jubilee
e6481eccab
Rollup merge of #136608 - kulst:ptx_target_features, r=bjorn3
Pass through of target features to llvm-bitcode-linker and handling them

When using the llvm-bitcode-linker (`linker-flavor=llbc`) target-features are not passed through and are not handled by it.
The llvm-bitcode-linker is mainly used as a self contained linker to link llvm bitcode for the nvptx64 target. It uses `llvm-link`, `opt` and `llc` internally. To produce a `.ptx` file of a specific ptx-version it is necessary to pass the version to llc with the `--mattr` option. Without explicitly setting it, the emitted `.ptx`-version is the minimum supported version of the `--target-cpu`.

I would like to be able to explicitly set the ptx version as [some llvm problems only occur in earlier `.ptx`-versions](https://github.com/llvm/llvm-project/issues/112998).

Therefore this pull request adds support for passing target features to llvm-bitcode-linker and handling them.
I was not quite sure if adding these features to `rustc_target/src/target_features.rs` is necessary or not. If so I will gladly add these.

    r? ``@kjetilkjeka``
2025-02-20 14:58:17 -08:00
Jubilee
acbe0aa5d2
Rollup merge of #134340 - Urgau:stabilize-num_midpoint_signed, r=scottmcm
Stabilize `num_midpoint_signed` feature

This PR proposes that we stabilize the signed variants of [`iN::midpoint`](https://github.com/rust-lang/rust/issues/110840#issue-1684506201), the operation is equivalent to doing `(a + b) / 2` in a sufficiently large number.

The stabilized API surface would be:

```rust
/// Calculates the middle point of `self` and `rhs`.
///
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
/// sufficiently-large signed integer type. This implies that the result is
/// always rounded towards zero and that no overflow will ever occur.

impl i{8,16,32,64,128,size} {
    pub const fn midpoint(self, rhs: Self) -> Self;
}
```

T-libs-api previously stabilized the unsigned (and float) variants in #131784, the signed variants were left out because of the rounding that should be used in case of negative midpoint.

This stabilization proposal proposes that we round towards zero because:
 - it makes the obvious `(a + b) / 2` in a sufficiently-large number always true
   - using another rounding for the positive result would be inconsistent with the unsigned variants
 - it makes `midpoint(-a, -b)` == `-midpoint(a, b)` always true
 - it is consistent with `midpoint(a as f64, b as f64) as i64`
 - it makes it possible to always suggest `midpoint` as a replacement for `(a + b) / 2` expressions *(which we may want to do as a future work given the 21.2k hits on [GitHub Search](https://github.com/search?q=lang%3Arust+%2F%5C%28%5Ba-zA-Z_%5D*+%5C%2B+%5Ba-zA-Z_%5D*%5C%29+%5C%2F+2%2F&type=code&p=1))*

`@scottmcm` mentioned a drawback in https://github.com/rust-lang/rust/pull/132191#issuecomment-2439891200:
> I'm torn, because rounding towards zero makes it "wider" than other values, which `>> 1` avoids -- `(a + b) >> 1` has the nice behaviour that `midpoint(a, b) + 2 == midpoint(a + 2, b + 2)`.
>
> But I guess overall sticking with `(a + b) / 2` makes sense as well, and I do like the negation property 🤷

Which I think is outweigh by the advantages cited above.

Closes #110840
cc `@rust-lang/libs-api`
cc `@scottmcm`
r? `@dtolnay`
2025-02-20 14:58:16 -08:00
Zachary S
8aba4e6dcb Remove BackendRepr::Uninhabited, replaced with an uninhabited: bool field in LayoutData.
Also update comments that refered to BackendRepr::Uninhabited.
2025-02-20 13:27:32 -06:00
Laurențiu Nicola
88fbdcd510
Merge pull request #19192 from BenjaminBrienen/patch-4
Update style.md
2025-02-20 18:53:54 +00:00
Benjamin Brienen
3a333962ee
Update style.md
fix dead link
2025-02-20 19:38:24 +01:00
bors
c1e647b1e7 Auto merge of #136771 - scottmcm:poke-slice-iter-next, r=joboet
Simplify `slice::Iter::next` enough that it inlines

Inspired by this zulip conversation: <https://rust-lang.zulipchat.com/#narrow/channel/189540-t-compiler.2Fwg-mir-opt/topic/Feedback.20on.20a.20MIR.20optimization.20idea/near/498579990>

~~Draft for now because it needs #136735 to get the codegen tests to pass.~~
2025-02-20 18:20:40 +00:00
Lukas Wirth
88bc40aac0
Merge pull request #19189 from Veykril/push-qutznxznnwqn
minor: Improve unset `OUT_DIR` error message
2025-02-20 18:15:29 +00:00
Lukas Wirth
6b32c8329f Improve unset OUT_DIR error message 2025-02-20 19:00:23 +01:00
Laurențiu Nicola
8de928d028
Merge pull request #19190 from BenjaminBrienen/patch-4
Update editor_features.md
2025-02-20 16:20:35 +00:00
Benjamin Brienen
701c2de137
Update editor_features.md
fix typos in snippets
2025-02-20 17:05:18 +01:00
Lukas Wirth
6265c53132
Merge pull request #19151 from infiniteregrets/infi/fix-proc-macro
Use correct working directory for non-workspace proc-macro execution
2025-02-20 16:04:52 +00:00
Laurențiu Nicola
2612123e8a
Merge pull request #19188 from lnicola/ubuntu-latest
internal: Use ubuntu-latest workers for releases
2025-02-20 07:50:21 +00:00
Laurențiu Nicola
85e627433b Use ubuntu-latest workers for releases 2025-02-20 09:34:19 +02:00
Laurențiu Nicola
457d1d263c
Merge pull request #19185 from BenjaminBrienen/patch-3
Update architecture.md
2025-02-20 07:23:34 +00:00
Laurențiu Nicola
99ea63459a
Merge pull request #19187 from BenjaminBrienen/patch-4
Update configuration.md
2025-02-20 07:06:39 +00:00
Laurențiu Nicola
1d1da786c9
Merge pull request #19186 from joshrotenberg/fix-source-link-line-anchor
doc: missed the L for the line number
2025-02-20 07:06:13 +00:00
bors
99beae85a5 Auto merge of #137023 - Kobzol:bump-sccache, r=marcoieni
Bump sccache in CI to 0.9.1

We haven't updated the used sccache version for years, it has accrued a bunch of fixes and features in the meantime. It now supports the `--show-adv-stats` flag, which gives a more detailed summary of the results of caching. And it can also cache Rust code, which could be useful in the future (https://github.com/rust-lang/rust/pull/136942 - although now there are no large wins).

It also supports caching PGO now, but since the PGO profiles are always different, it won't make any real difference.

https://github.com/rust-lang/rust/pull/133076 previously tried to update the version to 0.3 (CC `@klensy)`

r? `@marcoieni`
2025-02-20 05:59:04 +00:00
Benjamin Brienen
92e9c76f15
Update configuration.md
fix dead links
2025-02-20 03:21:45 +01:00
Josh Rotenberg
5968782ce6 missed the L for the line number 2025-02-19 16:52:12 -08:00
Benjamin Brienen
11daea37b6
Update architecture.md
it is stable since 1.52
2025-02-20 01:28:20 +01:00
Shoyu Vanilla
a82773ab48 Explicitly compare TypesMap as ptrs 2025-02-20 08:49:00 +09:00
Shoyu Vanilla
9d459e8de7 fix: Binding wrong assoc ty when lowering trait ref bound 2025-02-20 00:47:21 +09:00
bors
45ad364b10 Auto merge of #136539 - matthewjasper:late-normalize-errors, r=compiler-errors
Emit dropck normalization errors in borrowck

Borrowck generally assumes that any queries it runs for type checking will succeed, thinking that HIR typeck will have errored first if there was a problem. However as of #98641, dropck isn't run on HIR, so there's no direct guarantee that it doesn't error. While a type being well-formed might be expected to ensure that its fields are well-formed, this is not the case for types containing a type projection:

```rust
pub trait AuthUser {
    type Id;
}

pub trait AuthnBackend {
    type User: AuthUser;
}

pub struct AuthSession<Backend: AuthnBackend> {
    data: Option<<<Backend as AuthnBackend>::User as AuthUser>::Id>,
}

pub trait Authz: Sized {
    type AuthnBackend: AuthnBackend<User = Self>;
}

pub fn run_query<User: Authz>(auth: AuthSession<User::AuthnBackend>) {}
// ^ No User: AuthUser bound is required or inferred.
```

While improvements to trait solving might fix this in the future, for now we go for a pragmatic solution of emitting an error from borrowck (by rerunning dropck outside of a query) and making drop elaboration check if an error has been emitted previously before panicking for a failed normalization.

Closes #103899
Closes #135039

r? `@compiler-errors` (feel free to re-assign)
2025-02-19 07:49:08 +00:00
Lukas Wirth
9691da7707
Merge pull request #19180 from joshrotenberg/fix-source-file-url
doc: use fully qualified url for source path
2025-02-19 06:37:01 +00:00
Chayim Refael Friedman
3028f844c5
Merge pull request #19179 from alibektas/19090_new
Ignore assists with many results if grouping not supported
2025-02-18 21:13:06 +00:00
Ali Bektas
9d5a97368a Add a check_assist_* overload and move tests under assists 2025-02-18 21:58:27 +01:00
Josh Rotenberg
ea9e179287 use fully qualified url for source path 2025-02-18 12:57:18 -08:00
Ali Bektas
fc10fe44de Fix 19090 2025-02-18 20:51:42 +01:00
Laurențiu Nicola
4a6ea31013
Merge pull request #19176 from BenjaminBrienen/patch-3
Fix dead link
2025-02-18 16:39:43 +00:00
Benjamin Brienen
e5484d9c73
Fix dead link 2025-02-18 17:22:45 +01:00
Lukas Wirth
957d3450da
Merge pull request #19173 from rust-lang/revert-19122-master
Revert "pass struct fields to chalk"
2025-02-18 10:53:35 +00:00
Lukas Wirth
6543225ad9
Revert "pass struct fields to chalk" 2025-02-18 11:37:43 +01:00
bors
b219a0e9ab Auto merge of #133852 - x17jiri:cold_path, r=saethlin
improve cold_path()

#120370 added a new instrinsic `cold_path()` and used it to fix `likely` and `unlikely`

However, in order to limit scope, the information about cold code paths is only used in 2-target switch instructions. This is sufficient for `likely` and `unlikely`, but limits usefulness of `cold_path` for idiomatic rust. For example, code like this:

```
if let Some(x) = y { ... }
```

may generate 3-target switch:

```
switch y.discriminator:
0 => true branch
1 = > false branch
_ => unreachable
```

and therefore marking a branch as cold will have no effect.

This PR improves `cold_path()` to work with arbitrary switch instructions.

Note that for 2-target switches, we can use `llvm.expect`, but for multiple targets we need to manually emit branch weights. I checked Clang and it also emits weights in this situation. The Clang's weight calculation is more complex that this PR, which I believe is mainly because `switch` in `C/C++` can have multiple cases going to the same target.
2025-02-18 07:49:09 +00:00
Lukas Wirth
e865b249e6
Merge pull request #19157 from joshrotenberg/dev-guide-to-book
doc: move dev docs to manual
2025-02-18 07:00:23 +00:00