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

Generalize even more impls #73

Merged
merged 1 commit into from
Aug 24, 2023
Merged

Generalize even more impls #73

merged 1 commit into from
Aug 24, 2023

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Aug 24, 2023

This PR is the serialization equivalent of the deserialization impl changes in #71.

fn assert_is_serializer<S: serde::Serializer>(_serializer: S) {}

fn do_thing(mut serializer: Box<dyn erased_serde::Serializer>) {
    assert_is_serializer(&mut *serializer);
}
error[E0597]: `*serializer` does not live long enough
 --> src/main.rs:4:26
  |
3 | fn do_thing(mut serializer: Box<dyn erased_serde::Serializer>) {
  |             -------------- binding `serializer` declared here
4 |     assert_is_serializer(&mut *serializer);
  |     ---------------------^^^^^^^^^^^^^^^^-
  |     |                    |
  |     |                    borrowed value does not live long enough
  |     argument requires that `*serializer` is borrowed for `'static`
5 | }
  | - `*serializer` dropped here while still borrowed

For more information about this error, try `rustc --explain E0597`.

@dtolnay dtolnay merged commit 8a9cefe into master Aug 24, 2023
15 checks passed
@dtolnay dtolnay deleted the serimpl branch August 24, 2023 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant