Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skipped enum variants still contribute to bounds #892

Closed
dtolnay opened this issue Apr 21, 2017 · 1 comment
Closed

Skipped enum variants still contribute to bounds #892

dtolnay opened this issue Apr 21, 2017 · 1 comment
Assignees
Labels

Comments

@dtolnay
Copy link
Member

dtolnay commented Apr 21, 2017

There should be no bounds placed on T in this example, just like there wouldn't be with skip_serializing / skip_deserializing on a field.

#[macro_use]
extern crate serde_derive;

extern crate serde;
use serde::Serialize;

#[derive(Serialize)]
enum E<T> {
    #[serde(skip_serializing)]
    T(T),
    Unit,
}

struct Not;

fn main() {
    fn assert<T: Serialize>() {}
    assert::<E<Not>>();
}
error[E0277]: the trait bound `Not: serde::Serialize` is not satisfied
  --> src/main.rs:18:5
   |
18 |     assert::<E<Not>>();
   |     ^^^^^^^^^^^^^^^^ the trait `serde::Serialize` is not implemented for `Not`
   |
   = note: required because of the requirements on the impl of `serde::Serialize` for `E<Not>`
   = note: required by `main::assert`
@dtolnay dtolnay added the bug label Apr 21, 2017
@dtolnay dtolnay self-assigned this May 7, 2018
@dtolnay
Copy link
Member Author

dtolnay commented May 8, 2018

Fixed in c4181f4.

@dtolnay dtolnay closed this as completed May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant