Opt out of trait bounds on type params for #[derive(Animate)]

This allows us to not generate trait bounds for field types anymore,
by excluding bounds for type parameters used only in fields annotated
with `#[animation(error)]`.

The syntax is `#[animation(no_bound(Foo, Bar))]` where `Foo` is a type
parameter for the type on which we derive things. Ideally this should
be an attribute on the type parameter but this isn't stable yet.
This commit is contained in:
Anthony Ramine 2018-03-11 14:53:33 +01:00
parent 29e10d4f88
commit 5cc2d7c4b3
3 changed files with 24 additions and 13 deletions

View file

@ -43,6 +43,7 @@ pub enum ShapeBox {
/// A shape source, for some reference box.
#[allow(missing_docs)]
#[animate(no_bound(ImageOrUrl))]
#[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
#[animation(error)]

View file

@ -15,6 +15,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
/// An SVG paint value
///
/// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint>
#[animate(no_bound(UrlPaintServer))]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedValue, ToComputedValue, ToCss)]
pub struct SVGPaint<ColorType, UrlPaintServer> {
@ -29,6 +30,7 @@ pub struct SVGPaint<ColorType, UrlPaintServer> {
/// Whereas the spec only allows PaintServer
/// to have a fallback, Gecko lets the context
/// properties have a fallback as well.
#[animate(no_bound(UrlPaintServer))]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
pub enum SVGPaintKind<ColorType, UrlPaintServer> {