Commit Graph

285680 Commits

Author SHA1 Message Date
Michael Rieder
2d2486d2da Fix parameter order for _by() variants of min / max/ minmax in std::cmp 2025-04-04 10:11:29 +02:00
bors
9e14530c7c Auto merge of #120706 - Bryanskiy:leak, r=lcnr
Initial support for auto traits with default bounds

This PR is part of ["MCP: Low level components for async drop"](https://github.com/rust-lang/compiler-team/issues/727)
Tracking issue: #138781
Summary: https://github.com/rust-lang/rust/pull/120706#issuecomment-1934006762

### Intro

Sometimes we want to use type system to express specific behavior and provide safety guarantees. This behavior can be specified by various "marker" traits. For example, we use `Send` and `Sync` to keep track of which types are thread safe. As the language develops, there are more problems that could be solved by adding new marker traits:

- to forbid types with an async destructor to be dropped in a synchronous context a trait like `SyncDrop` could be used [Async destructors, async genericity and completion futures](https://sabrinajewson.org/blog/async-drop).
- to support [scoped tasks](https://without.boats/blog/the-scoped-task-trilemma/) or in a more general sense to provide a [destruction guarantee](https://zetanumbers.github.io/book/myosotis.html) there is a desire among some users to see a `Leak` (or `Forget`) trait.
- Withoutboats in his [post](https://without.boats/blog/changing-the-rules-of-rust/) reflected on the use of `Move` trait instead of a `Pin`.

All the traits proposed above are supposed to be auto traits implemented for most types, and usually implemented automatically by compiler.

For backward compatibility these traits have to be added implicitly to all bound lists in old code (see below). Adding new default bounds involves many difficulties: many standard library interfaces may need to opt out of those default bounds, and therefore be infected with confusing `?Trait` syntax, migration to a new edition may contain backward compatibility holes, supporting new traits in the compiler can be quite difficult and so forth. Anyway, it's hard to evaluate the complexity until we try the system on a practice.

In this PR we introduce new optional lang items for traits that are added to all bound lists by default, similarly to existing `Sized`. The examples of such traits could be `Leak`, `Move`, `SyncDrop` or something else, it doesn't matter much right now (further I will call them `DefaultAutoTrait`'s). We want to land this change into rustc under an option, so it becomes available in bootstrap compiler. Then we'll be able to do standard library experiments with the aforementioned traits without adding hundreds of `#[cfg(not(bootstrap))]`s. Based on the experiments, we can come up with some scheme for the next edition, in which such bounds are added in a more targeted way, and not just everywhere.

Most of the implementation is basically a refactoring that replaces hardcoded uses of `Sized` with iterating over a list of traits including both `Sized` and the new traits when `-Zexperimental-default-bounds` is enabled (or just `Sized` as before, if the option is not enabled).

### Default bounds for old editions

All existing types, including generic parameters, are considered `Leak`/`Move`/`SyncDrop` and can be forgotten, moved or destroyed in generic contexts without specifying any bounds. New types that cannot be, for example, forgotten and do not implement `Leak` can be added at some point, and they should not be usable in such generic contexts in existing code.

To both maintain this property and keep backward compatibility with existing code, the new traits should be added as default bounds _everywhere_ in previous editions. Besides the implicit `Sized` bound contexts that includes supertrait lists and trait lists in trait objects (`dyn Trait1 + ... + TraitN`). Compiler should also generate implicit `DefaultAutoTrait` implementations for foreign types (`extern { type Foo; }`) because they are also currently usable in generic contexts without any bounds.

#### Supertraits

Adding the new traits as supertraits to all existing traits is potentially necessary, because, for example, using a `Self` param in a trait's associated item may be a breaking change otherwise:

```rust
trait Foo: Sized {
    fn new() -> Option<Self>; // ERROR: `Option` requires `DefaultAutoTrait`, but `Self` is not `DefaultAutoTrait`
}

// desugared `Option`
enum Option<T: DefaultAutoTrait + Sized> {
    Some(T),
    None,
}
```

However, default supertraits can significantly affect compiler performance. For example, if we know that `T: Trait`, the compiler would deduce that `T: DefaultAutoTrait`. It also implies proving `F: DefaultAutoTrait` for each field `F` of type `T` until an explicit impl is be provided.

If the standard library is not modified, then even traits like `Copy` or `Send` would get these supertraits.

In this PR for optimization purposes instead of adding default supertraits, bounds are added to the associated items:

```rust
// Default bounds are generated in the following way:
trait Trait {
   fn foo(&self) where Self: DefaultAutoTrait {}
}

// instead of this:
trait Trait: DefaultAutoTrait {
   fn foo(&self) {}
}
```

It is not always possible to do this optimization because of backward compatibility:

```rust
pub trait Trait<Rhs = Self> {}
pub trait Trait1 : Trait {} // ERROR: `Rhs` requires `DefaultAutoTrait`, but `Self` is not `DefaultAutoTrait`
```

or

```rust
trait Trait {
   type Type where Self: Sized;
}
trait Trait2<T> : Trait<Type = T> {} // ERROR: `???` requires `DefaultAutoTrait`, but `Self` is not `DefaultAutoTrait`
```

Therefore, `DefaultAutoTrait`'s are still being added to supertraits if the `Self` params or type bindings were found in the trait header.

#### Trait objects

Trait objects requires explicit `+ Trait` bound to implement corresponding trait which is not backward compatible:

```rust
fn use_trait_object(x: Box<dyn Trait>) {
   foo(x) // ERROR: `foo` requires `DefaultAutoTrait`, but `dyn Trait` is not `DefaultAutoTrait`
}

// implicit T: DefaultAutoTrait here
fn foo<T>(_: T) {}
```

So, for a trait object `dyn Trait` we should add an implicit bound `dyn Trait + DefaultAutoTrait` to make it usable, and allow relaxing it with a question mark syntax `dyn Trait + ?DefaultAutoTrait` when it's not necessary.

#### Foreign types

If compiler doesn't generate auto trait implementations for a foreign type, then it's a breaking change if the default bounds are added everywhere else:

```rust
// implicit T: DefaultAutoTrait here
fn foo<T: ?Sized>(_: &T) {}

extern "C" {
    type ExternTy;
}

fn forward_extern_ty(x: &ExternTy) {
    foo(x); // ERROR: `foo` requires `DefaultAutoTrait`, but `ExternTy` is not `DefaultAutoTrait`
}
```

We'll have to enable implicit `DefaultAutoTrait` implementations for foreign types at least for previous editions:

```rust
// implicit T: DefaultAutoTrait here
fn foo<T: ?Sized>(_: &T) {}

extern "C" {
    type ExternTy;
}

impl DefaultAutoTrait for ExternTy {} // implicit impl

fn forward_extern_ty(x: &ExternTy) {
    foo(x); // OK
}
```

### Unresolved questions

New default bounds affect all existing Rust code complicating an already complex type system.

- Proving an auto trait predicate requires recursively traversing the type and proving the predicate for it's fields. This leads to a significant performance regression. Measurements for the stage 2 compiler build show up to 3x regression.
    - We hope that fast path optimizations for well known traits could mitigate such regressions at least partially.
- New default bounds trigger some compiler bugs in both old and new trait solver.
- With new default bounds we encounter some trait solver cycle errors that break existing code.
    - We hope that these cases are bugs that can be addressed in the new trait solver.

Also migration to a new edition could be quite ugly and enormous, but that's actually what we want to solve. For other issues there's a chance that they could be solved by a new solver.
2025-04-04 01:35:52 +00:00
bors
4fd8c04da0 Auto merge of #139336 - matthiaskrgr:rollup-zsi8pgf, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #138017 (Tighten up assignment operator representations.)
 - #138462 (Dedup `&mut *` reborrow suggestion in loops)
 - #138610 (impl !PartialOrd for HirId)
 - #138767 (Allow boolean literals in `check-cfg`)
 - #139068 (io: Avoid marking some bytes as uninit)
 - #139255 (Remove unused variables generated in merged doctests)
 - #139270 (Add a mailmap entry for myself)
 - #139303 (Put Noratrieb on vacation)
 - #139312 (add Marco Ieni to mailmap)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-03 22:26:29 +00:00
Matthias Krüger
4cf6c21f3a
Rollup merge of #139312 - marcoieni:marco-mailmap, r=Kobzol
add Marco Ieni to mailmap
2025-04-03 21:18:33 +02:00
Matthias Krüger
42aef0c1ab
Rollup merge of #139303 - Noratrieb:Noratrieb-patch-3, r=Noratrieb
Put Noratrieb on vacation

My review queue has gotten a bit out of hand. I'll work on reviewing those PRs before taking up new ones.
2025-04-03 21:18:33 +02:00
Matthias Krüger
ec9aa8c36b
Rollup merge of #139270 - RossSmyth:mailmap, r=Noratrieb
Add a mailmap entry for myself

Turns out I have not been at all consistent. Oops.
2025-04-03 21:18:32 +02:00
Matthias Krüger
ed6efe6723
Rollup merge of #139255 - GuillaumeGomez:unused-var-merged-doctest, r=fmease
Remove unused variables generated in merged doctests

The variable is unused so no need to keep it around.

cc `@notriddle`
r? `@camelid`
2025-04-03 21:18:31 +02:00
Matthias Krüger
ff8f2eff3a
Rollup merge of #139068 - a1phyr:less_uninit, r=joboet
io: Avoid marking some bytes as uninit

These bytes were marked as uninit, which would cause them to be initialized multiple times even though it was not necessary.
2025-04-03 21:18:31 +02:00
Matthias Krüger
9d733eca06
Rollup merge of #138767 - clubby789:check-cfg-bool, r=Urgau
Allow boolean literals in `check-cfg`

https://github.com/rust-lang/rust/pull/138632#issuecomment-2738114495
This makes it consistent with `--cfg`

We could alternatively add a forward-compatible lint against `--cfg true/false`
r? `@Urgau`
2025-04-03 21:18:30 +02:00
Matthias Krüger
48a3919884
Rollup merge of #138610 - oli-obk:no-sort-hir-ids, r=compiler-errors
impl !PartialOrd for HirId

revive of https://github.com/rust-lang/rust/pull/92233

Another checkbox of https://github.com/rust-lang/rust/issues/90317, another small step in making incremental less likely to die in horrible ways
2025-04-03 21:18:30 +02:00
Matthias Krüger
731ce84d19
Rollup merge of #138462 - ShE3py:mut-borrow-in-loop, r=oli-obk
Dedup `&mut *` reborrow suggestion in loops

#73534 added a reborrow suggestion in loops; #127579 generalized this to generic parameters, making the suggestion triggers twice:
```rs
use std::io::Read;

fn decode_scalar(_reader: impl Read) {}
fn decode_array(reader: &mut impl Read) {
    for _ in 0.. {
        decode_scalar(reader);
    }
}
```
```
error[E0382]: use of moved value: `reader`
 --> src/lib.rs:6:23
  |
4 | fn decode_array(reader: &mut impl Read) {
  |                 ------ move occurs because `reader` has type `&mut impl Read`, which does not implement the `Copy` trait
5 |     for _ in 0.. {
  |     ------------ inside of this loop
6 |         decode_scalar(reader);
  |                       ^^^^^^ value moved here, in previous iteration of loop
  |
help: consider creating a fresh reborrow of `reader` here
  |
6 |         decode_scalar(&mut *reader);
  |                       ++++++
help: consider creating a fresh reborrow of `reader` here
  |
6 |         decode_scalar(&mut *reader);
  |                       ++++++
```
This PR removes the suggestion in loops, as it requires generic parameters anyway (i.e., the reborrow is automatic if there is no generic params).

`@rustbot` label +A-borrow-checker +A-diagnostics +A-suggestion-diagnostics +D-papercut
2025-04-03 21:18:29 +02:00
Matthias Krüger
e5c7451a10
Rollup merge of #138017 - nnethercote:tighten-assignment-op, r=spastorino
Tighten up assignment operator representations.

This is step 3 of [MCP 831](https://github.com/rust-lang/compiler-team/issues/831).

r? `@spastorino`
2025-04-03 21:18:28 +02:00
bors
00095b3da4 Auto merge of #132527 - DianQK:gvn-stmt-iter, r=oli-obk
gvn: Invalid dereferences for all non-local mutations

Fixes #132353.

This PR removes the computation value by traversing SSA locals through `for_each_assignment_mut`.

Because the `for_each_assignment_mut` traversal skips statements which have side effects, such as dereference assignments, the computation may be unsound. Instead of `for_each_assignment_mut`, we compute values by traversing in reverse postorder.

Because we compute and use the symbolic representation of values on the fly, I invalidate all old values when encountering a dereference assignment. The current approach does not prevent the optimization of a clone to a copy.

In the future, we may add an alias model, or dominance information for dereference assignments, or SSA form to help GVN.

r? cjgillot

cc `@jieyouxu` #132356
cc `@RalfJung` #133474
2025-04-03 19:17:33 +00:00
bors
82eb03ec62 Auto merge of #139301 - matthiaskrgr:rollup-sa6ali8, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #139080 (Experimental feature gate for `super let`)
 - #139145 (slice: Remove some uses of unsafe in first/last chunk methods)
 - #139149 (unstable book: document import_trait_associated_functions)
 - #139273 (Apply requested API changes to `cell_update`)
 - #139282 (rustdoc: make settings checkboxes always square)
 - #139283 (Rustc dev guide subtree update)
 - #139294 (Fix the `f16`/`f128` feature gates on integer literals)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-03 15:31:20 +00:00
dianqk
7d44887374
Invalid dereferences for all non-local mutations 2025-04-03 21:59:49 +08:00
dianqk
4e05d858ad
Only preserving derefs for trivial terminators like SwitchInt and Goto 2025-04-03 21:59:49 +08:00
dianqk
ac7dd7a1b3
Remove unsound-mir-opts for simplify_aggregate_to_copy 2025-04-03 21:59:43 +08:00
bors
946aea0b3d Auto merge of #139137 - petrochenkov:errwhere2, r=jieyouxu
compiletest: Require `//~` annotations even if `error-pattern` is specified

This is continuation of #138865 with some help from #139100.

`error-pattern` annotations that duplicate the newly added `//~` annotations are removed, other `error-pattern`s are not touched yet.

In exceptional cases `//@ compile-flags: --error-format=human` can be used to opt out of these checks.
In this PR I only had to use the opt out 3 times:
- `tests/ui/parser/utf16-{be,le}-without-bom.rs` - there are too many errors that are nearly identical (modulo location), because an error is reported on every second symbol
- `tests/ui-fulldeps/missing-rustc-driver-error.rs` - the errors list various rustc crate dependencies and may unexpectedly invalidate on random rustc changes
2025-04-03 12:05:32 +00:00
Bryanskiy
581c5fbc40 Initial support for auto traits with default bounds 2025-04-03 14:59:39 +03:00
MarcoIeni
b310e8cd8f
add Marco Ieni to mailmap 2025-04-03 12:36:39 +02:00
clubby789
3df2acd31b Allow boolean literals in check-cfg 2025-04-03 09:54:23 +00:00
Oli Scherer
57c4ab7ff5 impl !PartialOrd for HirId 2025-04-03 09:22:21 +00:00
Oli Scherer
5a4e7eb040 impl !PartialOrd for UpvarMigrationInfo 2025-04-03 09:22:21 +00:00
Oli Scherer
0795b3de9b Upvars HirIds always have the same owner, thus just use an ItemLocalId 2025-04-03 09:22:21 +00:00
Oli Scherer
805f389da5 Remove LintExpectationId from Level variants 2025-04-03 09:22:21 +00:00
Oli Scherer
c51816ee59 Make LevelAndSource a struct 2025-04-03 09:17:55 +00:00
Oli Scherer
f3eaf1624c Split ExpectationLintId off Level 2025-04-03 09:17:55 +00:00
bors
e0883a2a6c Auto merge of #137738 - Daniel-Aaron-Bloom:const_slice_make_iter, r=dtolnay
Make slice iterator constructors unstably const

See [tracking issue](https://github.com/rust-lang/rust/issues/137737) for justification.

try-job: aarch64-apple
try-job: x86_64-gnu
2025-04-03 08:57:46 +00:00
Vadim Petrochenkov
4916d44b59 Fix up tests on wasm and msvc, and rebase conflicts
Can be fixed properly later by adding a new flag for non-exhaustive line annotation checking
2025-04-03 11:08:55 +03:00
Vadim Petrochenkov
4d64990690 compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
Matthias Krüger
29c0fe747a
Rollup merge of #139294 - beetrees:fix-f16-f128-literal-feature-gate, r=fmease
Fix the `f16`/`f128` feature gates on integer literals

The feature gating logic for `f16`/`f128` currently only checks float literals, meaning this code currently compiles with no feature gates on stable ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=b0c0e285ccb822fc7e2abc595557886b)):
```rust
fn main() {
    let a = 1f16;
    let b = 1f128;
    dbg!(a, b);
}
```
This PR fixes that.

Tracking issue: #116909
2025-04-03 07:39:08 +02:00
Matthias Krüger
85c557e76e
Rollup merge of #139283 - BoxyUwU:rdg-push, r=jieyouxu
Rustc dev guide subtree update

r? ``@jieyouxu`` ``@Kobzol``
2025-04-03 07:39:08 +02:00
Matthias Krüger
b5d5b6cd41
Rollup merge of #139282 - lolbinarycat:rustdoc-settings-checkbox-noshrink, r=notriddle
rustdoc: make settings checkboxes always square

Previously, checkboxes would flex horizontally on small screens:
![Screenshot 2025-04-02 at 15-45-13 std - Rust](https://github.com/user-attachments/assets/405dc764-3c04-4ba4-b86c-19e9d4fc0bff)

this simple css tweak fixes this.
2025-04-03 07:39:07 +02:00
Matthias Krüger
184e4baf1b
Rollup merge of #139273 - tgross35:cell-update-changes, r=jhpratt
Apply requested API changes to `cell_update`

Do the following:

* Switch to `impl FnOnce` rather than a generic `F`.
* Change `update` to return nothing.

This was discussed at a libs-api meeting [1].

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

[1]: https://github.com/rust-lang/rust/pull/134446#issuecomment-2770842949
2025-04-03 07:39:07 +02:00
Matthias Krüger
ee56188457
Rollup merge of #139149 - mejrs:itaf, r=ehuss
unstable book: document import_trait_associated_functions

Documents https://github.com/rust-lang/rust/issues/134691 which was implemented in https://github.com/rust-lang/rust/pull/134754
2025-04-03 07:39:06 +02:00
Matthias Krüger
e332aa89a7
Rollup merge of #139145 - okaneco:safe_splits, r=Amanieu
slice: Remove some uses of unsafe in first/last chunk methods

Remove unsafe `split_at_unchecked` and `split_at_mut_unchecked` in some slice `split_first_chunk`/`split_last_chunk` methods.
Replace those calls with the safe `split_at` and `split_at_checked` where applicable.

Add codegen tests to check for no panics when calculating the last chunk index using `checked_sub` and `split_at`.

Better viewed with whitespace disabled in diff view

---

The unchecked calls are mostly manual implementations of the safe methods, but with the safety condition negated from `mid <= len` to `len < mid`.
```rust
if self.len() < N {
    None
} else {
    // SAFETY: We manually verified the bounds of the split.
    let (first, tail) = unsafe { self.split_at_unchecked(N) };
    // Or for the last_chunk methods
    let (init, last) = unsafe { self.split_at_unchecked(self.len() - N) };
```

Unsafe is still needed for the pointer array casts. Their safety comments are unmodified.
2025-04-03 07:39:05 +02:00
Matthias Krüger
dbd7f52c83
Rollup merge of #139080 - m-ou-se:super-let-gate, r=traviscross
Experimental feature gate for `super let`

This adds an experimental feature gate, `#![feature(super_let)]`, for the `super let` experiment.

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

Liaison: ``@nikomatsakis``

## Description

There's a rough (inaccurate) description here: https://blog.m-ou.se/super-let/

In short, `super let` allows you to define something that lives long enough to be borrowed by the tail expression of the block. For example:

```rust
let a = {
    super let b = temp();
    &b
};
```

Here, `b` is extended to live as long as `a`, similar to how in `let a = &temp();`, the temporary will be extended to live as long as `a`.

## Properties

During the temporary lifetimes work we did last year, we explored the properties of "super let" and concluded that the fundamental property should be that these two are always equivalent in any context:

1. `& $expr`
2. `{ super let a = & $expr; a }`

And, additionally, that these are equivalent in any context when `$expr` is a temporary (aka rvalue):

1. `& $expr`
2. `{ super let a = $expr; & a }`

This makes it possible to give a name to a temporary without affecting how temporary lifetimes work, such that a macro can transparently use a block in its expansion, without that having any effect on the outside.

## Implementing pin!() correctly

With `super let`, we can properly implement the `pin!()` macro without hacks: 

```rust
pub macro pin($value:expr $(,)?) {
    {
        super let mut pinned = $value;
        unsafe { $crate::pin::Pin::new_unchecked(&mut pinned) }
    }
}
```

This is important, as there is currently no way to express it without hacks in Rust 2021 and before (see [hacky definition](2a06022951/library/core/src/pin.rs (L1947))), and no way to express it at all in Rust 2024 (see [issue](https://github.com/rust-lang/rust/issues/138718)).

## Fixing format_args!()

This will also allow us to express `format_args!()` in a way where one can assign the result to a variable, fixing a [long standing issue](https://github.com/rust-lang/rust/issues/92698):

```rust
let f = format_args!("Hello {name}!"); // error today, but accepted in the future! (after separate FCP)
```

## Experiment

The precise definition of `super let`, what happens for `super let x;` (without initializer), and whether to accept `super let _ = _ else { .. }` are still open questions, to be answered by the experiment.

Furthermore, once we have a more complete understanding of the feature, we might be able to come up with a better syntax. (Which could be just a different keywords, or an entirely different way of naming temporaries that doesn't involve a block and a (super) let statement.)
2025-04-03 07:39:05 +02:00
bors
b6d74b5e15 Auto merge of #139250 - dianqk:llvm-20.1.2, r=cuviper
Update to LLVM 20.1.2

`@rustbot` label A-LLVM T-compiler
2025-04-03 03:27:29 +00:00
bors
3658060890 Auto merge of #139234 - compiler-errors:query-tweak, r=oli-obk
Misc query tweaks

Remove some redundant work around `cache_on_disk` and `ensure_ok`, since `Result<(), ErrorGuaranteed>` queries don't need to cache or recompute their "value" if they are only used for their result.
2025-04-03 00:13:54 +00:00
beetrees
62fcb9d585
Fix the f16/f128 feature gate on integer literals 2025-04-03 01:08:41 +01:00
Nicholas Nethercote
ddcb370bc6 Tighten up assignment operator representations.
In the AST, currently we use `BinOpKind` within `ExprKind::AssignOp` and
`AssocOp::AssignOp`, even though this allows some nonsensical
combinations. E.g. there is no `&&=` operator. Likewise for HIR and
THIR.

This commit introduces `AssignOpKind` which only includes the ten
assignable operators, and uses it in `ExprKind::AssignOp` and
`AssocOp::AssignOp`. (And does similar things for `hir::ExprKind` and
`thir::ExprKind`.) This avoids the possibility of nonsensical
combinations, as seen by the removal of the `bug!` case in
`lang_item_for_binop`.

The commit is mostly plumbing, including:
- Adds an `impl From<AssignOpKind> for BinOpKind` (AST) and `impl
  From<AssignOp> for BinOp` (MIR/THIR).
- `BinOpCategory` can now be created from both `BinOpKind` and
  `AssignOpKind`.
- Replaces the `IsAssign` type with `Op`, which has more information and
  a few methods.
- `suggest_swapping_lhs_and_rhs`: moves the condition to the call site,
  it's easier that way.
- `check_expr_inner`: had to factor out some code into a separate
  method.

I'm on the fence about whether avoiding the nonsensical combinations is
worth the extra code.
2025-04-03 10:23:03 +11:00
Nicholas Nethercote
ac8ccf09b4 Use BinOpKind instead of BinOp for function args where possible.
Because it's nice to avoid passing in unnecessary data.
2025-04-03 10:18:56 +11:00
Nicholas Nethercote
076cccd412 Remove Op type.
First, move the `lang_item_for_op` call from the top of
`lookup_op_method`'s body to its callsites. It makes those callsites a
little more verbose, but also means `lookup_op_method` no longer cares
whether it's handling a binop or unop. This lets us remove `Op` and
split `lang_item_for_op` into `lang_item_for_{bin,un}op`, which is a
little simpler.

This change is a prerequisite for adding the `ast::AssignOpKind` type in
a subsequent commit.
2025-04-03 10:18:56 +11:00
Mara Bos
14e6a964f2
Mark super_let feature as incomplete.
Co-authored-by: Travis Cross <tc@traviscross.com>
2025-04-02 23:43:41 +02:00
binarycat
33c1ff0579 rustdoc: make settings checkboxes always square 2025-04-02 16:25:29 -05:00
Ross Smyth
f798c46dad Map myself 2025-04-02 17:21:22 -04:00
bors
d5b4c2e4f1 Auto merge of #139269 - matthiaskrgr:rollup-pk78gig, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #138992 (literal pattern lowering: use the pattern's type instead of the literal's in `const_to_pat`)
 - #139211 (interpret: add a version of run_for_validation for &self)
 - #139235 (`AstValidator` tweaks)
 - #139237 (Add a dep kind for use of the anon node with zero dependencies)
 - #139260 (Add dianqk to codegen reviewers)
 - #139264 (Fix two incorrect turbofish suggestions)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-02 18:39:21 +00:00
Trevor Gross
072aa9e66f Apply requested API changes to cell_update
Do the following:

* Switch to `impl FnOnce` rather than a generic `F`.
* Change `update` to return nothing.

This was discussed at a libs-api meeting [1].

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

[1]: https://github.com/rust-lang/rust/pull/134446#issuecomment-2770842949
2025-04-02 18:18:50 +00:00
Matthias Krüger
278bc67fdc
Rollup merge of #139264 - freyacodes:fix/bad-turbofish-hints, r=petrochenkov
Fix two incorrect turbofish suggestions

This fixes #121901

This is my contribution to Rust, and my first contribution to a language parser that I didn't write myself.
I am a bit outside my depth here, so any constructive criticism is appreciated.
2025-04-02 19:44:15 +02:00
Matthias Krüger
43f17288e1
Rollup merge of #139260 - dianqk:dianqk-codegen-reviewers, r=Urgau
Add dianqk to codegen reviewers

Not an expert yet, but I may be able to review some LLVM-related PRs.

r? codegen
2025-04-02 19:44:14 +02:00