Commit graph

273162 commits

Author SHA1 Message Date
Tim (Theemathas) Chirananthavat
93889172bc Correctly document is_null CTFE behavior.
The "panic in const if CTFE doesn't know the answer" behavior was discussed to be the desired behavior in #74939, and is currently how the function actually behaves.

I intentionally wrote this documentation to allow for the possibility that a panic might not occur even if the pointer is out of bounds, because of #133700 and other potential changes in the future.
2024-12-21 15:36:16 +07:00
bors
7caf35b2e5 Auto merge of #134318 - matthiaskrgr:rollup-jda0jkx, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #132939 (Suggest using deref in patterns)
 - #133293 (Updates Solaris target information, adds Solaris maintainer)
 - #133392 (Fix ICE when multiple supertrait substitutions need assoc but only one is provided)
 - #133986 (Add documentation for anonymous pipe module)
 - #134022 (Doc: Extend for tuples to be stabilized in 1.85.0)
 - #134259 (Clean up `infer_return_ty_for_fn_sig`)
 - #134264 (Arbitrary self types v2: Weak & NonNull diagnostics)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-15 01:24:40 +00:00
Matthias Krüger
0f828022db
Rollup merge of #134264 - adetaylor:weak-and-nonnull, r=compiler-errors
Arbitrary self types v2: Weak & NonNull diagnostics

This builds on top of #134262 which is more urgent to review and merge first. I'll likely rebase this PR once that lands.

This is the first part of the diagnostic enhancements planned for Arbitrary Self Types v2.

Various types can be used as method receivers, such as `Rc<>`, `Box<>` and `Arc<>`. The arbitrary self types v2 work allows further types to be made method receivers by implementing the Receiver trait.

With that in mind, it may come as a surprise to people when certain common types do not implement Receiver and thus cannot be used as a method receiver.

The RFC for arbitrary self types v2 therefore proposes emitting specific
lint hints for these cases:
* `NonNull`
* `Weak`
* Raw pointers

The code already emits a hint for this third case, in that it advises folks that the `arbitrary_self_types_pointers` feature may meet their need. This PR adds diagnostic hints for the `Weak` and `NonNull` cases.

Tracking issue #44874

r? `@wesleywiser`
2024-12-14 23:56:32 +01:00
Matthias Krüger
1fa1f3001f
Rollup merge of #134259 - compiler-errors:infer-ret-ty, r=dtolnay
Clean up `infer_return_ty_for_fn_sig`

The code for lowering fn signatures from HIR currently is structured to prefer the recovery path (where users write `-> _`) over the good path. This PR pulls the recovery code out into a separate fn.

Review w/o whitespace
2024-12-14 23:56:31 +01:00
Matthias Krüger
9b9905593f
Rollup merge of #134022 - shahn:doc_clarify_extend_for_tuple_version, r=tgross35
Doc: Extend for tuples to be stabilized in 1.85.0

I assumed the RUSTC_CURRENT_VERSION would be replaced automatically, but it doesn't look like it on the nightly docs page. Sorry!
2024-12-14 23:56:31 +01:00
Matthias Krüger
08b9aa0182
Rollup merge of #133986 - olishmollie:tracking-issue-127154-documentation, r=tgross35
Add documentation for anonymous pipe module

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

`@NobodyXu` I've been using this feature lately and thought I might contribute with some documentation. I borrowed liberally from [os_pipe](https://docs.rs/os_pipe/latest/os_pipe/) so thanks to `@oconnor663.`
2024-12-14 23:56:30 +01:00
Matthias Krüger
67278cd9f4
Rollup merge of #133392 - compiler-errors:object-sup, r=lcnr
Fix ICE when multiple supertrait substitutions need assoc but only one is provided

Dyn traits must have all of their associated types constrained either by:
1. writing them in the dyn trait itself as an associated type bound, like `dyn Iterator<Item = u32>`,
2. A supertrait bound, like `trait ConstrainedIterator: Iterator<Item = u32> {}`, then you may write `dyn ConstrainedIterator` which doesn't need to mention `Item`.

However, the object type lowering code did not consider the fact that there may be multiple supertraits with different substitutions, so it just used the associated type's *def id* as a key for keeping track of which associated types are missing:

1fc691e6dd/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs (L131)

This means that we can have missing associated types when there are mutliple supertraits with different substitutions and only one of them is constrained, like:

```rust
trait Sup<T> {
    type Assoc: Default;
}

impl<T: Default> Sup<T> for () {
    type Assoc = T;
}
impl<T: Default, U: Default> Dyn<T, U> for () {}

trait Dyn<A, B>: Sup<A, Assoc = A> + Sup<B> {}
```

The above example allows you to name `<dyn Dyn<i32, u32> as Sup<u32>>::Assoc` even though it is not possible to project since it's neither constrained by a manually written projection bound or a supertrait bound. This successfully type-checks, but leads to a codegen ICE since we are not able to project the associated type.

This PR fixes the validation for checking that a dyn trait mentions all of its associated type bounds. This is theoretically a breaking change, since you could technically use that `dyn Dyn<A, B>` type mentionedin the example above without actually *projecting* to the bad associated type, but I don't expect it to ever be relevant to a user since it's almost certainly a bug. This is corroborated with the crater results[^crater], which show no failures[^unknown].

Crater: https://github.com/rust-lang/rust/pull/133392#issuecomment-2508769703

Fixes #133388

[^crater]: I cratered this originally with #133397, which is a PR that is stacked on top, then re-ran crater with just the failures from that PR.
[^unknown]: If you look at the crater results, it shows all of the passes as "unknown". I believe this is a crater bug, since looking at the results manually shows them as passes.
2024-12-14 23:56:30 +01:00
Matthias Krüger
ecfa09acc4
Rollup merge of #133293 - psumbera:solaris-maintainer, r=workingjubilee,jieyouxu,tgross35
Updates Solaris target information, adds Solaris maintainer
2024-12-14 23:56:29 +01:00
Matthias Krüger
db77788dc5
Rollup merge of #132939 - uellenberg:suggest-deref, r=oli-obk
Suggest using deref in patterns

Fixes #132784

This changes the following code:
```rs
use std::sync::Arc;
fn main() {
    let mut x = Arc::new(Some(1));
    match x {
        Some(_) => {}
        None => {}
    }
}
```

to output
```rs
error[E0308]: mismatched types
  --> src/main.rs:5:9
   |
LL |     match x {
   |           - this expression has type `Arc<Option<{integer}>>`
...
LL |         Some(_) => {}
   |         ^^^^^^^ expected `Arc<Option<{integer}>>`, found `Option<_>`
   |
   = note: expected struct `Arc<Option<{integer}>>`
                found enum `Option<_>`
help: consider dereferencing to access the inner value using the Deref trait
   |
LL |     match *x {
   |           ~~
```

instead of
```rs
error[E0308]: mismatched types
 --> src/main.rs:5:9
  |
4 |     match x {
  |           - this expression has type `Arc<Option<{integer}>>`
5 |         Some(_) => {}
  |         ^^^^^^^ expected `Arc<Option<{integer}>>`, found `Option<_>`
  |
  = note: expected struct `Arc<Option<{integer}>>`
               found enum `Option<_>`
```

This makes it more obvious that a Deref is available, and gives a suggestion on how to use it in order to fix the issue at hand.
2024-12-14 23:56:28 +01:00
bors
b57d93d8b9 Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung
Bounds-check with PtrMetadata instead of Len in MIR

Rather than emitting `Len(*_n)` in array index bounds checks, emit `PtrMetadata(copy _n)` instead -- with some asterisks for arrays and `&mut` that need it to be done slightly differently.

We're getting pretty close to removing `Len` entirely, actually.  I think just one more PR after this (for slice drop shims).

r? mir
2024-12-14 22:43:39 +00:00
Sebastian Hahn
7717df2286 Correct spelling of CURRENT_RUSTC_VERSION
I mixed it up with RUSTC_CURRENT_VERSION unfortunately. Also improve the
formatting of the macro invocation slightly.
2024-12-14 21:40:11 +01:00
Adrian Taylor
b27817c8c6 Arbitrary self types v2: Weak, NonNull hints
Various types can be used as method receivers, such as Rc<>, Box<> and
Arc<>. The arbitrary self types v2 work allows further types to be made
method receivers by implementing the Receiver trait.

With that in mind, it may come as a surprise to people when certain
common types do not implement Receiver and thus cannot be used as a
method receiver.

The RFC for arbitrary self types v2 therefore proposes emitting specific
lint hints for these cases:
* NonNull
* Weak
* Raw pointers

The code already emits a hint for this third case, in that it advises
folks that the `arbitrary_self_types_pointers` feature may meet their
need. This PR adds diagnostic hints for the Weak and NonNull cases.
2024-12-14 20:27:15 +00:00
bors
0aeaa5eb22 Auto merge of #134305 - matthiaskrgr:rollup-bja3lsz, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #133221 (Add external macros specific diagnostics for check-cfg)
 - #133386 (Update linux_musl base to dynamically link the crt by default)
 - #134191 (Make some types and methods related to Polonius + Miri public)
 - #134227 (Update wasi-sdk used to build WASI targets)
 - #134279 ((Re-)return adjustment target if adjust kind is never-to-any)
 - #134295 (Encode coroutine-closures in SMIR)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-14 20:03:16 +00:00
bors
85641f729f Auto merge of #134278 - weihanglo:update-cargo, r=weihanglo
Update cargo

19 commits in 20a443231846b81c7b909691ec3f15eb173f2b18..769f622e12db0001431d8ae36d1093fb8727c5d9
2024-12-06 21:56:56 +0000 to 2024-12-14 04:27:35 +0000
- test(build-std): dont require rustup (rust-lang/cargo#14933)
- fix(base): Support bases in patches in virtual manifests  (rust-lang/cargo#14931)
- fix(resolver): Report invalid index entries  (rust-lang/cargo#14927)
- feat: Implement `--depth workspace` for `cargo tree` command (rust-lang/cargo#14928)
- fix(resolver): In errors, show rejected versions over alt versions (rust-lang/cargo#14923)
- fix: emit_serialized_unit_graph uses the configured shell (rust-lang/cargo#14926)
- fix(script): Don't override the release profile (rust-lang/cargo#14925)
- feature(SourceId): use stable hash from rustc-stable-hash (rust-lang/cargo#14917)
- fix(resolver): Don't report all versions as rejected  (rust-lang/cargo#14921)
- fix(resolver): Report unmatched versions, rather than saying no package (rust-lang/cargo#14897)
- fix(build-rs): Implicitly report rerun-if-env-changed for input (rust-lang/cargo#14911)
- a faster hash for ActivationsKey (rust-lang/cargo#14915)
- feat(build-script): Pass CARGO_CFG_FEATURE  (rust-lang/cargo#14902)
- fix(build-rs): Correctly refer to the item in assert (rust-lang/cargo#14913)
- chore: update auto-label to include build-rs crate (rust-lang/cargo#14912)
- refactor: use Path::push to construct remap-path-prefix (rust-lang/cargo#14908)
- feat(build-rs): Add the 'error' directive (rust-lang/cargo#14910)
- fix(build-std): determine root crates by target spec `std:bool` (rust-lang/cargo#14899)
- SemVer: Add section on RPIT capturing (rust-lang/cargo#14849)
2024-12-14 17:22:58 +00:00
Weihang Lo
096f12fba7
Update cargo 2024-12-14 09:57:48 -05:00
Matthias Krüger
b0597b4eed
Rollup merge of #134295 - compiler-errors:smir-async-closure, r=oli-obk
Encode coroutine-closures in SMIR

Fixes #134246

r? oli-obk
2024-12-14 14:08:00 +01:00
Matthias Krüger
752f79a018
Rollup merge of #134279 - jieyouxu:return-adjustment-target, r=compiler-errors
(Re-)return adjustment target if adjust kind is never-to-any

This PR fixes #134162 where we ICE'd on

```rs
fn main() {
    struct X;
    let _ = [X] == [panic!(); 2];
}
```

In https://github.com/rust-lang/rust/pull/121208#discussion_r1494187622, there was a change

```diff
- if let Some(adjustments) = self.typeck_results.borrow().adjustments().get(expr.hir_id) {
-     let reported = self.dcx().span_delayed_bug(
-         expr.span,
-         "expression with never type wound up being adjusted",
-     );
-     return if let [Adjustment { kind: Adjust::NeverToAny, target }] = &adjustments[..] {
-         target.to_owned()
-     } else {
-         Ty::new_error(self.tcx(), reported)
-     };
- }
+ if let Some(_) = self.typeck_results.borrow().adjustments().get(expr.hir_id) {
+     self.dcx()
+         .span_bug(expr.span, "expression with never type wound up being adjusted");
+ }
```

It turned out returning the adjustment target if the adjustment kind is `NeverToAny` is necessary, as otherwise we will go through a series of `delay_bug`s and eventually find that we constructed a `TyKind::Error` without having actually emitted an error.

This PR addresses that by re-returning the adjustment target if the adjustment kind is `NeverToAny`, partially reverting this change from #121208.

This PR has two commits:

1. The first commit adds a regression test for #134162, which will ICE (on stable 1.83.0, beta and nightly 2024-12-13).
2. The second commit is the partial revert, which will fix the ICE.

cc `@nnethercote` FYI as this is related to #121208 changes. The changes from #121208 exposed that we lacked test coverage for the code pattern reported in #134162.
2024-12-14 14:07:59 +01:00
Matthias Krüger
352e3232b9
Rollup merge of #134227 - alexcrichton:update-wasi-sdk, r=lqd
Update wasi-sdk used to build WASI targets

Bump to the latest wasi-sdk-25 release which brings in various wasi-libc updates as well as LLVM 19 as the version used to compile wasi-libc.

- https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-24
- https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-25
2024-12-14 14:07:58 +01:00
Matthias Krüger
fffdb1bc01
Rollup merge of #134191 - willcrichton:dev, r=RalfJung,lqd
Make some types and methods related to Polonius + Miri public

We have a tool, [Aquascope](https://github.com/cognitive-engineering-lab/aquascope/), which uses Polonius and Miri to visualize the compile-time and run-time semantics of a Rust program. Changes in the last few months to both APIs have hidden away details we depend upon. This PR re-exposes some of those details, specifically:

**Polonius:**
- `BorrowSet` and `BorrowData` are added to `rustc_borrowck::consumers`, and their fields are made `pub` instead of `pub(crate)`. We need this to interpret the `BorrowIndex`es generated by Polonius.
- `BorrowSet::build` is now `pub`. We need this because the borrowck API doesn't provide access to the `BorrowSet` constructed during checking.
- `PoloniusRegionVid` is added to `rustc_borrowck::consumers`. We need this because it's also contained in the Polonius facts.

**Miri:**
- `InterpCx::local_to_op` is now a special case of `local_at_frame_to_op`, which allows querying locals in any frame. We need this because we walk the whole stack at each step to collect the state of memory.
- `InterpCx::layout_of_local` is now `pub`. We need this because we need to know the layout of every local at each step.

If these changes go against some design goal for keeping certain types private, please let me know so we can hash out a better solution. Additionally, if there's a better way to document that it's important that certain types stay public, also let me know. For example, `BorrowSet` was previously public but was hidden in 6676cec, breaking our build.

cc ```@RalfJung``` ```@nnethercote``` ```@gavinleroy```
2024-12-14 14:07:57 +01:00
Matthias Krüger
1c24da63a2
Rollup merge of #133386 - wesleywiser:update_musl_base_crt_default, r=jieyouxu
Update linux_musl base to dynamically link the crt by default

However, don't change the behavior of any existing targets at this time. For targets that used the old default, explicitly set `crt_static_default = true`.

This makes it easier for new targets to use the correct defaults while leaving the changing of individual targets to future PRs.

Related to https://github.com/rust-lang/compiler-team/issues/422
2024-12-14 14:07:56 +01:00
Matthias Krüger
f96fdab101
Rollup merge of #133221 - Urgau:check-cfg-macro-diag, r=jieyouxu
Add external macros specific diagnostics for check-cfg

This PR adds specific check-cfg diagnostics for unexpected cfg in external macros.

As well as hiding the some of the Cargo specific help/suggestions as they distraction for external macros and are generally not the right solution.

Follow-up to #132577

`@rustbot` label +L-unexpected_cfgs
r? compiler
2024-12-14 14:07:56 +01:00
bors
f1ec5d64b3 Auto merge of #134296 - matthiaskrgr:rollup-o0sxozj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #132150 (Fix powerpc64 big-endian FreeBSD ABI)
 - #133942 (Clarify how to use `black_box()`)
 - #134081 (Try to evaluate constants in legacy mangling)
 - #134192 (Remove `Lexer`'s dependency on `Parser`.)
 - #134208 (coverage: Tidy up creation of covmap and covfun records)
 - #134211 (On Neutrino QNX, reduce the need to set archiver via environment variables)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-14 13:06:18 +00:00
bors
f5079d00e6 Auto merge of #134185 - compiler-errors:impl-trait-in-bindings, r=oli-obk
(Re-)Implement `impl_trait_in_bindings`

This reimplements the `impl_trait_in_bindings` feature for local bindings.

"`impl Trait` in bindings" serve as a form of *trait* ascription, where the type basically functions as an infer var but additionally registering the `impl Trait`'s trait bounds for the infer type. These trait bounds can be used to enforce that predicates hold, and can guide inference (e.g. for closure signature inference):

```rust
let _: impl Fn(&u8) -> &u8 = |x| x;
```

They are implemented as an additional set of bounds that are registered when the type is lowered during typeck, and then these bounds are tied to a given `CanonicalUserTypeAscription` for borrowck. We enforce these `CanonicalUserTypeAscription` bounds during borrowck to make sure that the `impl Trait` types are sensitive to lifetimes:

```rust
trait Static: 'static {}
impl<T> Static for T where T: 'static {}

let local = 1;
let x: impl Static = &local;
//~^ ERROR `local` does not live long enough
```

r? oli-obk

cc #63065

---

Why can't we just use TAIT inference or something? Well, TAITs in bodies have the problem that they cannot reference lifetimes local to a body. For example:

```rust
type TAIT = impl Display;
let local = 0;
let x: TAIT = &local;
//~^ ERROR `local` does not live long enough
```

That's because TAITs requires us to do *opaque type inference* which is pretty strict, since we need to remap all of the lifetimes of the hidden type to universal regions. This is simply not possible here.

---

I consider this part of the "impl trait everywhere" experiment. I'm not certain if this needs yet another lang team experiment.
2024-12-14 10:22:43 +00:00
许杰友 Jieyou Xu (Joe)
d15315cf9d Return adjustment target if adjust kind is never-to-any
Without doing so, we'll run into a series of delayed bugs then find that
we have a `TyKind::Error` constructed yet fail to emit an error.

This partially reverts a change in
<https://github.com/rust-lang/rust/pull/121208> related to never type
adjustments in expr typecheck errors.
2024-12-14 17:07:20 +08:00
许杰友 Jieyou Xu (Joe)
0b0744ae80 Add a regression test for #134162 2024-12-14 17:07:20 +08:00
Andrew Bond
fb6a19bc67 Add documentation for anonymous pipe module 2024-12-14 01:10:33 -07:00
bors
ed14192604 Auto merge of #134294 - matthiaskrgr:rollup-anh6io8, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #134252 (Fix `Path::is_absolute` on Hermit)
 - #134254 (Fix building `std` for Hermit after `c_char` change)
 - #134255 (Update includes in `/library/core/src/error.rs`.)
 - #134261 (Document the symbol Visibility enum)
 - #134262 (Arbitrary self types v2: adjust diagnostic.)
 - #134265 (Rename `ty_def_id` so people will stop using it by accident)
 - #134271 (Arbitrary self types v2: better feature gate test)
 - #134274 (Add check-pass test for `&raw`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-14 06:44:05 +00:00
Matthias Krüger
a942794775
Rollup merge of #134211 - flba-eb:add_qnx_archiver, r=compiler-errors
On Neutrino QNX, reduce the need to set archiver via environment variables

This adds support for automatically selecting the correct `ar` tool when compiling for Neutrino QNX.
Once https://github.com/rust-lang/cc-rs/pull/1319 is merged and a new cc version is integrated, all environment variables of the [Neutrino documentation](https://github.com/rust-lang/rust/blob/stable/src/doc/rustc/src/platform-support/nto-qnx.md) can be removed.

CC: ````````@jonathanpallant```````` ````````@japaric```````` ````````@gh-tr```````` ````````@AkhilTThomas````````
2024-12-14 05:01:08 +01:00
Matthias Krüger
704102c0f0
Rollup merge of #134208 - Zalathar:covmap-covfun, r=compiler-errors
coverage: Tidy up creation of covmap and covfun records

This is a small follow-up to #134163 that mostly just inlines and renames some variables, and adds a few comments.

It also slightly defers the creation of the LLVM value that holds the filename table, to just before the value is needed.

---

try-job: x86_64-mingw-2
try-job: dist-x86_64-linux
2024-12-14 05:01:07 +01:00
Matthias Krüger
ac6ac81a67
Rollup merge of #134192 - nnethercote:rm-Lexer-Parser-dep, r=compiler-errors
Remove `Lexer`'s dependency on `Parser`.

Lexing precedes parsing, as you'd expect: `Lexer` creates a `TokenStream` and `Parser` then parses that `TokenStream`.

But, in a horrendous violation of layering abstractions and common sense, `Lexer` depends on `Parser`! The `Lexer::unclosed_delim_err` method does some error recovery that relies on creating a `Parser` to do some post-processing of the `TokenStream` that the `Lexer` just created.

This commit just removes `unclosed_delim_err`. This change removes `Lexer`'s dependency on `Parser`, and also means that `lex_token_tree`'s return value can have a more typical form.

The cost is slightly worse error messages in two obscure cases, as shown in these tests:
- tests/ui/parser/brace-in-let-chain.rs: there is slightly less explanation in this case involving an extra `{`.
- tests/ui/parser/diff-markers/unclosed-delims{,-in-macro}.rs: the diff marker detection is no longer supported (because that detection is implemented in the parser).

In my opinion this cost is outweighed by the magnitude of the code cleanup.

r? ```````@chenyukang```````
2024-12-14 05:01:06 +01:00
Matthias Krüger
03e328d178
Rollup merge of #134081 - oli-obk:push-prpsqxxynxnq, r=BoxyUwU
Try to evaluate constants in legacy mangling

Best reviewed commit by commit.

It seems kind of odd to treat literals differently from unevaluated free constants. So let's evaluate those constants and only fall back to `_` rendering if that fails to result in an integral constant
2024-12-14 05:01:06 +01:00
Matthias Krüger
8abb823520
Rollup merge of #133942 - BD103:black-box-docs, r=saethlin
Clarify how to use `black_box()`

Closes #133923.

r? libs
^ (I think that's the right group, this is my first time!)

This PR adds further clarification on the [`black_box()`](https://doc.rust-lang.org/stable/std/hint/fn.black_box.html) documentation. Specifically, it teaches _how_ to use it, instead of just _when_ to use it.

I tried my best to make it clear and accurate, but a lot of my information is sourced from https://github.com/rust-lang/rust-clippy/issues/12707 and [manually inspecting assembly](https://godbolt.org/). Please tell me if I got anything wrong!
2024-12-14 05:01:05 +01:00
Matthias Krüger
71ee12c8da
Rollup merge of #132150 - taiki-e:ppc64-freebsd-abi, r=pnkfelix
Fix powerpc64 big-endian FreeBSD ABI

Note that FreeBSD version bump may be reverted due to https://github.com/rust-lang/rust/pull/120869#issuecomment-2438685835. We may want to wait to merge this until that discussion is complete.

Fixes https://github.com/rust-lang/rust/pull/120869#discussion_r1813233054

> > PPC64 FreeBSD (ELFv1 and ELFv2, version 13.2)
>
> It seems odd that ELFv1 and 13.N coexist.
>
> https://www.freebsd.org/releases/13.0R/relnotes/
>
> > powerpc64 switched to ELFv2 ABI at the same time it switched to LLVM. This brings us to a parity with modern Linux distributions. This also makes the binaries from previous FreeBSD versions incompatible with 13.0-RELEASE. Kernel still supports ELFv1, so jails and chroots using older FreeBSD versions are still compatible. [e4399d169acc](https://cgit.freebsd.org/src/commit/?id=e4399d169acc)
>
> Well, it is also odd that this target claims ELFv2 support since our ABI code does not use ELFv2 on this target.
>
> be01dabfef/compiler/rustc_target/src/callconv/powerpc64.rs (L102-L111)

````````@rustbot```````` label +O-PowerPC +O-freebsd
2024-12-14 05:01:04 +01:00
bors
a1740a9c35 Auto merge of #134292 - matthiaskrgr:rollup-3kbjocl, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #134181 (Tweak multispan rendering to reduce output length)
 - #134209 (validate `--skip` and `--exclude` paths)
 - #134231 (rustdoc-search: fix mismatched path when parent re-exported twice)
 - #134236 (crashes: more tests v2)
 - #134240 (Only dist `llvm-objcopy` if llvm tools are enabled)
 - #134244 (rustc_borrowck: Stop suggesting the invalid syntax `&mut raw const`)
 - #134251 (A bunch of cleanups (part 2))
 - #134256 (Use a more precise span in placeholder_type_error_diag)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-14 03:55:47 +00:00
Michael Goulet
91e74edca0 Encode coroutine-closures in SMIR 2024-12-14 03:45:35 +00:00
Michael Goulet
d714a22e7b (Re-)Implement impl_trait_in_bindings 2024-12-14 03:21:24 +00:00
Michael Goulet
1da411e750 Split UserTypeAnnotation to have a kind 2024-12-14 03:20:50 +00:00
Matthias Krüger
4efa98cf2d
Rollup merge of #134274 - fmease:amp-raw-is-a-normal-borrow, r=Noratrieb
Add check-pass test for `&raw`

`&raw` denotes a normal/non-raw borrow of the path `raw`, not the start of raw borrow since it's not followed by either `const` or `mut`. Ensure this (and variants) will never regress!

When I saw the open diagnostic issue https://github.com/rust-lang/rust/issues/133231 (better parse error (recovery) on `&raw <expr>`), it made me think that we have to make sure that we will never commit too early/overzealously(†) when encountering the sequence `&raw`, even during parse error recovery!

Modifying the parser to eagerly treat `&raw` as the start of a raw borrow expr only lead to a single UI test failing, namely [tests/ui/enum-discriminant/ptr_niche.rs](4847d6a9d0/tests/ui/enum-discriminant/ptr_niche.rs). However, this is just coincidental — it didn't *intentionally* test this edge case of the grammar.

---

†: With "eager" I mean something like:

```patch
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 0904a42d8a4..68d690fd602 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
`@@` -873,11 +873,16 `@@` fn error_remove_borrow_lifetime(&self, span: Span, lt_span: Span) {

     /// Parse `mut?` or `raw [ const | mut ]`.
     fn parse_borrow_modifiers(&mut self) -> (ast::BorrowKind, ast::Mutability) {
-        if self.check_keyword(kw::Raw) && self.look_ahead(1, Token::is_mutability) {
+        if self.eat_keyword(kw::Raw) {
             // `raw [ const | mut ]`.
-            let found_raw = self.eat_keyword(kw::Raw);
-            assert!(found_raw);
-            let mutability = self.parse_const_or_mut().unwrap();
+            let mutability = self.parse_const_or_mut().unwrap_or_else(|| {
+                let span = self.prev_token.span;
+                self.dcx().emit_err(ExpectedMutOrConstInRawBorrowExpr {
+                    span,
+                    after_ampersand: span.shrink_to_hi(),
+                });
+                ast::Mutability::Not
+            });
             (ast::BorrowKind::Raw, mutability)
         } else {
             // `mut?`
```

---

r? compiler
2024-12-14 04:09:37 +01:00
Matthias Krüger
155dede638
Rollup merge of #134271 - adetaylor:feature-gate-test, r=wesleywiser
Arbitrary self types v2: better feature gate test

Slight improvement to the test for the `arbitrary_self_types_pointers` feature gate, to ensure it's independent of the `arbitrary_self_types` gate.

Part of #44874

r? `@wesleywiser`
2024-12-14 04:09:36 +01:00
Matthias Krüger
c55a97ed84
Rollup merge of #134265 - compiler-errors:ty_def_id, r=oli-obk
Rename `ty_def_id` so people will stop using it by accident

This function is just for cycle detection, but people keep using it because they think it's the right way of getting the def id from a `Ty` (and I can't blame them necessarily).
2024-12-14 04:09:36 +01:00
Matthias Krüger
2fc9ce7080
Rollup merge of #134262 - adetaylor:revert-diagnostics, r=compiler-errors
Arbitrary self types v2: adjust diagnostic.

The recently landed PR #132961 to adjust arbitrary self types was a bit overenthusiastic, advising folks to use the new Receiver trait even before it's been stabilized. Revert to the older wording of the lint in such cases.

Tracking issue #44874

r? ``@wesleywiser``
2024-12-14 04:09:35 +01:00
Matthias Krüger
cb459fa427
Rollup merge of #134261 - bjorn3:document_symbol_visibility, r=lqd
Document the symbol Visibility enum
2024-12-14 04:09:34 +01:00
Matthias Krüger
0b5003eaf0
Rollup merge of #134255 - bjoernager:master, r=Noratrieb
Update includes in `/library/core/src/error.rs`.

This PR removes the `crate::fmt::Result` include in `/library/core/src/error.rs`.

The main issue with this `use` statement is that it shadows the `Result` type from the prelude (i.e. `crate::result::Result`). This indirectly makes all docs references to `Result` in this module point to the wrong type (but only in `core::error` - not `std::error`, wherein this include isn't present to begin with).

Fixes: #134169
2024-12-14 04:09:34 +01:00
Matthias Krüger
198d2d486d
Rollup merge of #134254 - hermit-os:hermit-c_char, r=workingjubilee
Fix building `std` for Hermit after `c_char` change

These changes were made necessary by https://github.com/rust-lang/rust/pull/132975.
2024-12-14 04:09:33 +01:00
Matthias Krüger
c58b8bc1bf
Rollup merge of #134252 - hermit-os:hermit-is_absolute, r=tgross35
Fix `Path::is_absolute` on Hermit

Paths on Hermit work like paths on Unix.

Closes https://github.com/rust-lang/rust/issues/132141.
2024-12-14 04:09:33 +01:00
Matthias Krüger
75e778991e
Rollup merge of #134256 - krtab:suggestion_overlapping, r=petrochenkov
Use a more precise span in placeholder_type_error_diag

Closes: https://github.com/rust-lang/rust/issues/123861
2024-12-14 03:54:36 +01:00
Matthias Krüger
87bbbcd1bb
Rollup merge of #134251 - bjorn3:various_cleanups2, r=oli-obk
A bunch of cleanups (part 2)

Just like https://github.com/rust-lang/rust/pull/133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
2024-12-14 03:54:35 +01:00
Matthias Krüger
34e607594b
Rollup merge of #134244 - Enselic:no-mut-hint-for-raw-ref, r=jieyouxu
rustc_borrowck: Stop suggesting the invalid syntax `&mut raw const`

A legitimate suggestion would be to change from

    &raw const val

to

    &raw mut val

But until we have figured out how to make that happen we should at least
stop suggesting invalid syntax.

I recommend review commit-by-commit.

Part of #127562
2024-12-14 03:54:34 +01:00
Matthias Krüger
a53a3ccab4
Rollup merge of #134240 - cuviper:dist-llvm-tools, r=jieyouxu
Only dist `llvm-objcopy` if llvm tools are enabled

This uses the same condition that #132720 added in the compilation phase.

r? ``@jieyouxu``
2024-12-14 03:54:34 +01:00
Matthias Krüger
e4f9084965
Rollup merge of #134236 - matthiaskrgr:tests12122024, r=compiler-errors
crashes: more tests v2

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: x86_64-gnu
2024-12-14 03:54:33 +01:00