Commit graph

245579 commits

Author SHA1 Message Date
bors 42752cbe09 Auto merge of #117206 - cjgillot:jump-threading-default, r=tmiasko
Enable MIR JumpThreading by default

Mostly for perf

r? `@ghost`
2024-02-10 22:15:18 +00:00
bors 6cc4843512 Auto merge of #119614 - RalfJung:const-refs-to-static, r=oli-obk
unstably allow constants to refer to statics and read from immutable statics

I am not aware of any fundamental reason why we cannot allow constants to mention statics. What we really need is that constants do not *read from* statics that can change their value:
- This would break the principle that "constants behave as-if their expression was inlined everywhere and executed at runtime". This is enforced by halting const-eval interpretation when a read from a mutable global occurs.
- When building a valtree we want to be sure that the constant and everything it refers to is truly immutable. This is enforced by aborting valtree construction when a read from a mutable global occurs.

r? `@oli-obk` -- if you are okay with experimenting with this feature, I will create a tracking issue.
Based on and blocked on https://github.com/rust-lang/rust/pull/119044; only the last commit is new.
2024-02-10 15:52:24 +00:00
Ralf Jung 4def37386c manually bless an aarch64 test 2024-02-10 16:13:48 +01:00
Ralf Jung 04bc624ea0 rebless after rebase 2024-02-10 16:13:48 +01:00
Ralf Jung 77f8c3caea detect consts that reference extern statics 2024-02-10 16:13:48 +01:00
Ralf Jung 9c0623fe8f validation: descend from consts into statics 2024-02-10 16:13:47 +01:00
Ralf Jung 4e77e368eb unstably allow constants to refer to statics and read from immutable statics 2024-02-10 16:12:55 +01:00
bors 5f40394baa Auto merge of #120877 - matthiaskrgr:rollup-j1b8mv6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #117614 (static mut: allow mutable reference to arbitrary types, not just slices and arrays)
 - #120719 (Remove support for `associated_type_bound` nested in `dyn` types)
 - #120764 (Add documentation on `str::starts_with`)
 - #120823 (Clarify that atomic and regular integers can differ in alignment)
 - #120859 (Loosen an assertion to account for stashed errors.)
 - #120865 (Turn the "no saved object file in work product" ICE into a translatable fatal error)
 - #120866 (Remove unnecessary `#![feature(min_specialization)]`)
 - #120870 (Allow restricted trait impls under `#[allow_internal_unstable(min_specialization)]`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-10 12:28:39 +00:00
Matthias Krüger 55913368c5
Rollup merge of #120870 - Zalathar:allow-min-spec, r=oli-obk
Allow restricted trait impls under `#[allow_internal_unstable(min_specialization)]`

This is a follow-up to #119963 and a companion to #120866, though it can land independently from the latter.

---

We have several compiler crates that only enable `#[feature(min_specialization)]` because it is required by their expansions of `newtype_index!`, in order to implement traits marked with `#[rustc_specialization_trait]`.

This PR allows those traits to be implemented internally by macros with `#[allow_internal_unstable(min_specialization)]`, without needing specialization to be enabled in the enclosing crate.
2024-02-10 13:12:31 +01:00
Matthias Krüger ed3b049a8b
Rollup merge of #120866 - Zalathar:no-min-spec, r=compiler-errors
Remove unnecessary `#![feature(min_specialization)]`

As of #119963 and #120676, we can now rely on `newtype_index!` having `#[allow_internal_unstable(min_specialization)]`, so there are a few compiler crates that no longer need to include min-spec in their own crate features.

---

Some of the expansions of `newtype_index!` still appear to require min-spec in the crate features. I think this is because `#[orderable]` causes the expansion to include an implementation of `TrustedStep`, which is flagged with `#[rustc_specialization_trait]`, and for whatever reason that isn't permitted by allow-internal-unstable. So this PR only touches the crates where that isn't the case.
2024-02-10 13:12:31 +01:00
Matthias Krüger 9a8958f2bb
Rollup merge of #120865 - saethlin:missing-o-files, r=nnethercote
Turn the "no saved object file in work product" ICE into a translatable fatal error

