Commit Graph

249771 Commits

Author SHA1 Message Date
Kornel
55067c539a Suggest _ for missing generic arguments in turbofish 2024-03-17 17:34:17 +00:00
bors
35dfc67d94 Auto merge of #122637 - matthiaskrgr:rollup-bczj5bp, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #121236 (Don't show suggestion if slice pattern is not top-level)
 - #121787 (run change tracker even when config parse fails)
 - #122633 (avoid unnecessary collect())

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-17 13:55:27 +00:00
Matthias Krüger
12137462b4
Rollup merge of #122633 - matthiaskrgr:col, r=fmease
avoid unnecessary collect()
2024-03-17 14:04:15 +01:00
Matthias Krüger
2448162729
Rollup merge of #121787 - onur-ozkan:improve-change-tracker, r=albertlarsan68
run change tracker even when config parse fails

Please note that we are currently validating the build configuration on two entry points (e.g., profile validation is handled on the python side), and change tracker system is handled on the rust side. Once #94829 is completed (scheduled for 2024), we will be able to handle this more effectively.

Fixes #121756
2024-03-17 14:04:14 +01:00
Matthias Krüger
3ec2b7bd1d
Rollup merge of #121236 - long-long-float:rust-fix-consider-slicing, r=Nadrieril
Don't show suggestion if slice pattern is not top-level

Close #120605

Don't show suggestion to add slicing (`[..]`) if the slice pattern is enclosed by struct like `Struct { a: [] }`.

For example, current rustc makes a suggestion as a comment. However, the pattern `a: []` is wrong, not scrutinee `&self.a`.
In this case, the structure type `a: Vec<Struct>` and the pattern `a: []` are different so I think the pattern should be fixed, not the scrutinee.
If the parent of the pattern that was the target of the error is a structure, I made the compiler not show a suggestion.

```rs
pub struct Struct {
    a: Vec<Struct>,
}

impl Struct {
    pub fn test(&self) {
        if let [Struct { a: [] }] = &self.a {
//             ^^^^^^^^^^^^^^^^^^   ------- help: consider slicing here: `&self.a[..]`
            println!("matches!")
        }
    }
}
```

Note:

* ~~I created `PatInfo.history` to store parent-child relationships for patterns, but this may be inefficient.~~
  * I use two fields `parent_kind` and `current_kind` instead of vec. It may not performance issue.
* Currently only looking at direct parents, but may need to look at deeper ancestry.
2024-03-17 14:04:14 +01:00
bors
a0c20d52e0 Auto merge of #122628 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`
2024-03-17 11:53:08 +00:00
Matthias Krüger
b8db431f37 avoid unnecessary collect() 2024-03-17 12:19:46 +01:00
long-long-float
78e94cba77 Don't show suggestion if slice pattern is enclosed by any patterns 2024-03-17 19:21:13 +09:00
Laurențiu Nicola
20ecf0744d Merge commit '5ecace48f693afaa6adf8cb23086b651db3aec96' into sync-from-ra 2024-03-17 11:04:52 +02:00
bors
ecdea9e943 Auto merge of #122625 - matthiaskrgr:rollup-ue4dmnx, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #119411 (Add as_(mut_)ptr and as_(mut_)slice to raw array pointers)
 - #122248 (Respect stage0 sysroot when compiling rmake.rs with COMPILETEST_FORCE_STAGE0)
 - #122295 (mir-opt: always run tests for the current target)
 - #122574 (Register LLVM handlers for bad-alloc / OOM)
 - #122608 (Move check-cfg diagnostic logic into a separate file)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-17 08:44:44 +00:00
Matthias Krüger
325678c979
Rollup merge of #122608 - Urgau:check-cfg-move-diagnostic-logic, r=fmease
Move check-cfg diagnostic logic into a separate file

as well as adding some triagebot mentions (for me) for check-cfg related files.

``@rustbot`` label +F-check-cfg
2024-03-17 08:23:26 +01:00
Matthias Krüger
33b4ed225a
Rollup merge of #122574 - cuviper:llvm-oom, r=nikic
Register LLVM handlers for bad-alloc / OOM

LLVM's default bad-alloc handler may throw if exceptions are enabled,
and `operator new` isn't hooked at all by default. Now we register our
own handler that prints a message similar to fatal errors, then aborts.
We also call the function that registers the C++ `std::new_handler`.

Fixes #121305
Cc llvm/llvm-project#85281
r? ``@nikic``
2024-03-17 08:23:26 +01:00
Matthias Krüger
ea0745604f
Rollup merge of #122295 - Nadrieril:mir-opt-run-current-target, r=Mark-Simulacrum
mir-opt: always run tests for the current target

Currently, `./x.py test tests/mir-opt` runs only the tests for the current target, and `./x.py test tests/mir-opt --bless` runs tests for a representative set of targets. That representative set does not include the current target however, which means `--bless` can succeed when tests fail without it. This PR ensures we run the current target always.

Fixes https://github.com/rust-lang/rust/issues/122292
cc ``@RalfJung``
2024-03-17 08:23:26 +01:00
Matthias Krüger
a5dbdc2fa9
Rollup merge of #122248 - jieyouxu:rmake-sysroot, r=Mark-Simulacrum
Respect stage0 sysroot when compiling rmake.rs with COMPILETEST_FORCE_STAGE0

Context: <https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/stage0.20compiletest.20broken>.
> cg_clif uses `COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0` for running the rustc test suite. With the introduction of rmake.rs this broke. `librun_make_support.rlib` is compiled using the bootstrap rustc wrapper which sets `--sysroot build/aarch64-unknown-linux-gnu/stage0-sysroot`, but then compiletest will compile `rmake.rs` using the sysroot of the bootstrap compiler causing it to not find the `libstd.rlib` against which `librun_make_support.rlib` is compiled.

cc ``@bjorn3``

Fixes #122196.
2024-03-17 08:23:25 +01:00
Matthias Krüger
3c07321541
Rollup merge of #119411 - yotamofek:array-ptr-get, r=Nilstrieb
Add as_(mut_)ptr and as_(mut_)slice to raw array pointers

Hey, first time contributing to the standard libraries so not completely sure about the process.

These functions are complementary to the ones being added in #74265 . I found them missing on array pointers.

See also:
- ACP: https://github.com/rust-lang/libs-team/issues/321
- Tracking issue: #119834
2024-03-17 08:23:25 +01:00
bors
1eb882ef6d Auto merge of #122611 - rust-lang:cargo_update, r=clubby789
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt
    Updating ahash v0.8.10 -> v0.8.11
    Updating anyhow v1.0.80 -> v1.0.81
    Updating basic-toml v0.1.8 -> v0.1.9
    Updating bumpalo v3.15.3 -> v3.15.4
      Adding cfg_aliases v0.1.1
    Updating chrono v0.4.34 -> v0.4.35
    Updating clap v4.5.1 -> v4.5.3
    Updating clap_builder v4.5.1 -> v4.5.2
    Updating clap_derive v4.5.0 -> v4.5.3
    Updating color-eyre v0.6.2 -> v0.6.3
    Updating ctrlc v3.4.2 -> v3.4.4
    Updating env_logger v0.11.2 -> v0.11.3
    Updating h2 v0.3.24 -> v0.3.25
      Adding heck v0.5.0
    Updating http v0.2.11 -> v0.2.12
    Updating js-sys v0.3.68 -> v0.3.69
    Updating libloading v0.8.2 -> v0.8.3
    Updating new_debug_unreachable v1.0.4 -> v1.0.6
    Updating nix v0.27.1 -> v0.28.0
    Updating proc-macro2 v1.0.78 -> v1.0.79
    Updating reqwest v0.11.24 -> v0.11.26
    Updating syn v2.0.52 -> v2.0.53
    Updating sysinfo v0.30.6 -> v0.30.7
    Updating thiserror v1.0.57 -> v1.0.58
    Updating thiserror-impl v1.0.57 -> v1.0.58
    Updating wasm-bindgen v0.2.91 -> v0.2.92
    Updating wasm-bindgen-backend v0.2.91 -> v0.2.92
    Updating wasm-bindgen-futures v0.4.41 -> v0.4.42
    Updating wasm-bindgen-macro v0.2.91 -> v0.2.92
    Updating wasm-bindgen-macro-support v0.2.91 -> v0.2.92
    Updating wasm-bindgen-shared v0.2.91 -> v0.2.92
    Updating web-sys v0.3.68 -> v0.3.69
```
2024-03-17 06:43:56 +00:00
bors
c8f0d492a7 Auto merge of #122321 - majaha:mingw_ci_new, r=Mark-Simulacrum
`mv` tools off the path instead of `rm -r`-ing them in `install-msys2.sh`

This is a follow up patch to https://github.com/rust-lang/rust/pull/121182

r? `@Mark-Simulacrum`
2024-03-17 04:31:11 +00:00
bors
a615cea333 Auto merge of #121885 - reitermarkus:generic-nonzero-inner, r=oli-obk,wesleywiser
Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type.

Tracking issue: https://github.com/rust-lang/rust/issues/120257

r? `@dtolnay`
2024-03-17 02:27:52 +00:00
github-actions
c486d2d920 cargo update
Updating ahash v0.8.10 -> v0.8.11
    Updating anyhow v1.0.80 -> v1.0.81
    Updating basic-toml v0.1.8 -> v0.1.9
    Updating bumpalo v3.15.3 -> v3.15.4
      Adding cfg_aliases v0.1.1
    Updating chrono v0.4.34 -> v0.4.35
    Updating clap v4.5.1 -> v4.5.3
    Updating clap_builder v4.5.1 -> v4.5.2
    Updating clap_derive v4.5.0 -> v4.5.3
    Updating color-eyre v0.6.2 -> v0.6.3
    Updating ctrlc v3.4.2 -> v3.4.4
    Updating env_logger v0.11.2 -> v0.11.3
    Updating h2 v0.3.24 -> v0.3.25
      Adding heck v0.5.0
    Updating http v0.2.11 -> v0.2.12
    Updating js-sys v0.3.68 -> v0.3.69
    Updating libloading v0.8.2 -> v0.8.3
    Updating new_debug_unreachable v1.0.4 -> v1.0.6
    Updating nix v0.27.1 -> v0.28.0
    Updating proc-macro2 v1.0.78 -> v1.0.79
    Updating reqwest v0.11.24 -> v0.11.26
    Updating syn v2.0.52 -> v2.0.53
    Updating sysinfo v0.30.6 -> v0.30.7
    Updating thiserror v1.0.57 -> v1.0.58
    Updating thiserror-impl v1.0.57 -> v1.0.58
    Updating wasm-bindgen v0.2.91 -> v0.2.92
    Updating wasm-bindgen-backend v0.2.91 -> v0.2.92
    Updating wasm-bindgen-futures v0.4.41 -> v0.4.42
    Updating wasm-bindgen-macro v0.2.91 -> v0.2.92
    Updating wasm-bindgen-macro-support v0.2.91 -> v0.2.92
    Updating wasm-bindgen-shared v0.2.91 -> v0.2.92
    Updating web-sys v0.3.68 -> v0.3.69
2024-03-17 00:26:01 +00:00
bors
c8813ddd6d Auto merge of #122607 - fmease:rollup-ozl1eeq, r=fmease
Rollup of 9 pull requests

Successful merges:

 - #117918 (Add `wasm_c_abi` `future-incompat` lint)
 - #121545 (fix attribute validation on associated items in traits)
 - #121720 (Split refining_impl_trait lint into _reachable, _internal variants)
 - #122270 (fix `long-linker-command-lines` failure caused by `rust.rpath=false`)
 - #122564 (Delegation: fix ICE on duplicated associative items)
 - #122577 (Remove obsolete parameter `speculative` from `instantiate_poly_trait_ref`)
 - #122601 (Optimize `ptr::replace`)
 - #122604 (Mention jieyouxu for changes to compiletest, run-make tests and the run-make-support library)
 - #122605 (rustc-metadata: Store crate name in self-profile of metadata_register_crate)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-17 00:22:29 +00:00
Urgau
ed0478a918 Add some mentions for Urgau for check-cfg related files 2024-03-16 23:40:49 +01:00
Urgau
bf8715e6ee Move check-cfg diagnostic logic into it's own module 2024-03-16 23:33:54 +01:00
León Orell Valerian Liehr
caa6131ae5
Rollup merge of #122605 - osiewicz:metadata-register-crate-store-crate-name-in-profile, r=Nadrieril
rustc-metadata: Store crate name in self-profile of metadata_register_crate

When profiling a build of Zed, I found myself in need of names of crates that take the longest to register in downstream crates.
2024-03-16 23:28:50 +01:00
León Orell Valerian Liehr
53515f3faf
Rollup merge of #122604 - jieyouxu:triagebot-mention-compiletest-run-make, r=Nilstrieb
Mention jieyouxu for changes to compiletest, run-make tests and the run-make-support library
2024-03-16 23:28:50 +01:00
León Orell Valerian Liehr
de0c2a4723
Rollup merge of #122601 - joboet:ptr_replace, r=workingjubilee
Optimize `ptr::replace`

#83022 optimized `mem::replace` to reduce the number of `memcpy`s. `ptr::replace`, which is [documented to behave just like `mem::replace`](https://doc.rust-lang.org/nightly/std/ptr/fn.replace.html), was not optimized however, leading to [worse code](https://godbolt.org/z/T3hdEEdfe) and missed optimizations. This PR simply forwards `ptr::replace` to `mem::replace` to take advantage of the better implementation.
2024-03-16 23:28:49 +01:00
León Orell Valerian Liehr
4cbfa15a2d
Rollup merge of #122577 - fmease:speculative-say-what, r=compiler-errors
Remove obsolete parameter `speculative` from `instantiate_poly_trait_ref`

In #122527 I totally missed that `speculative` has become obsolete with the removal of `hir_trait_to_predicates` / due to #113671.

Fixes #114635.

r? `@compiler-errors`
2024-03-16 23:28:49 +01:00
León Orell Valerian Liehr
7b7a7fc891
Rollup merge of #122564 - Bryanskiy:delegation-fixes, r=compiler-errors
Delegation: fix ICE on duplicated associative items

Currently, functions delegation is only supported for delegation items with early resolved paths e.g. free functions and trait methods. During name resolution, information about function signatures is collected, including the number of parameters and whether there are self arguments. This information is then used when lowering from a delegation item into a regular function(`rustc_ast_lowering/src/delegation.rs`). The signature is usually inherited from path resolution id(`path_id`). However, in the case of trait impls `path_id` and `item_id` may be different:

```rust
trait Trait {
    fn foo(&self) -> u32 { 0 }
}

struct S;

mod to_reuse {
    use crate::S;

    pub fn foo(_: &S) -> u32 { 0 }
}

impl Trait for S {
    reuse to_reuse::foo { self }
    //~^ The signature should be inherited from item id instead of resolution id
}

```

Let's now consider an example from [issue](https://github.com/rust-lang/rust/issues/119920). Due to duplicated associative elements partial resolution for one of them will not be recorded:

9023f908cf/compiler/rustc_resolve/src/late.rs (L3153-L3162)

Which leads to an incorrect `is_in_trait_impl`

9023f908cf/compiler/rustc_ast_lowering/src/item.rs (L981-L986)

Which leads to an incorrect id for signature inheritance

9023f908cf/compiler/rustc_ast_lowering/src/delegation.rs (L99-L105)

Which lead to an ICE from original issue.

This patch fixes wrong `is_in_trait_impl`  calculation.

fixes https://github.com/rust-lang/rust/issues/119920
2024-03-16 23:28:48 +01:00
León Orell Valerian Liehr
c2b7d77d95
Rollup merge of #122270 - onur-ozkan:fix-rmake-test-with-rpath-false, r=Mark-Simulacrum
fix `long-linker-command-lines` failure caused by `rust.rpath=false`

Fixes `long-linker-command-lines` test failure (which happens when `rust.rpath` is set to `false`) by adjusting `LD_LIBRARY_PATH`.

Fixes https://github.com/rust-lang/rust/issues/90921
2024-03-16 23:28:48 +01:00
León Orell Valerian Liehr
0995508562
Rollup merge of #121720 - tmandry:split-refining, r=compiler-errors
Split refining_impl_trait lint into _reachable, _internal variants

As discussed in https://github.com/rust-lang/rust/issues/119535#issuecomment-1909352040:

> We discussed this today in triage and developed a consensus to:
>
> * Add a separate lint against impls that refine a return type defined with RPITIT even when the trait is not crate public.
> * Place that in a lint group along with the analogous crate public lint.
> * Create an issue to solicit feedback on these lints (or perhaps two separate ones).
> * Have the warnings displayed with each lint reference this issue in a similar manner to how we do that today with the required `Self: '0'` bound on GATs.
> * Make a note to review this feedback on 2-3 release cycles.

This points users to https://github.com/rust-lang/rust/issues/121718 to leave feedback.
2024-03-16 23:28:47 +01:00
León Orell Valerian Liehr
79c1e58801
Rollup merge of #121545 - gvozdvmozgu:fix-attribute-validation-associated-items, r=fmease
fix attribute validation on associated items in traits

#121537, fixed attribute validation on associated items in traits
2024-03-16 23:28:47 +01:00
León Orell Valerian Liehr
c00c5fec2a
Rollup merge of #117918 - daxpedda:wasm-c-abi-warning, r=workingjubilee
Add `wasm_c_abi` `future-incompat` lint

This is a warning that will tell users to update to `wasm-bindgen` v0.2.88, which supports spec-compliant C ABI.

The idea is to prepare for a future where Rust will switch to the spec-compliant C ABI by default; so not to break everyone's world, this warning is introduced.

Addresses #71871.
2024-03-16 23:28:46 +01:00
bors
4c1b9c3e2f Auto merge of #122594 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum
Bump to 1.79.0

r? `@Mark-Simulacrum`
2024-03-16 22:18:06 +00:00
Piotr Osiewicz
ad84934e6f rustc-metadata: Store crate name in self-profile of metadata_register_crate
When profiling a build of Zed, I found myself in need of names of crates that take the longest to register in downstream crates.
2024-03-16 21:35:10 +01:00
Yotam Ofek
d0c0887498 Add as_(mut_)ptr and as_(mut_)slice to raw array pointers 2024-03-16 20:15:30 +00:00
bors
766bdce744 Auto merge of #122602 - ChrisDenton:rollup-f0vumtg, r=ChrisDenton
Rollup of 7 pull requests

Successful merges:

 - #122323 (configure.py: add flag for loongarch64 musl-root)
 - #122372 (prevent notifying the same changes more than once)
 - #122390 (Bump windows-bindgen to 0.55.0)
 - #122401 (Check library crates for all tier 1 targets in PR CI)
 - #122489 (Bump `cargo update` PR more often)
 - #122583 (Use `UnsafeCell` for fast constant thread locals)
 - #122590 (bootstrap: Don't name things copy that are not copies)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-16 20:14:20 +00:00
许杰友 Jieyou Xu (Joe)
fc42f3bfe3
Mention @jieyouxu for changes to compiletest, run-make tests and the run-make-support library 2024-03-16 19:15:45 +00:00
Chris Denton
d3ad841781
Rollup merge of #122590 - Nilstrieb:bootstrap-do-you-know-what-the-word-copy-means, r=Mark-Simulacrum
bootstrap: Don't name things copy that are not copies

The bootstrap copy methods don't actually copy, they just hard link. Simply lying about it being "copying" can be very confusing! (ask me how I know!).

I'm not sure whether the name I chose is the ideal name, but it's definitely better than before.
2024-03-16 18:27:35 +00:00
Chris Denton
a9f8f8b070
Rollup merge of #122583 - Zoxc:tls-non-mut, r=joboet
Use `UnsafeCell` for fast constant thread locals

This uses `UnsafeCell` instead of `static mut` for fast constant thread locals. This changes the type of the TLS shims to return `&UnsafeCell<T>` instead of `*mut T` which means they are always non-null so LLVM can optimize away the check for `Some` in `LocalKey::with` if `T` has no destructor.

LLVM is currently unable to do this optimization as we lose the fact that `__getit` always returns `Some` as it gets optimized to just returning the value of the TLS shim.
2024-03-16 18:27:34 +00:00
Chris Denton
42e03fc158
Rollup merge of #122489 - clubby789:more-cargo-update, r=Mark-Simulacrum
Bump `cargo update` PR more often

r? `@Mark-Simulacrum`

(https://github.com/rust-lang/rust/pull/121923#issuecomment-1986879572)
2024-03-16 18:27:34 +00:00
Chris Denton
1fbe1390ca
Rollup merge of #122401 - ChrisDenton:check-tier1, r=Mark-Simulacrum
Check library crates for all tier 1 targets in PR CI

Let's try checking all tier 1 targets. Shouldn't take much time.

Not sure if this is the right place to put it or not but let's see if it works first.
2024-03-16 18:27:33 +00:00
Chris Denton
ceef59fa2b
Rollup merge of #122390 - ChrisDenton:bindgen, r=Mark-Simulacrum
Bump windows-bindgen to 0.55.0

windows-bindgen is the crate used to generate std's Windows API bindings.

Not many changes for us, it's mostly just simplifying the generate code (e.g. no more `-> ()`). The one substantial change is some structs now use `i8` byte arrays instead of `u8`. However, this only impacts one test.
2024-03-16 18:27:33 +00:00
Chris Denton
491acfa08d
Rollup merge of #122372 - onur-ozkan:change-id-improvement, r=Mark-Simulacrum
prevent notifying the same changes more than once

Prevents re-reporting of previously notified changes by using the .last-warned-change-id value for change detection.

Resolves #122344
2024-03-16 18:27:32 +00:00
Chris Denton
9870116309
Rollup merge of #122323 - heiher:loongarch64-musl-root, r=Mark-Simulacrum
configure.py: add flag for loongarch64 musl-root
2024-03-16 18:27:32 +00:00
bors
2ffa3c89fc Auto merge of #122599 - bjorn3:sync_cg_clif-2024-03-16, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlight this time is a fix for a recently introduced ICE.

Fixes https://github.com/rust-lang/rust/issues/122399

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-03-16 18:08:42 +00:00
Bryanskiy
b2ed9d0911 Delegation: fix ICE on duplicated associative items 2024-03-16 21:03:36 +03:00
bors
5ecace48f6 Auto merge of #16846 - roife:fix-issue16826, r=Veykril
fix: incorrect handling of `use` and panic issue in `extract_module`.

fix #16826

This PR includes the following changes:

1. Simplify the implementation partially, removing many unnecessary loops and `clone()`.

2. When it is found that the top level of the selection contains a `use` statement, a copy of the `use` will be reinserted before extraction. (#16826)

3. Fixed an issue during `extract_module`, where if the top level of the selected part contains `A` and `use A::B`, it caused a duplication of `use A`.
2024-03-16 17:35:49 +00:00
bjorn3
6697186f59 Merge commit '4cf4ffc6ba514f171b3f52d1c731063e4fc45be3' into sync_cg_clif-2024-03-16 2024-03-16 17:23:11 +00:00
bors
b94c2852fa Auto merge of #16856 - Veykril:macarons, r=Veykril
fix: Fix wrong where clause rendering on hover

We were not accounting for proper newline indentation in some places making the hover look weird (or just straight up wrong for type aliases)
2024-03-16 17:23:02 +00:00
joboet
f2721338f6
core: optimize ptr::replace 2024-03-16 17:51:00 +01:00
Lukas Wirth
d69a81fddb fix: Fix wrong where clause rendering on hover 2024-03-16 17:49:59 +01:00