]> git.lizzy.rs Git - rust.git/commitdiff
Error when new syntax is lowered
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Fri, 3 Jan 2020 00:35:07 +0000 (16:35 -0800)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Fri, 10 Jan 2020 00:46:15 +0000 (16:46 -0800)
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.

src/librustc_ast_lowering/item.rs
src/librustc_ast_lowering/lib.rs

index a5892a22d9dfaa945fa70bf9b458c5983934a9bf..7c95b2a86c6859ce33fff953fa243ab918285605 100644 (file)
@@ -71,6 +71,12 @@ fn visit_item(&mut self, item: &'a Item) {
             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);
index 385153b62ce8296082bb2119f9749f89ee273f1f..73d1e49725826ccc97d2058c286a22b9f9018c58 100644 (file)
@@ -2579,6 +2579,10 @@ fn lower_poly_trait_ref(
         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(),