Rollup merge of #99558 - fee1-dead-contrib:remap_constness_fix, r=oli-obk
Fix `remap_constness` `~const Drop` was renamed to `~const Destruct` and this special case should be removed
This commit is contained in:
commit
b068dc7392
2 changed files with 6 additions and 13 deletions
|
@ -790,22 +790,15 @@ pub struct TraitPredicate<'tcx> {
|
|||
pub type PolyTraitPredicate<'tcx> = ty::Binder<'tcx, TraitPredicate<'tcx>>;
|
||||
|
||||
impl<'tcx> TraitPredicate<'tcx> {
|
||||
pub fn remap_constness(&mut self, tcx: TyCtxt<'tcx>, param_env: &mut ParamEnv<'tcx>) {
|
||||
if std::intrinsics::unlikely(Some(self.trait_ref.def_id) == tcx.lang_items().drop_trait()) {
|
||||
// remap without changing constness of this predicate.
|
||||
// this is because `T: ~const Drop` has a different meaning to `T: Drop`
|
||||
// FIXME(fee1-dead): remove this logic after beta bump
|
||||
param_env.remap_constness_with(self.constness)
|
||||
} else {
|
||||
*param_env = param_env.with_constness(self.constness.and(param_env.constness()))
|
||||
}
|
||||
pub fn remap_constness(&mut self, param_env: &mut ParamEnv<'tcx>) {
|
||||
*param_env = param_env.with_constness(self.constness.and(param_env.constness()))
|
||||
}
|
||||
|
||||
/// Remap the constness of this predicate before emitting it for diagnostics.
|
||||
pub fn remap_constness_diag(&mut self, param_env: ParamEnv<'tcx>) {
|
||||
// this is different to `remap_constness` that callees want to print this predicate
|
||||
// in case of selection errors. `T: ~const Drop` bounds cannot end up here when the
|
||||
// param_env is not const because we it is always satisfied in non-const contexts.
|
||||
// param_env is not const because it is always satisfied in non-const contexts.
|
||||
if let hir::Constness::NotConst = param_env.constness() {
|
||||
self.constness = ty::BoundConstness::NotConst;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue