hyperium / http

Rust HTTP types
Apache License 2.0
1.16k stars 289 forks source link

Failed to build 0.2.7 #552

Closed kafji closed 2 years ago

kafji commented 2 years ago

I can't build crates that depend on http version 0.2.7.

$ cargo clean && cargo build -v -j1
...
   Compiling http v0.2.7
     Running `rustc --crate-name http --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/http-0.2.7/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=595d45b2ce9d13bf -C extra-filename=-595d45b2ce9d13bf --out-dir /home/nightjar/workspace/kafji/repro-http/target/debug/deps -C linker=/usr/bin/clang -L dependency=/home/nightjar/workspace/kafji/repro-http/target/debug/deps --extern bytes=/home/nightjar/workspace/kafji/repro-http/target/debug/deps/libbytes-59116c3d90e42d31.rmeta --extern fnv=/home/nightjar/workspace/kafji/repro-http/target/debug/deps/libfnv-6d1578eb67bc4123.rmeta --extern itoa=/home/nightjar/workspace/kafji/repro-http/target/debug/deps/libitoa-eb0b0da4f5c7fd02.rmeta --cap-lints allow -Clink-arg=-fuse-ld=lld -Clink-arg=-fuse-ld=lld`
error[E0658]: use of unstable library feature 'option_result_contains'
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/http-0.2.7/src/extensions.rs:94:18
   |
94 |         self.map.contains(type_id)
   |                  ^^^^^^^^
   |
   = note: see issue #62358 <https://github.com/rust-lang/rust/issues/62358> for more information

error[E0277]: can't compare `TypeId` with `Box<HashMap<TypeId, Box<dyn Any + Send + Sync>, BuildHasherDefault<IdHasher>>>`
    --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/http-0.2.7/src/extensions.rs:94:27
     |
94   |         self.map.contains(type_id)
     |                  -------- ^^^^^^^ no implementation for `TypeId == Box<HashMap<TypeId, Box<dyn Any + Send + Sync>, BuildHasherDefault<IdHasher>>>`
     |                  |
     |                  required by a bound introduced by this call
     |
     = help: the trait `PartialEq<Box<HashMap<TypeId, Box<dyn Any + Send + Sync>, BuildHasherDefault<IdHasher>>>>` is not implemented for `TypeId`
note: required by a bound in `Option::<T>::contains`
    --> /home/nightjar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1603:12
     |
1603 |         U: ~const PartialEq<T>,
     |            ^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::contains`

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `http` due to 2 previous errors
...

The errors references the Extension::check function:

            .and_then(|boxed| (&**boxed as &(dyn Any + 'static)).downcast_ref())
    }

    pub fn check(&self, type_id:&TypeId) -> bool {
        self.map.contains(type_id)
    }

    /// Get a mutable reference to a type previously inserted on this `Extensions`.

What's weird, is that I can't find that function in the trunk, neither in HEAD nor in v0.2.7.

seanmonstar commented 2 years ago

That function has not existed. Do you have a vendored and modified version? Or are using a Cargo patch or replace?

kafji commented 2 years ago

@seanmonstar No.

$ cat Cargo.lock 
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "bytes"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"

[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"

[[package]]
name = "http"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb"
dependencies = [
 "bytes",
 "fnv",
 "itoa",
]

[[package]]
name = "itoa"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"

[[package]]
name = "repro-http"
version = "0.1.0"
dependencies = [
 "http",
]
seanmonstar commented 2 years ago

Maybe some .cargo/config file thing? You can see the source of the crate published doesn't contain the method either: https://docs.rs/http/0.2.7/src/http/extensions.rs.html

kafji commented 2 years ago

Nothing exceptional in my cargo config file.

$ cat ~/.cargo/config.toml 
# https://raw.githubusercontent.com/bevyengine/bevy/master/.cargo/config_fast_builds

[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld"]

[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"

[net]
git-fetch-with-cli = true

[profile.release]
incremental = true

You can see the source of the crate published doesn't contain the method either

Yeah. I tried building it in different machine and it works. The problem is localized to my machine. Maybe cargo bug. I'll try nuking its cache later.

Thanks for the help and thank you for maintaining this crate.