diff options
| author | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2021-04-29 19:27:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 19:27:26 -0400 |
| commit | e6d8683239f27d2b99f50f71fb15dcf14d66c436 (patch) | |
| tree | 38dac59bb641d1bf761cd3df220c26ca3f270cc2 | |
| parent | 6e50ac8a3449af9b2d59cd7964ff0eb8cb003807 (diff) | |
| parent | da6261e07fa892f995703e4ae26832a633fa5a23 (diff) | |
| download | rust-e6d8683239f27d2b99f50f71fb15dcf14d66c436.tar.gz rust-e6d8683239f27d2b99f50f71fb15dcf14d66c436.zip | |
Rollup merge of #84705 - lcnr:const_generics-rec, r=joshtriplett
make feature recommendations optional this is what we're already doing for other feature gates, so it's better to be consistent
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/wfcheck.rs | 25 |
2 files changed, 21 insertions, 12 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index c5f12c0c691..6ea46f5c528 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -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 } diff --git a/compiler/rustc_typeck/src/check/wfcheck.rs b/compiler/rustc_typeck/src/check/wfcheck.rs index 26871d6f028..d25dd9a6e83 100644 --- a/compiler/rustc_typeck/src/check/wfcheck.rs +++ b/compiler/rustc_typeck/src/check/wfcheck.rs @@ -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() } }; |
