bors[bot] 412eda7387
Merge #3880
3880: Add support for attributes for struct fields r=matklad a=bnjjj

Hello I try to solve this example:
```rust
struct MyStruct {
    my_val: usize,
    #[cfg(feature = "foo")]
    bar: bool,
}
impl MyStruct {
    #[cfg(feature = "foo")]
    pub(crate) fn new(my_val: usize, bar: bool) -> Self {
        Self { my_val, bar }
    }
    #[cfg(not(feature = "foo"))]
    pub(crate) fn new(my_val: usize, _bar: bool) -> Self {
        Self { my_val }
    }
}
```

Here is a draft PR to try to solve this issue. In fact for now when i have this kind of example, rust-analyzer tells me that my second Self {} miss the bar field. Which is a bug.

I have some difficulties to add this features. Here in my draft I share my work about adding attributes support on struct field data. But I'm stuck when I have to fetch attributes from parent expressions. I don't really know how to do that. For the first iteration I just want to solve my issue without solving on all different expressions. And then after I will try to implement that on different kind of expression. I think I have to fetch my FunctionId and then I will be able to find attributes with myFunction.attrs() But I don't know if it's the right way.

@matklad (or anyone else) if you can help me it would be great :D 

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-09 08:08:55 +00:00
..
2020-03-31 09:02:12 -04:00
2020-03-26 17:09:32 +00:00
2020-04-01 18:56:47 +02:00
2020-03-23 16:22:46 -07:00
2020-04-08 12:00:08 +00:00
2020-04-06 17:21:33 +03:00
2020-04-08 18:34:20 +08:00
2020-04-03 19:01:44 +08:00
2020-04-09 13:04:01 +08:00
2020-03-30 11:33:01 +02:00
2020-04-06 17:00:18 +02:00
2020-04-06 14:04:26 +03:00