]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoRollup merge of #102207 - CraftSpider:const-layout, r=scottmcm
Manish Goregaokar [Tue, 22 Nov 2022 06:26:07 +0000 (01:26 -0500)]
Rollup merge of #102207 - CraftSpider:const-layout, r=scottmcm

Constify remaining `Layout` methods

Makes the methods on `Layout` that aren't yet unstably const, under the same feature and issue, #67521. Most of them required no changes, only non-trivial change is probably constifying `ValidAlignment` which may affect #102072

19 months agoRollup merge of #101655 - dns2utf8:box_docs, r=dtolnay
Manish Goregaokar [Tue, 22 Nov 2022 06:26:06 +0000 (01:26 -0500)]
Rollup merge of #101655 - dns2utf8:box_docs, r=dtolnay

Make the Box one-liner more descriptive

I would like to avoid a definition that relies on itself.

r? `@GuillaumeGomez`

19 months agoRollup merge of #95583 - scottmcm:deprecate-ptr-to-from-bits, r=dtolnay
Manish Goregaokar [Tue, 22 Nov 2022 06:26:05 +0000 (01:26 -0500)]
Rollup merge of #95583 - scottmcm:deprecate-ptr-to-from-bits, r=dtolnay

Deprecate the unstable `ptr_to_from_bits` feature

I propose that we deprecate the (unstable!) `to_bits` and `from_bits` methods on raw pointers.  (With the intent to ~~remove them once `addr` has been around long enough to make the transition easy on people -- maybe another 6 weeks~~ remove them fairly soon after, as the strict and expose versions have been around for a while already.)

