diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2024-07-16 16:15:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-16 16:15:14 -0500 |
| commit | 36ea06827bf32cb4d12bf479e5a56c54bd358611 (patch) | |
| tree | 284a18bf63458027fb0e4e77bf7b03cb844ae2cd /compiler/rustc_mir_transform/src/coverage/graph.rs | |
| parent | 63f239c89f661dc1e1157ab730e71197e55a12f0 (diff) | |
| parent | 7ee97f93dabd0be0cfbee437c42dd6555f7bdfd4 (diff) | |
| download | rust-36ea06827bf32cb4d12bf479e5a56c54bd358611.tar.gz rust-36ea06827bf32cb4d12bf479e5a56c54bd358611.zip | |
Rollup merge of #126699 - Bryanskiy:delegation-coercion, r=compiler-errors
Delegation: support coercion for target expression
(solves https://github.com/rust-lang/rust/issues/118212#issuecomment-2160723092)
The implementation consist of 2 parts. Firstly, method call is generated instead of fully qualified call in AST->HIR lowering if there were no generic arguments or `Qpath` were provided. These restrictions are imposed due to the loss of information after desugaring. For example in
```rust
trait Trait {
fn foo(&self) {}
}
reuse <u8 as Trait>::foo;
```
We would like to generate such a code:
```rust
fn foo<u8: Trait>(x: &u8) {
x.foo(x)
}
```
however, the signature is inherited during HIR analysis where `u8` was discarded.
Then, we probe the single pre-resolved method.
P.S In the future, we would like to avoid restrictions on the callee path by `Self` autoref/autoderef in fully qualified calls, but at the moment it didn't work out.
r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/graph.rs')
0 files changed, 0 insertions, 0 deletions
