diff options
| author | Jubilee <workingjubilee@gmail.com> | 2024-10-30 14:01:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-30 14:01:38 -0700 |
| commit | 7b19508abea5943266fa018466a4a044d0d2350c (patch) | |
| tree | 85240c9b181766431b4f1d9f0dad50ebd50078fa /compiler/rustc_trait_selection/src | |
| parent | f90abe763b9aedfab0c12506e0a354b48bd0ca6d (diff) | |
| parent | 802f3a78a6eea323617964a168a612d1b0826bd6 (diff) | |
| download | rust-7b19508abea5943266fa018466a4a044d0d2350c.tar.gz rust-7b19508abea5943266fa018466a4a044d0d2350c.zip | |
Rollup merge of #132344 - compiler-errors:same-thing, r=lcnr
Merge `HostPolarity` and `BoundConstness` They're basically the same thing, and I think `BoundConstness` is easier to use. r? fee1-dead or reassign
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/effects.rs | 5 |
2 files changed, 7 insertions, 11 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 6014ed555b6..612e92ea784 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -545,10 +545,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { polarity: ty::PredicatePolarity::Positive, }), None, - Some(match predicate.host { - ty::HostPolarity::Maybe => ty::BoundConstness::ConstIfConst, - ty::HostPolarity::Const => ty::BoundConstness::Const, - }), + Some(predicate.constness), None, String::new(), ); @@ -2238,18 +2235,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { (None, _) => Some(cannot_do_this), // suggested using default post message ( - Some(ty::BoundConstness::Const | ty::BoundConstness::ConstIfConst), + Some(ty::BoundConstness::Const | ty::BoundConstness::Maybe), Some(AppendConstMessage::Default), ) => Some(format!("{cannot_do_this} in const contexts")), // overridden post message ( - Some(ty::BoundConstness::Const | ty::BoundConstness::ConstIfConst), + Some(ty::BoundConstness::Const | ty::BoundConstness::Maybe), Some(AppendConstMessage::Custom(custom_msg, _)), ) => Some(format!("{cannot_do_this}{custom_msg}")), // fallback to generic message - (Some(ty::BoundConstness::Const | ty::BoundConstness::ConstIfConst), None) => { - None - } + (Some(ty::BoundConstness::Const | ty::BoundConstness::Maybe), None) => None, } }) .unwrap_or_else(|| { diff --git a/compiler/rustc_trait_selection/src/traits/effects.rs b/compiler/rustc_trait_selection/src/traits/effects.rs index 60b3357810a..cb36f1a62db 100644 --- a/compiler/rustc_trait_selection/src/traits/effects.rs +++ b/compiler/rustc_trait_selection/src/traits/effects.rs @@ -47,7 +47,7 @@ fn match_candidate<'tcx>( obligation: &HostEffectObligation<'tcx>, candidate: ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>, ) -> Result<ThinVec<PredicateObligation<'tcx>>, NoSolution> { - if !candidate.skip_binder().host.satisfies(obligation.predicate.host) { + if !candidate.skip_binder().constness.satisfies(obligation.predicate.constness) { return Err(NoSolution); } @@ -135,7 +135,8 @@ fn evaluate_host_effect_from_selection_candiate<'tcx>( .map(|(trait_ref, _)| { obligation.with( tcx, - trait_ref.to_host_effect_clause(tcx, obligation.predicate.host), + trait_ref + .to_host_effect_clause(tcx, obligation.predicate.constness), ) }), ); |
