This commit introduces the following changes:
* Change error message for type param in a const expression when using min_const_generics * Change ParamInNonTrivialAnonConst to contain an extra bool used for distinguishing whether the passed-in symbol is a type or a value.
This commit is contained in:
parent
356d8ad1a3
commit
7d5db239e7
9 changed files with 82 additions and 14 deletions
|
@ -221,7 +221,7 @@ enum ResolutionError<'a> {
|
|||
/// generic parameters must not be used inside of non trivial constant values.
|
||||
///
|
||||
/// This error is only emitted when using `min_const_generics`.
|
||||
ParamInNonTrivialAnonConst(Symbol),
|
||||
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
|
||||
/// Error E0735: type parameters with a default cannot use `Self`
|
||||
SelfInTyParamDefault,
|
||||
/// Error E0767: use of unreachable label
|
||||
|
@ -2638,9 +2638,10 @@ impl<'a> Resolver<'a> {
|
|||
if record_used {
|
||||
self.report_error(
|
||||
span,
|
||||
ResolutionError::ParamInNonTrivialAnonConst(
|
||||
rib_ident.name,
|
||||
),
|
||||
ResolutionError::ParamInNonTrivialAnonConst {
|
||||
name: rib_ident.name,
|
||||
is_type: true,
|
||||
},
|
||||
);
|
||||
}
|
||||
return Res::Err;
|
||||
|
@ -2718,7 +2719,10 @@ impl<'a> Resolver<'a> {
|
|||
if record_used {
|
||||
self.report_error(
|
||||
span,
|
||||
ResolutionError::ParamInNonTrivialAnonConst(rib_ident.name),
|
||||
ResolutionError::ParamInNonTrivialAnonConst {
|
||||
name: rib_ident.name,
|
||||
is_type: false,
|
||||
},
|
||||
);
|
||||
}
|
||||
return Res::Err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue