diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-09 09:08:55 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-09 09:08:55 +0100 |
commit | 412eda73877c7a897561a70b83f55ee346e18a2c (patch) | |
tree | b30c91efe4050087f1935d477db4612357a2665a /crates/ra_flycheck/src | |
parent | 01e5bd50f30ae22abab0733468d1e1c6dea7d506 (diff) | |
parent | 585bb83e2aec9c79dae8c2e031e9165f40937003 (diff) |
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 <[email protected]>
Diffstat (limited to 'crates/ra_flycheck/src')
0 files changed, 0 insertions, 0 deletions