33596 Commits

Author SHA1 Message Date
Lukas Wirth
168f177fe0
Merge pull request #19163 from Veykril/push-owykwupqnzpq
fix: Stabilize sort order of `related_tests`
2025-02-16 12:33:40 +00:00
Lukas Wirth
1afbc220bc fix: Stabilize sort order of related_tests 2025-02-16 13:18:47 +01:00
Lukas Wirth
b332a053e0
Merge pull request #19161 from Veykril/push-prmuyxlnxzxo
fix: Improve sort order of runnables
2025-02-16 11:37:52 +00:00
Lukas Wirth
7128701947
Merge pull request #19160 from Veykril/push-f3601671f6a468a8cc0774253ddaddff
Improve error recovery when method-calling an assoc function
2025-02-16 11:26:02 +00:00
Lukas Wirth
e0d1fba739 fix: Stabilize sort order of runnables 2025-02-16 12:22:26 +01:00
Lukas Wirth
e6ea353d94 Improve error recovery when method-calling an assoc function 2025-02-16 11:49:48 +01:00
Lukas Wirth
fb8bc313ff
Merge pull request #19159 from Veykril/push-kwtzytsyktpv
fix: Set `RUSTUP_TOOLCHAIN` when loading sysroot workspace
2025-02-16 10:08:51 +00:00
Lukas Wirth
b9f76287c2 Set RUSTUP_TOOLCHAIN when loading sysroot workspace 2025-02-16 10:54:08 +01:00
Olivier FAURE
4fa6595f9a Re-generate doctests 2025-02-15 16:26:28 +01:00
Shoyu Vanilla
7d74f2b3e9 Temporarily ignore tests with comments 2025-02-16 00:12:03 +09:00
Olivier FAURE
e4f62b6999 Implement expand_glob_reexport assist 2025-02-15 16:07:33 +01:00
Olivier FAURE
4de24de6b7 Factor out business logic of expand_glob_import 2025-02-15 13:23:32 +01:00
bors
4a8e46bc80 Auto merge of #136324 - GrigorenkoPV:erf, r=tgross35
Implement `f{16,32,64,128}::{erf,erfc}` (`#![feature(float_erf)]`)

Tracking issue: #136321

try-job: x86_64-gnu-aux
2025-02-15 04:52:50 +00:00
asuto15
c14140ab8b
fix: remove unnecessary conversion 2025-02-15 13:18:18 +09:00
asuto15
24a778f6c1
Delete library modifier to highlighting for extern crate 2025-02-15 12:06:21 +09:00
Lukas Wirth
40e4f9130f
Merge pull request #19156 from programmerjake/patch-1
add cargo's git checkouts to the list of paths to mark as read-only in vscode
2025-02-14 05:59:17 +00:00
Jacob Lifshay
a9dcc01357
add cargo's git checkouts to the list of paths to mark as read-only in vscode 2025-02-13 18:48:36 -08:00
bors
07ba8570a8 Auto merge of #134633 - GrigorenkoPV:get_disjoint_mut, r=cuviper
Stabilize `get_many_mut` as `get_disjoint_mut`

Tracking issue: #104642

Closes #104642

FCP completed in https://github.com/rust-lang/rust/issues/104642#issuecomment-2558161073
2025-02-13 21:09:31 +00:00
Shoyu Vanilla
8b947d7a12 internal: Remove mutable syntax tree usages from add_missing_match_arms assist 2025-02-14 02:36:05 +09:00
bors
c21bff4cc9 Auto merge of #136593 - lukas-code:ty-value-perf, r=oli-obk
valtree performance tuning

Summary: This PR makes type checking of code with many type-level constants faster.

After https://github.com/rust-lang/rust/pull/136180 was merged, we observed a small perf regression (https://github.com/rust-lang/rust/pull/136318#issuecomment-2635562821). This happened because that PR introduced additional copies in the fast reject code path for consts, which is very hot for certain crates: 6c1d960d88/compiler/rustc_type_ir/src/fast_reject.rs (L486-L487)

This PR improves the performance again by properly interning the valtrees so that copying and comparing them becomes faster. This will become especially useful with `feature(adt_const_params)`, so the fast reject code doesn't have to do a deep compare of the valtrees.

Note that we can't just compare the interned consts themselves in the fast reject, because sometimes `'static` lifetimes in the type are be replaced with inference variables (due to canonicalization) on one side but not the other.

A less invasive alternative that I considered is simply avoiding copies introduced by https://github.com/rust-lang/rust/pull/136180 and comparing the valtrees it in-place (see commit: 9e91e50ac5 / perf results: https://github.com/rust-lang/rust/pull/136593#issuecomment-2642303245), however that was still measurably slower than interning.

There are some minor regressions in secondary benchmarks: These happen due to changes in memory allocations and seem acceptable to me. The crates that make heavy use of valtrees show no significant changes in memory usage.
2025-02-13 15:27:30 +00:00
Lukas Wirth
51389bd00d
Merge pull request #19141 from Wilfred/split_editors
manual: Separate out installation and configuration pages
2025-02-13 06:44:39 +00:00
Lukas Wirth
c63ef6246f
Merge pull request #19150 from darichey/set-test-json-project
Apply cfg.setTest to json projects
2025-02-13 06:44:10 +00:00
bors
2a97412d11 Auto merge of #136535 - marcoieni:free-runners-remove-more-dirs, r=Mark-Simulacrum
ci: remove more unused files and directories in free runners

try-job: aarch64-gnu
try-job: aarch64-gnu-debug
2025-02-13 05:04:49 +00:00
bors
1675cb196d Auto merge of #136954 - jhpratt:rollup-koefsot, r=jhpratt
Rollup of 12 pull requests

Successful merges:

 - #134090 (Stabilize target_feature_11)
 - #135025 (Cast allocas to default address space)
 - #135841 (Reject `?Trait` bounds in various places where we unconditionally warned since 1.0)
 - #136217 (Mark condition/carry bit as clobbered in C-SKY inline assembly)
 - #136699 (std: replace the `FromInner` implementation for addresses with private conversion functions)
 - #136806 (Fix cycle when debug-printing opaque types from RPITIT)
 - #136807 (compiler: internally merge `PtxKernel` into `GpuKernel`)
 - #136818 (Implement `read*_exact` for `std:io::repeat`)
 - #136927 (Correctly escape hashtags when running `invalid_rust_codeblocks` lint)
 - #136937 (Update books)
 - #136945 (Add diagnostic item for `std::io::BufRead`)
 - #136947 (Reinstate nnethercote in the review rotation.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-13 02:13:24 +00:00
Jacob Pratt
226df19dd1
Rollup merge of #136807 - workingjubilee:merge-gpus-to-get-the-arcradeongeforce, r=bjorn3
compiler: internally merge `PtxKernel` into `GpuKernel`

r? ``@bjorn3`` for review
2025-02-12 20:10:00 -05:00
Jacob Pratt
fd6f7a65a4
Rollup merge of #136806 - adwinwhite:cycle-in-pretty-print-rpitit, r=compiler-errors
Fix cycle when debug-printing opaque types from RPITIT

Extend #66594 to opaque types from RPITIT.

Before this PR, enabling debug logging like `RUSTC_LOG="[check_type_bounds]"` for code containing RPITIT produces a query cycle of `explicit_item_bounds`, as pretty printing for opaque type calls [it](d9a4a47b8b/compiler/rustc_middle/src/ty/print/pretty.rs (L1001)).
2025-02-12 20:09:59 -05:00
Jacob Pratt
b71a8982c2
Rollup merge of #136217 - taiki-e:csky-asm-flags, r=Amanieu
Mark condition/carry bit as clobbered in C-SKY inline assembly

C-SKY's compare and some arithmetic/logical instructions modify condition/carry bit (C) in PSR, but there is currently no way to mark it as clobbered in `asm!`.

This PR marks it as clobbered except when [`options(preserves_flags)`](https://doc.rust-lang.org/reference/inline-assembly.html#r-asm.options.supported-options.preserves_flags) is used.

Refs:
- Section 1.3 "Programming model" and Section 1.3.5 "Condition/carry bit" in CSKY Architecture user_guide:
  9f7121f7d4/CSKY%20Architecture%20user_guide.pdf

  > Under user mode, condition/carry bit (C) is located in the lowest bit of PSR, and it can be
accessed and changed by common user instructions. It is the only data bit that can be visited
under user mode in PSR.

  > Condition or carry bit represents the result after one operation. Condition/carry bit can be
clearly set according to the results of compare instructions or unclearly set as some
high-precision arithmetic or logical instructions. In addition, special instructions such as
DEC[GT,LT,NE] and XTRB[0-3] will influence the value of condition/carry bit.

- Register definition in LLVM:
  https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/CSKY/CSKYRegisterInfo.td#L88

cc ```@Dirreke``` ([target maintainer](aa6f5ab18e/src/doc/rustc/src/platform-support/csky-unknown-linux-gnuabiv2.md (target-maintainers)))

r? ```@Amanieu```

```@rustbot``` label +O-csky +A-inline-assembly
2025-02-12 20:09:58 -05:00
Jacob Pratt
cdfc2f89b1
Rollup merge of #135025 - Flakebi:alloca-addrspace, r=nikic
Cast allocas to default address space

Pointers for variables all need to be in the same address space for correct compilation. Therefore ensure that even if an `alloca` is created in a different address space, it is casted to the default address space before its value is used.

This is necessary for the amdgpu target and others where the default address space for `alloca`s is not 0.

For example the following code compiles incorrectly when not casting the address space to the default one:

```rust
fn f(p: *const i8 /* addrspace(0) */) -> *const i8 /* addrspace(0) */ {
    let local = 0i8; /* addrspace(5) */
    let res = if cond { p } else { &raw const local };
    res
}
```

results in

```llvm
    %local = alloca addrspace(5) i8
    %res = alloca addrspace(5) ptr

if:
    ; Store 64-bit flat pointer
    store ptr %p, ptr addrspace(5) %res

else:
    ; Store 32-bit scratch pointer
    store ptr addrspace(5) %local, ptr addrspace(5) %res

ret:
    ; Load and return 64-bit flat pointer
    %res.load = load ptr, ptr addrspace(5) %res
    ret ptr %res.load
```

For amdgpu, `addrspace(0)` are 64-bit pointers, `addrspace(5)` are 32-bit pointers.
The above code may store a 32-bit pointer and read it back as a 64-bit pointer, which is obviously wrong and cannot work. Instead, we need to `addrspacecast %local to ptr addrspace(0)`, then we store and load the correct type.

Tracking issue: #135024
2025-02-12 20:09:56 -05:00
Jacob Pratt
8229ab8633
Rollup merge of #134090 - veluca93:stable-tf11, r=oli-obk
Stabilize target_feature_11

# Stabilization report

This is an updated version of https://github.com/rust-lang/rust/pull/116114, which is itself a redo of https://github.com/rust-lang/rust/pull/99767. Most of this commit and report were copied from those PRs. Thanks ```@LeSeulArtichaut``` and ```@calebzulawski!```

## Summary
Allows for safe functions to be marked with `#[target_feature]` attributes.

Functions marked with `#[target_feature]` are generally considered as unsafe functions: they are unsafe to call, cannot *generally* be assigned to safe function pointers, and don't implement the `Fn*` traits.

However, calling them from other `#[target_feature]` functions with a superset of features is safe.

```rust
// Demonstration function
#[target_feature(enable = "avx2")]
fn avx2() {}

fn foo() {
    // Calling `avx2` here is unsafe, as we must ensure
    // that AVX is available first.
    unsafe {
        avx2();
    }
}

#[target_feature(enable = "avx2")]
fn bar() {
    // Calling `avx2` here is safe.
    avx2();
}
```

Moreover, once https://github.com/rust-lang/rust/pull/135504 is merged, they can be converted to safe function pointers in a context in which calling them is safe:

