diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-02-22 18:46:12 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-22 18:46:12 +0000 |
| commit | 0b53744f2d7e0694cd7207cca632fd6de1dc5bff (patch) | |
| tree | 8a9d1f752fdebad3b3d97836a1f455d604372f15 /src/test/codegen/src-hash-algorithm | |
| parent | 033f91e75d515936cfc0cc529b121f1ca3792179 (diff) | |
| parent | 0db0dec9993b510efeb61cb1d8ff113270d4ca51 (diff) | |
| download | rust-0b53744f2d7e0694cd7207cca632fd6de1dc5bff.tar.gz rust-0b53744f2d7e0694cd7207cca632fd6de1dc5bff.zip | |
Merge #11461
11461: Extract struct from enum variant filters generics r=jo-goro a=jo-goro
Fixes #11452.
This PR updates extract_struct_from_enum_variant. Extracting a struct `A` form an enum like
```rust
enum X<'a, 'b> {
A { a: &'a () },
B { b: &'b () },
}
```
will now be correctly generated as
```rust
struct A<'a> { a: &'a () }
enum X<'a, 'b> {
A(A<'a>),
B { b: &'b () },
}
```
instead of the previous
```rust
struct A<'a, 'b>{ a: &'a () } // <- should not have 'b
enum X<'a, 'b> {
A(A<'a, 'b>),
B { b: &'b () },
}
```
This also works for generic type parameters and const generics.
Bounds are also copied, however I have not yet implemented a filter for unneeded bounds. Extracting `B` from the following enum
```rust
enum X<'a, 'b: 'a> {
A { a: &'a () },
B { b: &'b () },
}
```
will be generated as
```rust
struct B<'b: 'a> { b: &'b () } // <- should be `struct B<'b> { b: &'b () }`
enum X<'a, 'b: 'a> {
A { a: &'a () },
B(B<'b>),
}
```
Extracting bounds with where clauses is also still not implemented.
Co-authored-by: Jonas Goronczy <goronczy.jonas@gmail.com>
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions
