diff options
| author | Eric Holk <ericholk@microsoft.com> | 2022-02-11 11:36:02 -0800 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2022-03-07 08:47:18 -0800 |
| commit | 801be21d11806d37bacd7c7adaeb93a33871f31e (patch) | |
| tree | 300395a83ecf0e1858ae5634566ac7baa2a5bca7 /compiler | |
| parent | 8e93a48c32852b09f4270348883b61edba5bb068 (diff) | |
| download | rust-801be21d11806d37bacd7c7adaeb93a33871f31e.tar.gz rust-801be21d11806d37bacd7c7adaeb93a33871f31e.zip | |
Remove dead/useless code
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/check.rs | 36 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/ops.rs | 22 |
2 files changed, 0 insertions, 58 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index fc53f2785ca..3b255de6314 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -230,8 +230,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> { } } - self.check_item_predicates(); - for (idx, local) in body.local_decls.iter_enumerated() { // Handle the return place below. if idx == RETURN_PLACE || local.internal { @@ -364,40 +362,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> { } } - fn check_item_predicates(&mut self) { - let ConstCx { tcx, .. } = *self.ccx; - - let mut current = self.def_id().to_def_id(); - loop { - let predicates = tcx.predicates_of(current); - for (predicate, _) in predicates.predicates { - match predicate.kind().skip_binder() { - ty::PredicateKind::RegionOutlives(_) - | ty::PredicateKind::TypeOutlives(_) - | ty::PredicateKind::WellFormed(_) - | ty::PredicateKind::Projection(_) - | ty::PredicateKind::ConstEvaluatable(..) - | ty::PredicateKind::ConstEquate(..) - | ty::PredicateKind::Trait(..) - | ty::PredicateKind::TypeWellFormedFromEnv(..) => continue, - ty::PredicateKind::ObjectSafe(_) => { - bug!("object safe predicate on function: {:#?}", predicate) - } - ty::PredicateKind::ClosureKind(..) => { - bug!("closure kind predicate on function: {:#?}", predicate) - } - ty::PredicateKind::Subtype(_) | ty::PredicateKind::Coerce(_) => { - bug!("subtype/coerce predicate on function: {:#?}", predicate) - } - } - } - match predicates.parent { - Some(parent) => current = parent, - None => break, - } - } - } - fn check_mut_borrow(&mut self, local: Local, kind: hir::BorrowKind) { match self.const_kind() { // In a const fn all borrows are transient or point to the places given via 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 00c28fef5d2..0f5bcabeb84 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -816,26 +816,4 @@ pub mod ty { ) } } - - /// A trait bound with the `?const Trait` opt-out - #[derive(Debug)] - pub struct TraitBoundNotConst; - impl<'tcx> NonConstOp<'tcx> for TraitBoundNotConst { - fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status { - Status::Unstable(sym::const_trait_bound_opt_out) - } - - fn build_error( - &self, - ccx: &ConstCx<'_, 'tcx>, - span: Span, - ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> { - feature_err( - &ccx.tcx.sess.parse_sess, - sym::const_trait_bound_opt_out, - span, - "`?const Trait` syntax is unstable", - ) - } - } } |
