Change:
Hi! I'm trying to compile my Rocket/Diesel/R2d2 task management project, which has previously successfully compiled, and when I add the newest piece which relies on macros in some new/different way (sorry for vague, I'm new to rust) it starts failing to compile. Looking at the backtrace, the error seems to be in MacroExpander::expandinvoc. I expect it to have the same behavior as the simpler version of the route: which warns about unused query result on compile but successfully runs, builds the NewTask struct from url components, and inserts it into the database. it fails to compile during cargo run, and the same exact error shows during cargo check. I've pasted the whole command with outputs here: Check out my project's for the exact code where I get the bug. Check out my project's master branch at commit to see the functional version (requires a local postgresql instance and a DATABASEURL env variable in a env file).
I minimized down to nothing but 14 looping macros in order to squarely place the blame on a single culprit once and for all: A function that just loops surely cannot be responsible for dropping a , so the must be a bug in rustc. (I still rather doubt it is in though, but rather, in a function that gets inlined into it)
So... I mentioned in the other issue how terrifying of a concept I thought was. For the uninitiated, is a type alias for a with a in its variant, which acts like a ticking timebomb; it explodes if the error is ever dropped. Simply put, has some methods that you must never call on a . Do you see it? :wink:
Ha! Thank you for the digging That stray is really cheeky, ain't it?
I'll probably submit a PR; I'm just browsing around the existing test cases for plugins trying to glean "best practices." (I'm also trying to see if there's any test case that causes the other in the branch to blow up. I don't think there is since it appears that the full attribute gets parsed before it tries to expand .)

Discussion:
match *ext { MultiModifier(ref mac) => { <del> let meta = attr.parse_meta(self.cx.parse_sess).ok()?; </del> <ins> let meta = attr.parse_meta(self.cx.parse_sess) .map_err(|mut e| { e.emit(); }).ok()?; </ins> let item = mac.expand(self.cx, attr.span, &meta, item); Some(kind.expect_from_annotatables(item)) } MultiDecorator(ref mac) => { let mut items = Vec::new(); <del> let meta = attr.parse_meta(self.cx.parse_sess).ok()?; </del> <ins> let meta = attr.parse_meta(self.cx.parse_sess) .expect("derive meta should already have been parsed"); </ins> mac.expand(self.cx, attr.span, &meta, &item, &mut |item| items.push(item)); items.push(item); Some(kind.expect_from_annotatables(items))

Symbol::intern("into_multi_foo"), MultiModifier(Box::new(expand_into_foo_multi))); reg.register_syntax_extension( <ins> Symbol::intern("noop_attribute"), MultiModifier(Box::new(expand_noop_attribute))); reg.register_syntax_extension( </ins> Symbol::intern("duplicate"), MultiDecorator(Box::new(expand_duplicate))); }

} } <ins> fn expand_noop_attribute(_cx: &mut ExtCtxt, _sp: Span, _attr: &MetaItem, it: Annotatable) -> Annotatable { it } </ins> // Create a duplicate of the annotatable, based on the MetaItem fn expand_duplicate(cx: &mut ExtCtxt, _sp: Span,

<ins> // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // This is a regression test against an ICE that used to occur // on malformed attributes for a custom MultiModifier. // aux-build:macro_crate_test.rs // ignore-stage1 #![feature(plugin)] #![plugin(macro_crate_test)] #[noop_attribute"x"] //~ ERROR expected one of fn night() { } #[noop_attribute("hi"), rank = 2] //~ ERROR unexpected token fn knight() { } #[noop_attribute("/user", data= = "<user")] //~ ERROR literal or identifier fn nite() { } fn main() {} </ins>