Skip to content

Commit

Permalink
Update krates (#649)
Browse files Browse the repository at this point in the history
Updates krates to 0.16.10 to fix a bug originally filed on this repo,
EmbarkStudios/krates#82. This bug meant that
depending on the same crate multiple times by using different ``cfg()`
expressions could cause crates that were pulled in by features to not be
properly appended to the graph, and thus not checked by cargo-deny.
  • Loading branch information
Jake-Shadle authored Apr 12, 2024
1 parent 8e4d61e commit d3021f6
Show file tree
Hide file tree
Showing 8 changed files with 1,565 additions and 39 deletions.
47 changes: 24 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions tests/bans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,57 @@ deny = [

insta::assert_json_snapshot!(diags);
}

// Ensures that dependencies brought in by target specific features are banned
#[test]
fn deny_target_specific_dependencies() {
let diags = gather_bans(
func_name!(),
KrateGather {
name: "features",
no_default_features: true,
..Default::default()
},
r#"
deny = [
'serde'
]
"#,
);

insta::assert_json_snapshot!(diags);

let diags = gather_bans(
func_name!(),
KrateGather {
name: "features",
no_default_features: true,
targets: &["x86_64-windows-pc-msvc"],
..Default::default()
},
r#"
deny = [
'serde'
]
"#,
);

insta::assert_json_snapshot!(diags);

let diags = gather_bans(
func_name!(),
KrateGather {
name: "features",
no_default_features: true,
targets: &["x86_64-windows-pc-msvc", "aarch64-linux-android"],
..Default::default()
},
r#"
deny = [
'serde'
]
"#,
);

insta::assert_json_snapshot!(diags);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: tests/bans.rs
expression: diags
---
[]
46 changes: 46 additions & 0 deletions tests/snapshots/bans__deny_target_specific_dependencies-3.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
source: tests/bans.rs
expression: diags
---
[
{
"fields": {
"code": "banned",
"graphs": [
{
"Krate": {
"name": "serde",
"version": "1.0.197"
},
"parents": [
{
"Krate": {
"name": "smallvec",
"version": "1.13.2"
},
"parents": [
{
"Krate": {
"name": "features",
"version": "0.1.0"
}
}
]
}
]
}
],
"labels": [
{
"column": 6,
"line": 3,
"message": "banned here",
"span": "serde"
}
],
"message": "crate 'serde = 1.0.197' is explicitly banned",
"severity": "error"
},
"type": "diagnostic"
}
]
46 changes: 46 additions & 0 deletions tests/snapshots/bans__deny_target_specific_dependencies.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
source: tests/bans.rs
expression: diags
---
[
{
"fields": {
"code": "banned",
"graphs": [
{
"Krate": {
"name": "serde",
"version": "1.0.197"
},
"parents": [
{
"Krate": {
"name": "smallvec",
"version": "1.13.2"
},
"parents": [
{
"Krate": {
"name": "features",
"version": "0.1.0"
}
}
]
}
]
}
],
"labels": [
{
"column": 6,
"line": 3,
"message": "banned here",
"span": "serde"
}
],
"message": "crate 'serde = 1.0.197' is explicitly banned",
"severity": "error"
},
"type": "diagnostic"
}
]
39 changes: 23 additions & 16 deletions tests/snapshots/licenses__clarifications.snap
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,28 @@ expression: diags
"version": "1.16.0"
},
"parents": [
{
"Krate": {
"name": "ring",
"version": "0.16.20"
},
"parents": [
{
"Krate": {
"name": "rustls-webpki",
"version": "0.100.1"
},
"parents": [
{
"Krate": {
"name": "license-clarification",
"version": "0.1.0"
}
}
]
}
]
},
{
"Krate": {
"name": "wasm-bindgen-backend",
Expand Down Expand Up @@ -639,22 +661,7 @@ expression: diags
"name": "ring",
"version": "0.16.20"
},
"parents": [
{
"Krate": {
"name": "rustls-webpki",
"version": "0.100.1"
},
"parents": [
{
"Krate": {
"name": "license-clarification",
"version": "0.1.0"
}
}
]
}
]
"repeat": true
}
]
}
Expand Down
Loading

0 comments on commit d3021f6

Please sign in to comment.