make feature recommendations optional
This commit is contained in:
parent
814a560072
commit
da6261e07f
2 changed files with 21 additions and 12 deletions
|
@ -487,7 +487,13 @@ impl<'a> Resolver<'a> {
|
||||||
name
|
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
|
err
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,17 +315,20 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
tcx.sess
|
let mut err = tcx.sess.struct_span_err(
|
||||||
.struct_span_err(
|
hir_ty.span,
|
||||||
hir_ty.span,
|
&format!(
|
||||||
&format!(
|
"{} is forbidden as the type of a const generic parameter",
|
||||||
"{} is forbidden as the type of a const generic parameter",
|
unsupported_type
|
||||||
unsupported_type
|
),
|
||||||
),
|
);
|
||||||
)
|
err.note("the only supported types are integers, `bool` and `char`");
|
||||||
.note("the only supported types are integers, `bool` and `char`")
|
if tcx.sess.is_nightly_build() {
|
||||||
.help("more complex types are supported with `#![feature(const_generics)]`")
|
err.help(
|
||||||
.emit()
|
"more complex types are supported with `#![feature(const_generics)]`",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
err.emit()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue