Commit Graph

4 Commits

Author SHA1 Message Date
Artemis Tosini
285216aceb
rustPlatform.importCargoLock: copy lints from workspace
Rust 1.74 added support for configuring lints with cargo in a new
"lints" table. This also adds a new possible position to reference the
host workspace.

Fixes #273835
2023-12-16 05:36:59 +00:00
D Anzorge
38fb742663 rustPlatform.importCargoLock: fix [package] section handling
Members of the [package] table in Cargo.toml can be either subtables, or
values like strings and bools. Python is happy to check for membership
of "workspace" in a string, since Python strings are iterables, but if
the value is a bool, Python will throw an exception.
2023-04-29 21:05:05 +02:00
D Anzorge
c86b1a0bca rustPlatform.importCargoLock: handle workspace Cargo.toml false positives
Since we grep for 'workspace', it's possible the script ends up running
on a Cargo.toml that has the word 'workspace' in a comment, but does not
actually use workspaces
2023-03-24 15:45:16 +10:00
Winter
5686f0064d rustPlatform.importCargoLock: add support for git dependencies that use workspace inheritance
Rust 1.64.0 added support for workspace inheritance, which allows
for crates to inherit values such as dependency version constraints or
package metadata information from their workspaces [0].

This works by having workspace members specify a value as a table, with
`workspace` set to true. Thus, supporting this in importCargoLock is as
simple as walking the crate's Cargo.toml, replacing inherited values
with their workspace counterpart.

This is also what a forthcoming Cargo release will do for `cargo vendor` [1],
but we can get ahead of it ;)

[0]: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
[1]: https://github.com/rust-lang/cargo/pull/11414
2023-03-18 20:34:59 +01:00