Skip to content

Commit 801be21

Browse files
committed
Remove dead/useless code
1 parent 8e93a48 commit 801be21

File tree

2 files changed

+0
-58
lines changed

2 files changed

+0
-58
lines changed

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
230230
}
231231
}
232232

233-
self.check_item_predicates();
234-
235233
for (idx, local) in body.local_decls.iter_enumerated() {
236234
// Handle the return place below.
237235
if idx == RETURN_PLACE || local.internal {
@@ -364,40 +362,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
364362
}
365363
}
366364

367-
fn check_item_predicates(&mut self) {
368-
let ConstCx { tcx, .. } = *self.ccx;
369-
370-
let mut current = self.def_id().to_def_id();
371-
loop {
372-
let predicates = tcx.predicates_of(current);
373-
for (predicate, _) in predicates.predicates {
374-
match predicate.kind().skip_binder() {
375-
ty::PredicateKind::RegionOutlives(_)
376-
| ty::PredicateKind::TypeOutlives(_)
377-
| ty::PredicateKind::WellFormed(_)
378-
| ty::PredicateKind::Projection(_)
379-
| ty::PredicateKind::ConstEvaluatable(..)
380-
| ty::PredicateKind::ConstEquate(..)
381-
| ty::PredicateKind::Trait(..)
382-
| ty::PredicateKind::TypeWellFormedFromEnv(..) => continue,
383-
ty::PredicateKind::ObjectSafe(_) => {
384-
bug!("object safe predicate on function: {:#?}", predicate)
385-
}
386-
ty::PredicateKind::ClosureKind(..) => {
387-
bug!("closure kind predicate on function: {:#?}", predicate)
388-
}
389-
ty::PredicateKind::Subtype(_) | ty::PredicateKind::Coerce(_) => {
390-
bug!("subtype/coerce predicate on function: {:#?}", predicate)
391-
}
392-
}
393-
}
394-
match predicates.parent {
395-
Some(parent) => current = parent,
396-
None => break,
397-
}
398-
}
399-
}
400-
401365
fn check_mut_borrow(&mut self, local: Local, kind: hir::BorrowKind) {
402366
match self.const_kind() {
403367
// In a const fn all borrows are transient or point to the places given via

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -816,26 +816,4 @@ pub mod ty {
816816
)
817817
}
818818
}
819-
820-
/// A trait bound with the `?const Trait` opt-out
821-
#[derive(Debug)]
822-
pub struct TraitBoundNotConst;
823-
impl<'tcx> NonConstOp<'tcx> for TraitBoundNotConst {
824-
fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status {
825-
Status::Unstable(sym::const_trait_bound_opt_out)
826-
}
827-
828-
fn build_error(
829-
&self,
830-
ccx: &ConstCx<'_, 'tcx>,
831-
span: Span,
832-
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
833-
feature_err(
834-
&ccx.tcx.sess.parse_sess,
835-
sym::const_trait_bound_opt_out,
836-
span,
837-
"`?const Trait` syntax is unstable",
838-
)
839-
}
840-
}
841819
}

0 commit comments

Comments
 (0)