mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
make feature recommendations optional
This commit is contained in:
parent
814a560072
commit
da6261e07f
@ -487,7 +487,13 @@ impl<'a> Resolver<'a> {
|
||||
name
|
||||
));
|
||||
}
|
||||
err.help("use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions");
|
||||
|
||||
if self.session.is_nightly_build() {
|
||||
err.help(
|
||||
"use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` \
|
||||
to allow generic const expressions"
|
||||
);
|
||||
}
|
||||
|
||||
err
|
||||
}
|
||||
|
@ -315,17 +315,20 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
|
||||
),
|
||||
)
|
||||
} else {
|
||||
tcx.sess
|
||||
.struct_span_err(
|
||||
hir_ty.span,
|
||||
&format!(
|
||||
"{} is forbidden as the type of a const generic parameter",
|
||||
unsupported_type
|
||||
),
|
||||
)
|
||||
.note("the only supported types are integers, `bool` and `char`")
|
||||
.help("more complex types are supported with `#![feature(const_generics)]`")
|
||||
.emit()
|
||||
let mut err = tcx.sess.struct_span_err(
|
||||
hir_ty.span,
|
||||
&format!(
|
||||
"{} is forbidden as the type of a const generic parameter",
|
||||
unsupported_type
|
||||
),
|
||||
);
|
||||
err.note("the only supported types are integers, `bool` and `char`");
|
||||
if tcx.sess.is_nightly_build() {
|
||||
err.help(
|
||||
"more complex types are supported with `#![feature(const_generics)]`",
|
||||
);
|
||||
}
|
||||
err.emit()
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user