I don't know if it's fair to say this fixes https://github.com/rust-lang/rust/issues/120854 but it surely makes the error reporting better and should encourage people with good instincts like ```@CinchBlue.```
2024-02-10 13:12:31 +01:00
Matthias Krüger 2dbc9f55f7
Rollup merge of #120859 - nnethercote:fix-120856, r=oli-obk
Loosen an assertion to account for stashed errors.

The meaning of this assertion changed in #120828 when the meaning of `has_errors` changed to exclude stashed errors. Evidently the new meaning is too restrictive.

Fixes #120856.

r? ```@oli-obk```
2024-02-10 13:12:30 +01:00
Matthias Krüger 83544703f5
Rollup merge of #120823 - LegionMammal978:clarify-atomic-align, r=RalfJung
Clarify that atomic and regular integers can differ in alignment

The documentation for atomic integers says that they have the "same in-memory representation" as their underlying integers. This might be misconstrued as implying that they have the same layout. Therefore, clarify that atomic integers' alignment is equal to their size.
2024-02-10 13:12:29 +01:00
Matthias Krüger 2eda0c7b2e
Rollup merge of #120764 - Alfriadox:master, r=m-ou-se
Add documentation on `str::starts_with`

Add documentation about a current footgun of `str::starts_with`
2024-02-10 13:12:29 +01:00
Matthias Krüger e11e4446da
Rollup merge of #120719 - compiler-errors:no-dyn-atb, r=lcnr
Remove support for `associated_type_bound` nested in `dyn` types

These necessarily desugar to `impl Trait`, which is inconsistent with the `associated_type_bound` feature after #120584.

This PR keeps the `is_in_dyn_type` hack, which kind of makes me sad. Ideally, we'd be validating that no object types have associated type bounds somewhere else. Unfortunately, we can't do this later during astconv (i think?), nor can we do it earlier during ast validation (i think?) because of the feature gating of ATB being a *warning* rather than an *error*. Let me know if you have thoughts about this.

r? lcnr
2024-02-10 13:12:28 +01:00
Matthias Krüger 0b7f0ff230
Rollup merge of #117614 - RalfJung:static-mut-refs, r=davidtwco,oli-obk
static mut: allow mutable reference to arbitrary types, not just slices and arrays

For historical reasons, we allow this:
```rust
static mut ARRAY: &'static mut [isize] = &mut [1];
```
However, we do not allow this:
```rust
static mut INT: &'static mut isize = &mut 1;
```

I think that's terribly inconsistent. I don't care much for `static mut`, but we have to keep it around for backwards compatibility and so we have to keep supporting it properly in the compiler. In recent refactors of how we deal with mutability of data in `static` and `const`, I almost made a fatal mistake since I tested `static mut INT: &'static mut isize = &mut 1` and concluded that we don't allow such `'static` mutable references even inside `static mut`. After all, nobody would expect this to be allowed only for arrays and slices, right?!?? So for the sake of our own sanity, and of whoever else reverse engineers these rules in the future to understand what the Rust compiler accepts or does not accept, I propose that we accept this for all types, not just arrays and slices.
2024-02-10 13:12:28 +01:00
bors 232919c33a Auto merge of #120771 - oli-obk:useless_non_ensure_query_call, r=davidtwco
Use `ensure` when the result of the query is not needed beyond its `Result`ness

while I would like to just remove the `tcx` methods for ensure-only queries, that is hard to do without another query annotation or by turning the `define_callbacks` macro into a proc macro to get more control

should fix perf regression of https://github.com/rust-lang/rust/pull/120558
2024-02-10 09:27:14 +00:00
bors 757b8efed4 Auto merge of #120712 - compiler-errors:async-closures-harmonize, r=oli-obk
Harmonize `AsyncFn` implementations, make async closures conditionally impl `Fn*` traits

This PR implements several changes to the built-in and libcore-provided implementations of `Fn*` and `AsyncFn*` to address two problems:
1. async closures do not implement the `Fn*` family traits, leading to breakage: https://crater-reports.s3.amazonaws.com/pr-120361/index.html
2. *references* to async closures do not implement `AsyncFn*`, as a consequence of the existing blanket impls of the shape `AsyncFn for F where F: Fn, F::Output: Future`.

In order to fix (1.), we implement `Fn` traits appropriately for async closures. It turns out that async closures can:
* always implement `FnOnce`, meaning that they're drop-in compatible with `FnOnce`-bound combinators like `Option::map`.
* conditionally implement `Fn`/`FnMut` if they have no captures, which means that existing usages of async closures should *probably* work without breakage (crater checking this: https://github.com/rust-lang/rust/pull/120712#issuecomment-1930587805).

In order to fix (2.), we make all of the built-in callables implement `AsyncFn*` via built-in impls, and instead adjust the blanket impls for `AsyncFn*` provided by libcore to match the blanket impls for `Fn*`.
2024-02-10 07:15:15 +00:00
Zalathar a2479a4ae7 Remove unnecessary min_specialization after bootstrap
These crates all needed specialization for `newtype_index!`, which will no
longer be necessary when the current nightly eventually becomes the next
bootstrap compiler.
2024-02-10 18:15:11 +11:00
Zalathar 7b73e4fd44 Allow restricted trait impls in macros with min_specialization
Implementing traits marked with `#[rustc_specialization_trait]` normally
requires (min-)specialization to be enabled for the enclosing crate.

With this change, that permission can also be granted by an
`allow_internal_unstable` attribute on the macro that generates the impl.
2024-02-10 18:14:02 +11:00
bors 68125c72d3 Auto merge of #120721 - onur-ozkan:incorrect-llvm-path-on-cross-target, r=albertlarsan68
fix `llvm_out` to use the correct LLVM root

When `download-ci-llvm` is enabled, `llvm_out` ends up with the
error below due to an incorrect path on cross-compilations. This change fixes that.

```sh
failed to execute command: "/rust/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-config" "--version"
ERROR: No such file or directory (os error 2)
```
2024-02-10 04:12:51 +00:00
Michael Goulet e6f5af9671 Remove unused fn 2024-02-10 03:52:13 +00:00
Michael Goulet fde695a2d1 Add a helpful suggestion 2024-02-10 03:31:34 +00:00
Venus Xeon-Blonde d7263d7aad
Change wording 2024-02-09 22:24:57 -05:00
Michael Goulet 973bbfbd23 No more associated type bounds in dyn trait 2024-02-10 03:23:51 +00:00
Zalathar cf1096eb72 Remove unnecessary #![feature(min_specialization)] 2024-02-10 12:26:14 +11:00
Ben Kimock 3d4a9f5047 Turn the "no saved object file in work product" ICE into a translatable fatal error 2024-02-09 20:22:15 -05:00
bors b5c46dc542 Auto merge of #120862 - matthiaskrgr:rollup-jzfab58, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #120584 (For a rigid projection, recursively look at the self type's item bounds to fix the `associated_type_bounds` feature)
 - #120596 ([rustdoc] Correctly generate path for non-local items in source code pages)
 - #120629 (Move some test files)
 - #120846 (Update jobserver-rs to 0.1.28)
 - #120850 (ast_lowering: Fix regression in `use ::{}` imports.)
 - #120853 (Avoid a collection and iteration on empty passes)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-10 00:03:43 +00:00
Matthias Krüger 8e1eaddd27
Rollup merge of #120853 - blyxyas:no-collect, r=cjgillot
Avoid a collection and iteration on empty passes

Just some mini optimization I saw in the wild. This way, we avoid a `collect` and `map` on an empty `passes`. Honestly, I don't even think this is big enough of a change to make a benchmark, but I'd still like to see results.

Based on [this book](https://nnethercote.github.io/perf-book/iterators.html#collect-and-extend)
2024-02-10 00:58:40 +01:00
Matthias Krüger 8177c0fead
Rollup merge of #120850 - petrochenkov:empimpres, r=cjgillot
ast_lowering: Fix regression in `use ::{}` imports.

Fixes https://github.com/rust-lang/rust/issues/120789
2024-02-10 00:58:39 +01:00
Matthias Krüger 317c372284
Rollup merge of #120846 - petrochenkov:jobs, r=oli-obk
Update jobserver-rs to 0.1.28

Fixes the issues found in https://github.com/rust-lang/rust/issues/120515 besides the diagnostic wording.
2024-02-10 00:58:38 +01:00
Matthias Krüger 34489b7769
Rollup merge of #120629 - c410-f3r:testsssssss, r=petrochenkov
Move some test files

r? ``@petrochenkov``
2024-02-10 00:58:38 +01:00
Matthias Krüger c06199f863
Rollup merge of #120596 - GuillaumeGomez:jump-to-def-non-local-link, r=notriddle,fmease
[rustdoc] Correctly generate path for non-local items in source code pages

While browsing some crates using the "jump to def" feature, I realized that a lot of items didn't have a link generated. The reason is because we only cache foreign items if they appear in the documented API. This means that for the others, we need to infer them.

r? ``@notriddle``
2024-02-10 00:58:37 +01:00
Matthias Krüger 9ec287dec2
Rollup merge of #120584 - compiler-errors:u, r=lcnr
For a rigid projection, recursively look at the self type's item bounds to fix the `associated_type_bounds` feature

Given a deeply nested rigid projection like `<<<T as Trait1>::Assoc1 as Trait2>::Assoc2 as Trait3>::Assoc3`, this PR adjusts both trait solvers to look at the item bounds for all of `Assoc3`, `Assoc2`, and `Assoc1` in order to satisfy a goal. We do this because the item bounds for projections may contain relevant bounds for *other* nested projections when the `associated_type_bounds` (ATB) feature is enabled. For example:

```rust
#![feature(associated_type_bounds)]

trait Trait1 {
    type Assoc1: Trait2<Assoc2: Foo>;
    // Item bounds for `Assoc1` are:
    // `<Self as Trait1>::Assoc1: Trait2`
    // `<<Self as Trait1>::Assoc1 as Trait2>::Assoc2: Foo`
}

trait Trait2 {
    type Assoc2;
}

trait Foo {}

fn hello<T: Trait1>(x: <<T as Trait1>::Assoc1 as Trait2>::Assoc2) {
    fn is_foo(_: impl Foo) {}
    is_foo(x);
    // Currently fails with:
    // ERROR the trait bound `<<Self as Trait1>::Assoc1 as Trait2>::Assoc2: Foo` is not satisfied
}
```

This has been a long-standing place of brokenness for ATBs, and is also part of the reason why ATBs currently desugar so differently in various positions (i.e. sometimes desugaring to param-env bounds, sometimes desugaring to RPITs, etc). For example, in RPIT and TAIT position, `impl Foo<Bar: Baz>` currently desugars to `impl Foo<Bar = impl Baz>` because we do not currently take advantage of these nested item bounds if we desugared them into a single set of item bounds on the opaque. This is obviously both strange and unnecessary if we just take advantage of these bounds as we should.

## Approach

This PR repeatedly peels off each projection of a given goal's self type and tries to match its item bounds against a goal, repeating with the self type of the projection. This is pretty straightforward to implement in the new solver, only requiring us to loop on the self type of a rigid projection to discover inner rigid projections, and we also need to introduce an extra probe so we can normalize them.

In the old solver, we can do essentially the same thing, however we rely on the fact that projections *should* be normalized already. This is obviously not always the case -- however, in the case that they are not fully normalized, such as a projection which has both infer vars and, we bail out with ambiguity if we hit an infer var for the self type.

## Caveats

⚠️ In the old solver, this has the side-effect of actually stalling some higher-ranked trait goals of the form `for<'a> <?0 as Tr<'a>>: Tr2`. Because we stall them, they no longer are eagerly treated as error -- this cause some existing `known-bug` tests to go from fail -> pass.

I'm pretty unconvinced that this is a problem since we make code that we expect to pass in the *new* solver also pass in the *old* solver, though this obviously doesn't solve the *full* problem.

## And then also...

We also adjust the desugaring of ATB to always desugar to a regular associated bound, rather than sometimes to an impl Trait **except** for when the ATB is present in a `dyn Trait`. We need to lower `dyn Trait<Assoc: Bar>` to `dyn Trait<Assoc = impl Bar>` because object types need all of their associated types specified.

I would also be in favor of splitting out the ATB feature and/or removing support for object types in order to stabilize just the set of positions for which the ATB feature is consistent (i.e. always elaborates to a bound).
2024-02-10 00:58:36 +01:00
Nicholas Nethercote bb60ded24b Loosen an assertion to account for stashed errors.
The meaning of this assertion changed in #120828 when the meaning of
`has_errors` changed to exclude stashed errors. Evidently the new
meaning is too restrictive.

Fixes #120856.
2024-02-10 09:14:59 +11:00
Camille GILLOT 014b29eecf Remove ConstGoto and SeparateConstSwitch. 2024-02-09 21:13:53 +00:00
Camille GILLOT e132cac3c4 Enable by default. 2024-02-09 21:13:51 +00:00
bors d44e3b95cb Auto merge of #120852 - matthiaskrgr:rollup-01pr8gj, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #120351 (Implement SystemTime for UEFI)
 - #120354 (improve normalization of `Pointee::Metadata`)
 - #120776 (Move path implementations into `sys`)
 - #120790 (better error message on download CI LLVM failure)
 - #120806 (Clippy subtree update)
 - #120815 (Improve `Option::inspect` docs)
 - #120822 (Emit more specific diagnostics when enums fail to cast with `as`)
 - #120827 (Print image input file and checksum in CI only)
 - #120836 (hide impls if trait bound is proven from env)
 - #120844 (Build DebugInfo for async closures)
 - #120851 (Remove duplicate release note)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-09 21:06:12 +00:00
Caio 69a5264a52 Move some tests 2024-02-09 15:43:08 -03:00
blyxyas 4ef1790b4e
tidy 2024-02-09 19:30:47 +01:00
Matthias Krüger 3c1b7a741f
Rollup merge of #120851 - carols10cents:patch-1, r=Mark-Simulacrum
Remove duplicate release note

Oopsie. See https://github.com/rust-lang/rust/pull/120783#issuecomment-1935484219
2024-02-09 19:21:20 +01:00
Matthias Krüger aa0b0b65b3
Rollup merge of #120844 - compiler-errors:async-di, r=oli-obk
Build DebugInfo for async closures

The test is pretty bare, because I don't really know how to write debuginfo tests. I'd like to land this first, and then flesh it out correctly one it's no longer ICEing on master (which breaks people's ability to test using async closures).

