Description
Since upgrading to the latest nightly, I'm getting a compiler error for the following piece of code:
let field_set = quote_tokens!(context,
$var_name: self.$collection.pop(id),
);
This code is available in the Rustecs repository: https://github.com/hannobraun/rustecs/blob/cd844f90b3073626e4252ff46781bed6ab0b337e/rustecs_macros/src/generate/intermediate.rs#L73
The error:
/home/hanno/Projects/rustecs/rustecs_macros/src/generate/intermediate.rs:73:15: 73:19 error: expected identifier, found keyword `self`
/home/hanno/Projects/rustecs/rustecs_macros/src/generate/intermediate.rs:73 $var_name: self.$collection.pop(id),
^~~~
error: aborting due to previous error
Could not compile `rustecs_macros`.
I was able to create this reduced example:
// lib.rs
#![feature(quote)]
fn quote() {
quote_tokens!(context,
$var_name: self
);
}
While there are many reasons this code should not compile, it fails with the same error message. If I
- change
self
to something else or - remove the
:
or - Remove the
$
in$var_name
the error goes away and the compile fails with a different error (as expected).
I can reproduce the issue with the latest nightly. I'm not sure about the exact version, since rustc --version
only produces rustc 0.13.0-nightly
. I don't know which version broke it, but it must have been recent. The last successful Travis CI build was using 0.13.0-nightly (45cbdec41 2014-11-07 00:02:18 +0000)
. See https://travis-ci.org/hannobraun/rustecs/builds/40199720
More info about my system:
$ rustc --version=verbose
rustc 0.13.0-nightly
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly