return ExpandResult::Ready(vec![item]);
}
+ let item = cfg_eval(ecx, item);
+
let result =
ecx.resolver.resolve_derives(ecx.current_expansion.id, ecx.force_mode, &|| {
let template =
report_path_args(sess, &meta);
meta.path
})
- .map(|path| (path, None))
+ .map(|path| (path, item.clone(), None))
.collect()
});
match result {
- Ok(()) => ExpandResult::Ready(cfg_eval(ecx, item)),
+ Ok(()) => ExpandResult::Ready(vec![item]),
Err(Indeterminate) => ExpandResult::Retry(item),
}
}
sess,
span,
E0774,
- "`derive` may only be applied to structs, enums and unions",
+ "`derive` may only be applied to `struct`s, `enum`s and `union`s",
)
+ .span_label(span, "not applicable here")
+ .span_label(item.span(), "not a `struct`, `enum` or `union`")
.emit();
}
bad_target
_ => "for example, write `#[derive(Debug)]` for `Debug`".to_string(),
};
struct_span_err!(sess, lit.span, E0777, "expected path to a trait, found literal",)
+ .span_label(lit.span, "not a trait")
.help(&help_msg)
.emit();
}