r? oli-obk cc `@rust-lang/wg-debugging` (if any of y'all want to help me write a more fleshed out async closures test)
2024-02-09 19:21:19 +01:00
Matthias Krüger 251584581f
Rollup merge of #120836 - lcnr:param-env-hide-impl, r=BoxyUwU
hide impls if trait bound is proven from env

AVERT YOUR EYES `@compiler-errors`

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/76 and https://github.com/rust-lang/trait-system-refactor-initiative/issues/12#issuecomment-1865234925

this is kinda ugly and I hate it, but I wasn't able to think of a cleaner approach for now. I am also unsure whether we have to refine this filtering later on, so by making the change pretty minimal it should be easier to improve going forward.

r? `@BoxyUwU`
2024-02-09 19:21:19 +01:00
Matthias Krüger c9386246ae
Rollup merge of #120827 - DianQK:docker-run-local, r=Kobzol
Print image input file and checksum in CI only

Avoid getting stuck without the variable locally.

r? `@Kobzol`
2024-02-09 19:21:18 +01:00
Matthias Krüger d9a957b32a
Rollup merge of #120822 - gurry:120756-terse-non-prim-cast-diag, r=petrochenkov
Emit more specific diagnostics when enums fail to cast with `as`

Fixes #120756

Changes this diagnostic reported in the issue:
```
error[E0605]: non-primitive cast: `Bad` as `u32`
  --> src/main.rs:18:10
   |
18 |     dbg!(bad as u32);
   |          ^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
```

to this:
```
error[E0605]: non-primitive cast: `Bad` as `u32`
  --> src/main.rs:18:10
   |
18 |     dbg!(bad as u32);
   |          ^^^^^^^^^^ an `as` expression can be used to convert enum types to numeric types only if the enum type is unit-only or field-less
   |
   = note: see https://doc.rust-lang.org/reference/items/enumerations.html#casting for more information
```

This change is only for enums. The diagnostic remains unchanged for all other cases.
2024-02-09 19:21:18 +01:00
Matthias Krüger 40f998d7e9
Rollup merge of #120815 - camsteffen:inspect-docs, r=m-ou-se
Improve `Option::inspect` docs

* Refer to the function as "a function" instead of "the provided closure" since it is not necessarily a closure.
* State that the original Option/Result is returned.
* Adjust the example for `Option::inspect` to use chaining.
2024-02-09 19:21:17 +01:00
Matthias Krüger 5250abaeb8
Rollup merge of #120806 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-02-09 19:21:17 +01:00
Matthias Krüger c874b1a424
Rollup merge of #120790 - onur-ozkan:better-error-message, r=wesleywiser
better error message on download CI LLVM failure

self-explanatory
2024-02-09 19:21:17 +01:00
Matthias Krüger 434f080895
Rollup merge of #120776 - joboet:move_pal_path, r=ChrisDenton
Move path implementations into `sys`

Part of #117276.

r? `@ChrisDenton`
2024-02-09 19:21:16 +01:00
Matthias Krüger 99bafad6c2
Rollup merge of #120354 - lukas-code:metadata-normalize, r=lcnr
improve normalization of `Pointee::Metadata`

This PR makes it so that `<Wrapper<Tail> as Pointee>::Metadata` is normalized to `<Tail as Pointee>::Metadata` if we don't know `Wrapper<Tail>: Sized`. With that, the trait solver can prove projection predicates like `<Wrapper<Tail> as Pointee>::Metadata == <Tail as Pointee>::Metadata`, which makes it possible to use the metadata APIs to cast between the tail and the wrapper:

```rust
#![feature(ptr_metadata)]

use std::ptr::{self, Pointee};

fn cast_same_meta<T: ?Sized, U: ?Sized>(ptr: *const T) -> *const U
where
    T: Pointee<Metadata = <U as Pointee>::Metadata>,
{
    let (thin, meta) = ptr.to_raw_parts();
    ptr::from_raw_parts(thin, meta)
}

struct Wrapper<T: ?Sized>(T);

fn cast_to_wrapper<T: ?Sized>(ptr: *const T) -> *const Wrapper<T> {
    cast_same_meta(ptr)
}
```

Previously, this failed to compile:

```
error[E0271]: type mismatch resolving `<Wrapper<T> as Pointee>::Metadata == <T as Pointee>::Metadata`
  --> src/lib.rs:16:5
   |
15 | fn cast_to_wrapper<T: ?Sized>(ptr: *const T) -> *const Wrapper<T> {
   |                    - found this type parameter
16 |     cast_same_meta(ptr)
   |     ^^^^^^^^^^^^^^ expected `Wrapper<T>`, found type parameter `T`
   |
   = note: expected associated type `<Wrapper<T> as Pointee>::Metadata`
              found associated type `<T as Pointee>::Metadata`
   = note: an associated type was expected, but a different one was found
```

(Yes, you can already do this with `as` casts. But using functions is so much  *safer* , because you can't change the metadata on accident.)

---

This PR essentially changes the built-in impls of `Pointee` from this:

```rust
// before

impl Pointee for u8 {
    type Metadata = ();
}

impl Pointee for [u8] {
    type Metadata = usize;
}

// ...

impl Pointee for Wrapper<u8> {
    type Metadata = ();
}

impl Pointee for Wrapper<[u8]> {
    type Metadata = usize;
}

// ...

// This impl is only selected if `T` is a type parameter or unnormalizable projection or opaque type.
fallback impl<T: ?Sized> Pointee for Wrapper<T>
where
    Wrapper<T>: Sized
{
    type Metadata = ();
}

// This impl is only selected if `T` is a type parameter or unnormalizable projection or opaque type.
fallback impl<T /*: Sized */> Pointee for T {
    type Metadata = ();
}
```

to this:

```rust
// after

impl Pointee for u8 {
    type Metadata = ();
}

impl Pointee for [u8] {
    type Metadata = usize;
}

// ...

impl<T: ?Sized> Pointee for Wrapper<T> {
    // in the old solver this will instead project to the "deep" tail directly,
    // e.g. `Wrapper<Wrapper<T>>::Metadata = T::Metadata`
    type Metadata = <T as Pointee>::Metadata;
}

// ...

// This impl is only selected if `T` is a type parameter or unnormalizable projection or opaque type.
fallback impl<T /*: Sized */> Pointee for T {
    type Metadata = ();
}
```
2024-02-09 19:21:16 +01:00