Commit Graph

267811 Commits

Author SHA1 Message Date
Trevor Gross
1760d3914f Adjust allowed dependencies from the latest cargo update 2024-09-26 13:44:09 -04:00
Trevor Gross
4a515bdf7b Run cargo update in the project root 2024-09-26 13:40:17 -04:00
León Orell Valerian Liehr
e29ff8c058
Pass correct HirId to late_bound_vars in diagnostic code 2024-09-26 19:26:08 +02:00
Trevor Gross
fa64fb1de6 Partially update library/Cargo.lock
Run `cargo update` in library but exclude updates to `cc` and to
`compiler_builtins`. Exclusions were done because `cc` seems to have
some issues updating [1], and `compiler_builtins` needs to be updated on
its own.

[1]: https://github.com/rust-lang/rust/pull/130720
2024-09-26 13:21:48 -04:00
github-actions
fb095cc3ff cargo update: rustbook
rustbook dependencies:
     Locking 70 packages to latest compatible versions
    Removing adler v1.0.2
      Adding adler2 v2.0.0
    Updating anstream v0.6.14 -> v0.6.15
    Updating anstyle v1.0.7 -> v1.0.8
    Updating anstyle-parse v0.2.4 -> v0.2.5
    Updating anstyle-query v1.1.0 -> v1.1.1
    Updating anstyle-wincon v3.0.3 -> v3.0.4
    Updating anyhow v1.0.86 -> v1.0.89
    Removing base64 v0.22.1
    Updating bstr v1.9.1 -> v1.10.0
      Adding byteorder v1.5.0
    Updating cc v1.1.5 -> v1.1.21
    Updating clap v4.5.9 -> v4.5.18
    Updating clap_builder v4.5.9 -> v4.5.18
    Updating clap_complete v4.5.8 -> v4.5.29
    Updating clap_derive v4.5.8 -> v4.5.18
    Updating clap_lex v0.7.1 -> v0.7.2
    Updating colorchoice v1.0.1 -> v1.0.2
    Updating core-foundation-sys v0.8.6 -> v0.8.7
    Updating cpufeatures v0.2.12 -> v0.2.14
      Adding dateparser v0.2.1
    Removing deranged v0.3.11
    Updating env_filter v0.1.0 -> v0.1.2
    Updating env_logger v0.11.3 -> v0.11.5
    Updating fastrand v2.1.0 -> v2.1.1
    Updating flate2 v1.0.30 -> v1.0.33
    Updating iana-time-zone v0.1.60 -> v0.1.61
    Updating indexmap v2.2.6 -> v2.5.0
    Updating is_terminal_polyfill v1.70.0 -> v1.70.1
    Updating js-sys v0.3.69 -> v0.3.70
      Adding lazy_static v1.5.0
    Updating libc v0.2.155 -> v0.2.158
    Removing linked-hash-map v0.5.6
    Updating mdbook-i18n-helpers v0.3.4 -> v0.3.5
    Updating miniz_oxide v0.7.4 -> v0.8.0
    Updating normpath v1.2.0 -> v1.3.0
    Removing num-conv v0.1.0
    Updating opener v0.7.1 -> v0.7.2
    Updating pest v2.7.11 -> v2.7.13
    Updating pest_derive v2.7.11 -> v2.7.13
    Updating pest_generator v2.7.11 -> v2.7.13
    Updating pest_meta v2.7.11 -> v2.7.13
    Removing plist v1.7.0
    Removing powerfmt v0.2.0
    Updating ppv-lite86 v0.2.17 -> v0.2.20
      Adding pulldown-cmark v0.11.3 (latest: v0.12.1)
      Adding pulldown-cmark-escape v0.11.0
      Adding pulldown-cmark-to-cmark v15.0.1 (latest: v17.0.0)
    Removing quick-xml v0.32.0
    Updating quote v1.0.36 -> v1.0.37
    Updating redox_syscall v0.5.3 -> v0.5.4
    Updating regex v1.10.5 -> v1.10.6
    Updating rustix v0.38.34 -> v0.38.37
    Updating serde v1.0.204 -> v1.0.210
    Updating serde_derive v1.0.204 -> v1.0.210
    Updating serde_json v1.0.120 -> v1.0.128
    Updating serde_spanned v0.6.6 -> v0.6.7
    Updating syn v2.0.71 -> v2.0.77
    Updating tempfile v3.10.1 -> v3.12.0
    Updating thiserror v1.0.62 -> v1.0.63
    Updating thiserror-impl v1.0.62 -> v1.0.63
    Removing time v0.3.36
    Removing time-core v0.1.2
    Removing time-macros v0.2.18
    Updating toml v0.8.14 -> v0.8.19
    Updating toml_datetime v0.6.6 -> v0.6.8
    Updating toml_edit v0.22.15 -> v0.22.21
    Updating unicode-ident v1.0.12 -> v1.0.13
    Updating unicode-normalization v0.1.23 -> v0.1.24
    Updating unicode-width v0.1.13 -> v0.1.14 (latest: v0.2.0)
    Updating version_check v0.9.4 -> v0.9.5
    Updating wasm-bindgen v0.2.92 -> v0.2.93
    Updating wasm-bindgen-backend v0.2.92 -> v0.2.93
    Updating wasm-bindgen-macro v0.2.92 -> v0.2.93
    Updating wasm-bindgen-macro-support v0.2.92 -> v0.2.93
    Updating wasm-bindgen-shared v0.2.92 -> v0.2.93
    Updating winapi-util v0.1.8 -> v0.1.9
      Adding windows-sys v0.59.0
    Updating winnow v0.6.13 -> v0.6.18
    Removing yaml-rust v0.4.5
      Adding zerocopy v0.7.35
      Adding zerocopy-derive v0.7.35
