Skip to content

Commit eb1b8ce

Browse files
authored
Handle cyclic dependencies (#997)
When cyclic dependencies are used for either doctests or integrations tests (`x509-cert` depends on `rsa` which depends back to `der` in this workspace), the compiler will complain about lack of trait implementation because two crates will be pulled. One from this checkout as well as one from crates.io. This migrates the inclusion from local `path` in each Cargo.toml to a global `patch.crates-io`.
1 parent 8e2d739 commit eb1b8ce

File tree

16 files changed

+68
-40
lines changed

16 files changed

+68
-40
lines changed

Cargo.toml

+28
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,31 @@ members = [
2828

2929
[profile.dev]
3030
opt-level = 2
31+
32+
[patch.crates-io]
33+
# A global patch crates-io block is used to avoid cyclic dependencies errors
34+
# If we use other crates from the RustCrypto ecosystem, they may pull redundant
35+
# versions of dependencies.
36+
base16ct = { path = "./base16ct" }
37+
base32ct = { path = "./base32ct" }
38+
base64ct = { path = "./base64ct" }
39+
cmpv2 = { path = "./cmpv2" }
40+
cms = { path = "./cms" }
41+
const-oid = { path = "./const-oid" }
42+
crmf = { path = "./crmf" }
43+
der = { path = "./der" }
44+
der_derive = { path = "./der/derive" }
45+
pem-rfc7468 = { path = "./pem-rfc7468" }
46+
pkcs1 = { path = "./pkcs1" }
47+
pkcs5 = { path = "./pkcs5" }
48+
pkcs7 = { path = "./pkcs7" }
49+
pkcs8 = { path = "./pkcs8" }
50+
pkcs12 = { path = "./pkcs12" }
51+
sec1 = { path = "./sec1" }
52+
serdect = { path = "./serdect" }
53+
spki = { path = "./spki" }
54+
tai64 = { path = "./tai64" }
55+
tls_codec = { path = "./tls_codec" }
56+
tls_codec_derive = { path = "./tls_codec/derive" }
57+
x509-cert = { path = "./x509-cert" }
58+
x509-ocsp = { path = "./x509-ocsp" }

cmpv2/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ edition = "2021"
1515
rust-version = "1.65"
1616

1717
[dependencies]
18-
crmf = { version = "=0.2.0-pre.0", path = "../crmf" }
19-
der = { version = "0.7", features = ["alloc", "derive", "flagset", "oid"], path = "../der" }
20-
spki = { version = "0.7", path = "../spki" }
21-
x509-cert = { version = "0.2", default-features = false, path = "../x509-cert" }
18+
crmf = { version = "=0.2.0-pre.0" }
19+
der = { version = "0.7", features = ["alloc", "derive", "flagset", "oid"] }
20+
spki = { version = "0.7" }
21+
x509-cert = { version = "0.2", default-features = false }
2222

2323
[dev-dependencies]
2424
const-oid = { version = "0.9", features = ["db"] } # TODO: path = "../const-oid"

cms/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ edition = "2021"
1414
rust-version = "1.65"
1515

1616
[dependencies]
17-
der = { version = "0.7", features = ["alloc", "derive", "oid"], path = "../der" }
18-
spki = { version = "0.7", path = "../spki" }
19-
x509-cert = { version = "0.2", default-features = false, path = "../x509-cert" }
17+
der = { version = "0.7", features = ["alloc", "derive", "oid"] }
18+
spki = { version = "0.7" }
19+
x509-cert = { version = "0.2", default-features = false }
2020

2121
[dev-dependencies]
2222
const-oid = { version = "0.9", features = ["db"] } # TODO: path = "../const-oid"
2323
hex-literal = "0.3"
24-
pkcs5 = { version = "0.7", path = "../pkcs5" }
24+
pkcs5 = { version = "0.7" }
2525

2626
[features]
2727
alloc = ["der/alloc"]

crmf/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ edition = "2021"
1515
rust-version = "1.65"
1616

1717
[dependencies]
18-
cms = { version = "0.2", path = "../cms"}
19-
der = { version = "0.7", features = ["alloc", "derive"], path = "../der" }
20-
spki = { version = "0.7", path = "../spki" }
21-
x509-cert = { version = "0.2", default-features = false, path = "../x509-cert" }
18+
cms = { version = "0.2" }
19+
der = { version = "0.7", features = ["alloc", "derive"] }
20+
spki = { version = "0.7" }
21+
x509-cert = { version = "0.2", default-features = false }
2222

2323
[dev-dependencies]
2424
const-oid = { version = "0.9" } # TODO: path = "../const-oid"

der/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ rust-version = "1.65"
1818
[dependencies]
1919
arbitrary = { version = "1.3", features = ["derive"], optional = true }
2020
const-oid = { version = "0.9.2", optional = true } # TODO: path = "../const-oid"
21-
der_derive = { version = "0.7", optional = true, path = "derive" }
21+
der_derive = { version = "0.7", optional = true }
2222
flagset = { version = "0.4.3", optional = true }
23-
pem-rfc7468 = { version = "0.7", optional = true, features = ["alloc"], path = "../pem-rfc7468" }
23+
pem-rfc7468 = { version = "0.7", optional = true, features = ["alloc"] }
2424
time = { version = "0.3.4", optional = true, default-features = false }
2525
zeroize = { version = "1.5", optional = true, default-features = false }
2626

pem-rfc7468/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ edition = "2021"
1818
rust-version = "1.60"
1919

2020
[dependencies]
21-
base64ct = { version = "1.4", path = "../base64ct" }
21+
base64ct = { version = "1.4" }
2222

2323
[features]
2424
alloc = ["base64ct/alloc"]

pkcs1/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ edition = "2021"
1515
rust-version = "1.60"
1616

1717
[dependencies]
18-
der = { version = "0.7", features = ["oid"], path = "../der" }
19-
spki = { version = "0.7", path = "../spki" }
18+
der = { version = "0.7", features = ["oid"] }
19+
spki = { version = "0.7" }
2020

2121
# optional dependencies
22-
pkcs8 = { version = "0.10", optional = true, default-features = false, path = "../pkcs8" }
22+
pkcs8 = { version = "0.10", optional = true, default-features = false }
2323
zeroize = { version = "1", optional = true, default-features = false }
2424

2525
[dev-dependencies]

pkcs5/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ edition = "2021"
1515
rust-version = "1.65"
1616

1717
[dependencies]
18-
der = { version = "0.7", features = ["oid"], path = "../der" }
19-
spki = { version = "0.7", path = "../spki" }
18+
der = { version = "0.7", features = ["oid"] }
19+
spki = { version = "0.7" }
2020

2121
# optional dependencies
2222
cbc = { version = "0.1.2", optional = true }

pkcs7/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ edition = "2021"
1515
rust-version = "1.65"
1616

1717
[dependencies]
18-
der = { version = "0.7", features = ["oid"], path = "../der" }
19-
spki = { version = "0.7", path = "../spki" }
20-
x509-cert = { version = "0.2", default-features = false, path = "../x509-cert" }
18+
der = { version = "0.7", features = ["oid"] }
19+
spki = { version = "0.7" }
20+
x509-cert = { version = "0.2", default-features = false }
2121

2222
[dev-dependencies]
2323
hex-literal = "0.3"

pkcs8/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ edition = "2021"
1616
rust-version = "1.65"
1717

1818
[dependencies]
19-
der = { version = "0.7", features = ["oid"], path = "../der" }
20-
spki = { version = "0.7.1", path = "../spki" }
19+
der = { version = "0.7", features = ["oid"] }
20+
spki = { version = "0.7.1" }
2121

2222
# optional dependencies
2323
rand_core = { version = "0.6", optional = true, default-features = false }
24-
pkcs5 = { version = "0.7", optional = true, path = "../pkcs5" }
24+
pkcs5 = { version = "0.7", optional = true }
2525
subtle = { version = "2", optional = true, default-features = false }
2626

2727
[dev-dependencies]

sec1/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ edition = "2021"
1616
rust-version = "1.65"
1717

1818
[dependencies]
19-
base16ct = { version = "0.2", optional = true, default-features = false, path = "../base16ct" }
20-
der = { version = "0.7", optional = true, features = ["oid"], path = "../der" }
19+
base16ct = { version = "0.2", optional = true, default-features = false }
20+
der = { version = "0.7", optional = true, features = ["oid"] }
2121
generic-array = { version = "0.14.7", optional = true, default-features = false }
22-
pkcs8 = { version = "0.10", optional = true, default-features = false, path = "../pkcs8" }
23-
serdect = { version = "0.2", optional = true, default-features = false, features = ["alloc"], path = "../serdect" }
22+
pkcs8 = { version = "0.10", optional = true, default-features = false }
23+
serdect = { version = "0.2", optional = true, default-features = false, features = ["alloc"] }
2424
subtle = { version = "2", optional = true, default-features = false }
2525
zeroize = { version = "1", optional = true, default-features = false }
2626

serdect/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ edition = "2021"
1515
rust-version = "1.60"
1616

1717
[dependencies]
18-
base16ct = { version = "0.2", default-features = false, path = "../base16ct" }
18+
base16ct = { version = "0.2", default-features = false }
1919
serde = { version = "1.0.96", default-features = false }
2020

2121
# optional features

spki/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ edition = "2021"
1515
rust-version = "1.65"
1616

1717
[dependencies]
18-
der = { version = "0.7.2", features = ["oid"], path = "../der" }
18+
der = { version = "0.7.2", features = ["oid"] }
1919

2020
# Optional dependencies
2121
arbitrary = { version = "1.2", features = ["derive"], optional = true }
22-
base64ct = { version = "1", optional = true, default-features = false, path = "../base64ct" }
22+
base64ct = { version = "1", optional = true, default-features = false }
2323
sha2 = { version = "0.10", optional = true, default-features = false }
2424

2525
[dev-dependencies]

tls_codec/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ zeroize = { version = "1", default-features = false, features = ["alloc"] }
1616
# optional dependencies
1717
arbitrary = { version = "1", features = ["derive"], optional = true }
1818
serde = { version = "1.0.144", features = ["derive"], optional = true }
19-
tls_codec_derive = { version = "=0.3.0-pre.2", path = "derive", optional = true }
19+
tls_codec_derive = { version = "=0.3.0-pre.2", optional = true }
2020

2121
[dev-dependencies]
2222
criterion = "0.4"

x509-cert/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ rust-version = "1.65"
1616

1717
[dependencies]
1818
const-oid = { version = "0.9.2", features = ["db"] } # TODO: path = "../const-oid"
19-
der = { version = "0.7", features = ["alloc", "derive", "flagset", "oid"], path = "../der" }
20-
spki = { version = "0.7", path = "../spki", features = ["alloc"] }
19+
der = { version = "0.7", features = ["alloc", "derive", "flagset", "oid"] }
20+
spki = { version = "0.7", features = ["alloc"] }
2121

2222
# optional dependencies
23-
arbitrary = { version = "1.2", features = ["derive"], optional = true }
23+
arbitrary = { version = "1.3", features = ["derive"], optional = true }
2424

2525
[dev-dependencies]
2626
hex-literal = "0.3"

x509-ocsp/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ edition = "2021"
1515
rust-version = "1.65"
1616

1717
[dependencies]
18-
der = { version = "0.7", features = ["alloc", "derive", "oid"], path = "../der" }
19-
spki = { version = "0.7", path = "../spki" }
20-
x509-cert = { version = "0.2", default-features = false, path = "../x509-cert" }
18+
der = { version = "0.7", features = ["alloc", "derive", "oid"] }
19+
spki = { version = "0.7" }
20+
x509-cert = { version = "0.2", default-features = false }
2121

2222
[dev-dependencies]
2323
const-oid = { version = "0.9", features = ["db"] } # TODO: path = "../const-oid"

0 commit comments

Comments
 (0)