Skip to content

Commit 0c62c67

Browse files
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.
1 parent 14fca9f commit 0c62c67

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/librustc_ast_lowering/item.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ impl<'a, 'lowering, 'hir> Visitor<'a> for ItemLowerer<'a, 'lowering, 'hir> {
7171
self.lctx.with_parent_item_lifetime_defs(hir_id, |this| {
7272
let this = &mut ItemLowerer { lctx: this };
7373
if let ItemKind::Impl(.., ref opt_trait_ref, _, _) = item.kind {
74+
if opt_trait_ref.as_ref().map(|tr| tr.constness.is_some()).unwrap_or(false) {
75+
this.lctx
76+
.diagnostic()
77+
.span_err(item.span, "const trait impls are not yet implemented");
78+
}
79+
7480
this.with_trait_impl_ref(opt_trait_ref, |this| visit::walk_item(this, item));
7581
} else {
7682
visit::walk_item(this, item);

src/librustc_ast_lowering/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,6 +2575,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25752575
p: &PolyTraitRef,
25762576
mut itctx: ImplTraitContext<'_, 'hir>,
25772577
) -> hir::PolyTraitRef<'hir> {
2578+
if p.trait_ref.constness.is_some() {
2579+
self.diagnostic().span_err(p.span, "`?const` on trait bounds is not yet implemented");
2580+
}
2581+
25782582
let bound_generic_params = self.lower_generic_params(
25792583
&p.bound_generic_params,
25802584
&NodeMap::default(),

0 commit comments

Comments
 (0)