//! errors. We still look for those primitives in the MIR const-checker to ensure nothing slips
//! through, but errors for structured control flow in a `const` should be emitted here.
-use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc::hir::map::Map;
use rustc::session::config::nightly_options;
+use rustc::session::parse::feature_err;
use rustc::ty::query::Providers;
use rustc::ty::TyCtxt;
use rustc_error_codes::*;
+use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
+use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_span::{sym, Span, Symbol};
use syntax::ast::Mutability;
-use syntax::feature_gate::feature_err;
-use syntax::span_err;
use std::fmt;
required_gates.iter().copied().filter(|&g| !features.enabled(g)).collect();
match missing_gates.as_slice() {
- &[] => span_err!(self.tcx.sess, span, E0744, "{}", msg),
+ &[] => struct_span_err!(self.tcx.sess, span, E0744, "{}", msg).emit(),
// If the user enabled `#![feature(const_loop)]` but not `#![feature(const_if_match)]`,
// explain why their `while` loop is being rejected.
}
impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
- fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
+ type Map = Map<'tcx>;
+
+ fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}