llogiq / flamer

A compiler plugin to insert flame calls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No longer compiles since nightly 2018-04-02

parasyte opened this issue · comments

Build error on rustc 1.27.0-nightly (eeea94c11 2018-04-06):

   Compiling flamer v0.2.0
error[E0004]: non-exhaustive patterns: `ForeignItem(_)`, `Stmt(_)` and `Expr(_)` not covered
  --> /Users/parasyte/.cargo/registry/src/github.com-1ecc6299db9ec823/flamer-0.2.0/src/lib.rs:20:11
   |
20 |     match a {
   |           ^ patterns `ForeignItem(_)`, `Stmt(_)` and `Expr(_)` not covered

error: aborting due to previous error

For more information about this error, try `rustc --explain E0004`.
error: Could not compile `flamer`.

Here's a simple patch to workaround the compile failure by ignoring foreign items, statements, and expressions. (But it would be really nice if these could be annotated by flamer!)

diff --git a/src/lib.rs b/src/lib.rs
index ec5af96..6f03265 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -24,6 +24,7 @@ pub fn insert_flame_guard(cx: &mut ExtCtxt, _span: Span, _mi: &MetaItem,
             i.map(|i| Flamer { cx: cx, ident: i.ident }.fold_trait_item(i).expect_one("expected exactly one item"))),
         Annotatable::ImplItem(i) => Annotatable::ImplItem(
             i.map(|i| Flamer { cx: cx, ident: i.ident }.fold_impl_item(i).expect_one("expected exactly one item"))),
+        _ => panic!("Unexpected Annotatable: {:?}", a),
     }
 }
 

Thank you for giving me notice!

Statements and expressions have no name, so I wouldn't know how to flame them. Perhaps I'll figure something out later.