derive-new icon indicating copy to clipboard operation
derive-new copied to clipboard

Does not work with closure members

Open Boscop opened this issue 8 years ago • 0 comments

#[derive(new)]
pub struct P<'a> {
	pub f: &'a Fn(f32) -> String,
}

/*
error: proc-macro derive panicked
  = help: message: Couldn't parse item: "failed to parse macro input: 
  \"pub struct P<\\\'a> {\\n    pub f: &\\\'a Fn(f32) -> String,\\n}\""
*/

Another example:

#[derive(new)]
pub struct P<S: Fn(f32) -> String> {
	pub f: S,
}
/*
error: proc-macro derive panicked
   = help: message: Couldn't parse item: "failed to parse macro input: 
   \"pub struct P<S: Fn(f32) -> String> {\\n    pub f: S,\\n}\""
*/

Boscop avatar Jun 04 '17 16:06 Boscop