Skip to content

Commit e275f2c

Browse files
committed
Extend docstring
1 parent ad0d3b5 commit e275f2c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libsyntax/parse/diagnostics.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,13 @@ impl<'a> Parser<'a> {
12341234
}
12351235

12361236
/// Replace duplicated recovered arguments with `_` pattern to avoid unecessary errors.
1237+
///
1238+
/// This is necessary because at this point we don't know whether we parsed a function with
1239+
/// anonymous arguments or a function with names but no types. In order to minimize
1240+
/// unecessary errors, we assume the arguments are in the shape of `fn foo(a, b, c)` where
1241+
/// the arguments are *names* (so we don't emit errors about not being able to find `b` in
1242+
/// the local scope), but if we find the same name multiple times, like in `fn foo(i8, i8)`,
1243+
/// we deduplicate them to not complain about duplicated argument names.
12371244
crate fn deduplicate_recovered_arg_names(&self, fn_inputs: &mut Vec<Arg>) {
12381245
let mut seen_inputs = FxHashSet::default();
12391246
for input in fn_inputs.iter_mut() {

0 commit comments

Comments
 (0)