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

Build failure related to AsJson/JsonFrom #33

Closed
clehner opened this issue Jan 20, 2022 · 2 comments
Closed

Build failure related to AsJson/JsonFrom #33

clehner opened this issue Jan 20, 2022 · 2 comments

Comments

@clehner
Copy link
Contributor

clehner commented Jan 20, 2022

When building/testing v0.6.0 (7df142c), I get errors like this:

error[E0311]: the associated type `<K as generic_json::Json>::Array` may not live long enough
   --> src/util/json/build.rs:118:53
    |
118 | impl<J: JsonClone, K: JsonFrom<J>, T: AsJson<J, K>> AsJson<J, K> for [T] {
    |                                                     ^^^^^^^^^^^^
    |
    = help: consider adding an explicit lifetime bound `<K as generic_json::Json>::Array: 'a`...
    = note: ...so that the type `<K as generic_json::Json>::Array` will meet its required lifetime bounds...
note: ...that is required by this bound
   --> src/util/json/build.rs:13:35
    |
13  | pub trait AsJson<J: JsonClone, K: JsonFrom<J>> {
    |                                   ^^^^^^^^^^^

cargo 1.60.0-nightly (95bb3c92b 2022-01-18)

@timothee-haudebourg
Copy link
Owner

That's new... At first glance I would say it is related to rust-lang/rust#87479. I'll investigate.

@timothee-haudebourg
Copy link
Owner

timothee-haudebourg commented Jan 24, 2022

This looks like a compiler bug to me. The lifetime is inconsistently required depending on where the HRTB (comming from the JsonMut trait alias used in JsonFrom) is placed. I've opened an issue.

In the meantime, I think I can get around the issue just by removing the JsonFrom bound from the AsJson trait definition. I hope.

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

No branches or pull requests

2 participants