note: pass `--verbose` to see 26 unchanged dependencies behind latest

[ extracted from rust-lang/rust#129538 - Trevor ]

Co-authored-by: Trevor Gross <tmgross@umich.edu>
2024-09-26 12:56:46 -04:00
Josh Stone
9431d1ab4e Add sun_path to the fake doc sockaddr_un 2024-09-26 09:33:30 -07:00
Mads Marquart
fb10eeb42b Move Apple linker args from rustc_target to rustc_codegen_ssa
They are dependent on the deployment target and SDK version, but having
these in `rustc_target` makes it hard to introduce that dependency.
2024-09-26 16:40:25 +02:00
Ralf Jung
ef87a7f663 add missing FIXME(const-hack) 2024-09-26 15:42:37 +02:00
bors
4428a05167 Auto merge of #129759 - dingxiangfei2009:stabilize-const-refs-to-static, r=RalfJung
Stabilize `const_refs_to_static`

Meanwhile, I am cooking a sub-section in the language reference.
2024-09-26 13:36:03 +00:00
zopsicle
cdd3371bb4 rustdoc: do not animate when user prefers reduced motion
This accessibility improvement gates the target flashing and tooltip fade-out
behind an inverted prefers-reduced-motion media query.
2024-09-26 13:56:22 +02:00
Ding Xiang Fei
1576a6d618
Stabilize const_refs_to_static
update tests

fix bitwidth-sensitive stderr output

use build-fail for asm tests
2024-09-26 13:21:15 +02:00
bors
c361d52a9b Auto merge of #3916 - rust-lang:rustup-2024-09-26, r=RalfJung
Automatic Rustup
2024-09-26 09:41:27 +00:00
Ralf Jung
18aa926d09 remove some clippy lints from the list that we do not even trigger any more 2024-09-26 11:40:04 +02:00
Ralf Jung
bf78aec510 fix clippy::needless_return 2024-09-26 11:40:04 +02:00
Urgau
1e24104587 Add [Option<T>; N]::transpose 2024-09-26 10:43:56 +02:00
bors
f2becdff04 Auto merge of #130865 - cuviper:library-raw_ref_op, r=tgross35
Use `&raw` in the standard library

Since the stabilization in #127679 has reached stage0, 1.82-beta, we can
start using `&raw` freely, and even the soft-deprecated `ptr::addr_of!`
and `ptr::addr_of_mut!` can stop allowing the unstable feature.

I intentionally did not change any documentation or tests, but the rest
of those macro uses are all now using `&raw const` or `&raw mut` in the
standard library.
2024-09-26 08:12:02 +00:00
Folkert de Vries
42542d8cda update compiler_builtins to 0.1.126 2024-09-26 09:54:28 +02:00
Folkert de Vries
20c0067528 add a bootstrap variant of naked_asm 2024-09-26 09:54:00 +02:00
Taiki Endo
36455c6f6b rustc_target: Add powerpc64 atomic-related features 2024-09-26 16:43:04 +09:00
Ralf Jung
294fdb820c clippy 2024-09-26 09:36:44 +02:00
bors
fcc59fe1ad Auto merge of #3917 - RalfJung:sysroot, r=RalfJung
bump rustc-build-sysroot version

This removes an implicit `--cap-lints` in the sysroot build. Let's see if that causes any trouble for the targets we test.
2024-09-26 07:21:41 +00:00
Ralf Jung
adbaf13d32 bump rustc-build-sysroot version 2024-09-26 09:18:14 +02:00
The Miri Cronjob Bot
51087d2247 Merge from rustc 2024-09-26 05:23:15 +00:00
The Miri Cronjob Bot
824884d743 Preparing for merge from rustc 2024-09-26 05:15:46 +00:00
Taiki Endo
1bef68c4cb Update FIXME comment in s390x_unknown_linux_*.rs 2024-09-26 12:52:35 +09:00
bors
76ed7a1fa4 Auto merge of #130329 - khuey:reorder-constant-spills, r=davidtwco
Reorder stack spills so that constants come later.

Currently constants are "pulled forward" and have their stack spills emitted first. This confuses LLVM as to where to place breakpoints at function entry, and results in argument values being wrong in the debugger. It's straightforward to avoid emitting the stack spills for constants until arguments/etc have been introduced in debug_introduce_locals, so do that.

Example LLVM IR (irrelevant IR elided):
Before:
```
define internal void `@_ZN11rust_1289457binding17h2c78f956ba4bd2c3E(i64` %a, i64 %b, double %c) unnamed_addr #0 !dbg !178 { start:
  %c.dbg.spill = alloca [8 x i8], align 8
  %b.dbg.spill = alloca [8 x i8], align 8
  %a.dbg.spill = alloca [8 x i8], align 8
  %x.dbg.spill = alloca [4 x i8], align 4
  store i32 0, ptr %x.dbg.spill, align 4, !dbg !192            ; LLVM places breakpoint here.
    #dbg_declare(ptr %x.dbg.spill, !190, !DIExpression(), !192)
  store i64 %a, ptr %a.dbg.spill, align 8
    #dbg_declare(ptr %a.dbg.spill, !187, !DIExpression(), !193)
  store i64 %b, ptr %b.dbg.spill, align 8
    #dbg_declare(ptr %b.dbg.spill, !188, !DIExpression(), !194)
  store double %c, ptr %c.dbg.spill, align 8
    #dbg_declare(ptr %c.dbg.spill, !189, !DIExpression(), !195)
  ret void, !dbg !196
}
```
After:
```
define internal void `@_ZN11rust_1289457binding17h2c78f956ba4bd2c3E(i64` %a, i64 %b, double %c) unnamed_addr #0 !dbg !178 { start:
  %x.dbg.spill = alloca [4 x i8], align 4
  %c.dbg.spill = alloca [8 x i8], align 8
  %b.dbg.spill = alloca [8 x i8], align 8
  %a.dbg.spill = alloca [8 x i8], align 8
  store i64 %a, ptr %a.dbg.spill, align 8
    #dbg_declare(ptr %a.dbg.spill, !187, !DIExpression(), !192)
  store i64 %b, ptr %b.dbg.spill, align 8
    #dbg_declare(ptr %b.dbg.spill, !188, !DIExpression(), !193)
  store double %c, ptr %c.dbg.spill, align 8
    #dbg_declare(ptr %c.dbg.spill, !189, !DIExpression(), !194)
  store i32 0, ptr %x.dbg.spill, align 4, !dbg !195            ; LLVM places breakpoint here.
    #dbg_declare(ptr %x.dbg.spill, !190, !DIExpression(), !195)
  ret void, !dbg !196
}
```
Note in particular the position of the "LLVM places breakpoint here" comment relative to the stack spills for the function arguments. LLVM assumes that the first instruction with with a debug location is the end of the prologue. As LLVM does not currently offer front ends any direct control over the placement of the prologue end reordering the IR is the only mechanism available to fix argument values at function entry in the presence of MIR optimizations like SingleUseConsts. Fixes #128945

r? `@michaelwoerister`
2024-09-26 02:37:52 +00:00
makai410
58921874cb Fix the misleading diagnostic for let_underscore_drop on type without Drop implementation 2024-09-26 10:18:18 +08:00
Scott McMurray
ddfd0c701a Remove feature(control_flow_enum) in tests 2024-09-25 19:00:19 -07:00
Scott McMurray
c89b873172 Remove the control_flow_enum feature from clippy 2024-09-25 19:00:19 -07:00
Scott McMurray
fd5aa07f4f Stabilize the map/value methods on ControlFlow
And fix the stability attribute on the `pub use` in `core::ops`.
2024-09-25 19:00:17 -07:00
Josh Stone
f4d9d1a0ea Use &raw in the standard library
Since the stabilization in #127679 has reached stage0, 1.82-beta, we can
start using `&raw` freely, and even the soft-deprecated `ptr::addr_of!`
and `ptr::addr_of_mut!` can stop allowing the unstable feature.

I intentionally did not change any documentation or tests, but the rest
of those macro uses are all now using `&raw const` or `&raw mut` in the
standard library.
2024-09-25 17:03:20 -07:00
Josh Stone
a51b0a2adf Use mem::offset_of! for sockaddr_un.sun_path 2024-09-25 16:40:50 -07:00
Samuel Moelius
51b527266e Fix bug found during review
https://github.com/rust-lang/rust-clippy/pull/13286#issuecomment-2374245772
2024-09-25 17:56:51 -04:00
Lukas Markeffsky
345077af98 don't clone clean::Item in TypeImplCollector 2024-09-25 23:46:15 +02:00
Lukas Markeffsky
4facc1ce41 rm higher-ranked lifetimes from DocVisitor
This allows the visitor to borrow from the visitees.
2024-09-25 23:46:15 +02:00
Lukas Markeffsky
b1745c3919 de-rc external traits
Don't keep the `external_traits` as shared mutable data between the
`DocContext` and `clean::Crate`. Instead, move the data over when necessary.
This allows us to get rid of a borrowck hack in the `DocVisitor`.
2024-09-25 23:45:57 +02:00
bors
9e394f551c Auto merge of #120752 - compiler-errors:more-relevant-bounds, r=lcnr
Collect relevant item bounds from trait clauses for nested rigid projections

Rust currently considers trait where-clauses that bound the trait's *own* associated types to act like an item bound:

```rust
trait Foo where Self::Assoc: Bar { type Assoc; }
// acts as if:
trait Foo { type Assoc: Bar; }
```

### Background

This behavior has existed since essentially forever (i.e. before Rust 1.0), since we originally started out by literally looking at the where clauses written on the trait when assembling `SelectionCandidate::ProjectionCandidate` for projections. However, looking at the predicates of the associated type themselves was not sound, since it was unclear which predicates were *assumed* and which predicates were *implied*, and therefore this was reworked in #72788 (which added a query for the predicates we consider for `ProjectionCandidate`s), and then finally item bounds and predicates were split in #73905.

### Problem 1: GATs don't uplift bounds correctly

All the while, we've still had logic to uplift associated type bounds from a trait's where clauses. However, with the introduction of GATs, this logic was never really generalized correctly for them, since we were using simple equality to test if the self type of a trait where clause is a projection. This leads to shortcomings, such as:

```rust
trait Foo
where
    for<'a> Self::Gat<'a>: Debug,
{
    type Gat<'a>;
}

fn test<T: Foo>(x: T::Gat<'static>) {
    //~^ ERROR `<T as Foo>::Gat<'a>` doesn't implement `Debug`
    println!("{:?}", x);
}
```

### Problem 2: Nested associated type bounds are not uplifted

We also don't attempt to uplift bounds on nested associated types, something that we couldn't really support until #120584. This can be demonstrated best with an example:

```rust
trait A
    where Self::Assoc: B,
    where <Self::Assoc as B>::Assoc2: C,
{
    type Assoc; // <~ The compiler *should* treat this like it has an item bound `B<Assoc2: C>`.
}

trait B { type Assoc2; }
trait C {}

fn is_c<T: C>() {}

fn test<T: A>() {
    is_c::<<Self::Assoc as B>::Assoc2>();
    //~^ ERROR the trait bound `<<T as A>::Assoc as B>::Assoc2: C` is not satisfied
}
```

Why does this matter?

Well, generalizing this behavior bridges a gap between the associated type bounds (ATB) feature and trait where clauses. Currently, all bounds that can be stably written on associated types can also be expressed as where clauses on traits; however, with the stabilization of ATB, there are now bounds that can't be desugared in the same way. This fixes that.

## How does this PR fix things?

First, when scraping item bounds from the trait's where clauses, given a trait predicate, we'll loop of the self type of the predicate as long as it's a projection. If we find a projection whose trait ref matches, we'll uplift the bound. This allows us to uplift, for example `<Self as Trait>::Assoc: Bound` (pre-existing), but also `<<Self as Trait>::Assoc as Iterator>::Item: Bound` (new).

If that projection is a GAT, we will check if all of the GAT's *own* args are all unique late-bound vars. We then map the late-bound vars to early-bound vars from the GAT -- this allows us to uplift `for<'a, 'b> Self::Assoc<'a, 'b>: Trait` into an item bound, but we will leave `for<'a> Self::Assoc<'a, 'a>: Trait` and `Self::Assoc<'static, 'static>: Trait` alone.

### Okay, but does this *really* matter?

I consider this to be an improvement of the status quo because it makes GATs a bit less magical, and makes rigid projections a bit more expressive.
2024-09-25 21:12:07 +00:00
Aleksei Romanov
afb7eef79a Pass Module Analysis Manager to Standard Instrumentations 2024-09-25 22:57:32 +03:00
bors
c771204ffb Auto merge of #13456 - vHugoObject:master, r=llogiq
fix(clippy_lints/matches): wildcard_in_or_patterns will no longer be triggered for types annotated with #[nonexhaustive]

fixes #13350

----

changelog: none
2024-09-25 19:11:30 +00:00
bors
0399709cdc Auto merge of #130847 - matthiaskrgr:rollup-f0n80bw, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #130735 (Simple validation for unsize coercion in MIR validation)
 - #130781 (Fix up setting strip = true in Cargo.toml makes build scripts fail in…)
 - #130811 (add link from random() helper fn to extensive DefaultRandomSource docs)
 - #130819 (Add `must_use` attribute to `len_utf8` and `len_utf16`.)
 - #130832 (fix some cfg logic around optimize_for_size and 16-bit targets)
 - #130842 (Add tracking issue for io_error_inprogress)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-25 18:19:08 +00:00
VictorHugoPilled
bc07027397 fix(clippy_lints/matches): wildcard_in_or_patterns will no longer be triggered for types annotated with #[nonexhaustive] 2024-09-25 13:12:19 -05:00
Matthias Krüger
e805182fcc
Rollup merge of #130842 - Noratrieb:tracking-issue-inprogress, r=jieyouxu
Add tracking issue for io_error_inprogress

I forgot to mention this in #130789
2024-09-25 20:11:01 +02:00
Matthias Krüger
3a3352386c
Rollup merge of #130832 - RalfJung:sort-cfg-mess, r=workingjubilee
fix some cfg logic around optimize_for_size and 16-bit targets

Fixes https://github.com/rust-lang/rust/issues/130818.
Fixes https://github.com/rust-lang/rust/issues/129910.

There are still some warnings when building on a 16bit target:
```
warning: struct `AlignedStorage` is never constructed
   --> /home/r/src/rust/rustc.2/library/core/src/slice/sort/stable/mod.rs:135:8
    |
135 | struct AlignedStorage<T, const N: usize> {
    |        ^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: associated items `new` and `as_uninit_slice_mut` are never used
   --> /home/r/src/rust/rustc.2/library/core/src/slice/sort/stable/mod.rs:141:8
    |
140 | impl<T, const N: usize> AlignedStorage<T, N> {
    | -------------------------------------------- associated items in this implementation
141 |     fn new() -> Self {
    |        ^^^
...
145 |     fn as_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>] {
    |        ^^^^^^^^^^^^^^^^^^^

warning: function `quicksort` is never used
  --> /home/r/src/rust/rustc.2/library/core/src/slice/sort/unstable/quicksort.rs:19:15
   |
19 | pub(crate) fn quicksort<'a, T, F>(
   |               ^^^^^^^^^

warning: `core` (lib) generated 3 warnings
```

However, the cfg stuff here is sufficiently messy that I didn't want to touch more of it. I think all `feature = "optimize_for_size"` should become `any(feature = "optimize_for_size", target_pointer_width = "16")` but I am not entirely certain. Warnings are fine, Miri will just ignore them.

Cc `@Voultapher`
2024-09-25 20:11:00 +02:00
Matthias Krüger
3b2580914b
Rollup merge of #130819 - bjoernager:char-must-use-len-utf, r=Noratrieb
Add `must_use` attribute to `len_utf8` and `len_utf16`.

The `len_utf8` and `len_utf16` methods in `char` should have the `must_use` attribute.

The somewhat similar method `<[T]>::len` has had this attribute since #95274. Considering that these two methods would most likely be used to test the size of a buffer (before a call to `encode_utf8` or `encode_utf16`), *not* using their return values could indicate a bug.

According to ["When to add `#[must_use]`](https://std-dev-guide.rust-lang.org/policy/must-use.html), this is **not** considered a breaking change (and could be reverted again at a later time).
2024-09-25 20:11:00 +02:00
Matthias Krüger
3ee3e063c1
Rollup merge of #130811 - RalfJung:random, r=joboet
add link from random() helper fn to extensive DefaultRandomSource docs
2024-09-25 20:10:59 +02:00
Matthias Krüger
81ac893d3b
Rollup merge of #130781 - monkeydbobo:mdb/fix_up_cross_compile_osx, r=davidtwco
Fix up setting strip = true in Cargo.toml makes build scripts fail in…

Fix issue: https://github.com/rust-lang/rust/issues/110536
Strip binary is PATH dependent which breaks builds in MacOS.
For example, on my Mac, the output of 'which strip' is '/opt/homebrew/opt/binutils/bin/strip', which leads to incorrect 'strip' results. Therefore, just like on other systems, it is also necessary to specify 'stripcmd' on macOS. However, it seems that there is a bug in binutils [bugzilla-Bug 31571](https://sourceware.org/bugzilla/show_bug.cgi?id=31571), which leads to the problem mentioned above.
2024-09-25 20:10:59 +02:00
Matthias Krüger
0055895c30
Rollup merge of #130735 - compiler-errors:validate-unsize, r=spastorino,RalfJung
Simple validation for unsize coercion in MIR validation

This adds the most basic validity check to unsize coercions in MIR. The src and target of an unsize cast must *at least* implement `Src: CoerceUnsized<Target>` for this to be valid.

This doesn't the second, more subtle validity check that is taken of advantage in codegen [here](914193c8f4/compiler/rustc_codegen_ssa/src/base.rs (L126)), but I did leave a beefy FIXME for that explaining what it is.

As a consequence, this also fixes an ICE with GVN and invalid unsize coercions. This is somewhat coincidental, since MIR inlining will check that a body is valid before inlining it; so now that we determine it to be invalid, we don't inline it, and we don't encounter the GVN ICE. I'm not certain if the same GVN ICE is triggerable without the inliner, and perhaps instead with trivial where clauses or something.

cc `@RalfJung`
2024-09-25 20:10:58 +02:00
Chris Denton
d3e59a502b
Revert Break into the debugger on panic (129019) 2024-09-25 17:53:57 +00:00
Samuel Moelius
5c2f6db289 Fix typo in needless_lifetimes test 2024-09-25 13:52:12 -04:00
Samuel Moelius
66f1f544af Fix clippy_lints and clippy_utils 2024-09-25 13:52:12 -04:00