guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54509] bump: make rust-cargo understand rust-edition2021 which rust


From: Mekeor Melire
Subject: [bug#54509] bump: make rust-cargo understand rust-edition2021 which rustc already does
Date: Fri, 01 Jul 2022 21:48:43 +0000

2022-06-30 / 10:10 / maximedevos@telenet.be:

> Mekeor Melire schreef op wo 29-06-2022 om 22:57 [+0000]:

> > the rust-compiler which is packaged for guix supports edition2021
> > but the cargo version packaged for guix does not
>
> Pretty sure that it does, IIRC under antioxidant-build-system I've seen
> some things being compiled with the 2021 edition of rust, presumably
> they also compiled under cargo-build-system.

i tested this again. i'll describe the issue with some instructions:

    create a cargo project:

        $ cargo new foo
        $ cd foo

    use edition 2021 instead of 2018:

        $ sed -i 's/2018/2021/' Cargo.toml

    attempt to build and run. you'll observe an error:

        $ cargo run

        > error: failed to parse manifest at `/home/user/foo/Cargo.toml`
        > Caused by:
        >   feature `edition2021` is required
        >   consider adding `cargo-features = ["edition2021"]` to the manifest

    specify the 2021-edition as a cargo-feature, as suggested by cargo.
    and try building and running again. it'll work fine:

        $ (echo 'cargo-features = ["edition2021"]' && cat Cargo.toml) | \
          sponge Cargo.toml
        $ cargo run

        > [...]
        > Hello world!

    but now, let's add a package as dependency - a package which uses
    edition2021. and then, try to build and run:

        $ echo 'axum = "0.5.4"' >> Cargo.toml
        $ cargo run

        > error: failed to download `axum-core v0.2.6`
        > Caused by:
        >   unable to get packages from source
        > Caused by:
        >   failed to parse manifest at
        >   
`/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/axum-core-0.2.6/Cargo.toml`
        > Caused by:
        >   feature `edition2021` is required
        >   consider adding `cargo-features = ["edition2021"]` to the manifest

TLDR: you can't build projects which depend on packages which depend on
edition2021.

> Also, rust-cargo does not have the cargo binary (but a cargo library!),
> you may be looking for the 'cargo' output of the 'rust' package
> instead.
>
> Greetings,
> Maxime.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]