use rustc::arena::Arena;
use rustc::bug;
-use rustc::hir;
-use rustc::hir::def::{DefKind, Res};
-use rustc::hir::def_id::DefId;
-use rustc::util::nodemap::NodeMap;
use rustc_error_codes::*;
+use rustc_errors::struct_span_err;
+use rustc_hir as hir;
+use rustc_hir::def::{DefKind, Res};
+use rustc_hir::def_id::DefId;
+use rustc_session::node_id::NodeMap;
use rustc_span::source_map::{respan, DesugaringKind};
use rustc_span::symbol::{kw, sym};
use rustc_span::Span;
use rustc_target::spec::abi;
use syntax::ast::*;
use syntax::attr;
-use syntax::struct_span_err;
use syntax::visit::{self, Visitor};
use log::debug;
pub(super) lctx: &'a mut LoweringContext<'lowering, 'hir>,
}
-impl<'a, 'lowering, 'hir> ItemLowerer<'a, 'lowering, 'hir> {
- fn with_trait_impl_ref<F>(&mut self, trait_impl_ref: &Option<TraitRef>, f: F)
- where
- F: FnOnce(&mut Self),
- {
+impl ItemLowerer<'_, '_, '_> {
+ fn with_trait_impl_ref(&mut self, impl_ref: &Option<TraitRef>, f: impl FnOnce(&mut Self)) {
let old = self.lctx.is_in_trait_impl;
- self.lctx.is_in_trait_impl = if let &None = trait_impl_ref { false } else { true };
+ self.lctx.is_in_trait_impl = if let &None = impl_ref { false } else { true };
f(self);
self.lctx.is_in_trait_impl = old;
}
}
-impl<'a, 'lowering, 'hir> Visitor<'a> for ItemLowerer<'a, 'lowering, 'hir> {
+impl<'a> Visitor<'a> for ItemLowerer<'a, '_, '_> {
fn visit_mod(&mut self, m: &'a Mod, _s: Span, _attrs: &[Attribute], n: NodeId) {
let hir_id = self.lctx.lower_node_id(n);
self.lctx.with_parent_item_lifetime_defs(hir_id, |this| {
let this = &mut ItemLowerer { lctx: this };
if let ItemKind::Impl(.., ref opt_trait_ref, _, _) = item.kind {
+ if opt_trait_ref.as_ref().map(|tr| tr.constness.is_some()).unwrap_or(false) {
+ this.lctx
+ .diagnostic()
+ .span_err(item.span, "const trait impls are not yet implemented");
+ }
+
this.with_trait_impl_ref(opt_trait_ref, |this| visit::walk_item(this, item));
} else {
visit::walk_item(this, item);