1
Fork 0

min_const_generics diagnostics improvements

2

3
This commit is contained in:
Ethan Brierley 2020-10-11 16:47:45 +01:00
parent 1661f77e7b
commit d7029cbd7e
54 changed files with 182 additions and 189 deletions

View file

@ -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