1
Fork 0

move 'trait bounds on const fn' to separate feature gate

This commit is contained in:
Ralf Jung 2021-04-18 18:36:41 +02:00
parent 6765010495
commit fdad6ab3a3
14 changed files with 44 additions and 31 deletions

View file

@ -642,12 +642,17 @@ pub mod ty {
}
fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {
mcf_status_in_item(ccx)
if ccx.const_kind() != hir::ConstContext::ConstFn {
Status::Allowed
} else {
Status::Unstable(sym::const_fn_trait_bound)
}
}
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
mcf_build_error(
ccx,
feature_err(
&ccx.tcx.sess.parse_sess,
sym::const_fn_trait_bound,
span,
"trait bounds other than `Sized` on const fn parameters are unstable",
)