Files
rust/tests/ui/self
Zalathar b420a664dd Rollup merge of #163049 - estebank:dyn-compat-receiver, r=ShoyuVanilla
Tweak dyn compatibility error when pointing at receiver

Account for receivers with arbitrary self types to suggest idiomatic code.

```
error[E0038]: the trait `Fetcher` is not dyn compatible
  --> $DIR/undispatchable-receiver-and-wc-references-Self.rs:19:21
   |
LL | fn fetcher() -> Box<dyn Fetcher> {
   |                     ^^^^^^^^^^^ `Fetcher` is not dyn compatible
   |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
  --> $DIR/undispatchable-receiver-and-wc-references-Self.rs:11:16
   |
LL | pub trait Fetcher: Send + Sync {
   |           ------- this trait is not dyn compatible...
LL |     fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>>
   |                ^^^^^^^^^^^^^^^^^^^ ...because method `get`'s `self` parameter cannot be dispatched on
help: consider changing method `get`'s `self` parameter to be `&self`
   |
LL -     fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>>
LL +     fn get<'a>(&'a self) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>>
   |
```

Instead of

```
help: consider changing method `get`'s `self` parameter to be `&self`
   |
LL -     fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>>
LL +     fn get<'a>(self: &Self) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>>
   |
```
2026-09-22 12:01:39 +10:00
..
2025-12-02 18:25:13 +00:00
2026-09-07 13:56:42 +00:00
2025-12-01 19:51:20 +09:00
2026-06-19 16:50:52 +02:00
2026-06-20 22:37:27 +02:00