Skip to content

Commit 8e07a85

Browse files
committed
Remove code that was removed in master, and the corresponding diagnostic
1 parent 965dbf6 commit 8e07a85

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

compiler/rustc_passes/src/check_const.rs

+1-21
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt;
1717
use rustc_session::parse::feature_err;
1818
use rustc_span::{sym, Span, Symbol};
1919

20-
use crate::errors::{ConstImplConstTrait, ExprNotAllowedInContext};
20+
use crate::errors::ExprNotAllowedInContext;
2121

2222
/// An expression that is not *always* legal in a const context.
2323
#[derive(Clone, Copy)]
@@ -196,26 +196,6 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
196196
self.tcx.hir()
197197
}
198198

199-
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
200-
let tcx = self.tcx;
201-
if let hir::ItemKind::Impl(hir::Impl {
202-
constness: hir::Constness::Const,
203-
of_trait: Some(trait_ref),
204-
..
205-
}) = item.kind
206-
&& let Some(def_id) = trait_ref.trait_def_id()
207-
{
208-
let source_map = tcx.sess.source_map();
209-
if !tcx.has_attr(def_id, sym::const_trait) {
210-
tcx.sess.emit_err(ConstImplConstTrait {
211-
span: source_map.guess_head_span(item.span),
212-
def_span: source_map.guess_head_span(tcx.def_span(def_id)),
213-
});
214-
}
215-
}
216-
intravisit::walk_item(self, item);
217-
}
218-
219199
fn visit_anon_const(&mut self, anon: &'tcx hir::AnonConst) {
220200
let kind = Some(hir::ConstContext::Const);
221201
self.recurse_into(kind, None, |this| intravisit::walk_anon_const(this, anon));

compiler/rustc_passes/src/errors.rs

-9
Original file line numberDiff line numberDiff line change
@@ -859,15 +859,6 @@ pub struct ExprNotAllowedInContext<'a> {
859859
pub context: &'a str,
860860
}
861861

862-
#[derive(Diagnostic)]
863-
#[diag(passes::const_impl_const_trait)]
864-
pub struct ConstImplConstTrait {
865-
#[primary_span]
866-
pub span: Span,
867-
#[note]
868-
pub def_span: Span,
869-
}
870-
871862
pub struct BreakNonLoop<'a> {
872863
pub span: Span,
873864
pub head: Option<Span>,

0 commit comments

Comments
 (0)