```rust
// Demonstration function
#[target_feature(enable = "avx2")]
fn avx2() {}

fn foo() -> fn() {
    // Converting `avx2` to fn() is a compilation error here.
    avx2
}

#[target_feature(enable = "avx2")]
fn bar() -> fn() {
    // `avx2` coerces to fn() here
    avx2
}
```

See the section "Closures" below for justification of this behaviour.

## Test cases
Tests for this feature can be found in [`tests/ui/target_feature/`](f6cb952dc1/tests/ui/target-feature).

## Edge cases
### Closures
 * [target-feature 1.1: should closures inherit target-feature annotations? #73631](https://github.com/rust-lang/rust/issues/73631)

Closures defined inside functions marked with #[target_feature] inherit the target features of their parent function. They can still be assigned to safe function pointers and implement the appropriate `Fn*` traits.

```rust
#[target_feature(enable = "avx2")]
fn qux() {
    let my_closure = || avx2(); // this call to `avx2` is safe
    let f: fn() = my_closure;
}
```
This means that in order to call a function with #[target_feature], you must guarantee that the target-feature is available while the function, any closures defined inside it, as well as any safe function pointers obtained from target-feature functions inside it, execute.

This is usually ensured because target features are assumed to never disappear, and:
- on any unsafe call to a `#[target_feature]` function, presence of the target feature is guaranteed by the programmer through the safety requirements of the unsafe call.
- on any safe call, this is guaranteed recursively by the caller.

If you work in an environment where target features can be disabled, it is your responsibility to ensure that no code inside a target feature function (including inside a closure) runs after this (until the feature is enabled again).

**Note:** this has an effect on existing code, as nowadays closures do not inherit features from the enclosing function, and thus this strengthens a safety requirement. It was originally proposed in #73631 to solve this by adding a new type of UB: “taking a target feature away from your process after having run code that uses that target feature is UB” .
This was motivated by userspace code already assuming in a few places that CPU features never disappear from a program during execution (see i.e. 2e29bdf908/crates/std_detect/src/detect/arch/x86.rs); however, concerns were raised in the context of the Linux kernel; thus, we propose to relax that requirement to "causing the set of usable features to be reduced is unsafe; when doing so, the programmer is required to ensure that no closures or safe fn pointers that use removed features are still in scope".

* [Fix #[inline(always)] on closures with target feature 1.1 #111836](https://github.com/rust-lang/rust/pull/111836)

Closures accept `#[inline(always)]`, even within functions marked with `#[target_feature]`. Since these attributes conflict, `#[inline(always)]` wins out to maintain compatibility.

### ABI concerns
* [The extern "C" ABI of SIMD vector types depends on target features #116558](https://github.com/rust-lang/rust/issues/116558)

The ABI of some types can change when compiling a function with different target features. This could have introduced unsoundness with target_feature_11, but recent fixes (#133102, #132173) either make those situations invalid or make the ABI no longer dependent on features. Thus, those issues should no longer occur.

### Special functions
The `#[target_feature]` attribute is forbidden from a variety of special functions, such as main, current and future lang items (e.g. `#[start]`, `#[panic_handler]`), safe default trait implementations and safe trait methods.

This was not disallowed at the time of the first stabilization PR for target_features_11, and resulted in the following issues/PRs:
* [`#[target_feature]` is allowed on `main` #108645](https://github.com/rust-lang/rust/issues/108645)
* [`#[target_feature]` is allowed on default implementations #108646](https://github.com/rust-lang/rust/issues/108646)
* [#[target_feature] is allowed on #[panic_handler] with target_feature 1.1 #109411](https://github.com/rust-lang/rust/issues/109411)
* [Prevent using `#[target_feature]` on lang item functions #115910](https://github.com/rust-lang/rust/pull/115910)

## Documentation
 * Reference: [Document the `target_feature_11` feature reference#1181](https://github.com/rust-lang/reference/pull/1181)
---

cc tracking issue https://github.com/rust-lang/rust/issues/69098
cc ```@workingjubilee```
cc ```@RalfJung```
r? ```@rust-lang/lang```
2025-02-12 20:09:56 -05:00
bors
988bc0d488 Auto merge of #135994 - 1c3t3a:rename-unsafe-ptr, r=oli-obk
Rename rustc_middle::Ty::is_unsafe_ptr to is_raw_ptr

The wording unsafe pointer is less common and not mentioned in a lot of places, instead this is usually called a "raw pointer". For the sake of uniformity, we rename this method.
This came up during the review of
https://github.com/rust-lang/rust/pull/134424.

r? `@Noratrieb`
2025-02-12 23:18:14 +00:00
David Richey
a297d438bc Apply cfg.setTest to json projects 2025-02-12 14:05:34 -06:00
asuto15
22b1977840
Delete useless comma 2025-02-13 04:33:08 +09:00
asuto15
535338d8bb
Add modifiers to highlighting for extern crate 2025-02-13 03:58:20 +09:00
Wilfred Hughes
3394744928 manual: Separate out installation and configuration pages
Organise the installation content into:

* VS Code instructions
* Binary installation
* Editor configuration
2025-02-12 10:21:09 -08:00
Lukas Wirth
c661e5e14e
Merge pull request #19142 from Veykril/push-upwqztrsuwpz
Spawn toolchain querying processes in parallel
2025-02-12 16:04:57 +00:00
Lukas Wirth
172a504b56 Rename sysroot src/lib related things 2025-02-12 16:51:27 +01:00
Lukas Wirth
26a5e24507
Merge pull request #19148 from Veykril/push-ptnykrwnwwlu
Improve error recovery when method-calling a field
2025-02-12 15:51:04 +00:00
Lukas Wirth
c942fb6061 Improve error recovery when method-calling a field 2025-02-12 16:37:15 +01:00
Lukas Wirth
8a8ff99273 Spawn toolchain querying processes in parallel 2025-02-12 16:24:49 +01:00
Lukas Wirth
12d87252ac
Merge pull request #18928 from roife/fix-18918
fix: handle character boundary in search mode
2025-02-12 14:07:51 +00:00
Lukas Wirth
8e81cc0772
Merge pull request #19109 from Veykril/push-nzpuuqommpnq
fix: Do not show safety hints for extern items lacking semantics
2025-02-12 13:58:56 +00:00
roife
608d7e14d7 fix: handle character boundary in search mode 2025-02-12 14:47:28 +01:00
Lukas Wirth
e0814742f0 fix: Do not show safety hints for extern items lacking semantics 2025-02-12 14:43:51 +01:00
Lukas Wirth
c9838ec62d
Merge pull request #19111 from ShoyuVanilla/issue-19021
fix: Apply adjustments to proper expr when invoking `CoerceMany`
2025-02-12 13:42:52 +00:00
Lukas Wirth
aa64a6da0e
Merge pull request #19110 from eagr/panic-context
Simplify panic_context
2025-02-12 13:41:11 +00:00
Lukas Wirth
b636cf93e5
Merge pull request #19125 from ChayimFriedman2/cfg-attr-fast
fix: Censor cfg_attr for attribute macros
2025-02-12 13:38:24 +00:00
Lukas Wirth
622ef64f93
Merge pull request #18995 from alibektas/12210
fix: Lower range pattern bounds to expressions
2025-02-12 11:58:33 +00:00
Lukas Wirth
5235caf402
Merge pull request #19129 from ChayimFriedman2/snippet-macro
fix: Fix postfix completions inside macros
2025-02-12 11:55:46 +00:00
Lukas Wirth
3b6f77c722
Merge pull request #19132 from joshrotenberg/book-readme-run-codegen
doc: add xtask codegen command in development README as well
2025-02-12 11:49:11 +00:00
Lukas Wirth
0e5a127607
Merge pull request #19136 from rust-lang/dependabot/npm_and_yarn/editors/code/esbuild-0.25.0
Bump esbuild from 0.18.12 to 0.25.0 in /editors/code
2025-02-12 11:48:43 +00:00