about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-27 23:27:23 +0100
committerGitHub <noreply@github.com>2024-03-27 23:27:23 +0100
commitae33b9045b05780c50db1da3c898bea52883ce8e (patch)
tree7a6eb226f5c5f4a874b2f30bc3f3326ef9cfe9c8 /compiler/rustc_pattern_analysis/src
parent6464e5b78cf7b09ed5b025339c365ba79246fbab (diff)
parent0cd9708de60fb0f92561e0a6ed0a8c5991fd871d (diff)
downloadrust-ae33b9045b05780c50db1da3c898bea52883ce8e.tar.gz
rust-ae33b9045b05780c50db1da3c898bea52883ce8e.zip
Rollup merge of #123101 - Bryanskiy:delegation-fixes-2, r=petrochenkov
Delegation: fix ICE on wrong `Self` instantiation

fixes https://github.com/rust-lang/rust/issues/119921
fixes https://github.com/rust-lang/rust/issues/119919

There is no way to instantiate `Self` param for caller in delegation item if

1. callee is a trait method && callee contains `Self` param
2. delegation item isn't an associative item

In general, we can consider `Self` param as independent type param in these cases:

```rust

trait Trait {
    fn foo(_: Option<&Self>) {...}
}

reuse Trait::foo;
// will be desugared to:
fn foo<T: Trait>(x: Option<&T>) { Trait::foo(x) }
```

But this requires early bound parameters support. For now, I suggest banning such cases to avoid ICE's.

r? ``@petrochenkov``
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions