mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Merge #11595
11595: fix: lower string literals with actual value instead of default r=lnicola a=tysg Fixes #11582. Some questions below in the code review section. Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
This commit is contained in:
commit
908c17bfa6
2 changed files with 25 additions and 1 deletions
|
@ -957,7 +957,10 @@ impl From<ast::LiteralKind> for Literal {
|
|||
let text = bs.value().map(Box::from).unwrap_or_else(Default::default);
|
||||
Literal::ByteString(text)
|
||||
}
|
||||
LiteralKind::String(_) => Literal::String(Default::default()),
|
||||
LiteralKind::String(s) => {
|
||||
let text = s.value().map(Box::from).unwrap_or_else(Default::default);
|
||||
Literal::String(text)
|
||||
}
|
||||
LiteralKind::Byte => Literal::Uint(Default::default(), Some(BuiltinUint::U8)),
|
||||
LiteralKind::Bool(val) => Literal::Bool(val),
|
||||
LiteralKind::Char => Literal::Char(Default::default()),
|
||||
|
|
|
@ -3508,6 +3508,27 @@ const FOO$0: usize = 1 << 100;
|
|||
|
||||
---
|
||||
|
||||
This is a doc
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
r#"
|
||||
/// This is a doc
|
||||
const FOO$0: &str = "bar";
|
||||
"#,
|
||||
expect![[r#"
|
||||
*FOO*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
const FOO: &str = "bar"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
This is a doc
|
||||
"#]],
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue