min_const_generics
diagnostics improvements
2 3
This commit is contained in:
parent
1661f77e7b
commit
d7029cbd7e
54 changed files with 182 additions and 189 deletions
|
@ -469,24 +469,17 @@ impl<'a> Resolver<'a> {
|
|||
ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => {
|
||||
let mut err = self.session.struct_span_err(
|
||||
span,
|
||||
"generic parameters must not be used inside of non-trivial constant values",
|
||||
);
|
||||
err.span_label(
|
||||
span,
|
||||
&format!(
|
||||
"non-trivial anonymous constants must not depend on the parameter `{}`",
|
||||
name
|
||||
),
|
||||
"generic parameters must not be used inside const evaluations",
|
||||
);
|
||||
err.span_label(span, &format!("cannot perform const operation using `{}`", name));
|
||||
|
||||
if is_type {
|
||||
err.note("type parameters are currently not permitted in anonymous constants");
|
||||
err.note("type parameters may not be used in anonymous constants");
|
||||
} else {
|
||||
err.help(
|
||||
&format!("it is currently only allowed to use either `{0}` or `{{ {0} }}` as generic constants",
|
||||
name
|
||||
)
|
||||
);
|
||||
err.help(&format!(
|
||||
"const parameters may only be used as standalone arguments `{}`",
|
||||
name
|
||||
));
|
||||
}
|
||||
|
||||
err
|
||||
|
|
|
@ -218,7 +218,7 @@ enum ResolutionError<'a> {
|
|||
ParamInTyOfConstParam(Symbol),
|
||||
/// constant values inside of type parameter defaults must not depend on generic parameters.
|
||||
ParamInAnonConstInTyDefault(Symbol),
|
||||
/// generic parameters must not be used inside of non-trivial constant values.
|
||||
/// generic parameters must not be used inside const evaluations.
|
||||
///
|
||||
/// This error is only emitted when using `min_const_generics`.
|
||||
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue