File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,10 @@ impl ActiveParameter {
161
161
162
162
let idx = active_parameter?;
163
163
let mut params = signature. params ( sema. db ) ;
164
+ if !( idx < params. len ( ) ) {
165
+ mark:: hit!( too_many_arguments) ;
166
+ return None ;
167
+ }
164
168
let ( pat, ty) = params. swap_remove ( idx) ;
165
169
let name = pat?. to_string ( ) ;
166
170
Some ( ActiveParameter { ty, name } )
Original file line number Diff line number Diff line change @@ -1159,6 +1159,22 @@ fn go(world: &WorldSnapshot) { go(w<|>) }
1159
1159
) ;
1160
1160
}
1161
1161
1162
+ #[ test]
1163
+ fn too_many_arguments ( ) {
1164
+ mark:: check!( too_many_arguments) ;
1165
+ check_scores (
1166
+ r#"
1167
+ struct Foo;
1168
+ fn f(foo: &Foo) { f(foo, w<|>) }
1169
+ "# ,
1170
+ expect ! [ [ r#"
1171
+ st Foo []
1172
+ fn f(…) []
1173
+ bn foo []
1174
+ "# ] ] ,
1175
+ ) ;
1176
+ }
1177
+
1162
1178
#[ test]
1163
1179
fn guesses_macro_braces ( ) {
1164
1180
check_edit (
You can’t perform that action at this time.
0 commit comments