mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
support const params
This commit is contained in:
parent
b6201051b2
commit
734193bc23
1 changed files with 20 additions and 1 deletions
|
@ -80,7 +80,7 @@ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<(
|
|||
let number_of_arguments = generics
|
||||
.iter()
|
||||
.filter(|param| match param {
|
||||
hir::GenericParam::TypeParam(_) => true,
|
||||
hir::GenericParam::TypeParam(_) | hir::GenericParam::ConstParam(_) => true,
|
||||
_ => false,
|
||||
})
|
||||
.count();
|
||||
|
@ -361,6 +361,25 @@ fn make<'a, T, A>(t: T, a: A) {}
|
|||
fn main() {
|
||||
make::<${0:_,_}>(5, 2);
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_turbo_fish_function_const_parameter() {
|
||||
check_assist(
|
||||
add_turbo_fish,
|
||||
r#"
|
||||
fn make<T, const N: usize>(t: T) {}
|
||||
fn main() {
|
||||
make$0(3);
|
||||
}
|
||||
"#,
|
||||
r#"
|
||||
fn make<T, const N: usize>(t: T) {}
|
||||
fn main() {
|
||||
make::<${0:_,_}>(3);
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue