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

Latest release (tag v0.10.0) does not compile under latest stable Rust (1.76.0) #3476

Closed
1 task done
H2CO3 opened this issue Feb 22, 2024 · 6 comments
Closed
1 task done
Labels
bug Something isn't working devops Packaging, CI, etc.

Comments

@H2CO3
Copy link

H2CO3 commented Feb 22, 2024

Description

Rust version: 1.76.0 (07dca489a 2024-02-04)
Arch: x64
OS: same result on both macOS Big Sur 11.1 and on Linux in the official Rust 1.76.0 Docker image

When I try installing Typst using

cargo install --git https://github.com/typst/typst.git --tag v0.10.0 typst-cli

the compilation starts, but after some time, I get a type error:

    Updating git repository `https://github.com/typst/typst.git`
  Installing typst-cli v0.10.0 (https://github.com/typst/typst.git?tag=v0.10.0#70ca0d25)
    Updating crates.io index
   Compiling proc-macro2 v1.0.78
   Compiling unicode-ident v1.0.12
   Compiling serde v1.0.197
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.153
   …etc…
   Compiling rustls-pemfile v1.0.4
   Compiling typst-pdf v0.10.0 (/Users/H2CO3/.cargo/git/checkouts/typst-6808799b0d8fdaa9/70ca0d2/crates/typst-pdf)
   Compiling typst-render v0.10.0 (/Users/H2CO3/.cargo/git/checkouts/typst-6808799b0d8fdaa9/70ca0d2/crates/typst-render)
   Compiling typst-svg v0.10.0 (/Users/H2CO3/.cargo/git/checkouts/typst-6808799b0d8fdaa9/70ca0d2/crates/typst-svg)
warning: `typst` (lib) generated 1 warning
error[E0308]: mismatched types
   --> crates/typst-cli/src/download.rs:60:38
    |
60  |         builder = builder.tls_config(config.clone());
    |                           ---------- ^^^^^^^^^^^^^^ expected `ClientConfig`, found a different `ClientConfig`
    |                           |
    |                           arguments to this method are incorrect
    |
    = note: `ClientConfig` and `ClientConfig` have similar names, but are actually distinct types
note: `ClientConfig` is defined in crate `rustls`
   --> /Users/H2CO3/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.21.10/src/client/client_conn.rs:128:1
    |
128 | pub struct ClientConfig {
    | ^^^^^^^^^^^^^^^^^^^^^^^
note: `ClientConfig` is defined in crate `rustls`
   --> /Users/H2CO3/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.22.2/src/client/client_conn.rs:150:1
    |
150 | pub struct ClientConfig {
    | ^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `rustls` are being used?
note: method defined here
   --> /Users/H2CO3/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ureq-2.9.6/src/agent.rs:611:12
    |
611 |     pub fn tls_config(mut self, tls_config: Arc<rustls::ClientConfig>) -> Self {
    |            ^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `typst-cli` (bin "typst") due to 1 previous error
error: failed to compile `typst-cli v0.10.0 (https://github.com/typst/typst.git?tag=v0.10.0#70ca0d25)`, intermediate artifacts can be found at `/var/folders/1j/jy9cg8f15lvb577w7mgfvsn00000gn/T/cargo-installhLVzXS`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

This doesn't seem right – how was the 0.10.0 version released if even the latest version of Rust isn't enough to compile it?

Reproduction URL

No response

Operating system

Linux, macOS

Typst version

  • I am using the latest version of Typst
@H2CO3 H2CO3 added the bug Something isn't working label Feb 22, 2024
@laurmaedje
Copy link
Member

Can you try running the command with --locked? It looks like dependency resolution resolves two different versions of rustls.

@laurmaedje laurmaedje added the devops Packaging, CI, etc. label Feb 22, 2024
@H2CO3
Copy link
Author

H2CO3 commented Feb 22, 2024

This worked, thanks. Is this a bug in Cargo's dependency resolution, then?

@laurmaedje
Copy link
Member

I'm not entirely sure. It could perhaps also be a mistake in our Cargo.toml.

@laurmaedje
Copy link
Member

Closing this as it doesn't look like a bug on our end and we don't depend on rustls anymore. I don't have time to investigate whether this is a cargo bug, but I'll post it on Discord in case someone wants to take a look.

@laurmaedje laurmaedje closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@H2CO3
Copy link
Author

H2CO3 commented Mar 11, 2024

Perfect, thanks – since installing with --locked works just fine anyway, this isn't any more than a very minor inconvenience.

@alerque
Copy link
Contributor

alerque commented Mar 11, 2024

This isn't an issue with Typst and technically not a bug in Cargo either, it is a case of a bad choice of defaults for cargo install. There is a long standing issue and a recent RFC for fixing it upstream for background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working devops Packaging, CI, etc.
Projects
None yet
Development

No branches or pull requests

3 participants