more friend error message for in fn arg
This commit is contained in:
parent
15c18e725c
commit
8e82c21bf3
1 changed files with 12 additions and 2 deletions
|
|
@ -2361,8 +2361,18 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
"type name"
|
||||
};
|
||||
|
||||
let msg = format!("use of undeclared {} `{}`", kind,
|
||||
path_names_to_string(path, 0));
|
||||
let self_type_name = special_idents::type_self.name;
|
||||
let is_invalid_self_type_name =
|
||||
path.segments.len() > 0 &&
|
||||
maybe_qself.is_none() &&
|
||||
path.segments[0].identifier.name == self_type_name;
|
||||
let msg = if is_invalid_self_type_name {
|
||||
"expected type name, found keyword `Self`".to_string()
|
||||
} else {
|
||||
format!("use of undeclared {} `{}`",
|
||||
kind, path_names_to_string(path, 0))
|
||||
};
|
||||
|
||||
self.resolve_error(ty.span, &msg[..]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue