From 8e07a85ad7e998ef8c682abbd366cef981b7d168 Mon Sep 17 00:00:00 2001 From: Nathan Stocks Date: Wed, 5 Oct 2022 15:46:14 -0600 Subject: [PATCH] Remove code that was removed in master, and the corresponding diagnostic --- compiler/rustc_passes/src/check_const.rs | 22 +--------------------- compiler/rustc_passes/src/errors.rs | 9 --------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 0a509598ec51..aa726d6cd92a 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt; use rustc_session::parse::feature_err; use rustc_span::{sym, Span, Symbol}; -use crate::errors::{ConstImplConstTrait, ExprNotAllowedInContext}; +use crate::errors::ExprNotAllowedInContext; /// An expression that is not *always* legal in a const context. #[derive(Clone, Copy)] @@ -196,26 +196,6 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> { self.tcx.hir() } - fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { - let tcx = self.tcx; - if let hir::ItemKind::Impl(hir::Impl { - constness: hir::Constness::Const, - of_trait: Some(trait_ref), - .. - }) = item.kind - && let Some(def_id) = trait_ref.trait_def_id() - { - let source_map = tcx.sess.source_map(); - if !tcx.has_attr(def_id, sym::const_trait) { - tcx.sess.emit_err(ConstImplConstTrait { - span: source_map.guess_head_span(item.span), - def_span: source_map.guess_head_span(tcx.def_span(def_id)), - }); - } - } - intravisit::walk_item(self, item); - } - fn visit_anon_const(&mut self, anon: &'tcx hir::AnonConst) { let kind = Some(hir::ConstContext::Const); self.recurse_into(kind, None, |this| intravisit::walk_anon_const(this, anon)); diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index e7d652c50487..0f07da19c7d5 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -859,15 +859,6 @@ pub struct ExprNotAllowedInContext<'a> { pub context: &'a str, } -#[derive(Diagnostic)] -#[diag(passes::const_impl_const_trait)] -pub struct ConstImplConstTrait { - #[primary_span] - pub span: Span, - #[note] - pub def_span: Span, -} - pub struct BreakNonLoop<'a> { pub span: Span, pub head: Option,