The APIs that came from the strict provenance explorations (#95228) are a more holistic version of these, and things like `.expose_addr()` work for the "that cast looks sketchy" case even if the full strict provenance stuff never happens.  (As a bonus, `addr` is even shorter than `to_bits`, though it is only applicable if people can use full strict provenance! `addr` is *not* a direct replacement for `to_bits`.)  So I think it's fine to move away from the `{to|from}_bits` methods, and encourage the others instead.

That also resolves the worry that was brought up (I forget where) that `q.to_bits()` and `(*q).to_bits()` both work if `q` is a pointer-to-floating-point, as they also have a `to_bits` method.

Tracking issue #91126
Code search: https://github.com/search?l=Rust&p=1&q=ptr_to_from_bits&type=Code

For potential pushback, some users in case they want to chime in
- `@RSSchermer` https://github.com/RSSchermer/ARWA/blob/365bb68541447453fc44f6fbcc5d394bb94c14e9/arwa/src/html/custom_element.rs#L105
- `@strax` https://github.com/strax/pbr/blob/99616d1dbf42f93ec8dd668d05b3180649558180/openexr/src/core/alloc.rs#L36
- `@MiSawa` https://github.com/MiSawa/pomelo/blob/577c6223588d539295a71ff125d8f249e59f4146/crates/kernel/src/timer.rs#L50

19 months agoRollup merge of #83608 - Kimundi:index_many, r=Mark-Simulacrum
Manish Goregaokar [Tue, 22 Nov 2022 06:26:05 +0000 (01:26 -0500)]
Rollup merge of #83608 - Kimundi:index_many, r=Mark-Simulacrum

Add slice methods for indexing via an array of indices.

Disclaimer: It's been a while since I contributed to the main Rust repo, apologies in advance if this is large enough already that it should've been an RFC.

---

# Update:

- Based on feedback, removed the `&[T]` variant of this API, and removed the requirements for the indices to be sorted.

# Description

This adds the following slice methods to `core`:

```rust
impl<T> [T] {
    pub unsafe fn get_many_unchecked_mut<const N: usize>(&mut self, indices: [usize; N]) -> [&mut T; N];
    pub fn get_many_mut<const N: usize>(&mut self, indices: [usize; N]) -> Option<[&mut T; N]>;
}
```

This allows creating multiple mutable references to disjunct positions in a slice, which previously required writing some awkward code with `split_at_mut()` or `iter_mut()`. For the bound-checked variant, the indices are checked against each other and against the bounds of the slice, which requires `N * (N + 1) / 2` comparison operations.

This has a proof-of-concept standalone implementation here: https://crates.io/crates/index_many

Care has been taken that the implementation passes miri borrow checks, and generates straight-forward assembly (though this was only checked on x86_64).

# Example

```rust
let v = &mut [1, 2, 3, 4];
let [a, b] = v.get_many_mut([0, 2]).unwrap();
std::mem::swap(a, b);
*v += 100;
assert_eq!(v, &[3, 2, 101, 4]);
```

# Codegen Examples

<details>
  <summary>Click to expand!</summary>

Disclaimer: Taken from local tests with the standalone implementation.

## Unchecked Indexing:

```rust
pub unsafe fn example_unchecked(slice: &mut [usize], indices: [usize; 3]) -> [&mut usize; 3] {
    slice.get_many_unchecked_mut(indices)
}
```

```nasm
example_unchecked:
 mov     rcx, qword, ptr, [r9]
 mov     r8, qword, ptr, [r9, +, 8]
 mov     r9, qword, ptr, [r9, +, 16]
 lea     rcx, [rdx, +, 8*rcx]
 lea     r8, [rdx, +, 8*r8]
 lea     rdx, [rdx, +, 8*r9]
 mov     qword, ptr, [rax], rcx
 mov     qword, ptr, [rax, +, 8], r8
 mov     qword, ptr, [rax, +, 16], rdx
 ret
```

## Checked Indexing (Option):

```rust
pub unsafe fn example_option(slice: &mut [usize], indices: [usize; 3]) -> Option<[&mut usize; 3]> {
    slice.get_many_mut(indices)
}
```

```nasm
 mov     r10, qword, ptr, [r9, +, 8]
 mov     rcx, qword, ptr, [r9, +, 16]
 cmp     rcx, r10
 je      .LBB0_7
 mov     r9, qword, ptr, [r9]
 cmp     rcx, r9
 je      .LBB0_7
 cmp     rcx, r8
 jae     .LBB0_7
 cmp     r10, r9
 je      .LBB0_7
 cmp     r9, r8
 jae     .LBB0_7
 cmp     r10, r8
 jae     .LBB0_7
 lea     r8, [rdx, +, 8*r9]
 lea     r9, [rdx, +, 8*r10]
 lea     rcx, [rdx, +, 8*rcx]
 mov     qword, ptr, [rax], r8
 mov     qword, ptr, [rax, +, 8], r9
 mov     qword, ptr, [rax, +, 16], rcx
 ret
.LBB0_7:
 mov     qword, ptr, [rax], 0
 ret
```

## Checked Indexing (Panic):

```rust
pub fn example_panic(slice: &mut [usize], indices: [usize; 3]) -> [&mut usize; 3] {
    let len = slice.len();
    match slice.get_many_mut(indices) {
        Some(s) => s,
        None => {
            let tmp = indices;
            index_many::sorted_bound_check_failed(&tmp, len)
        }
    }
}
```

```nasm
example_panic:
 sub     rsp, 56
 mov     rax, qword, ptr, [r9]
 mov     r10, qword, ptr, [r9, +, 8]
 mov     r9, qword, ptr, [r9, +, 16]
 cmp     r9, r10
 je      .LBB0_6
 cmp     r9, rax
 je      .LBB0_6
 cmp     r9, r8
 jae     .LBB0_6
 cmp     r10, rax
 je      .LBB0_6
 cmp     rax, r8
 jae     .LBB0_6
 cmp     r10, r8
 jae     .LBB0_6
 lea     rax, [rdx, +, 8*rax]
 lea     r8, [rdx, +, 8*r10]
 lea     rdx, [rdx, +, 8*r9]
 mov     qword, ptr, [rcx], rax
 mov     qword, ptr, [rcx, +, 8], r8
 mov     qword, ptr, [rcx, +, 16], rdx
 mov     rax, rcx
 add     rsp, 56
 ret
.LBB0_6:
 mov     qword, ptr, [rsp, +, 32], rax
 mov     qword, ptr, [rsp, +, 40], r10
 mov     qword, ptr, [rsp, +, 48], r9
 lea     rcx, [rsp, +, 32]
 mov     edx, 3
 call    index_many::bound_check_failed
 ud2
```
</details>

# Extensions

There are multiple optional extensions to this.

## Indexing With Ranges

This could easily be expanded to allow indexing with `[I; N]` where `I: SliceIndex<Self>`.  I wanted to keep the initial implementation simple, so I didn't include it yet.

## Panicking Variant

We could also add this method:

```rust
impl<T> [T] {
    fn index_many_mut<const N: usize>(&mut self, indices: [usize; N]) -> [&mut T; N];
}
```

This would work similar to the regular index operator and panic with out-of-bound indices. The advantage would be that we could more easily ensure good codegen with a useful panic message, which is non-trivial with the `Option` variant.

This is implemented in the standalone implementation, and used as basis for the codegen examples here and there.

19 months agoAuto merge of #104696 - matthiaskrgr:rollup-gi1pdb0, r=matthiaskrgr
bors [Tue, 22 Nov 2022 01:35:57 +0000 (01:35 +0000)]
Auto merge of #104696 - matthiaskrgr:rollup-gi1pdb0, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #103396 (Pin::new_unchecked: discuss pinning closure captures)
 - #104416 (Fix using `include_bytes` in pattern position)
 - #104557 (Add a test case for async dyn* traits)
 - #104559 (Split `MacArgs` in two.)
 - #104597 (Probe + better error messsage for `need_migrate_deref_output_trait_object`)
 - #104656 (Move tests)
 - #104657 (Do not check transmute if has non region infer)
 - #104663 (rustdoc: factor out common button CSS)
 - #104666 (Migrate alias search result to CSS variables)
 - #104674 (Make negative_impl and negative_impl_exists take the right types)
 - #104692 (Update test's cfg-if dependency to 1.0)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoTouch up Box<T> one-liner
David Tolnay [Mon, 21 Nov 2022 23:28:41 +0000 (15:28 -0800)]
Touch up Box<T> one-liner

19 months agoRustc_deprecated attribute superseded by deprecated
David Tolnay [Mon, 21 Nov 2022 23:18:36 +0000 (15:18 -0800)]
Rustc_deprecated attribute superseded by deprecated

19 months agoBump ptr_to_from_bits deprecation to Rust 1.67
David Tolnay [Mon, 21 Nov 2022 23:10:59 +0000 (15:10 -0800)]
Bump ptr_to_from_bits deprecation to Rust 1.67

19 months agoRollup merge of #104692 - chbaker0:libtest-cfg-if, r=thomcc
Matthias Krüger [Mon, 21 Nov 2022 23:01:12 +0000 (00:01 +0100)]
Rollup merge of #104692 - chbaker0:libtest-cfg-if, r=thomcc

Update test's cfg-if dependency to 1.0

This change was mistakenly left out of #103367

Finishes #103365

19 months agoRollup merge of #104674 - spastorino:negative-impl-tcx, r=lcnr
Matthias Krüger [Mon, 21 Nov 2022 23:01:12 +0000 (00:01 +0100)]
Rollup merge of #104674 - spastorino:negative-impl-tcx, r=lcnr

Make negative_impl and negative_impl_exists take the right types

r? `@lcnr`

19 months agoRollup merge of #104666 - GuillaumeGomez:migrate-alias-search-result, r=notriddle
Matthias Krüger [Mon, 21 Nov 2022 23:01:11 +0000 (00:01 +0100)]
Rollup merge of #104666 - GuillaumeGomez:migrate-alias-search-result, r=notriddle

Migrate alias search result to CSS variables

r? `@notriddle`

19 months agoRollup merge of #104663 - notriddle:notriddle/button-cursor, r=GuillaumeGomez
Matthias Krüger [Mon, 21 Nov 2022 23:01:11 +0000 (00:01 +0100)]
Rollup merge of #104663 - notriddle:notriddle/button-cursor, r=GuillaumeGomez

rustdoc: factor out common button CSS

19 months agoRollup merge of #104657 - hi-rustin:rustin-patch-check-transmute, r=compiler-errors
Matthias Krüger [Mon, 21 Nov 2022 23:01:10 +0000 (00:01 +0100)]
Rollup merge of #104657 - hi-rustin:rustin-patch-check-transmute, r=compiler-errors

Do not check transmute if has non region infer

close https://github.com/rust-lang/rust/issues/104609

See: https://github.com/rust-lang/rust/issues/104609#issuecomment-1320956351

r? `@compiler-errors`

19 months agoRollup merge of #104656 - c410-f3r:moar-errors, r=petrochenkov
Matthias Krüger [Mon, 21 Nov 2022 23:01:10 +0000 (00:01 +0100)]
Rollup merge of #104656 - c410-f3r:moar-errors, r=petrochenkov

Move tests

r? `@petrochenkov`

19 months agoRollup merge of #104597 - compiler-errors:need_migrate_deref_output_trait_object...
Matthias Krüger [Mon, 21 Nov 2022 23:01:09 +0000 (00:01 +0100)]
Rollup merge of #104597 - compiler-errors:need_migrate_deref_output_trait_object-msg, r=eholk

Probe + better error messsage for `need_migrate_deref_output_trait_object`

1. Use `InferCtxt::probe` in `need_migrate_deref_output_trait_object` -- that normalization *could* technically do type inference as a side-effect, and this is a lint, so it should have no side-effects.
2. Return the trait-ref so we format the error message correctly. See the UI test change -- `(dyn A + 'static)` is not a trait.

19 months agoRollup merge of #104559 - nnethercote:split-MacArgs, r=petrochenkov
Matthias Krüger [Mon, 21 Nov 2022 23:01:09 +0000 (00:01 +0100)]
Rollup merge of #104559 - nnethercote:split-MacArgs, r=petrochenkov

Split `MacArgs` in two.

`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's used in two ways:
- For representing attribute macro arguments (e.g. in `AttrItem`), where all three variants are used.
- For representing function-like macros (e.g. in `MacCall` and `MacroDef`), where only the `Delimited` variant is used.

In other words, `MacArgs` is used in two quite different places due to them having partial overlap. I find this makes the code hard to read. It also leads to various unreachable code paths, and allows invalid values (such as accidentally using `MacArgs::Empty` in a `MacCall`).

This commit splits `MacArgs` in two:
- `DelimArgs` is a new struct just for the "delimited arguments" case. It is now used in `MacCall` and `MacroDef`.
- `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro case. Its `Delimited` variant now contains a `DelimArgs`.

Various other related things are renamed as well.

These changes make the code clearer, avoids several unreachable paths, and disallows the invalid values.

r? `@petrochenkov`

19 months agoRollup merge of #104557 - eholk:dyn-star-in-traits, r=compiler-errors
Matthias Krüger [Mon, 21 Nov 2022 23:01:08 +0000 (00:01 +0100)]
Rollup merge of #104557 - eholk:dyn-star-in-traits, r=compiler-errors

Add a test case for async dyn* traits

This adds a test case that approximates async functions in dyn traits using `dyn*`. The purpose is to have an example of where we are with `dyn*` and the goal of using it for dyn traits.

Issue #102425

r? `@compiler-errors`

19 months agoRollup merge of #104416 - clubby789:fix-104414, r=eholk
Matthias Krüger [Mon, 21 Nov 2022 23:01:07 +0000 (00:01 +0100)]
Rollup merge of #104416 - clubby789:fix-104414, r=eholk

Fix using `include_bytes` in pattern position

Fix #104414

19 months agoRollup merge of #103396 - RalfJung:pinning-closure-captures, r=dtolnay
Matthias Krüger [Mon, 21 Nov 2022 23:01:06 +0000 (00:01 +0100)]
Rollup merge of #103396 - RalfJung:pinning-closure-captures, r=dtolnay

Pin::new_unchecked: discuss pinning closure captures

Regardless of how the discussion in https://github.com/rust-lang/rust/pull/102737 turns out, pinning closure captures is super subtle business and probably worth discussing separately.

19 months agoSplit `MacArgs` in two.
Nicholas Nethercote [Fri, 18 Nov 2022 00:24:21 +0000 (11:24 +1100)]
Split `MacArgs` in two.

`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's
used in two ways:
- For representing attribute macro arguments (e.g. in `AttrItem`), where all
  three variants are used.
- For representing function-like macros (e.g. in `MacCall` and `MacroDef`),
  where only the `Delimited` variant is used.

In other words, `MacArgs` is used in two quite different places due to them
having partial overlap. I find this makes the code hard to read. It also leads
to various unreachable code paths, and allows invalid values (such as
accidentally using `MacArgs::Empty` in a `MacCall`).

This commit splits `MacArgs` in two:
- `DelimArgs` is a new struct just for the "delimited arguments" case. It is
  now used in `MacCall` and `MacroDef`.
- `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro
  case. Its `Delimited` variant now contains a `DelimArgs`.

Various other related things are renamed as well.

These changes make the code clearer, avoids several unreachable paths, and
disallows the invalid values.

19 months agoAuto merge of #104533 - oli-obk:method_callee, r=lcnr
bors [Mon, 21 Nov 2022 21:51:00 +0000 (21:51 +0000)]
Auto merge of #104533 - oli-obk:method_callee, r=lcnr

Clean up and harden various methods around trait substs

r? `@lcnr`

19 months agoUpdate test's cfg-if dependency to 1.0
Collin Baker [Mon, 21 Nov 2022 21:43:34 +0000 (16:43 -0500)]
Update test's cfg-if dependency to 1.0

This change was mistakenly left out of #103367

19 months agomerge self type and substs in `trait_method`
Oli Scherer [Mon, 21 Nov 2022 15:59:15 +0000 (15:59 +0000)]
merge self type and substs in `trait_method`

19 months agoSimplify one more `TraitRef::new` site
Oli Scherer [Mon, 21 Nov 2022 15:55:37 +0000 (15:55 +0000)]
Simplify one more `TraitRef::new` site

19 months agoSimplify test
Oli Scherer [Mon, 21 Nov 2022 15:52:18 +0000 (16:52 +0100)]
Simplify test

Co-authored-by: lcnr <rust@lcnr.de>
19 months agoUse `as_closure` helper method
Oli Scherer [Mon, 21 Nov 2022 15:52:01 +0000 (16:52 +0100)]
Use `as_closure` helper method

Co-authored-by: lcnr <rust@lcnr.de>
19 months agoStop passing the self-type as a separate argument.
Oli Scherer [Mon, 21 Nov 2022 12:24:53 +0000 (12:24 +0000)]
Stop passing the self-type as a separate argument.

19 months agoFix clippy's missing substs
Oli Scherer [Fri, 18 Nov 2022 19:58:07 +0000 (19:58 +0000)]
Fix clippy's missing substs

19 months agoRemove some unnecessary slicing
Oli Scherer [Thu, 17 Nov 2022 16:05:41 +0000 (16:05 +0000)]
Remove some unnecessary slicing

19 months agoRemove a redundant assert
Oli Scherer [Thu, 17 Nov 2022 15:39:11 +0000 (15:39 +0000)]
Remove a redundant assert

19 months agoFix an ICE that I just made worse
Oli Scherer [Thu, 17 Nov 2022 15:30:42 +0000 (15:30 +0000)]
Fix an ICE that I just made worse

19 months agoFor lcnr
Oli Scherer [Thu, 17 Nov 2022 15:23:07 +0000 (15:23 +0000)]
For lcnr

19 months agoAdd helper to create the trait ref for a lang item
Oli Scherer [Thu, 17 Nov 2022 14:39:19 +0000 (14:39 +0000)]
Add helper to create the trait ref for a lang item

19 months agoSome cleanup around trait_method lookup
Oli Scherer [Thu, 17 Nov 2022 13:28:32 +0000 (13:28 +0000)]
Some cleanup around trait_method lookup

19 months agoUse iterators instead of slices at more sites
Oli Scherer [Thu, 17 Nov 2022 13:06:37 +0000 (13:06 +0000)]
Use iterators instead of slices at more sites

19 months agoAllow iterators instead of requiring slices that will get turned into iterators
Oli Scherer [Thu, 17 Nov 2022 13:00:35 +0000 (13:00 +0000)]
Allow iterators instead of requiring slices that will get turned into iterators

19 months agoRemove an unnecessary query + subst round
Oli Scherer [Thu, 17 Nov 2022 12:07:31 +0000 (12:07 +0000)]
Remove an unnecessary query + subst round

19 months agoAdd a helper for replacing the self type in trait refs
Oli Scherer [Thu, 17 Nov 2022 11:55:27 +0000 (11:55 +0000)]
Add a helper for replacing the self type in trait refs

19 months agoAssert that various types have the right amount of generic args and fix the sites...
Oli Scherer [Thu, 17 Nov 2022 11:21:39 +0000 (11:21 +0000)]
Assert that various types have the right amount of generic args and fix the sites that used the wrong amount

19 months agoSplit out the actual predicate solving code into a separate function
Oli Scherer [Thu, 17 Nov 2022 10:36:18 +0000 (10:36 +0000)]
Split out the actual predicate solving code into a separate function

19 months agoUse ty::List instead of InternalSubsts
Oli Scherer [Thu, 17 Nov 2022 10:24:55 +0000 (10:24 +0000)]
Use ty::List instead of InternalSubsts

19 months agoCheck that type_implements_trait actually is passed the right amount of generic params
Oli Scherer [Thu, 17 Nov 2022 10:22:44 +0000 (10:22 +0000)]
Check that type_implements_trait actually is passed the right amount of generic params

19 months agoReduce the amount of passed-around arguments that will get merged into one later...
Oli Scherer [Thu, 17 Nov 2022 09:03:27 +0000 (09:03 +0000)]
Reduce the amount of passed-around arguments that will get merged into one later anyway

19 months agoAuto merge of #104120 - mejrs:diag, r=davidtwco
bors [Mon, 21 Nov 2022 18:36:26 +0000 (18:36 +0000)]
Auto merge of #104120 - mejrs:diag, r=davidtwco

Match and enforce crate and slug names

Some of these were in the wrong place or had a name that didn't match.

19 months agoCoercions work now
Eric Holk [Mon, 21 Nov 2022 18:20:12 +0000 (10:20 -0800)]
Coercions work now

19 months agoAdd a test case for async dyn* traits
Eric Holk [Fri, 18 Nov 2022 00:03:55 +0000 (16:03 -0800)]
Add a test case for async dyn* traits

19 months agorustdoc: add test case for pointer cursor
Michael Howell [Mon, 21 Nov 2022 16:16:54 +0000 (09:16 -0700)]
rustdoc: add test case for pointer cursor

19 months agoAuto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
bors [Mon, 21 Nov 2022 15:22:54 +0000 (15:22 +0000)]
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #104420 (Fix doc example for `wrapping_abs`)
 - #104499 (rustdoc JSON: Use `Function` everywhere and remove `Method`)
 - #104500 (`rustc_ast`: remove `ref` patterns)
 - #104511 (Mark functions created for `raw-dylib` on x86 with DllImport storage class)
 - #104595 (Add `PolyExistentialPredicate` type alias)
 - #104605 (deduplicate constant evaluation in cranelift backend)
 - #104628 (Revert "Update CI to use Android NDK r25b")
 - #104662 (Streamline deriving on packed structs.)
 - #104667 (Revert formatting changes of a test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agonegative_impl_exists should take an InferCtxt
Santiago Pastorino [Mon, 21 Nov 2022 14:26:23 +0000 (11:26 -0300)]
negative_impl_exists should take an InferCtxt

19 months agoFix make test
mejrs [Sun, 13 Nov 2022 14:51:05 +0000 (15:51 +0100)]
Fix make test

19 months agoImprove slug name error
mejrs [Sun, 13 Nov 2022 12:10:36 +0000 (13:10 +0100)]
Improve slug name error

19 months agoFix tests
mejrs [Mon, 7 Nov 2022 23:42:00 +0000 (00:42 +0100)]
Fix tests

19 months agoMatch crate and slug names
mejrs [Mon, 7 Nov 2022 18:47:32 +0000 (19:47 +0100)]
Match crate and slug names

19 months agonegative_impl should take a TyCtxt
Santiago Pastorino [Mon, 21 Nov 2022 14:04:55 +0000 (11:04 -0300)]
negative_impl should take a TyCtxt

19 months agoRollup merge of #104667 - WaffleLapkin:unfmttest, r=Dylan-DPC
Matthias Krüger [Mon, 21 Nov 2022 13:11:13 +0000 (14:11 +0100)]
Rollup merge of #104667 - WaffleLapkin:unfmttest, r=Dylan-DPC

Revert formatting changes of a test

See https://github.com/rust-lang/rust/pull/99935/files#r1027259119
cc ``@CAD97``

19 months agoRollup merge of #104662 - nnethercote:tweak-deriving-for-packed-non-copy, r=jackh726
Matthias Krüger [Mon, 21 Nov 2022 13:11:13 +0000 (14:11 +0100)]
Rollup merge of #104662 - nnethercote:tweak-deriving-for-packed-non-copy, r=jackh726

Streamline deriving on packed structs.

The current approach to field accesses in derived code:
- Normal case: `&self.0`
- In a packed struct that derives `Copy`: `&{self.0}`
- In a packed struct that doesn't derive `Copy`: `let Self(ref x) = *self`

The `let` pattern used in the third case is equivalent to the simpler field access in the first case. This commit changes the third case to use a field access.

The commit also combines two boolean arguments (`is_packed` and `always_copy`) into a single field (`copy_fields`) earlier, to save passing both around.

r? ``@jackh726``

19 months agoRollup merge of #104628 - alex-pinkus:revert-android-ndk-upgrade, r=pietroalbini
Matthias Krüger [Mon, 21 Nov 2022 13:11:12 +0000 (14:11 +0100)]
Rollup merge of #104628 - alex-pinkus:revert-android-ndk-upgrade, r=pietroalbini

Revert "Update CI to use Android NDK r25b"

This reverts commit bf7f1ca316a249cf99d722d79a0db12fef687142 (pull request #102332).

The relevant discussion can be found in #103673, where it was agreed that more time is needed to warn the community of the upcoming breakage.

This PR is for the `master` branch, where a conflict was recently introduced due to 6d8160261ff3aee3b6eaacc37ac96cafff530980. The conflict is in `cc_detect.rs`, where the code that corrects the target triple was moved to a new function called `ndk_compiler()`. This puts the old logic in the `ndk_compiler` function, and assumes that it works properly in the other location where that code is being called. I would appreciate review from ``@pietroalbini`` to understand how we can test that the reverted logic is also suitable for the additional use case (seems to be related to setting `cc` and `cxx`). I've confirmed already that with these changes I can compile for `armv7-linux-androideabi`, `aarch64-linux-android`, `i686-linux-android`, and `x86_64-linux-android` using `x.py`.

A separate revert for the `beta` branch will be required, since the original change has already made it to beta. The beta revert is available at https://github.com/alex-pinkus/rust/commit/3fa0d94674fbe37090ebe44ac1f06e2233f3121e, but I'm not sure of the process for staging that PR.

19 months agoRollup merge of #104605 - RalfJung:clf_consts, r=bjorn3
Matthias Krüger [Mon, 21 Nov 2022 13:11:12 +0000 (14:11 +0100)]
Rollup merge of #104605 - RalfJung:clf_consts, r=bjorn3

deduplicate constant evaluation in cranelift backend

The cranelift backend had two matches on `ConstantKind`, which can be avoided, and used this `eval_for_mir` that nothing else uses... this makes things more consistent with the (better-tested) LLVM backend.

I noticed this because cranelift was the only user of `eval_for_mir`. However `try_eval_for_mir` still has one other user in `eval`... the odd thing is that the interpreter has its own `eval_mir_constant` which seems to duplicate the same functionality and does not use `try_eval_for_mir`. No idea what is happening here.

r? ``@bjorn3``
Cc ``@lcnr``

19 months agoRollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnr
Matthias Krüger [Mon, 21 Nov 2022 13:11:11 +0000 (14:11 +0100)]
Rollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnr

Add `PolyExistentialPredicate` type alias

Wrapping `ExistentialPredicate`s in a binder is very common, and this alias already exists for the `PolyExistential{TraitRef,Projection}` types.

19 months agoRollup merge of #104511 - dpaoliello:privateglobalworkaround, r=michaelwoerister
Matthias Krüger [Mon, 21 Nov 2022 13:11:10 +0000 (14:11 +0100)]
Rollup merge of #104511 - dpaoliello:privateglobalworkaround, r=michaelwoerister

Mark functions created for `raw-dylib` on x86 with DllImport storage class

Fix for #104453

## Issue Details
On x86 Windows, LLVM uses 'L' as the prefix for any private global symbols (`PrivateGlobalPrefix`), so when the `raw-dylib` feature creates an undecorated function symbol that begins with an 'L' LLVM misinterprets that as a private global symbol that it created and so fails the compilation at a later stage since such a symbol must have a definition.

## Fix Details
Mark the function we are creating for `raw-dylib` with `DllImport` storage class (this was already being done for MSVC at a later point for `callee::get_fn` but not for GNU (due to "backwards compatibility")): this will cause LLVM to prefix the name with `__imp_` and so it won't mistake it for a private global symbol.

19 months agoRollup merge of #104500 - WaffleLapkin:deref-the-compiler, r=wesleywiser
Matthias Krüger [Mon, 21 Nov 2022 13:11:10 +0000 (14:11 +0100)]
Rollup merge of #104500 - WaffleLapkin:deref-the-compiler, r=wesleywiser

`rustc_ast`: remove `ref` patterns

Or in other words use match ergonomics in `rustc_ast`. I do plan to do the same with other crates, but to keep the diff sane, let's do them one at a time.

19 months agoRollup merge of #104499 - Enselic:no-method-in-rustdoc-json, r=GuillaumeGomez
Matthias Krüger [Mon, 21 Nov 2022 13:11:09 +0000 (14:11 +0100)]
Rollup merge of #104499 - Enselic:no-method-in-rustdoc-json, r=GuillaumeGomez

rustdoc JSON: Use `Function` everywhere and remove `Method`

Closes #100259

19 months agoRollup merge of #104420 - TethysSvensson:master, r=JohnTitor
Matthias Krüger [Mon, 21 Nov 2022 13:11:09 +0000 (14:11 +0100)]
Rollup merge of #104420 - TethysSvensson:master, r=JohnTitor

Fix doc example for `wrapping_abs`

The `max` variable is unused. This change introduces the `min_plus` variable, to make the example similar to the one from `saturating_abs`. An alternative would be to remove the unused variable.

19 months agoAuto merge of #103491 - cjgillot:self-rpit, r=oli-obk
bors [Mon, 21 Nov 2022 12:17:03 +0000 (12:17 +0000)]
Auto merge of #103491 - cjgillot:self-rpit, r=oli-obk

Support using `Self` or projections inside an RPIT/async fn

I reuse the same idea as https://github.com/rust-lang/rust/pull/103449 to use variances to encode whether a lifetime parameter is captured by impl-trait.

The current implementation of async and RPIT replace all lifetimes from the parent generics by `'static`.  This PR changes the scheme
```rust
impl<'a> Foo<'a> {
    fn foo<'b, T>() -> impl Into<Self> + 'b { ... }
}

opaque Foo::<'_a>::foo::<'_b, T>::opaque<'b>: Into<Foo<'_a>> + 'b;
impl<'a> Foo<'a> {
    // OLD
    fn foo<'b, T>() -> Foo::<'static>::foo::<'static, T>::opaque::<'b> { ... }
                             ^^^^^^^ the `Self` becomes `Foo<'static>`

    // NEW
    fn foo<'b, T>() -> Foo::<'a>::foo::<'b, T>::opaque::<'b> { ... }
                             ^^ the `Self` stays `Foo<'a>`
}
```

There is the same issue with projections. In the example, substitute `Self` by `<T as Trait<'b>>::Assoc` in the sugared version, and `Foo<'_a>` by `<T as Trait<'_b>>::Assoc` in the desugared one.

This allows to support `Self` in impl-trait, since we do not replace lifetimes by `'static` any more.  The same trick allows to use projections like `T::Assoc` where `Self` is allowed.  The feature is gated behind a `impl_trait_projections` feature gate.

The implementation relies on 2 tweaking rules for opaques in 2 places:
- we only relate substs that correspond to captured lifetimes during TypeRelation;
- we only list captured lifetimes in choice region computation.

For simplicity, I encoded the "capturedness" of lifetimes as a variance, `Bivariant` vs `Invariant` for unused vs captured lifetimes. The `variances_of` query used to ICE for opaques.

Impl-trait that do not reference `Self` or projections will have their variances as:
- `o` (invariant) for each parent type or const;
- `*` (bivariant) for each parent lifetime --> will not participate in borrowck;
- `o` (invariant) for each own lifetime.

Impl-trait that does reference `Self` and/or projections will have some parent lifetimes marked as `o` (as the example above), and participate in type relation and borrowck.  In the example above, `variances_of(opaque) = ['_a: o, '_b: *, T: o, 'b: o]`.

r? types
cc `@compiler-errors` , as you asked about the issue with `Self` and projections.

19 months agoAdd delay span bug
hi-rustin [Mon, 21 Nov 2022 12:03:28 +0000 (20:03 +0800)]
Add delay span bug

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
19 months agoRevert formatting changes of a test
Maybe Waffle [Mon, 21 Nov 2022 10:23:53 +0000 (10:23 +0000)]
Revert formatting changes of a test

19 months agoExtend GUI test for alias search result
Guillaume Gomez [Mon, 21 Nov 2022 10:15:54 +0000 (11:15 +0100)]
Extend GUI test for alias search result

19 months agoMigrate search result alias to CSS variables
Guillaume Gomez [Mon, 21 Nov 2022 10:15:41 +0000 (11:15 +0100)]
Migrate search result alias to CSS variables

19 months agoRemove `ref` patterns from `rustc_ast`
Maybe Waffle [Wed, 16 Nov 2022 19:26:38 +0000 (19:26 +0000)]
Remove `ref` patterns from `rustc_ast`

Also use if let chains in one case.

19 months agorustdoc: factor out common button CSS
Michael Howell [Mon, 21 Nov 2022 04:48:57 +0000 (21:48 -0700)]
rustdoc: factor out common button CSS

19 months agoAuto merge of #103454 - camsteffen:remove-conservatively-uninhabited, r=oli-obk
bors [Mon, 21 Nov 2022 04:42:43 +0000 (04:42 +0000)]
Auto merge of #103454 - camsteffen:remove-conservatively-uninhabited, r=oli-obk

Factor out `conservative_is_privately_uninhabited`

After #102660 there is no more need for `conservative_is_privately_uninhabited`.

r? `@oli-obk`

19 months agoStreamline deriving on packed structs.
Nicholas Nethercote [Mon, 21 Nov 2022 00:48:25 +0000 (11:48 +1100)]
Streamline deriving on packed structs.

The current approach to field accesses in derived code:
- Normal case: `&self.0`
- In a packed struct that derives `Copy`: `&{self.0}`
- In a packed struct that doesn't derive `Copy`: `let Self(ref x) = *self`

The `let` pattern used in the third case is equivalent to the simpler
field access in the first case. This commit changes the third case to
use a field access.

The commit also combines two boolean arguments (`is_packed` and
`always_copy`) into a single field (`copy_fields`) earlier, to save
passing both around.

19 months agoAuto merge of #102717 - beetrees:repr128-c-style-debuginfo, r=nagisa
bors [Mon, 21 Nov 2022 01:44:12 +0000 (01:44 +0000)]
Auto merge of #102717 - beetrees:repr128-c-style-debuginfo, r=nagisa

Pass 128-bit C-style enum enumerator values to LLVM

Pass the full 128 bits of C-style enum enumerators through to LLVM. This means that debuginfo for C-style repr128 enums is now emitted correctly for DWARF platforms (as compared to not being correctly emitted on any platform).

Tracking issue: #56071

19 months agoFactor out conservative_is_privately_uninhabited
Cameron Steffen [Sun, 23 Oct 2022 22:32:40 +0000 (17:32 -0500)]
Factor out conservative_is_privately_uninhabited

19 months agoChange to Ty::is_inhabited_from
Cameron Steffen [Sun, 23 Oct 2022 22:32:17 +0000 (17:32 -0500)]
Change to Ty::is_inhabited_from

19 months agoFix typo
Cameron Steffen [Sun, 23 Oct 2022 23:19:06 +0000 (18:19 -0500)]
Fix typo

19 months agoDo not check transmute if has non region infer
hi-rustin [Mon, 21 Nov 2022 01:03:33 +0000 (09:03 +0800)]
Do not check transmute if has non region infer

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
19 months agoMove tests
Caio [Sun, 20 Nov 2022 23:08:14 +0000 (20:08 -0300)]
Move tests

19 months agoAuto merge of #104655 - matthiaskrgr:rollup-r5kfffy, r=matthiaskrgr
bors [Sun, 20 Nov 2022 23:03:20 +0000 (23:03 +0000)]
Auto merge of #104655 - matthiaskrgr:rollup-r5kfffy, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #101310 (Clarify and restrict when `{Arc,Rc}::get_unchecked_mut` is allowed.)
 - #104461 (Fix building of `aarch64-pc-windows-gnullvm`)
 - #104487 (update ntapi dep to remove future-incompat warning)
 - #104504 (Add a detailed note for missing comma typo w/ FRU syntax)
 - #104581 (rustdoc: remove unused JS IIFE from main.js)
 - #104632 (avoid non-strict-provenance casts in libcore tests)
 - #104634 (move core::arch into separate file)
 - #104641 (replace unusual grammar)
 - #104643 (add examples to chunks remainder methods. )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoRollup merge of #104643 - pnkfelix:examples-for-chunks-remainder, r=scottmcm
Matthias Krüger [Sun, 20 Nov 2022 22:50:30 +0000 (23:50 +0100)]
Rollup merge of #104643 - pnkfelix:examples-for-chunks-remainder, r=scottmcm

add examples to chunks remainder methods.

add examples to chunks remainder methods.

my motivation for adding the examples was to make it very clear that the state of the iterator (in terms of where its cursor lies) has no effect on what remainder returns.

Also fixed some links to rchunk remainder methods.

19 months agoRollup merge of #104641 - tshepang:grammar, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:29 +0000 (23:50 +0100)]
Rollup merge of #104641 - tshepang:grammar, r=Mark-Simulacrum

replace unusual grammar

19 months agoRollup merge of #104634 - RalfJung:core-arch, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:29 +0000 (23:50 +0100)]
Rollup merge of #104634 - RalfJung:core-arch, r=Mark-Simulacrum

move core::arch into separate file

This works around https://github.com/rust-lang/rust/issues/104633 which otherwise leads to warnings in miri-test-libstd.

19 months agoRollup merge of #104632 - RalfJung:core-test-strict-provenance, r=thomcc
Matthias Krüger [Sun, 20 Nov 2022 22:50:28 +0000 (23:50 +0100)]
Rollup merge of #104632 - RalfJung:core-test-strict-provenance, r=thomcc

avoid non-strict-provenance casts in libcore tests

r? `@thomcc`

19 months agoRollup merge of #104581 - notriddle:notriddle/js-iife-2, r=GuillaumeGomez
Matthias Krüger [Sun, 20 Nov 2022 22:50:28 +0000 (23:50 +0100)]
Rollup merge of #104581 - notriddle:notriddle/js-iife-2, r=GuillaumeGomez

rustdoc: remove unused JS IIFE from main.js

This [IIFE] made sense when it was added in deaf5e200e79a75ac57d3f0952f6758a38168e52 and there was a local variable scoped to it, but now it calls a function, but declares nothing.

[IIFE]: https://developer.mozilla.org/en-US/docs/Glossary/IIFE "immediately invoked function expression"

19 months agoRollup merge of #104504 - compiler-errors:fru-syntax-note, r=estebank
Matthias Krüger [Sun, 20 Nov 2022 22:50:27 +0000 (23:50 +0100)]
Rollup merge of #104504 - compiler-errors:fru-syntax-note, r=estebank

Add a detailed note for missing comma typo w/ FRU syntax

Thanks to `@pierwill` for working on this with me!

Fixes #104373, perhaps `@alice-i-cecile` can comment on the new error for the example provided on that issue -- feedback is welcome.

```
error[E0063]: missing field `defaulted` in initializer of `Outer`
  --> $DIR/multi-line-fru-suggestion.rs:14:5
   |
LL |     Outer {
   |     ^^^^^ missing `defaulted`
   |
note: this expression may have been misinterpreted as a `..` range expression
  --> $DIR/multi-line-fru-suggestion.rs:16:16
   |
LL |           inner: Inner {
   |  ________________^
LL | |             a: 1,
LL | |             b: 2,
LL | |         }
   | |_________^ this expression does not end in a comma...
LL |           ..Default::default()
   |           ^^^^^^^^^^^^^^^^^^^^ ... so this is interpreted as a `..` range expression, instead of functional record update syntax
help: to set the remaining fields from `Default::default()`, separate the last named field with a comma
   |
LL |         },
   |          +

error: aborting due to previous error

For more information about this error, try `rustc --explain E0063`.
```

19 months agoRollup merge of #104487 - klensy:ntapi, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:27 +0000 (23:50 +0100)]
Rollup merge of #104487 - klensy:ntapi, r=Mark-Simulacrum

update ntapi dep to remove future-incompat warning

This fixes warning https://github.com/rust-lang-ci/rust/actions/runs/3477235400/jobs/5813202075#step:25:217
`warning: the following packages contain code that will be rejected by a future version of Rust: ntapi v0.3.7`

by upgrading `sysinfo` version (https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md#0267)

There was some breaking changes in `sysinfo`:
* 0.25.0 (System::refresh_cpu behaviour changed: it only computes CPU usage and doesn't retrieve CPU frequency.) not affected?
* 0.26.0 (Switch memory unit from kilobytes to bytes) fixed.

19 months agoRollup merge of #104461 - mati865:gnullvm-aarch64-fixup, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:26 +0000 (23:50 +0100)]
Rollup merge of #104461 - mati865:gnullvm-aarch64-fixup, r=Mark-Simulacrum

Fix building of `aarch64-pc-windows-gnullvm`

That change had been lost during rebase of my last PR (https://github.com/rust-lang/rust/pull/103894).

19 months agoRollup merge of #101310 - zachs18:rc_get_unchecked_mut_docs_soundness, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:26 +0000 (23:50 +0100)]
Rollup merge of #101310 - zachs18:rc_get_unchecked_mut_docs_soundness, r=Mark-Simulacrum

Clarify and restrict when `{Arc,Rc}::get_unchecked_mut` is allowed.

(Tracking issue for `{Arc,Rc}::get_unchecked_mut`: #63292)

(I'm using `Rc` in this comment, but it applies for `Arc` all the same).

As currently documented, `Rc::get_unchecked_mut` can lead to unsoundness when multiple `Rc`/`Weak` pointers to the same allocation exist. The current documentation only requires that other `Rc`/`Weak` pointers to the same allocation "must not be dereferenced for the duration of the returned borrow". This can lead to unsoundness in (at least) two ways: variance, and `Rc<str>`/`Rc<[u8]>` aliasing. ([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d7e2d091c389f463d121630ab0a37320)).

This PR changes the documentation of `Rc::get_unchecked_mut` to restrict usage to when all `Rc<T>`/`Weak<T>` have the exact same `T` (including lifetimes). I believe this is sufficient to prevent unsoundness, while still allowing `get_unchecked_mut` to be called on an aliased `Rc` as long as the safety contract is upheld by the caller.

## Alternatives

* A less strict, but still sound alternative would be to say that the caller must only write values which are valid for all aliased `Rc`/`Weak` inner types. (This was [mentioned](https://github.com/rust-lang/rust/issues/63292#issuecomment-568284090) in the tracking issue). This may be too complicated to clearly express in the documentation.
* A more strict alternative would be to say that there must not be any aliased `Rc`/`Weak` pointers, i.e. it is required that get_mut would return `Some(_)`. (This was also mentioned in the tracking issue). There is at least one codebase that this would cause to become unsound ([here](https://github.com/kaimast/lsm-rs/blob/be5a164d770d850d905e510e2966ad4b1cc9aa5e/src/memtable.rs#L166), where additional locking is used to ensure unique access to an aliased `Rc<T>`;  I saw this because it was linked on the tracking issue).

19 months agoOnly one feature gate needed
Rune Tynan [Sun, 20 Nov 2022 22:10:47 +0000 (17:10 -0500)]
Only one feature gate needed

19 months agoUse ? instead of match
Rune Tynan [Sun, 13 Nov 2022 16:13:32 +0000 (11:13 -0500)]
Use ? instead of match

19 months agoFix issue number
Rune Tynan [Sun, 13 Nov 2022 01:48:32 +0000 (20:48 -0500)]
Fix issue number

19 months agoAdd derive_const feature
Rune Tynan [Sun, 13 Nov 2022 01:09:42 +0000 (20:09 -0500)]
Add derive_const feature

19 months agoUpdate with derive_const
Rune Tynan [Sat, 12 Nov 2022 19:21:18 +0000 (14:21 -0500)]
Update with derive_const

19 months agoAdd stability for alignment
Rune Tynan [Mon, 17 Oct 2022 16:27:27 +0000 (12:27 -0400)]
Add stability for alignment

19 months agoconstify remaining layout methods
Rune Tynan [Fri, 23 Sep 2022 19:14:34 +0000 (15:14 -0400)]
constify remaining layout methods

Remove bad impl for Eq

Update Cargo.lock and fix last ValidAlign

19 months agoAuto merge of #104646 - matthiaskrgr:rollup-7xnhzf0, r=matthiaskrgr
bors [Sun, 20 Nov 2022 19:14:14 +0000 (19:14 +0000)]
Auto merge of #104646 - matthiaskrgr:rollup-7xnhzf0, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #104537 (fix std::thread docs are unclear regarding stack sizes)
 - #104558 (Don't assume `FILE_ID_BOTH_DIR_INFO` will be aligned)
 - #104564 (interpret: use Either over Result when it is not representing an error condition)
 - #104568 (clarify that realloc refreshes pointer provenance even when the allocation remains in-place)
 - #104611 (rustdoc: use real buttons for scrape examples controls)
 - #104640 (Migrate kdb style to CSS variables)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoRollup merge of #104640 - GuillaumeGomez:migrate-kdb-css, r=notriddle
Matthias Krüger [Sun, 20 Nov 2022 17:21:49 +0000 (18:21 +0100)]
Rollup merge of #104640 - GuillaumeGomez:migrate-kdb-css, r=notriddle

Migrate kdb style to CSS variables

r? `@notriddle`

19 months agoRollup merge of #104611 - notriddle:notriddle/scrape-examples-button, r=GuillaumeGomez
Matthias Krüger [Sun, 20 Nov 2022 17:21:49 +0000 (18:21 +0100)]
Rollup merge of #104611 - notriddle:notriddle/scrape-examples-button, r=GuillaumeGomez

rustdoc: use real buttons for scrape examples controls

This makes the expand and switch controls keyboard-accessible.

Preview: https://notriddle.com/notriddle-rustdoc-demos/scrape-examples-button/test_dingus/fn.test.html

19 months agoRollup merge of #104568 - RalfJung:realloc, r=Amanieu
Matthias Krüger [Sun, 20 Nov 2022 17:21:48 +0000 (18:21 +0100)]
Rollup merge of #104568 - RalfJung:realloc, r=Amanieu

clarify that realloc refreshes pointer provenance even when the allocation remains in-place

This [matches what C does](https://en.cppreference.com/w/c/memory/realloc):

> The original pointer ptr is invalidated and any access to it is undefined behavior (even if reallocation was in-place).

Cc `@rust-lang/wg-allocators`

19 months agoRollup merge of #104564 - RalfJung:either, r=oli-obk
Matthias Krüger [Sun, 20 Nov 2022 17:21:48 +0000 (18:21 +0100)]
Rollup merge of #104564 - RalfJung:either, r=oli-obk

interpret: use Either over Result when it is not representing an error condition

r? `@oli-obk`