1
Fork 0

Rollup merge of #115744 - fmease:fix-e0401, r=compiler-errors

Improve diagnostic for generic params from outer items (E0401)

Generalize the wording of E0401 to talk about *outer items* instead of *outer functions* since the current phrasing is outdated. The outer item can be a function, constant, trait, ADT or impl block (see the new UI test for the more exotic examples).

Further, don't suggest introducing generic parameters to constant items unless the feature `generic_const_items` is enabled.

Lastly, make E0401 translatable while we're at it.

Fixes #115720.
This commit is contained in:
Matthias Krüger 2023-09-11 17:03:32 +02:00 committed by GitHub
commit 8b49731211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 306 additions and 183 deletions

View file

@ -186,8 +186,8 @@ struct BindingError {
#[derive(Debug)]
enum ResolutionError<'a> {
/// Error E0401: can't use type or const parameters from outer function.
GenericParamsFromOuterFunction(Res, HasGenericParams),
/// Error E0401: can't use type or const parameters from outer item.
GenericParamsFromOuterItem(Res, HasGenericParams),
/// Error E0403: the name is already used for a type or const parameter in this generic
/// parameter list.
NameAlreadyUsedInParameterList(Symbol, Span),