Skip to content

Commit b390fc4

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 0cf52a7 commit b390fc4

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
@@ -2579,6 +2579,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25792579
p: &PolyTraitRef,
25802580
mut itctx: ImplTraitContext<'_, 'hir>,
25812581
) -> hir::PolyTraitRef<'hir> {
2582+
if p.trait_ref.constness.is_some() {
2583+
self.diagnostic().span_err(p.span, "`?const` on trait bounds is not yet implemented");
2584+
}
2585+
25822586
let bound_generic_params = self.lower_generic_params(
25832587
&p.bound_generic_params,
25842588
&NodeMap::default(),

0 commit comments

Comments
 (0)