diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_def/src/attr.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index 98293aad3..4e8b908d0 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs | |||
@@ -195,8 +195,11 @@ impl Attr { | |||
195 | fn from_src(ast: ast::Attr, hygiene: &Hygiene) -> Option<Attr> { | 195 | fn from_src(ast: ast::Attr, hygiene: &Hygiene) -> Option<Attr> { |
196 | let path = ModPath::from_src(ast.path()?, hygiene)?; | 196 | let path = ModPath::from_src(ast.path()?, hygiene)?; |
197 | let input = if let Some(lit) = ast.literal() { | 197 | let input = if let Some(lit) = ast.literal() { |
198 | // FIXME: escape? raw string? | 198 | let value = if let ast::LiteralKind::String(string) = lit.kind() { |
199 | let value = lit.syntax().first_token()?.text().trim_matches('"').into(); | 199 | string.value()?.into() |
200 | } else { | ||
201 | lit.syntax().first_token()?.text().trim_matches('"').into() | ||
202 | }; | ||
200 | Some(AttrInput::Literal(value)) | 203 | Some(AttrInput::Literal(value)) |
201 | } else if let Some(tt) = ast.token_tree() { | 204 | } else if let Some(tt) = ast.token_tree() { |
202 | Some(AttrInput::TokenTree(ast_to_token_tree(&tt)?.0)) | 205 | Some(AttrInput::TokenTree(ast_to_token_tree(&tt)?.0)) |