Skip to content

Commit 6de0afc

Browse files
committed
Remove the special treatment of the const_cmp and const_trait_impl features
1 parent 3cc9f73 commit 6de0afc

8 files changed

Lines changed: 3 additions & 465 deletions

compiler/rustc_mir_build/src/builder/matches/match_pair.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_middle::mir::*;
55
use rustc_middle::span_bug;
66
use rustc_middle::thir::*;
77
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
8-
use rustc_span::sym;
98

109
use crate::builder::Builder;
1110
use crate::builder::expr::as_place::{PlaceBase, PlaceBuilder};
@@ -47,16 +46,11 @@ fn try_reconstruct_aggregate_constant<'tcx>(
4746

4847
impl<'a, 'tcx> Builder<'a, 'tcx> {
4948
/// Check if we can use aggregate `PartialEq::eq` comparisons for constant array/slice patterns.
50-
/// This is not possible in const contexts unless `#![feature(const_cmp, const_trait_impl)]` are enabled,
51-
/// because `PartialEq` is not const-stable.
49+
/// This is not possible in const contexts, because `PartialEq` is not const-stable yet.
5250
fn can_use_aggregate_eq(&self) -> bool {
53-
let const_partial_eq_enabled = {
54-
let features = self.tcx.features();
55-
features.enabled(sym::const_trait_impl) && features.enabled(sym::const_cmp)
56-
};
5751
let in_const_context = self.tcx.is_const_fn(self.def_id.to_def_id())
5852
|| !self.tcx.hir_body_owner_kind(self.def_id).is_fn_or_closure();
59-
!in_const_context || const_partial_eq_enabled
53+
!in_const_context
6054
}
6155
}
6256

compiler/rustc_span/src/symbol.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,6 @@ symbols! {
648648
const_block_items,
649649
const_c_variadic,
650650
const_closures,
651-
const_cmp,
652651
const_compare_raw_pointers,
653652
const_constructor,
654653
const_continue,

tests/mir-opt/building/match/aggregate_array_eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Verify that matching against a constant array pattern produces a single
55
// `PartialEq::eq` call rather than element-by-element comparisons.
66
// In const contexts, the aggregate comparison must NOT be used because
7-
// `PartialEq` is not const-stable (unless `#![feature(const_cmp)]`).
7+
// `PartialEq` is not const-stable.
88

99
#![crate_type = "lib"]
1010

tests/mir-opt/building/match/aggregate_array_eq_const_cmp.const_array_match.built.after.panic-abort.mir

Lines changed: 0 additions & 51 deletions
This file was deleted.

tests/mir-opt/building/match/aggregate_array_eq_const_cmp.const_array_match.built.after.panic-unwind.mir

Lines changed: 0 additions & 51 deletions
This file was deleted.

tests/mir-opt/building/match/aggregate_array_eq_const_cmp.const_try_from_matched.built.after.panic-abort.mir

Lines changed: 0 additions & 157 deletions
This file was deleted.

0 commit comments

Comments
 (0)