capnproto / capnpc-rust

Cap'n Proto code generation for Rust
76 stars 26 forks source link

capnpc panics when function argument contains an underscore #41

Closed gavento closed 7 years ago

gavento commented 7 years ago

Rust capnpc (ver 0.8.5) panics without a helpful message (in particular, no file name or line number) when a method parameter in an interface contains '_' (which is not allowed in capnp). Underscores in other names (methods, structs, ...) have a nice error message.

Minimal example:

@0xca18754725ac2b4c;
interface Foo {
    bar @0 (qu_uq :Int32) -> ();
}

Error mentions '_' but not the location (and a panic is not a nice result in any case):

thread 'main' panicked at 'not alphanumeric '_', i.e. 95', /home/gavento/.cargo/registry/src/github.com-1ecc6299db9ec823/capnpc-0.8.5/src/codegen.rs:115:8

Full trace: https://gist.github.com/gavento/9526b6b5971816c71041b2946e7a0cda

dwrensha commented 7 years ago

Thanks for the report. https://github.com/capnproto/capnpc-rust/pull/39 adds a better error message, and I've just now released capnpc version 0.8.6 which includes that change.