Remove code that was removed in master, and the corresponding diagnostic
This commit is contained in:
parent
965dbf6c28
commit
8e07a85ad7
2 changed files with 1 additions and 30 deletions
|
@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_session::parse::feature_err;
|
use rustc_session::parse::feature_err;
|
||||||
use rustc_span::{sym, Span, Symbol};
|
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.
|
/// An expression that is not *always* legal in a const context.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
@ -196,26 +196,6 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
|
||||||
self.tcx.hir()
|
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) {
|
fn visit_anon_const(&mut self, anon: &'tcx hir::AnonConst) {
|
||||||
let kind = Some(hir::ConstContext::Const);
|
let kind = Some(hir::ConstContext::Const);
|
||||||
self.recurse_into(kind, None, |this| intravisit::walk_anon_const(this, anon));
|
self.recurse_into(kind, None, |this| intravisit::walk_anon_const(this, anon));
|
||||||
|
|
|
@ -859,15 +859,6 @@ pub struct ExprNotAllowedInContext<'a> {
|
||||||
pub context: &'a str,
|
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 struct BreakNonLoop<'a> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub head: Option<Span>,
|
pub head: Option<Span>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue