Rust: `http` crate does not compile against latest nightly (caused by `TryFrom`).

Created on 28 Mar 2018  路  4Comments  路  Source: rust-lang/rust

See here: https://github.com/hyperium/http/issues/192

try_from is already defined on on an HttpTryFrom trait in the library.

This is caused by TryFrom being included in prelude.

T-libs

Most helpful comment

The "fix" seems to be to not include TryFrom in std's prelude until the next Rust edition, which is coming soon.

It does seem like adding new traits to the prelude with a generic name like that should be reserved for new editions.


I'd suggest that the real solution is to have the compiler resolve the conflict by ranking explicit trait imports as higher than traits in a prelude (I guess any glob import).

All 4 comments

I replied to @sfackler in the issue linked above, but I thought it would be worth posting here:

My understanding was that these sorts of "expected breakage" would go through an ecosystem "crater" (or whatever it is called) and if it broke things it wouldn't be applied.

I understand the problem that one must be able to add new fns / traits, but if breaking the http crate is considered "expected breakage", that seems to fail at Rust's promise for backwards compatibility as this will cascade down do everyone that depends on http as well as production Rust users.

The "fix" seems to be to not include TryFrom in std's prelude until the next Rust edition, which is coming soon.

The "fix" seems to be to not include TryFrom in std's prelude until the next Rust edition, which is coming soon.

It does seem like adding new traits to the prelude with a generic name like that should be reserved for new editions.


I'd suggest that the real solution is to have the compiler resolve the conflict by ranking explicit trait imports as higher than traits in a prelude (I guess any glob import).

There's a fair bit of discussion going on on this topic in the stabilization PR.

Since we've reverted TryFrom stabilization entirely and I believe this is no longer a problem, I'm going to close this.

Was this page helpful?
0 / 5 - 0 ratings