Error when new syntax is lowered

This means the new syntax will always fail to compile, even when the
feature gate is enabled. These checks will be removed in a later PR
once the implementation is done.
This commit is contained in:
Dylan MacKenzie 2020-01-02 16:35:07 -08:00
parent 0cf52a7dd8
commit b390fc4cf1
2 changed files with 10 additions and 0 deletions

View file

@ -71,6 +71,12 @@ impl<'a, 'lowering, 'hir> Visitor<'a> for ItemLowerer<'a, 'lowering, 'hir> {
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);

View file

@ -2579,6 +2579,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
p: &PolyTraitRef,
mut itctx: ImplTraitContext<'_, 'hir>,
) -> hir::PolyTraitRef<'hir> {
if p.trait_ref.constness.is_some() {
self.diagnostic().span_err(p.span, "`?const` on trait bounds is not yet implemented");
}
let bound_generic_params = self.lower_generic_params(
&p.bound_generic_params,
&NodeMap::default(),