Rollup merge of #87134 - BoxyUwU:cgd-self-ty-error, r=lcnr

Make SelfInTyParamDefault wording not be specific to type defaults

r? ```@lcnr```
This commit is contained in:
Yuki Okushi 2021-07-15 21:19:20 +09:00 committed by GitHub
commit 6d0d80e181
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 23 deletions

View file

@ -502,14 +502,14 @@ impl<'a> Resolver<'a> {
err
}
ResolutionError::SelfInTyParamDefault => {
ResolutionError::SelfInGenericParamDefault => {
let mut err = struct_span_err!(
self.session,
span,
E0735,
"type parameters cannot use `Self` in their defaults"
"generic parameters cannot use `Self` in their defaults"
);
err.span_label(span, "`Self` in type parameter default".to_string());
err.span_label(span, "`Self` in generic parameter default".to_string());
err
}
ResolutionError::UnreachableLabel { name, definition_span, suggestion } => {

View file

@ -249,7 +249,7 @@ enum ResolutionError<'a> {
/// This error is only emitted when using `min_const_generics`.
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
/// Error E0735: generic parameters with a default cannot use `Self`
SelfInTyParamDefault,
SelfInGenericParamDefault,
/// Error E0767: use of unreachable label
UnreachableLabel { name: Symbol, definition_span: Span, suggestion: Option<LabelSuggestion> },
}
@ -2643,7 +2643,7 @@ impl<'a> Resolver<'a> {
if let ForwardGenericParamBanRibKind = all_ribs[rib_index].kind {
if record_used {
let res_error = if rib_ident.name == kw::SelfUpper {
ResolutionError::SelfInTyParamDefault
ResolutionError::SelfInGenericParamDefault
} else {
ResolutionError::ForwardDeclaredGenericParam
};