update help message

This commit is contained in:
Bastian Kauschke 2020-07-16 11:10:22 +02:00
parent 6f5d8bf5c8
commit 0c511ab5c7
7 changed files with 22 additions and 13 deletions

View File

@ -442,14 +442,17 @@ impl<'a> Resolver<'a> {
);
err
}
ResolutionError::ParamInTyOfConstArg => {
ResolutionError::ParamInTyOfConstArg(name) => {
let mut err = struct_span_err!(
self.session,
span,
E0770,
"the type of const parameters must not depend on other generic parameters"
);
err.span_label(span, "const parameters must have a concrete type");
err.span_label(
span,
format!("the type must not depend on the parameter `{}`", name),
);
err
}
ResolutionError::SelfInTyParamDefault => {

View File

@ -215,7 +215,7 @@ enum ResolutionError<'a> {
/// Error E0128: type parameters with a default cannot use forward-declared identifiers.
ForwardDeclaredTyParam, // FIXME(const_generics:defaults)
/// ERROR E0770: the type of const parameters must not depend on other generic parameters.
ParamInTyOfConstArg,
ParamInTyOfConstArg(Symbol),
/// Error E0735: type parameters with a default cannot use `Self`
SelfInTyParamDefault,
/// Error E0767: use of unreachable label
@ -2484,7 +2484,7 @@ impl<'a> Resolver<'a> {
}
ConstParamTyRibKind => {
if record_used {
self.report_error(span, ParamInTyOfConstArg);
self.report_error(span, ParamInTyOfConstArg(rib_ident.name));
}
return Res::Err;
}
@ -2513,7 +2513,10 @@ impl<'a> Resolver<'a> {
FnItemRibKind => HasGenericParams::Yes,
ConstParamTyRibKind => {
if record_used {
self.report_error(span, ResolutionError::ParamInTyOfConstArg);
self.report_error(
span,
ResolutionError::ParamInTyOfConstArg(rib_ident.name),
);
}
return Res::Err;
}
@ -2552,7 +2555,10 @@ impl<'a> Resolver<'a> {
FnItemRibKind => HasGenericParams::Yes,
ConstParamTyRibKind => {
if record_used {
self.report_error(span, ResolutionError::ParamInTyOfConstArg);
self.report_error(
span,
ResolutionError::ParamInTyOfConstArg(rib_ident.name),
);
}
return Res::Err;
}

View File

@ -2,13 +2,13 @@ error[E0770]: the type of const parameters must not depend on other generic para
--> $DIR/const-param-type-depends-on-const-param.rs:9:52
|
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^ const parameters must have a concrete type
| ^ the type must not depend on the parameter `N`
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-const-param.rs:12:40
|
LL | pub struct SelfDependent<const N: [u8; N]>;
| ^ const parameters must have a concrete type
| ^ the type must not depend on the parameter `N`
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-param-type-depends-on-const-param.rs:1:12

View File

@ -2,7 +2,7 @@ error[E0770]: the type of const parameters must not depend on other generic para
--> $DIR/const-param-type-depends-on-type-param-ungated.rs:3:22
|
LL | struct B<T, const N: T>(PhantomData<[T; N]>);
| ^ const parameters must have a concrete type
| ^ the type must not depend on the parameter `T`
error[E0658]: const generics are unstable
--> $DIR/const-param-type-depends-on-type-param-ungated.rs:3:19

View File

@ -2,7 +2,7 @@ error[E0770]: the type of const parameters must not depend on other generic para
--> $DIR/const-param-type-depends-on-type-param.rs:9:34
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ const parameters must have a concrete type
| ^ the type must not depend on the parameter `T`
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-param-type-depends-on-type-param.rs:1:12

View File

@ -2,13 +2,13 @@ error[E0770]: the type of const parameters must not depend on other generic para
--> $DIR/issue-71381.rs:13:82
|
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
| ^^^^ const parameters must have a concrete type
| ^^^^ the type must not depend on the parameter `Args`
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/issue-71381.rs:22:40
|
LL | const FN: unsafe extern "C" fn(Args),
| ^^^^ const parameters must have a concrete type
| ^^^^ the type must not depend on the parameter `Args`
error: using function pointers as const generic parameters is forbidden
--> $DIR/issue-71381.rs:13:61

View File

@ -2,7 +2,7 @@ error[E0770]: the type of const parameters must not depend on other generic para
--> $DIR/issue-71611.rs:4:31
|
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
| ^ const parameters must have a concrete type
| ^ the type must not depend on the parameter `A`
error: using function pointers as const generic parameters is forbidden
--> $DIR/issue-71611.rs:4:21