rust/crates
bors[bot] 0b53744f2d
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>
2022-02-22 18:46:12 +00:00
..
base_db Add test for giving attribute proc macros valid syntax 2022-02-07 12:54:08 +01:00
cfg Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
flycheck Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
hir simplify and document 2022-02-22 10:45:29 +01:00
hir_def simplify and document 2022-02-22 10:45:29 +01:00
hir_expand fix: Fix expand_macro always expanding the first listed derive 2022-02-22 12:32:27 +01:00
hir_ty Merge #11481 2022-02-21 13:08:31 +00:00
ide fix: Fix expand_macro always expanding the first listed derive 2022-02-22 12:32:27 +01:00
ide_assists Merge #11461 2022-02-22 18:46:12 +00:00
ide_completion Simplify 2022-02-22 10:20:45 +01:00
ide_db simplify and document 2022-02-22 10:45:29 +01:00
ide_diagnostics More correct $crate handling in eager macros 2022-01-27 16:57:53 +01:00
ide_ssr fix: Complete functions and methods from block level impls 2022-02-01 23:29:40 +01:00
limit Use compare_exchange_weak in limit::Limit::check 2022-01-28 18:19:35 +03:00
mbe internal: Split unresolve proc-macro error out of mbe 2022-02-22 10:08:00 +01:00
parser Update tests 2022-02-21 08:34:35 +02:00
paths Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
proc_macro_api Set current working directory for procedural macros 2022-01-27 16:18:12 +03:00
proc_macro_srv fix: Fix proc-macro server not using the supplied span in Ident::new 2022-01-31 17:02:57 +01:00
proc_macro_test Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
profile Generate AnyHasDocComments node 2022-01-07 12:38:18 +01:00
project_model Pass required features to cargo when using run action 2022-02-06 19:02:25 +03:00
rust-analyzer Merge #11455 2022-02-21 16:56:37 +00:00
sourcegen Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
stdx Generate AnyHasDocComments node 2022-01-07 12:38:18 +01:00
syntax Make replace_derive_with_manual_impl work again 2022-02-22 10:20:44 +01:00
test_utils fix: Do not complete Drop::drop, complete std::mem::drop instead 2021-12-22 02:25:38 +01:00
text_edit Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
toolchain Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
tt Track synthetic tokens, to be able to remove them again later 2022-02-08 18:13:18 +01:00
vfs Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
vfs-notify Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00