From 6c31f6ce1211a9f635526652eb85002850620277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Mar 2024 22:09:00 +0000 Subject: [PATCH] Provide structured suggestion for `#![feature(foo)]` ``` error: `S2<'_>` is forbidden as the type of a const generic parameter --> $DIR/lifetime-in-const-param.rs:5:23 | LL | struct S<'a, const N: S2>(&'a ()); | ^^ | = note: the only supported types are integers, `bool` and `char` help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | LL + #![feature(adt_const_params)] | ``` Fix #55941. --- .../src/transform/check_consts/ops.rs | 12 ++-- .../src/astconv/generics.rs | 10 ++-- compiler/rustc_hir_analysis/src/check/mod.rs | 4 ++ .../rustc_hir_analysis/src/check/wfcheck.rs | 11 +++- compiler/rustc_hir_typeck/src/method/probe.rs | 16 +++--- compiler/rustc_lint/src/levels.rs | 1 + compiler/rustc_middle/src/ty/context.rs | 43 ++++++++++++++- compiler/rustc_passes/src/check_const.rs | 15 ++--- compiler/rustc_session/messages.ftl | 3 + compiler/rustc_session/src/errors.rs | 12 ++++ compiler/rustc_session/src/parse.rs | 13 +++-- .../src/traits/error_reporting/suggestions.rs | 8 ++- .../passes/check_custom_code_classes.rs | 1 + .../ui/check-static-values-constraints.stderr | 5 +- .../suggest_feature_only_when_possible.rs | 12 ++-- .../suggest_feature_only_when_possible.stderr | 42 ++++++++++---- .../const-param-elided-lifetime.min.stderr | 25 +++++++-- ...ram-type-depends-on-const-param.min.stderr | 10 +++- ...ay-size-in-generic-struct-param.min.stderr | 5 +- .../unify-op-with-fn-call.stderr | 15 ++++- ...ics-type_name-as-const-argument.min.stderr | 5 +- tests/ui/const-generics/issue-93647.stderr | 5 +- .../issues/issue-56445-1.min.stderr | 5 +- .../issues/issue-62878.min.stderr | 10 +++- .../issues/issue-63322-forbid-dyn.min.stderr | 5 +- .../issues/issue-67185-2.stderr | 10 +++- .../issues/issue-68366.full.stderr | 5 +- .../issues/issue-68366.min.stderr | 5 +- .../issues/issue-68615-adt.min.stderr | 5 +- .../issues/issue-68615-array.min.stderr | 5 +- .../issues/issue-71169.min.stderr | 5 +- .../issues/issue-73491.min.stderr | 5 +- ...tic-reference-array-const-param.min.stderr | 5 +- .../issues/issue-74101.min.stderr | 10 +++- .../issues/issue-74255.min.stderr | 5 +- .../issues/issue-74950.min.stderr | 20 +++++-- .../issues/issue-75047.min.stderr | 5 +- .../const-generics/issues/issue-90318.stderr | 10 +++- .../lifetime-in-const-param.stderr | 5 +- .../min_const_generics/complex-types.stderr | 30 ++++++++-- .../ui/const-generics/nested-type.min.stderr | 5 +- .../slice-const-param-mismatch.min.stderr | 10 +++- .../std/const-generics-range.min.stderr | 30 ++++++++-- ...te-const-param-static-reference.min.stderr | 5 +- .../type-dependent/issue-71348.min.stderr | 10 +++- tests/ui/consts/const-fn-error.stderr | 10 +++- tests/ui/consts/const-for-feature-gate.stderr | 10 +++- tests/ui/consts/const-for.stderr | 10 +++- tests/ui/consts/const-try-feature-gate.stderr | 10 +++- tests/ui/consts/const-try.stderr | 10 +++- ...constifconst-call-in-const-position.stderr | 10 +++- tests/ui/consts/control-flow/loop.stderr | 20 +++++-- tests/ui/consts/control-flow/try.stderr | 10 +++- tests/ui/consts/fn_trait_refs.stderr | 25 +++++++-- .../invalid-inline-const-in-match-arm.stderr | 5 +- tests/ui/consts/issue-103790.stderr | 5 +- tests/ui/consts/issue-28113.stderr | 5 +- tests/ui/consts/issue-56164.stderr | 5 +- .../issue-68542-closure-in-array-len.stderr | 5 +- .../ui/consts/issue-73976-monomorphic.stderr | 5 +- tests/ui/consts/issue-90870.fixed | 37 ------------- tests/ui/consts/issue-90870.rs | 8 +-- tests/ui/consts/issue-90870.stderr | 19 +++++-- tests/ui/consts/issue-94675.stderr | 5 +- tests/ui/consts/try-operator.stderr | 20 +++++-- .../unstable-const-fn-in-libcore.stderr | 5 +- tests/ui/cross/cross-fn-cache-hole.stderr | 5 +- .../feature-gate-adt_const_params.stderr | 5 +- ...ature-gate-generic_arg_infer.normal.stderr | 5 +- .../feature-gate-trivial_bounds.stderr | 55 +++++++++++++++---- .../elided-lifetimes.stderr | 5 +- .../impl-trait/normalize-tait-in-const.stderr | 5 +- tests/ui/inference/inference_unstable.stderr | 31 +++++++++-- tests/ui/issues/issue-25901.stderr | 5 +- .../lifetimes/unusual-rib-combinations.stderr | 5 +- tests/ui/never_type/issue-52443.stderr | 10 +++- ...mpl-item-type-no-body-semantic-fail.stderr | 10 +++- .../issue-35813-postfix-after-cast.stderr | 5 +- tests/ui/resolve/issue-39559-2.stderr | 10 +++- .../call-const-trait-method-pass.stderr | 10 +++- .../const-closure-trait-method-fail.stderr | 5 +- .../const-closure-trait-method.stderr | 5 +- .../const-closures.stderr | 15 ++++- .../cross-crate.stock.stderr | 5 +- .../cross-crate.stocknc.stderr | 10 +++- .../generic-bound.stderr | 5 +- .../issue-102985.stderr | 5 +- .../issue-88155.stderr | 5 +- .../match-non-const-eq.gated.stderr | 5 +- .../match-non-const-eq.stock.stderr | 5 +- ...st-op-const-closure-non-const-outer.stderr | 5 +- .../staged-api-user-crate.stderr | 5 +- .../std-impl-gate.gated.stderr | 5 +- .../std-impl-gate.stock.stderr | 5 +- .../ui/specialization/const_trait_impl.stderr | 15 ++++- .../defaultimpl/validation.stderr | 5 +- .../trait-bounds/super-assoc-mismatch.stderr | 5 +- .../typeck_type_placeholder_item.stderr | 10 +++- 98 files changed, 755 insertions(+), 253 deletions(-) delete mode 100644 tests/ui/consts/issue-90870.fixed diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index 15720f25c5cff..e87e60f62dc88 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -99,7 +99,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { #[allow(rustc::untranslatable_diagnostic)] fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, _: Span) -> Diag<'tcx> { let FnCallNonConst { caller, callee, args, span, call_source, feature } = *self; - let ConstCx { tcx, param_env, .. } = *ccx; + let ConstCx { tcx, param_env, body, .. } = *ccx; let diag_trait = |err, self_ty: Ty<'_>, trait_id| { let trait_ref = TraitRef::from_method(tcx, trait_id, args); @@ -297,10 +297,12 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { ccx.const_kind(), )); - if let Some(feature) = feature - && ccx.tcx.sess.is_nightly_build() - { - err.help(format!("add `#![feature({feature})]` to the crate attributes to enable",)); + if let Some(feature) = feature { + ccx.tcx.disabled_nightly_features( + &mut err, + body.source.def_id().as_local().map(|local| ccx.tcx.local_def_id_to_hir_id(local)), + [(String::new(), feature)], + ); } if let ConstContext::Static(_) = ccx.const_kind() { diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/astconv/generics.rs index 428eea2f686e9..42e303c10ea84 100644 --- a/compiler/rustc_hir_analysis/src/astconv/generics.rs +++ b/compiler/rustc_hir_analysis/src/astconv/generics.rs @@ -16,7 +16,7 @@ use rustc_middle::ty::{ self, GenericArgsRef, GenericParamDef, GenericParamDefKind, IsSuggestable, Ty, TyCtxt, }; use rustc_session::lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS; -use rustc_span::symbol::kw; +use rustc_span::symbol::{kw, sym}; use smallvec::SmallVec; /// Report an error that a generic argument did not match the generic parameter that was @@ -41,9 +41,11 @@ fn generic_arg_mismatch_err( if let GenericParamDefKind::Const { .. } = param.kind { if matches!(arg, GenericArg::Type(hir::Ty { kind: hir::TyKind::Infer, .. })) { err.help("const arguments cannot yet be inferred with `_`"); - if sess.is_nightly_build() { - err.help("add `#![feature(generic_arg_infer)]` to the crate attributes to enable"); - } + tcx.disabled_nightly_features( + &mut err, + param.def_id.as_local().map(|local| tcx.local_def_id_to_hir_id(local)), + [(String::new(), sym::generic_arg_infer)], + ); } } diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 22afddad6336d..4c4ff28808e46 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -291,12 +291,16 @@ fn default_body_is_unstable( reason: reason_str, }); + let inject_span = item_did + .as_local() + .and_then(|id| tcx.crate_level_attribute_injection_span(tcx.local_def_id_to_hir_id(id))); rustc_session::parse::add_feature_diagnostics_for_issue( &mut err, &tcx.sess, feature, rustc_feature::GateIssue::Library(issue), false, + inject_span, ); err.emit(); diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index f525004534408..41b03f0b66e4f 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -999,9 +999,14 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(), // Implments `ConstParamTy`, suggest adding the feature to enable. Ok(..) => true, }; - if may_suggest_feature && tcx.sess.is_nightly_build() { - diag.help( - "add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types", + if may_suggest_feature { + tcx.disabled_nightly_features( + &mut diag, + Some(param.hir_id), + [( + " more complex and user defined types".to_string(), + sym::adt_const_params, + )], ); } diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index bdc796aca3a46..990f530123cf2 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -1420,15 +1420,13 @@ impl<'tcx> Pick<'tcx> { } _ => {} } - if tcx.sess.is_nightly_build() { - for (candidate, feature) in &self.unstable_candidates { - lint.help(format!( - "add `#![feature({})]` to the crate attributes to enable `{}`", - feature, - tcx.def_path_str(candidate.item.def_id), - )); - } - } + tcx.disabled_nightly_features( + lint, + Some(scope_expr_id), + self.unstable_candidates.iter().map(|(candidate, feature)| { + (format!(" `{}`", tcx.def_path_str(candidate.item.def_id)), *feature) + }), + ); }, ); } diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 95f312a31b332..21af6a182a9df 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -1078,6 +1078,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { feature, GateIssue::Language, lint_from_cli, + None, ); }, ); diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 17ba97c5fd3a7..10a4da4042903 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -43,7 +43,9 @@ use rustc_data_structures::sync::{self, FreezeReadGuard, Lock, Lrc, WorkerLocal} #[cfg(parallel_compiler)] use rustc_data_structures::sync::{DynSend, DynSync}; use rustc_data_structures::unord::UnordSet; -use rustc_errors::{Diag, DiagCtxt, DiagMessage, ErrorGuaranteed, LintDiagnostic, MultiSpan}; +use rustc_errors::{ + Applicability, Diag, DiagCtxt, DiagMessage, ErrorGuaranteed, LintDiagnostic, MultiSpan, +}; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; @@ -2174,6 +2176,45 @@ impl<'tcx> TyCtxt<'tcx> { lint_level(self.sess, lint, level, src, Some(span.into()), msg, decorate); } + /// Find the crate root and the appropriate span where `use` and outer attributes can be + /// inserted at. + pub fn crate_level_attribute_injection_span(self, hir_id: HirId) -> Option { + for (_hir_id, node) in self.hir().parent_iter(hir_id) { + if let hir::Node::Crate(m) = node { + return Some(m.spans.inject_use_span.shrink_to_lo()); + } + } + None + } + + pub fn disabled_nightly_features( + self, + diag: &mut Diag<'_, E>, + hir_id: Option, + features: impl IntoIterator, + ) { + if !self.sess.is_nightly_build() { + return; + } + + let span = hir_id.and_then(|id| self.crate_level_attribute_injection_span(id)); + for (desc, feature) in features { + // FIXME: make this string translatable + let msg = + format!("add `#![feature({feature})]` to the crate attributes to enable{desc}"); + if let Some(span) = span { + diag.span_suggestion_verbose( + span, + msg, + format!("#![feature({feature})]\n"), + Applicability::MachineApplicable, + ); + } else { + diag.help(msg); + } + } + } + /// Emit a lint from a lint struct (some type that implements `LintDiagnostic`, typically /// generated by `#[derive(LintDiagnostic)]`). #[track_caller] diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 30a65d69c4ef8..8080216a25236 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -155,16 +155,11 @@ impl<'tcx> CheckConstVisitor<'tcx> { // // FIXME(ecstaticmorse): Maybe this could be incorporated into `feature_err`? This // is a pretty narrow case, however. - if tcx.sess.is_nightly_build() { - for gate in missing_secondary { - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] - err.help(format!( - "add `#![feature({gate})]` to the crate attributes to enable" - )); - } - } + tcx.disabled_nightly_features( + &mut err, + def_id.map(|id| tcx.local_def_id_to_hir_id(id)), + missing_secondary.into_iter().map(|gate| (String::new(), *gate)), + ); err.emit(); } diff --git a/compiler/rustc_session/messages.ftl b/compiler/rustc_session/messages.ftl index 42c681e496174..179fd79bef7c8 100644 --- a/compiler/rustc_session/messages.ftl +++ b/compiler/rustc_session/messages.ftl @@ -24,6 +24,9 @@ session_feature_diagnostic_for_issue = session_feature_diagnostic_help = add `#![feature({$feature})]` to the crate attributes to enable +session_feature_diagnostic_suggestion = + add `#![feature({$feature})]` to the crate attributes to enable + session_feature_suggest_upgrade_compiler = this compiler was built on {$date}; consider upgrading it if it is out of date diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index d523da1ad7e38..cfbeac79e5082 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -54,6 +54,18 @@ pub struct FeatureDiagnosticHelp { pub feature: Symbol, } +#[derive(Subdiagnostic)] +#[suggestion( + session_feature_diagnostic_suggestion, + applicability = "maybe-incorrect", + code = "#![feature({feature})]\n" +)] +pub struct FeatureDiagnosticSuggestion { + pub feature: Symbol, + #[primary_span] + pub span: Span, +} + #[derive(Subdiagnostic)] #[help(session_cli_feature_diagnostic_help)] pub struct CliFeatureDiagnosticHelp { diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 398138d7e1ff3..5434bbe0b98a2 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -3,8 +3,8 @@ use crate::config::{Cfg, CheckCfg}; use crate::errors::{ - CliFeatureDiagnosticHelp, FeatureDiagnosticForIssue, FeatureDiagnosticHelp, FeatureGateError, - SuggestUpgradeCompiler, + CliFeatureDiagnosticHelp, FeatureDiagnosticForIssue, FeatureDiagnosticHelp, + FeatureDiagnosticSuggestion, FeatureGateError, SuggestUpgradeCompiler, }; use crate::lint::{ builtin::UNSTABLE_SYNTAX_PRE_EXPANSION, BufferedEarlyLint, BuiltinLintDiag, Lint, LintId, @@ -112,7 +112,7 @@ pub fn feature_err_issue( } let mut err = sess.psess.dcx.create_err(FeatureGateError { span, explain: explain.into() }); - add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false); + add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false, None); err } @@ -141,7 +141,7 @@ pub fn feature_warn_issue( explain: &'static str, ) { let mut err = sess.psess.dcx.struct_span_warn(span, explain); - add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false); + add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false, None); // Decorate this as a future-incompatibility lint as in rustc_middle::lint::lint_level let lint = UNSTABLE_SYNTAX_PRE_EXPANSION; @@ -160,7 +160,7 @@ pub fn add_feature_diagnostics( sess: &Session, feature: Symbol, ) { - add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language, false); + add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language, false, None); } /// Adds the diagnostics for a feature to an existing error. @@ -175,6 +175,7 @@ pub fn add_feature_diagnostics_for_issue( feature: Symbol, issue: GateIssue, feature_from_cli: bool, + inject_span: Option, ) { if let Some(n) = find_feature_issue(feature, issue) { err.subdiagnostic(sess.dcx(), FeatureDiagnosticForIssue { n }); @@ -184,6 +185,8 @@ pub fn add_feature_diagnostics_for_issue( if sess.psess.unstable_features.is_nightly_build() { if feature_from_cli { err.subdiagnostic(sess.dcx(), CliFeatureDiagnosticHelp { feature }); + } else if let Some(span) = inject_span { + err.subdiagnostic(sess.dcx(), FeatureDiagnosticSuggestion { feature, span }); } else { err.subdiagnostic(sess.dcx(), FeatureDiagnosticHelp { feature }); } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 067ca883bd8ad..e77d322b49058 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -3510,9 +3510,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } ObligationCauseCode::TrivialBound => { err.help("see issue #48214"); - if tcx.sess.opts.unstable_features.is_nightly_build() { - err.help("add `#![feature(trivial_bounds)]` to the crate attributes to enable"); - } + tcx.disabled_nightly_features( + err, + Some(tcx.local_def_id_to_hir_id(body_id)), + [(String::new(), sym::trivial_bounds)], + ); } ObligationCauseCode::OpaqueReturnType(expr_info) => { if let Some((expr_ty, expr_span)) = expr_info { diff --git a/src/librustdoc/passes/check_custom_code_classes.rs b/src/librustdoc/passes/check_custom_code_classes.rs index 451a44cd53a42..524795ed77c26 100644 --- a/src/librustdoc/passes/check_custom_code_classes.rs +++ b/src/librustdoc/passes/check_custom_code_classes.rs @@ -75,6 +75,7 @@ pub(crate) fn look_for_custom_classes<'tcx>(cx: &DocContext<'tcx>, item: &Item) sym::custom_code_classes_in_docs, GateIssue::Language, false, + None, ); err.note( diff --git a/tests/ui/check-static-values-constraints.stderr b/tests/ui/check-static-values-constraints.stderr index e7532de5647ad..dee1f2b1210a5 100644 --- a/tests/ui/check-static-values-constraints.stderr +++ b/tests/ui/check-static-values-constraints.stderr @@ -36,8 +36,11 @@ LL | field2: SafeEnum::Variant4("str".to_string()), | ^^^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:96:5 diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs index a83830178d40e..0d2e65c45eaf5 100644 --- a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs +++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs @@ -5,11 +5,16 @@ // Can never be used as const generics. fn uwu_0() {} //~^ ERROR: forbidden as the type of a const generic +//~| HELP: add `#![feature(adt_const_params)]` +//~| HELP: add `#![feature(adt_const_params)]` +//~| HELP: add `#![feature(adt_const_params)]` +//~| HELP: add `#![feature(adt_const_params)]` +//~| HELP: add `#![feature(adt_const_params)]` +//~| HELP: add `#![feature(adt_const_params)]` // Needs the feature but can be used, so suggest adding the feature. fn owo_0() {} //~^ ERROR: forbidden as the type of a const generic -//~^^ HELP: add `#![feature(adt_const_params)]` // Can only be used in const generics with changes. struct Meow { @@ -18,22 +23,17 @@ struct Meow { fn meow_0() {} //~^ ERROR: forbidden as the type of a const generic -//~^^ HELP: add `#![feature(adt_const_params)]` fn meow_1() {} //~^ ERROR: forbidden as the type of a const generic -//~^^ HELP: add `#![feature(adt_const_params)]` fn meow_2() {} //~^ ERROR: forbidden as the type of a const generic -//~^^ HELP: add `#![feature(adt_const_params)]` fn meow_3() {} //~^ ERROR: forbidden as the type of a const generic -//~^^ HELP: add `#![feature(adt_const_params)]` // This is suboptimal that it thinks it can be used // but better to suggest the feature to the user. fn meow_4() {} //~^ ERROR: forbidden as the type of a const generic -//~^^ HELP: add `#![feature(adt_const_params)]` // Non-local ADT that does not impl `ConstParamTy` fn nya_0() {} diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr index 04527e3158ed1..cd4349623d722 100644 --- a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr +++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr @@ -7,58 +7,76 @@ LL | fn uwu_0() {} = note: the only supported types are integers, `bool` and `char` error: `&'static u32` is forbidden as the type of a const generic parameter - --> $DIR/suggest_feature_only_when_possible.rs:10:19 + --> $DIR/suggest_feature_only_when_possible.rs:16:19 | LL | fn owo_0() {} | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `Meow` is forbidden as the type of a const generic parameter - --> $DIR/suggest_feature_only_when_possible.rs:19:20 + --> $DIR/suggest_feature_only_when_possible.rs:24:20 | LL | fn meow_0() {} | ^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&'static Meow` is forbidden as the type of a const generic parameter - --> $DIR/suggest_feature_only_when_possible.rs:22:20 + --> $DIR/suggest_feature_only_when_possible.rs:26:20 | LL | fn meow_1() {} | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `[Meow; 100]` is forbidden as the type of a const generic parameter - --> $DIR/suggest_feature_only_when_possible.rs:25:20 + --> $DIR/suggest_feature_only_when_possible.rs:28:20 | LL | fn meow_2() {} | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `(Meow, u8)` is forbidden as the type of a const generic parameter - --> $DIR/suggest_feature_only_when_possible.rs:28:20 + --> $DIR/suggest_feature_only_when_possible.rs:30:20 | LL | fn meow_3() {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `(Meow, String)` is forbidden as the type of a const generic parameter - --> $DIR/suggest_feature_only_when_possible.rs:34:20 + --> $DIR/suggest_feature_only_when_possible.rs:35:20 | LL | fn meow_4() {} | ^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `String` is forbidden as the type of a const generic parameter --> $DIR/suggest_feature_only_when_possible.rs:39:19 diff --git a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr index ffe4528598850..1c81b14f8f5c2 100644 --- a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr +++ b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr @@ -35,7 +35,10 @@ LL | struct A; | ^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:14:15 @@ -44,7 +47,10 @@ LL | impl A { | ^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:22:15 @@ -53,7 +59,10 @@ LL | impl B for A {} | ^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:26:17 @@ -62,7 +71,10 @@ LL | fn bar() {} | ^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:17:21 @@ -71,7 +83,10 @@ LL | fn foo(&self) {} | ^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 10 previous errors diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr index daeeadeed7cfd..fcc86b9ac33f2 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr @@ -21,7 +21,10 @@ LL | pub struct Dependent([(); N]); | ^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `[u8; N]` is forbidden as the type of a const generic parameter --> $DIR/const-param-type-depends-on-const-param.rs:15:35 @@ -30,7 +33,10 @@ LL | pub struct SelfDependent; | ^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr index 1f4b892e20f97..1f67a5c09f134 100644 --- a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr +++ b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr @@ -23,7 +23,10 @@ LL | struct B { | ^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr index 77a7da17c131c..0bf99bb8b2641 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr @@ -54,7 +54,10 @@ note: impl defined here, but it is not `const` LL | impl const std::ops::Add for Foo { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const fn `::add` in constants --> $DIR/unify-op-with-fn-call.rs:21:13 @@ -63,7 +66,10 @@ LL | bar::<{ std::ops::Add::add(N, N) }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const fn `::add` in constants --> $DIR/unify-op-with-fn-call.rs:30:14 @@ -72,7 +78,10 @@ LL | bar2::<{ std::ops::Add::add(N, N) }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 7 previous errors diff --git a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr index 95f75c32186a0..5e4acd80e9336 100644 --- a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr +++ b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr @@ -14,7 +14,10 @@ LL | trait Trait {} | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issue-93647.stderr b/tests/ui/const-generics/issue-93647.stderr index a87b59940cb8c..81f50a1b51724 100644 --- a/tests/ui/const-generics/issue-93647.stderr +++ b/tests/ui/const-generics/issue-93647.stderr @@ -6,7 +6,10 @@ LL | (||1usize)() | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-56445-1.min.stderr b/tests/ui/const-generics/issues/issue-56445-1.min.stderr index fc10aba0fecd0..580542bb6da38 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.min.stderr +++ b/tests/ui/const-generics/issues/issue-56445-1.min.stderr @@ -13,7 +13,10 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); | ^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr index 984381d1669ad..5205726d73845 100644 --- a/tests/ui/const-generics/issues/issue-62878.min.stderr +++ b/tests/ui/const-generics/issues/issue-62878.min.stderr @@ -13,7 +13,10 @@ LL | fn foo() {} | ^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error[E0747]: type provided when a constant was expected --> $DIR/issue-62878.rs:10:11 @@ -22,7 +25,10 @@ LL | foo::<_, { [1] }>(); | ^ | = help: const arguments cannot yet be inferred with `_` - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable +help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + | +LL + #![feature(generic_arg_infer)] + | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr index b9588e23e55ce..7f387cbd5a13f 100644 --- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr +++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr @@ -5,7 +5,10 @@ LL | fn test() { | ^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-67185-2.stderr b/tests/ui/const-generics/issues/issue-67185-2.stderr index 24a2d60f2e1f0..e39d43205c1d4 100644 --- a/tests/ui/const-generics/issues/issue-67185-2.stderr +++ b/tests/ui/const-generics/issues/issue-67185-2.stderr @@ -8,7 +8,10 @@ LL | ::Quaks: Bar, [u16; 4] [[u16; 3]; 3] = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied --> $DIR/issue-67185-2.rs:14:5 @@ -20,7 +23,10 @@ LL | [::Quaks; 2]: Bar, [u16; 4] [[u16; 3]; 3] = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied --> $DIR/issue-67185-2.rs:21:6 diff --git a/tests/ui/const-generics/issues/issue-68366.full.stderr b/tests/ui/const-generics/issues/issue-68366.full.stderr index dc20af7731068..3363a895e4725 100644 --- a/tests/ui/const-generics/issues/issue-68366.full.stderr +++ b/tests/ui/const-generics/issues/issue-68366.full.stderr @@ -5,7 +5,10 @@ LL | struct Collatz>; | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-68366.rs:12:7 diff --git a/tests/ui/const-generics/issues/issue-68366.min.stderr b/tests/ui/const-generics/issues/issue-68366.min.stderr index 78e49f46e1a4b..276f91e76dd42 100644 --- a/tests/ui/const-generics/issues/issue-68366.min.stderr +++ b/tests/ui/const-generics/issues/issue-68366.min.stderr @@ -14,7 +14,10 @@ LL | struct Collatz>; | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-68366.rs:12:7 diff --git a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr index 20962098bfff9..2f95eef98c01e 100644 --- a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr +++ b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr @@ -5,7 +5,10 @@ LL | struct Const {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-68615-array.min.stderr b/tests/ui/const-generics/issues/issue-68615-array.min.stderr index 8c76f9b5d65c3..6d18f8195d242 100644 --- a/tests/ui/const-generics/issues/issue-68615-array.min.stderr +++ b/tests/ui/const-generics/issues/issue-68615-array.min.stderr @@ -5,7 +5,10 @@ LL | struct Foo {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-71169.min.stderr b/tests/ui/const-generics/issues/issue-71169.min.stderr index bba92f32a7842..94d11f969ff8a 100644 --- a/tests/ui/const-generics/issues/issue-71169.min.stderr +++ b/tests/ui/const-generics/issues/issue-71169.min.stderr @@ -13,7 +13,10 @@ LL | fn foo() {} | ^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-73491.min.stderr b/tests/ui/const-generics/issues/issue-73491.min.stderr index 64df76756ac3a..8fdd65894ef2b 100644 --- a/tests/ui/const-generics/issues/issue-73491.min.stderr +++ b/tests/ui/const-generics/issues/issue-73491.min.stderr @@ -5,7 +5,10 @@ LL | fn hoge() {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr index 2b33f35defd0f..e9363d421487f 100644 --- a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr +++ b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr @@ -5,7 +5,10 @@ LL | fn a() {} | ^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-74101.min.stderr b/tests/ui/const-generics/issues/issue-74101.min.stderr index 7852ce5bcfcea..236556addcefd 100644 --- a/tests/ui/const-generics/issues/issue-74101.min.stderr +++ b/tests/ui/const-generics/issues/issue-74101.min.stderr @@ -5,7 +5,10 @@ LL | fn test() {} | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `[u8; 1 + 2]` is forbidden as the type of a const generic parameter --> $DIR/issue-74101.rs:9:21 @@ -14,7 +17,10 @@ LL | struct Foo; | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-74255.min.stderr b/tests/ui/const-generics/issues/issue-74255.min.stderr index 63d8fc12fa441..800902860a763 100644 --- a/tests/ui/const-generics/issues/issue-74255.min.stderr +++ b/tests/ui/const-generics/issues/issue-74255.min.stderr @@ -5,7 +5,10 @@ LL | fn ice_struct_fn() {} | ^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-74950.min.stderr b/tests/ui/const-generics/issues/issue-74950.min.stderr index a573dac608753..086176d9959c7 100644 --- a/tests/ui/const-generics/issues/issue-74950.min.stderr +++ b/tests/ui/const-generics/issues/issue-74950.min.stderr @@ -5,7 +5,10 @@ LL | struct Outer; | ^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `Inner` is forbidden as the type of a const generic parameter --> $DIR/issue-74950.rs:19:23 @@ -14,8 +17,11 @@ LL | struct Outer; | ^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `Inner` is forbidden as the type of a const generic parameter --> $DIR/issue-74950.rs:19:23 @@ -24,8 +30,11 @@ LL | struct Outer; | ^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `Inner` is forbidden as the type of a const generic parameter --> $DIR/issue-74950.rs:19:23 @@ -34,8 +43,11 @@ LL | struct Outer; | ^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/issues/issue-75047.min.stderr b/tests/ui/const-generics/issues/issue-75047.min.stderr index 1d7ac1b01111b..f2cc76b9bed03 100644 --- a/tests/ui/const-generics/issues/issue-75047.min.stderr +++ b/tests/ui/const-generics/issues/issue-75047.min.stderr @@ -5,7 +5,10 @@ LL | struct Foo::value()]>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-90318.stderr b/tests/ui/const-generics/issues/issue-90318.stderr index 471a6660ce0f3..a534e8f8d44f8 100644 --- a/tests/ui/const-generics/issues/issue-90318.stderr +++ b/tests/ui/const-generics/issues/issue-90318.stderr @@ -29,7 +29,10 @@ LL | If<{ TypeId::of::() != TypeId::of::<()>() }>: True, note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot call non-const operator in constants --> $DIR/issue-90318.rs:22:10 @@ -40,7 +43,10 @@ LL | If<{ TypeId::of::() != TypeId::of::<()>() }>: True, note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/lifetime-in-const-param.stderr b/tests/ui/const-generics/lifetime-in-const-param.stderr index c2fcdcf1a7128..4096725c52a1b 100644 --- a/tests/ui/const-generics/lifetime-in-const-param.stderr +++ b/tests/ui/const-generics/lifetime-in-const-param.stderr @@ -11,7 +11,10 @@ LL | struct S<'a, const N: S2>(&'a ()); | ^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/min_const_generics/complex-types.stderr b/tests/ui/const-generics/min_const_generics/complex-types.stderr index 8cc75dbaff9c3..8e83ea58194f7 100644 --- a/tests/ui/const-generics/min_const_generics/complex-types.stderr +++ b/tests/ui/const-generics/min_const_generics/complex-types.stderr @@ -5,7 +5,10 @@ LL | struct Foo; | ^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `()` is forbidden as the type of a const generic parameter --> $DIR/complex-types.rs:6:21 @@ -14,7 +17,10 @@ LL | struct Bar; | ^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `No` is forbidden as the type of a const generic parameter --> $DIR/complex-types.rs:11:21 @@ -23,7 +29,10 @@ LL | struct Fez; | ^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&'static u8` is forbidden as the type of a const generic parameter --> $DIR/complex-types.rs:14:21 @@ -32,7 +41,10 @@ LL | struct Faz; | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `!` is forbidden as the type of a const generic parameter --> $DIR/complex-types.rs:17:21 @@ -49,7 +61,10 @@ LL | enum Goo { A, B } | ^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `()` is forbidden as the type of a const generic parameter --> $DIR/complex-types.rs:23:20 @@ -58,7 +73,10 @@ LL | union Boo { a: () } | ^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 7 previous errors diff --git a/tests/ui/const-generics/nested-type.min.stderr b/tests/ui/const-generics/nested-type.min.stderr index ca5af5f969f58..0da2b30e3f1a9 100644 --- a/tests/ui/const-generics/nested-type.min.stderr +++ b/tests/ui/const-generics/nested-type.min.stderr @@ -30,7 +30,10 @@ LL | | }]>; | |__^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr index 26f5af6c831c1..0650dafc685d5 100644 --- a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr +++ b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr @@ -5,7 +5,10 @@ LL | struct ConstString; | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&'static [u8]` is forbidden as the type of a const generic parameter --> $DIR/slice-const-param-mismatch.rs:9:28 @@ -14,7 +17,10 @@ LL | struct ConstBytes; | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error[E0308]: mismatched types --> $DIR/slice-const-param-mismatch.rs:14:35 diff --git a/tests/ui/const-generics/std/const-generics-range.min.stderr b/tests/ui/const-generics/std/const-generics-range.min.stderr index d45f749246c8e..67f137cf1a077 100644 --- a/tests/ui/const-generics/std/const-generics-range.min.stderr +++ b/tests/ui/const-generics/std/const-generics-range.min.stderr @@ -5,7 +5,10 @@ LL | struct _Range>; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `RangeFrom` is forbidden as the type of a const generic parameter --> $DIR/const-generics-range.rs:13:28 @@ -14,7 +17,10 @@ LL | struct _RangeFrom>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `RangeFull` is forbidden as the type of a const generic parameter --> $DIR/const-generics-range.rs:18:28 @@ -23,7 +29,10 @@ LL | struct _RangeFull; | ^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `RangeInclusive` is forbidden as the type of a const generic parameter --> $DIR/const-generics-range.rs:24:33 @@ -32,7 +41,10 @@ LL | struct _RangeInclusive>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `RangeTo` is forbidden as the type of a const generic parameter --> $DIR/const-generics-range.rs:29:26 @@ -41,7 +53,10 @@ LL | struct _RangeTo>; | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `RangeToInclusive` is forbidden as the type of a const generic parameter --> $DIR/const-generics-range.rs:34:35 @@ -50,7 +65,10 @@ LL | struct _RangeToInclusive>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 6 previous errors diff --git a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr index 25bb7ac803962..fdb6ddeb578b6 100644 --- a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr +++ b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr @@ -5,7 +5,10 @@ LL | struct Const; | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr index 6490592c1e1e6..f42a331a8a405 100644 --- a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr +++ b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr @@ -5,7 +5,10 @@ LL | trait Get<'a, const N: &'static str> { | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: `&'static str` is forbidden as the type of a const generic parameter --> $DIR/issue-71348.rs:18:25 @@ -14,7 +17,10 @@ LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a >::Ta | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-fn-error.stderr b/tests/ui/consts/const-fn-error.stderr index 68c335c71d958..14603e433c1c3 100644 --- a/tests/ui/consts/const-fn-error.stderr +++ b/tests/ui/consts/const-fn-error.stderr @@ -23,7 +23,10 @@ LL | for i in 0..x { note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0658]: mutable references are not allowed in constant functions --> $DIR/const-fn-error.rs:5:14 @@ -42,7 +45,10 @@ LL | for i in 0..x { | ^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 4 previous errors diff --git a/tests/ui/consts/const-for-feature-gate.stderr b/tests/ui/consts/const-for-feature-gate.stderr index 413d144ca0ac3..0f2f912572e8d 100644 --- a/tests/ui/consts/const-for-feature-gate.stderr +++ b/tests/ui/consts/const-for-feature-gate.stderr @@ -17,7 +17,10 @@ LL | for _ in 0..5 {} note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0658]: mutable references are not allowed in constants --> $DIR/const-for-feature-gate.rs:4:14 @@ -36,7 +39,10 @@ LL | for _ in 0..5 {} | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 4 previous errors diff --git a/tests/ui/consts/const-for.stderr b/tests/ui/consts/const-for.stderr index 3fb9787c0d868..8605fb8eef54a 100644 --- a/tests/ui/consts/const-for.stderr +++ b/tests/ui/consts/const-for.stderr @@ -7,7 +7,10 @@ LL | for _ in 0..5 {} note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot call non-const fn ` as Iterator>::next` in constants --> $DIR/const-for.rs:5:14 @@ -16,7 +19,10 @@ LL | for _ in 0..5 {} | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-try-feature-gate.stderr b/tests/ui/consts/const-try-feature-gate.stderr index efa1fb107f624..0c4c16fc56ac0 100644 --- a/tests/ui/consts/const-try-feature-gate.stderr +++ b/tests/ui/consts/const-try-feature-gate.stderr @@ -17,7 +17,10 @@ LL | Some(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions --> $DIR/const-try-feature-gate.rs:4:5 @@ -28,7 +31,10 @@ LL | Some(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr index 37a6598af9e6e..2d91424c8d320 100644 --- a/tests/ui/consts/const-try.stderr +++ b/tests/ui/consts/const-try.stderr @@ -10,7 +10,10 @@ note: impl defined here, but it is not `const` LL | impl const Try for TryMe { | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions --> $DIR/const-try.rs:33:5 @@ -24,7 +27,10 @@ note: impl defined here, but it is not `const` LL | impl const FromResidual for TryMe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/constifconst-call-in-const-position.stderr b/tests/ui/consts/constifconst-call-in-const-position.stderr index 42ad412582484..09827f29baf96 100644 --- a/tests/ui/consts/constifconst-call-in-const-position.stderr +++ b/tests/ui/consts/constifconst-call-in-const-position.stderr @@ -14,7 +14,10 @@ LL | [0; T::a()] | ^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const fn `::a` in constants --> $DIR/constifconst-call-in-const-position.rs:16:38 @@ -23,7 +26,10 @@ LL | const fn foo() -> [u8; T::a()] { | ^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/consts/control-flow/loop.stderr b/tests/ui/consts/control-flow/loop.stderr index e162a404ace8f..2815b888ccd97 100644 --- a/tests/ui/consts/control-flow/loop.stderr +++ b/tests/ui/consts/control-flow/loop.stderr @@ -37,7 +37,10 @@ LL | for i in 0..4 { note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0658]: mutable references are not allowed in constants --> $DIR/loop.rs:53:14 @@ -56,7 +59,10 @@ LL | for i in 0..4 { | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot convert `std::ops::Range` into an iterator in constants --> $DIR/loop.rs:60:14 @@ -67,7 +73,10 @@ LL | for i in 0..4 { note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0658]: mutable references are not allowed in constants --> $DIR/loop.rs:60:14 @@ -86,7 +95,10 @@ LL | for i in 0..4 { | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 8 previous errors diff --git a/tests/ui/consts/control-flow/try.stderr b/tests/ui/consts/control-flow/try.stderr index f4c42c4d819b9..e08f52369faaa 100644 --- a/tests/ui/consts/control-flow/try.stderr +++ b/tests/ui/consts/control-flow/try.stderr @@ -17,7 +17,10 @@ LL | x?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: `?` cannot convert from residual of `Option` in constant functions --> $DIR/try.rs:6:5 @@ -28,7 +31,10 @@ LL | x?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr index 527579d99eaf9..aad0ae64e8585 100644 --- a/tests/ui/consts/fn_trait_refs.stderr +++ b/tests/ui/consts/fn_trait_refs.stderr @@ -81,7 +81,10 @@ LL | assert!(test_one == (1, 1, 1)); | ^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const operator in constants --> $DIR/fn_trait_refs.rs:75:17 @@ -90,7 +93,10 @@ LL | assert!(test_two == (2, 2)); | ^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const closure in constant functions --> $DIR/fn_trait_refs.rs:17:5 @@ -99,11 +105,14 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | T: ~const Fn<()> + ~const Destruct + ~const std::ops::Fn<()>, | +++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/fn_trait_refs.rs:13:23 @@ -121,11 +130,14 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | T: ~const FnMut<()> + ~const Destruct + ~const std::ops::FnMut<()>, | ++++++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/fn_trait_refs.rs:20:27 @@ -143,11 +155,14 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | T: ~const FnOnce<()> + ~const std::ops::FnOnce<()>, | +++++++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/fn_trait_refs.rs:34:21 diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr index a88c16158f324..7579f7f969245 100644 --- a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr +++ b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr @@ -6,7 +6,10 @@ LL | const { (|| {})() } => {} | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-103790.stderr b/tests/ui/consts/issue-103790.stderr index abe7366483b05..eecaf5ff63a30 100644 --- a/tests/ui/consts/issue-103790.stderr +++ b/tests/ui/consts/issue-103790.stderr @@ -62,7 +62,10 @@ LL | struct S; | ^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 5 previous errors diff --git a/tests/ui/consts/issue-28113.stderr b/tests/ui/consts/issue-28113.stderr index 01bbe4bc9b96c..c2f53870173a3 100644 --- a/tests/ui/consts/issue-28113.stderr +++ b/tests/ui/consts/issue-28113.stderr @@ -6,7 +6,10 @@ LL | || -> u8 { 5 }() | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-56164.stderr b/tests/ui/consts/issue-56164.stderr index 1b267214a022e..6ec4ce0fbd70e 100644 --- a/tests/ui/consts/issue-56164.stderr +++ b/tests/ui/consts/issue-56164.stderr @@ -6,7 +6,10 @@ LL | const fn foo() { (||{})() } | = note: closures need an RFC before allowed to be called in constant functions = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: function pointer calls are not allowed in constant functions --> $DIR/issue-56164.rs:5:5 diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.stderr b/tests/ui/consts/issue-68542-closure-in-array-len.stderr index 3c0408cbedf73..b414a6e0dba0e 100644 --- a/tests/ui/consts/issue-68542-closure-in-array-len.stderr +++ b/tests/ui/consts/issue-68542-closure-in-array-len.stderr @@ -6,7 +6,10 @@ LL | a: [(); (|| { 0 })()] | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-73976-monomorphic.stderr b/tests/ui/consts/issue-73976-monomorphic.stderr index 465efc7bfc249..79dbed4bea82f 100644 --- a/tests/ui/consts/issue-73976-monomorphic.stderr +++ b/tests/ui/consts/issue-73976-monomorphic.stderr @@ -7,7 +7,10 @@ LL | GetTypeId::::VALUE == GetTypeId::::VALUE note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-90870.fixed b/tests/ui/consts/issue-90870.fixed deleted file mode 100644 index c125501f61c5f..0000000000000 --- a/tests/ui/consts/issue-90870.fixed +++ /dev/null @@ -1,37 +0,0 @@ -// Regression test for issue #90870. - -//@ run-rustfix - -#![allow(dead_code)] - -const fn f(a: &u8, b: &u8) -> bool { - *a == *b - //~^ ERROR: cannot call non-const operator in constant functions [E0015] - //~| HELP: consider dereferencing here - //~| HELP: add `#![feature(const_trait_impl)]` -} - -const fn g(a: &&&&i64, b: &&&&i64) -> bool { - ****a == ****b - //~^ ERROR: cannot call non-const operator in constant functions [E0015] - //~| HELP: consider dereferencing here - //~| HELP: add `#![feature(const_trait_impl)]` -} - -const fn h(mut a: &[u8], mut b: &[u8]) -> bool { - while let ([l, at @ ..], [r, bt @ ..]) = (a, b) { - if *l == *r { - //~^ ERROR: cannot call non-const operator in constant functions [E0015] - //~| HELP: consider dereferencing here - //~| HELP: add `#![feature(const_trait_impl)]` - a = at; - b = bt; - } else { - return false; - } - } - - a.is_empty() && b.is_empty() -} - -fn main() {} diff --git a/tests/ui/consts/issue-90870.rs b/tests/ui/consts/issue-90870.rs index 94254fb27f927..e1929c68c70a1 100644 --- a/tests/ui/consts/issue-90870.rs +++ b/tests/ui/consts/issue-90870.rs @@ -1,21 +1,20 @@ // Regression test for issue #90870. -//@ run-rustfix - #![allow(dead_code)] const fn f(a: &u8, b: &u8) -> bool { +//~^ HELP: add `#![feature(const_trait_impl)]` +//~| HELP: add `#![feature(const_trait_impl)]` +//~| HELP: add `#![feature(const_trait_impl)]` a == b //~^ ERROR: cannot call non-const operator in constant functions [E0015] //~| HELP: consider dereferencing here - //~| HELP: add `#![feature(const_trait_impl)]` } const fn g(a: &&&&i64, b: &&&&i64) -> bool { a == b //~^ ERROR: cannot call non-const operator in constant functions [E0015] //~| HELP: consider dereferencing here - //~| HELP: add `#![feature(const_trait_impl)]` } const fn h(mut a: &[u8], mut b: &[u8]) -> bool { @@ -23,7 +22,6 @@ const fn h(mut a: &[u8], mut b: &[u8]) -> bool { if l == r { //~^ ERROR: cannot call non-const operator in constant functions [E0015] //~| HELP: consider dereferencing here - //~| HELP: add `#![feature(const_trait_impl)]` a = at; b = bt; } else { diff --git a/tests/ui/consts/issue-90870.stderr b/tests/ui/consts/issue-90870.stderr index 8825efd1449d8..df88a0c95cc5b 100644 --- a/tests/ui/consts/issue-90870.stderr +++ b/tests/ui/consts/issue-90870.stderr @@ -1,15 +1,18 @@ error[E0015]: cannot call non-const operator in constant functions - --> $DIR/issue-90870.rs:8:5 + --> $DIR/issue-90870.rs:9:5 | LL | a == b | ^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable help: consider dereferencing here | LL | *a == *b | + + +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot call non-const operator in constant functions --> $DIR/issue-90870.rs:15:5 @@ -18,24 +21,30 @@ LL | a == b | ^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable help: consider dereferencing here | LL | ****a == ****b | ++++ ++++ +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot call non-const operator in constant functions - --> $DIR/issue-90870.rs:23:12 + --> $DIR/issue-90870.rs:22:12 | LL | if l == r { | ^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable help: consider dereferencing here | LL | if *l == *r { | + + +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/issue-94675.stderr b/tests/ui/consts/issue-94675.stderr index 60a56f85c11fd..ebfa09b2e5d5d 100644 --- a/tests/ui/consts/issue-94675.stderr +++ b/tests/ui/consts/issue-94675.stderr @@ -15,7 +15,10 @@ LL | self.bar[0] = baz.len(); note: impl defined here, but it is not `const` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/try-operator.stderr b/tests/ui/consts/try-operator.stderr index c19d1a6199d83..2c8b4c7fcd9cb 100644 --- a/tests/ui/consts/try-operator.stderr +++ b/tests/ui/consts/try-operator.stderr @@ -13,7 +13,10 @@ LL | Err(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/result.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: `?` cannot convert from residual of `Result` in constant functions --> $DIR/try-operator.rs:10:9 @@ -24,7 +27,10 @@ LL | Err(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/result.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: `?` cannot determine the branch of `Option<()>` in constant functions --> $DIR/try-operator.rs:18:9 @@ -35,7 +41,10 @@ LL | None?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions --> $DIR/try-operator.rs:18:9 @@ -46,7 +55,10 @@ LL | None?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 5 previous errors diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr index ee4a0f6a8436b..9590b3372e321 100644 --- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr +++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr @@ -11,11 +11,14 @@ LL | Opt::None => f(), | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | const fn unwrap_or_else T + ~const std::ops::FnOnce<()>>(self, f: F) -> T { | +++++++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0493]: destructor of `F` cannot be evaluated at compile-time --> $DIR/unstable-const-fn-in-libcore.rs:19:60 diff --git a/tests/ui/cross/cross-fn-cache-hole.stderr b/tests/ui/cross/cross-fn-cache-hole.stderr index dec2f2553c2c2..b7bcbc8933ff4 100644 --- a/tests/ui/cross/cross-fn-cache-hole.stderr +++ b/tests/ui/cross/cross-fn-cache-hole.stderr @@ -10,7 +10,10 @@ help: this trait has no implementations, consider adding one LL | trait Bar { } | ^^^^^^^^^^^^ = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `i32: Bar` is not satisfied --> $DIR/cross-fn-cache-hole.rs:30:15 diff --git a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr index e6eeca2e098a9..fcb9b8a6fc573 100644 --- a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr +++ b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr @@ -5,7 +5,10 @@ LL | struct Foo; | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr b/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr index bc022476c19c0..97370f0489b56 100644 --- a/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr +++ b/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr @@ -27,7 +27,10 @@ LL | let _x = foo::<_>([1,2]); | ^ | = help: const arguments cannot yet be inferred with `_` - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable +help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + | +LL + #![feature(generic_arg_infer)] + | error[E0658]: using `_` for array lengths is unstable --> $DIR/feature-gate-generic_arg_infer.rs:11:27 diff --git a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr index 5e62221628d26..0ee2d93fb26a2 100644 --- a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -6,7 +6,10 @@ LL | enum E where i32: Foo { V } | = help: the trait `Foo` is implemented for `()` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:12:16 @@ -16,7 +19,10 @@ LL | struct S where i32: Foo; | = help: the trait `Foo` is implemented for `()` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:14:15 @@ -26,7 +32,10 @@ LL | trait T where i32: Foo {} | = help: the trait `Foo` is implemented for `()` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:16:15 @@ -36,7 +45,10 @@ LL | union U where i32: Foo { f: i32 } | = help: the trait `Foo` is implemented for `()` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:20:23 @@ -46,7 +58,10 @@ LL | impl Foo for () where i32: Foo { | = help: the trait `Foo` is implemented for `()` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:28:14 @@ -56,7 +71,10 @@ LL | fn f() where i32: Foo | = help: the trait `Foo` is implemented for `()` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `String: Neg` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:36:38 @@ -65,7 +83,10 @@ LL | fn use_op(s: String) -> String where String: ::std::ops::Neg | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Neg` is not implemented for `String` | = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: `i32` is not an iterator --> $DIR/feature-gate-trivial_bounds.rs:40:20 @@ -75,7 +96,10 @@ LL | fn use_for() where i32: Iterator { | = help: the trait `Iterator` is not implemented for `i32` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:52:32 @@ -85,7 +109,10 @@ LL | struct TwoStrs(str, str) where str: Sized; | = help: the trait `Sized` is not implemented for `str` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:55:26 @@ -100,7 +127,10 @@ note: required because it appears within the type `Dst<(dyn A + 'static)>` LL | struct Dst { | ^^^ = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:59:30 @@ -110,7 +140,10 @@ LL | fn return_str() -> str where str: Sized { | = help: the trait `Sized` is not implemented for `str` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error: aborting due to 11 previous errors diff --git a/tests/ui/generic-const-items/elided-lifetimes.stderr b/tests/ui/generic-const-items/elided-lifetimes.stderr index e7df8ca5cfd99..1d4a997ff6067 100644 --- a/tests/ui/generic-const-items/elided-lifetimes.stderr +++ b/tests/ui/generic-const-items/elided-lifetimes.stderr @@ -28,7 +28,10 @@ LL | const I: &str = ""; | ^^^^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 4 previous errors diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index f77b4bd517f43..7ae8306d74d5d 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -11,11 +11,14 @@ LL | fun(filter_positive()); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | const fn with_positive Fn(&'a Alias<'a>) + ~const Destruct + ~const std::ops::Fn<(&Alias<'_>,)>>(fun: F) { | ++++++++++++++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0493]: destructor of `F` cannot be evaluated at compile-time --> $DIR/normalize-tait-in-const.rs:25:79 diff --git a/tests/ui/inference/inference_unstable.stderr b/tests/ui/inference/inference_unstable.stderr index c48aaf9f49528..51f086177dbab 100644 --- a/tests/ui/inference/inference_unstable.stderr +++ b/tests/ui/inference/inference_unstable.stderr @@ -7,8 +7,11 @@ LL | assert_eq!('x'.ipu_flatten(), 1); = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! = note: for more information, see issue #48919 = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten` = note: `#[warn(unstable_name_collisions)]` on by default +help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten` + | +LL + #![feature(ipu_flatten)] + | warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:19:20 @@ -19,7 +22,10 @@ LL | assert_eq!('x'.ipu_by_value_vs_by_ref(), 1); = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! = note: for more information, see issue #48919 = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_value_vs_by_ref(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_value_vs_by_ref` +help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_value_vs_by_ref` + | +LL + #![feature(ipu_flatten)] + | warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:22:20 @@ -30,7 +36,10 @@ LL | assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1); = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! = note: for more information, see issue #48919 = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_ref_vs_by_ref_mut(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_ref_vs_by_ref_mut` +help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_ref_vs_by_ref_mut` + | +LL + #![feature(ipu_flatten)] + | warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:25:40 @@ -41,17 +50,27 @@ LL | assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1) = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! = note: for more information, see issue #48919 = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_mut_ptr_vs_by_const_ptr(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_mut_ptr_vs_by_const_ptr` +help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_mut_ptr_vs_by_const_ptr` + | +LL + #![feature(ipu_flatten)] + | warning: an associated constant with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:28:16 | LL | assert_eq!(char::C, 1); - | ^^^^^^^ help: use the fully qualified path to the associated const: `::C` + | ^^^^^^^ | = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! = note: for more information, see issue #48919 - = help: add `#![feature(assoc_const_ipu_iter)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::C` +help: use the fully qualified path to the associated const + | +LL | assert_eq!(::C, 1); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ +help: add `#![feature(assoc_const_ipu_iter)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::C` + | +LL + #![feature(assoc_const_ipu_iter)] + | warning: 5 warnings emitted diff --git a/tests/ui/issues/issue-25901.stderr b/tests/ui/issues/issue-25901.stderr index 673f29fff18c2..5c19abffa0292 100644 --- a/tests/ui/issues/issue-25901.stderr +++ b/tests/ui/issues/issue-25901.stderr @@ -16,8 +16,11 @@ note: impl defined here, but it is not `const` LL | impl Deref for A { | ^^^^^^^^^^^^^^^^ = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index e3b70232ef86c..320e64a2f7744 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -56,7 +56,10 @@ LL | fn d() {} | ^ | = note: the only supported types are integers, `bool` and `char` - = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + | +LL + #![feature(adt_const_params)] + | error: aborting due to 8 previous errors diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr index 83afd9ef2f2ca..bab47064f6cdf 100644 --- a/tests/ui/never_type/issue-52443.stderr +++ b/tests/ui/never_type/issue-52443.stderr @@ -50,7 +50,10 @@ LL | [(); { for _ in 0usize.. {}; 0}]; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0658]: mutable references are not allowed in constants --> $DIR/issue-52443.rs:9:21 @@ -69,7 +72,10 @@ LL | [(); { for _ in 0usize.. {}; 0}]; | ^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 6 previous errors; 1 warning emitted diff --git a/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr index 29b0b25a564d9..9800420072be4 100644 --- a/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr +++ b/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr @@ -89,12 +89,15 @@ LL | type W: Ord where Self: Eq; | ^^^^^^^^ the trait `Eq` is not implemented for `X` | = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable help: consider annotating `X` with `#[derive(Eq)]` | LL + #[derive(Eq)] LL | struct X; | +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `X: Eq` is not satisfied --> $DIR/impl-item-type-no-body-semantic-fail.rs:18:18 @@ -103,12 +106,15 @@ LL | type W where Self: Eq; | ^^^^^^^^ the trait `Eq` is not implemented for `X` | = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable help: consider annotating `X` with `#[derive(Eq)]` | LL + #[derive(Eq)] LL | struct X; | +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0592]: duplicate definitions with name `W` --> $DIR/impl-item-type-no-body-semantic-fail.rs:18:5 diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr index 6a8cbd9389b76..7b896ce14266a 100644 --- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr +++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr @@ -352,8 +352,11 @@ LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); | ^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 40 previous errors diff --git a/tests/ui/resolve/issue-39559-2.stderr b/tests/ui/resolve/issue-39559-2.stderr index e9d8eb0835bdb..7f51357a56f44 100644 --- a/tests/ui/resolve/issue-39559-2.stderr +++ b/tests/ui/resolve/issue-39559-2.stderr @@ -5,7 +5,10 @@ LL | let array: [usize; Dim3::dim()] | ^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot call non-const fn `::dim` in constants --> $DIR/issue-39559-2.rs:16:15 @@ -14,7 +17,10 @@ LL | = [0; Dim3::dim()]; | ^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr index f802841d2e468..22e8e692752cc 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr @@ -10,7 +10,10 @@ note: impl defined here, but it is not `const` LL | impl const std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const fn `::plus` in constant functions --> $DIR/call-const-trait-method-pass.rs:36:7 @@ -19,7 +22,10 @@ LL | a.plus(b) | ^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr index 14c41f3e01d6f..151bd6facf72c 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr @@ -11,11 +11,14 @@ LL | x(()) | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | const fn need_const_closure i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 { | ++++++++++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr index 8fe11fffbf9f8..e2b3e35270122 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr @@ -11,11 +11,14 @@ LL | x(()) | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | const fn need_const_closure i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 { | ++++++++++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr index a225125ef53d6..e5a773123e904 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr @@ -29,11 +29,14 @@ LL | f() + f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | const fn answer u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 { | +++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:24:11 @@ -42,11 +45,14 @@ LL | f() + f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | const fn answer u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 { | +++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:12:5 @@ -55,11 +61,14 @@ LL | f() * 7 | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable help: consider further restricting this bound | LL | F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>, | +++++++++++++++++++++++++ +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 7 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stock.stderr index ab039397edc23..a0c50ac7e61b4 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stock.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stock.stderr @@ -5,7 +5,10 @@ LL | Const.func(); | ^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr index ebbe9aa2202f9..312818ae6313e 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr @@ -5,7 +5,10 @@ LL | NonConst.func(); | ^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot call non-const fn `::func` in constant functions --> $DIR/cross-crate.rs:20:11 @@ -14,7 +17,10 @@ LL | Const.func(); | ^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr index f42fee59bf092..7905abfa40ed6 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr @@ -10,7 +10,10 @@ note: impl defined here, but it is not `const` LL | impl const std::ops::Add for S { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr index 0fa4c8fe04c1a..8401d1bd4f6c3 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr @@ -6,7 +6,10 @@ LL | n => n(), | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr index e5347a095981c..afe1ea3b1b732 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr @@ -5,7 +5,10 @@ LL | T::assoc() | ^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr index 28254ac15a87a..c7d211516614a 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr @@ -6,7 +6,10 @@ LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in | = note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr index 5431116a1a701..0f5ecac3891e9 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr @@ -6,7 +6,10 @@ LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in | = note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/non-const-op-const-closure-non-const-outer.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/non-const-op-const-closure-non-const-outer.stderr index d82a49be75e40..c362a1077e339 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/non-const-op-const-closure-non-const-outer.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/non-const-op-const-closure-non-const-outer.stderr @@ -5,7 +5,10 @@ LL | (const || { (()).foo() })(); | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api-user-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api-user-crate.stderr index 1346c4c4ae292..781191ec97cd1 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api-user-crate.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api-user-crate.stderr @@ -5,7 +5,10 @@ LL | Unstable::func(); | ^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.gated.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.gated.stderr index e51ff1483390c..d761fdce4bf0a 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.gated.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.gated.stderr @@ -11,7 +11,10 @@ LL | Default::default() | ^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.stock.stderr index 6d624def27693..b63ea695fc22a 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.stock.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.stock.stderr @@ -5,7 +5,10 @@ LL | Default::default() | ^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error: aborting due to 1 previous error diff --git a/tests/ui/specialization/const_trait_impl.stderr b/tests/ui/specialization/const_trait_impl.stderr index 187049e623cc7..fc02f6f8f7433 100644 --- a/tests/ui/specialization/const_trait_impl.stderr +++ b/tests/ui/specialization/const_trait_impl.stderr @@ -23,7 +23,10 @@ LL | const _: () = assert!(<()>::a() == 42); | ^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const fn `::a` in constants --> $DIR/const_trait_impl.rs:53:23 @@ -32,7 +35,10 @@ LL | const _: () = assert!(::a() == 3); | ^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error[E0015]: cannot call non-const fn `::a` in constants --> $DIR/const_trait_impl.rs:54:23 @@ -41,7 +47,10 @@ LL | const _: () = assert!(::a() == 2); | ^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(effects)]` to the crate attributes to enable +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | error: aborting due to 6 previous errors diff --git a/tests/ui/specialization/defaultimpl/validation.stderr b/tests/ui/specialization/defaultimpl/validation.stderr index 5f62e8dce17e4..f56f16162a27f 100644 --- a/tests/ui/specialization/defaultimpl/validation.stderr +++ b/tests/ui/specialization/defaultimpl/validation.stderr @@ -35,7 +35,10 @@ LL | default unsafe impl Send for S {} = help: the trait `Send` is not implemented for `S` = help: the trait `Send` is implemented for `S` = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error: impls of auto traits cannot be default --> $DIR/validation.rs:11:15 diff --git a/tests/ui/trait-bounds/super-assoc-mismatch.stderr b/tests/ui/trait-bounds/super-assoc-mismatch.stderr index 47535776348b9..f2c5eb47e5981 100644 --- a/tests/ui/trait-bounds/super-assoc-mismatch.stderr +++ b/tests/ui/trait-bounds/super-assoc-mismatch.stderr @@ -78,7 +78,10 @@ help: this trait has no implementations, consider adding one LL | trait Sub: Super {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable +help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + | +LL + #![feature(trivial_bounds)] + | error[E0277]: the trait bound `(): SubGeneric` is not satisfied --> $DIR/super-assoc-mismatch.rs:55:22 diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index e8f1de1ad04cd..8bcad56916aa9 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -673,7 +673,10 @@ LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0015]: cannot call non-const fn `, {closure@$DIR/typeck_type_placeholder_item.rs:230:29: 230:32}> as Iterator>::map::` in constants --> $DIR/typeck_type_placeholder_item.rs:230:45 @@ -682,7 +685,10 @@ LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); | ^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants - = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + | +LL + #![feature(const_trait_impl)] + | error[E0515]: cannot return reference to function parameter `x` --> $DIR/typeck_type_placeholder_item.rs:50:5