Commit Graph

267083 Commits

Author SHA1 Message Date
Urgau
8075ddb98e Implement RFC3137 trim-paths sysroot changes 2024-09-27 13:27:54 +02:00
bors
b9dc4a30e1 Auto merge of #130919 - workingjubilee:rollup-4diycoy, r=workingjubilee
Rollup of 8 pull requests

Successful merges:

 - #130313 ([`cfg_match`] Generalize inputs)
 - #130706 ([rustdoc] Remove unneeded jinja comments)
 - #130846 (Revert Break into the debugger on panic (129019))
 - #130875 (update `compiler-builtins` to 0.1.126)
 - #130889 (Weekly `cargo update`: only `rustbook`)
 - #130892 (Partially update `library/Cargo.lock`)
 - #130911 (diagnostics: wrap fn cast suggestions in parens when needed)
 - #130912 (On implicit `Sized` bound on fn argument, point at type instead of pattern)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-27 07:01:20 +00:00
Jubilee
b463bd1f27
Rollup merge of #130912 - estebank:point-at-arg-type, r=compiler-errors
On implicit `Sized` bound on fn argument, point at type instead of pattern

Instead of

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:20
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                    ^^^^^^^ doesn't have a size known at compile-time
```

output

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:29
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                             ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
```
2024-09-26 22:20:57 -07:00
Jubilee
6b0c897499
Rollup merge of #130911 - notriddle:notriddle/suggest-wrap-parens-fn-pointer, r=compiler-errors
diagnostics: wrap fn cast suggestions in parens when needed

Fixes #121632
2024-09-26 22:20:56 -07:00
Jubilee
081b9469d8
Rollup merge of #130892 - tgross35:library-cargo-update, r=Noratrieb
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.

Partially supersedes https://github.com/rust-lang/rust/pull/129538.

[1]: https://github.com/rust-lang/rust/pull/130720

try-job: x86_64-msvc
2024-09-26 22:20:56 -07:00
Jubilee
dfb377691b
Rollup merge of #130889 - tgross35:rustbook-cargo-update, r=tgross35
Weekly `cargo update`: only `rustbook`

We are having problems getting updates to merge due to CI failures. I took only the rustbook portion of https://github.com/rust-lang/rust/pull/129538 and put it into this PR, which hopefully should be able to successfully merge on its own.

Original message:

```
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
```
2024-09-26 22:20:55 -07:00
Jubilee
1e882537d4
Rollup merge of #130875 - folkertdev:naked-asm-bootstrap, r=tgross35
update `compiler-builtins` to 0.1.126

this requires the addition of a bootstrap variant of the new `naked_asm!` macro

r? `@tgross35`

extracted from https://github.com/rust-lang/rust/pull/128651
2024-09-26 22:20:55 -07:00
Jubilee
9734723259
Rollup merge of #130846 - ChrisDenton:revert-break, r=Noratrieb
Revert Break into the debugger on panic (129019)

This was talked about a bit at a recent libs meeting. While I think experimenting with this is worthwhile, I am nervous about this new behaviour reaching stable. We've already reverted on one tier 1 platform (Linux, https://github.com/rust-lang/rust/pull/130810) which means we have differing semantics on different tier 1 platforms. Also the fact it triggers even when `catch_unwind` is used to catch the panic means it can be very noisy in some projects.

At the very least I think it could use some more discussion before being instantly stable. I think this could maybe be re-landed with an environment variable to control/override the behaviour. But that part would likely need a libs-api decision.

cc ````@workingjubilee```` ````@kromych````
2024-09-26 22:20:54 -07:00
Jubilee
0b53cecb79
Rollup merge of #130706 - GuillaumeGomez:remove-unneeded-jinja-comments, r=notriddle
[rustdoc] Remove unneeded jinja comments

This is a follow-up of https://github.com/rust-lang/rust/pull/130585.

Since we now check for the jinja comments we missed, we can now check for the jinja comments which are unneeded. It will make the parsing and therefore the compilation a tiny bit faster (well, if anyone sees a difference haha). The real goal is mostly to have easier to read template files. 😉

r? ``@notriddle``
2024-09-26 22:20:54 -07:00
Jubilee
98f567b35a
Rollup merge of #130313 - c410-f3r:unlock-rfc-2011, r=thomcc
[`cfg_match`] Generalize inputs

cc #115585

Changes the input type from `item` to `tt`, which makes the macro have the same functionality of `cfg_if`.

Also adds a test to ensure that `stmt_expr_attributes` is not triggered.
2024-09-26 22:20:53 -07:00
Michael Howell
c48b0d4eb4 diagnostics: wrap fn cast suggestions in parens
Fixes #121632
2024-09-26 18:17:52 -07:00
Esteban Küber
c7d171d771 On implicit Sized bound on fn argument, point at type instead of pattern
Instead of

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:20
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                    ^^^^^^^ doesn't have a size known at compile-time
```

output

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:29
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                             ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
```
2024-09-27 00:45:02 +00:00
Guillaume Gomez
575df06a8b Remove unneeded jinja comments in templates 2024-09-27 00:58:13 +02:00
Guillaume Gomez
69150396bf Extend rustdoc template check to detect unneeded comments 2024-09-27 00:53:04 +02:00
bors
58420a065b Auto merge of #130907 - GuillaumeGomez:rollup-423r4i4, r=GuillaumeGomez
Rollup of 11 pull requests

Successful merges:

 - #130279 (Document subtleties of `ManuallyDrop`)
 - #130517 (Add the library workspace to the suggested rust-analyzer config)
 - #130820 (Fix diagnostics for coroutines with () as input.)
 - #130833 (Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation)
 - #130845 (Utf8Chunks: add link to Utf8Chunk)
 - #130850 (Pass Module Analysis Manager to Standard Instrumentations)
 - #130861 (Use `mem::offset_of!` for `sockaddr_un.sun_path`)
 - #130862 (rustdoc: do not animate :target when user prefers reduced motion)
 - #130868 (Update FIXME comment in s390x_unknown_linux_*.rs)
 - #130879 (Pass correct HirId to late_bound_vars in diagnostic code)
 - #130880 (add missing FIXME(const-hack))

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-26 22:49:52 +00:00
Guillaume Gomez
3d4d45f87b
Rollup merge of #130880 - RalfJung:const-hack, r=scottmcm
add missing FIXME(const-hack)

r? ```@scottmcm```
2024-09-27 00:43:35 +02:00
Guillaume Gomez
ed902a8a58
Rollup merge of #130879 - fmease:fix-diag-ice, r=compiler-errors
Pass correct HirId to late_bound_vars in diagnostic code

Fixes #130858.
Fixes #125655.
Fixes #130391.
Fixes #130663.

r? compiler-errors
2024-09-27 00:43:35 +02:00
Guillaume Gomez
18dfee00c8
Rollup merge of #130868 - taiki-e:s390x-fixme, r=jieyouxu
Update FIXME comment in s390x_unknown_linux_*.rs

- Remove comment about "LLVM < 16" since the minimum external LLVM version is 16+ since https://github.com/rust-lang/rust/pull/117947
- Reflect rename of cabi_s390x.rs in 030244cd4a (renamed to [abi/call/s390x.rs](030244cd4a (diff-20136d4a18fa0ef9bd4fc2e6f92e88daad6be88bfb156e5702af39ee87ca4879)), and it is currently [still in the same location](9e394f551c/compiler/rustc_target/src/abi/call/s390x.rs)).

r? ``````@cuviper``````

``````@rustbot`````` label +O-SystemZ
2024-09-27 00:43:34 +02:00
Guillaume Gomez
432b1ff8f1
Rollup merge of #130862 - zopsicle:patch-1, r=notriddle,GuillaumeGomez
rustdoc: do not animate :target when user prefers reduced motion

This accessibility improvement gates #129284 behind an inverted [prefers-reduced-motion](https://developer.mozilla.org/en-US/docs/Web/CSS/`@media/prefers-reduced-motion)` media query.
2024-09-27 00:43:34 +02:00
Guillaume Gomez
329f9fcb05
Rollup merge of #130861 - cuviper:sun-path-offset, r=ibraheemdev
Use `mem::offset_of!` for `sockaddr_un.sun_path`

We don't need manual pointer math here anymore!

try-job: dist-i686-msvc
2024-09-27 00:43:33 +02:00
Guillaume Gomez
c9478ef311
Rollup merge of #130850 - saveasguy:pass-mam-to-standrd-instrumentations, r=nikic
Pass Module Analysis Manager to Standard Instrumentations

This PR introduces changes related to llvm::PassInstrumentationCallbacks. Now, we pass Module Analysis Manager to StandardInstrumentations::registerCallbacks, so it can take advantage of such instrumentations as IR verifier or preserved CFG checker. So basically this is NFC PR.
2024-09-27 00:43:33 +02:00
Guillaume Gomez
e65054633c
Rollup merge of #130845 - RalfJung:utf8chunk, r=tgross35
Utf8Chunks: add link to Utf8Chunk

It is currently surprisingly non-trivial to go from the `utf8_chunks` method to the docs of the `valid`/`invalid` methods used in the example. This should help.
2024-09-27 00:43:32 +02:00
Guillaume Gomez
d3cb1ce0a0
Rollup merge of #130833 - makai410:master, r=compiler-errors,fee1-dead
Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation

Closes: #130430
r? rust-lang/diagnostics
2024-09-27 00:43:32 +02:00
Guillaume Gomez
0acddf5060
Rollup merge of #130820 - 91khr:fix-coroutine-unit-arg, r=compiler-errors
Fix diagnostics for coroutines with () as input.

This may be a more real-life example to trigger the diagnostic:

```rust
#![features(try_blocks, coroutine_trait, coroutines)]

use std::ops::Coroutine;

struct Request;
struct Response;
fn get_args() -> Result<String, String> { todo!() }
fn build_request(_arg: String) -> Request { todo!() }
fn work() -> impl Coroutine<Option<Response>, Yield = Request> {
    #[coroutine]
    |_| {
        let r: Result<(), String> = try {
            let req = get_args()?;
            yield build_request(req)
        };
        if let Err(msg) = r {
            eprintln!("Error: {msg}");
        }
    }
}
```
2024-09-27 00:43:31 +02:00
Guillaume Gomez
a4a591a78c
Rollup merge of #130517 - bjorn3:update_ra_config, r=onur-ozkan
Add the library workspace to the suggested rust-analyzer config
2024-09-27 00:43:31 +02:00
Guillaume Gomez
8a827c77e3
Rollup merge of #130279 - theemathas:manually-drop-docs, r=thomcc,traviscross
Document subtleties of `ManuallyDrop`

After seeing #130140 and #130141, I figured that `ManuallyDrop` needs documentation explaining its subtleties, hence this PR.

See also https://github.com/rust-lang/unsafe-code-guidelines/issues/245
2024-09-27 00:43:30 +02:00
zopsicle
5b5848188d rustdoc: consolidate prefers-reduced-motion-gated rulesets 2024-09-26 23:59:13 +02:00
bors
2bd1e894ef Auto merge of #129624 - tgross35:cargo-update, r=Mark-Simulacrum
Run `cargo update` in the project root

try-job: x86_64-msvc
2024-09-26 20:21:46 +00:00
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
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
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
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
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
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
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
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