Skip to content

Commit 0289ce4

Browse files
authored
Merge pull request rust-lang#20937 from A4-Tacks/duplicate-raw-const
Fix duplicate `const` complete after `raw`
2 parents 35ab21b + aecab34 commit 0289ce4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ pub(crate) fn complete_expr_path(
352352

353353
if !in_block_expr {
354354
add_keyword("unsafe", "unsafe {\n $0\n}");
355-
add_keyword("const", "const {\n $0\n}");
355+
if !wants_const_token {
356+
// Avoid having two `const` items in `&raw $0`
357+
add_keyword("const", "const {\n $0\n}");
358+
}
356359
}
357360
add_keyword("match", "match $1 {\n $0\n}");
358361
add_keyword("while", "while $1 {\n $0\n}");

src/tools/rust-analyzer/crates/ide-completion/src/tests/expression.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,6 @@ fn completes_after_ref_expr() {
628628
fn main() fn()
629629
bt u32 u32
630630
kw const
631-
kw const
632631
kw crate::
633632
kw false
634633
kw for

0 commit comments

Comments
 (0)