diff options
Diffstat (limited to 'crates/ra_hir_def/src/adt.rs')
-rw-r--r-- | crates/ra_hir_def/src/adt.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 6d59c8642..4ba694480 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -12,10 +12,11 @@ use ra_syntax::ast::{self, NameOwner, VisibilityOwner}; | |||
12 | use tt::{Delimiter, DelimiterKind, Leaf, Subtree, TokenTree}; | 12 | use tt::{Delimiter, DelimiterKind, Leaf, Subtree, TokenTree}; |
13 | 13 | ||
14 | use crate::{ | 14 | use crate::{ |
15 | attr::AttrInput, | 15 | attr::{Attr, AttrInput}, |
16 | body::{CfgExpander, LowerCtx}, | 16 | body::{CfgExpander, LowerCtx}, |
17 | db::DefDatabase, | 17 | db::DefDatabase, |
18 | item_tree::{AttrOwner, Field, Fields, ItemTree, ModItem}, | 18 | item_tree::{AttrOwner, Field, Fields, ItemTree, ModItem}, |
19 | path::{ModPath, PathKind}, | ||
19 | src::HasChildSource, | 20 | src::HasChildSource, |
20 | src::HasSource, | 21 | src::HasSource, |
21 | trace::Trace, | 22 | trace::Trace, |
@@ -69,8 +70,12 @@ pub enum ReprKind { | |||
69 | 70 | ||
70 | fn repr_from_value(item_tree: &ItemTree, of: AttrOwner) -> Option<ReprKind> { | 71 | fn repr_from_value(item_tree: &ItemTree, of: AttrOwner) -> Option<ReprKind> { |
71 | item_tree.attrs(of).iter().find_map(|a| { | 72 | item_tree.attrs(of).iter().find_map(|a| { |
72 | if a.path.segments[0].to_string() == "repr" { | 73 | if let Attr { |
73 | if let Some(AttrInput::TokenTree(subtree)) = &a.input { | 74 | path: ModPath { kind: PathKind::Plain, segments }, |
75 | input: Some(AttrInput::TokenTree(subtree)), | ||
76 | } = a | ||
77 | { | ||
78 | if segments.len() == 1 && segments[0].to_string() == "repr" { | ||
74 | parse_repr_tt(subtree) | 79 | parse_repr_tt(subtree) |
75 | } else { | 80 | } else { |
76 | None | 81 | None |