Skip to content

Unexpected interpolate tokens in quote_item! macro #24914

Closed
@ptal

Description

@ptal

Recent changes (I guess #23085) make interpolated items unexpected when quoting items. The error is:expected one of const, extern, fn, pub, type, unsafe, or }, found an interpolated item``. The full failing code is available ptal/oak@20ddd3d and a snippet is below:

pub struct PegCompiler<'cx>
{
  cx: &'cx ExtCtxt<'cx>,
  top_level_items: Vec<rust::P<rust::Item>>
}

impl<'cx> PegCompiler<'cx>
{
  fn compile_peg(&mut self) {
    let items = &self.top_level_items;
    parser.push(quote_item!(self.cx,
        impl Parser
        {
          pub fn new() -> Parser
          {
            Parser
          }
          $items // <== Remove this, and the error dissapears.
        }).unwrap());
  }
}

On rustc 1.1.0-dev (441b3f0c2 2015-04-28) (built 2015-04-28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions