From 8398771cf598e842d963ff319cec90544166a8dd Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Fri, 13 Dec 2024 16:31:22 +0100 Subject: [PATCH] Update cargo dependencies (#3776) This includes updates beyond patch version level to `cargo_metadata` and `tree-sitter` (and `tree-sitter-rust`), which required code changes. (Updating `which` did not entail code changes.) By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --- Cargo.lock | 115 ++++++++++++++++++++++---------- cprover_bindings/Cargo.toml | 2 +- deny.toml | 4 +- kani-driver/Cargo.toml | 4 +- kani-driver/src/call_cargo.rs | 32 ++++----- tools/build-kani/Cargo.toml | 4 +- tools/build-kani/src/sysroot.rs | 12 ++-- tools/kani-cov/Cargo.toml | 4 +- tools/kani-cov/src/coverage.rs | 2 +- 9 files changed, 111 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7931066348b7..0c2954adf118 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,9 +160,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" +checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" dependencies = [ "memchr", "regex-automata 0.4.9", @@ -176,7 +176,7 @@ dependencies = [ "anyhow", "cargo_metadata", "clap", - "which", + "which 7.0.0", ] [[package]] @@ -211,23 +211,23 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +checksum = "8769706aad5d996120af43197bf46ef6ad0fda35216b4505f926a365a232d924" dependencies = [ "camino", "cargo-platform", "semver", "serde", "serde_json", - "thiserror", + "thiserror 2.0.6", ] [[package]] name = "cc" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ "shlex", ] @@ -273,7 +273,7 @@ dependencies = [ "tracing", "tracing-subscriber", "tracing-tree 0.4.0 (git+https://github.com/Nadrieril/tracing-tree)", - "which", + "which 6.0.3", ] [[package]] @@ -587,6 +587,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "getopts" version = "0.2.21" @@ -627,7 +633,7 @@ checksum = "3a6ad932c6dd3cfaf16b66754a42f87bbeefd591530c4b6a8334270a7df3e853" dependencies = [ "ahash", "petgraph", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -644,6 +650,9 @@ name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash", +] [[package]] name = "hashlink" @@ -819,7 +828,7 @@ dependencies = [ "toml", "tracing", "tracing-subscriber", - "which", + "which 7.0.0", ] [[package]] @@ -867,9 +876,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.167" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "linear-map" @@ -1319,9 +1328,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags", ] @@ -1449,18 +1458,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -1476,9 +1485,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -1595,14 +1604,19 @@ dependencies = [ "kani", ] +[[package]] +name = "streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520" + [[package]] name = "string-interner" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" +checksum = "1a3275464d7a9f2d4cac57c89c2ef96a8524dba2864c8d6f82e3980baf136f9b" dependencies = [ - "cfg-if", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "serde", ] @@ -1684,7 +1698,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +dependencies = [ + "thiserror-impl 2.0.6", ] [[package]] @@ -1698,6 +1721,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "thiserror-impl" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -1747,7 +1781,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8450ade61b78735ed7811cc14639462723d87a6cd748a41e7bfde554ac5033dd" dependencies = [ - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1900,30 +1934,31 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0203df02a3b6dd63575cc1d6e609edc2181c9a11867a271b25cfd2abff3ec5ca" +checksum = "8ac95b18f0f727aaaa012bd5179a1916706ee3ed071920fdbda738750b0c0bf5" dependencies = [ "cc", "regex", "regex-syntax 0.8.5", + "streaming-iterator", "tree-sitter-language", ] [[package]] name = "tree-sitter-language" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ddffe35a0e5eeeadf13ff7350af564c6e73993a24db62caee1822b185c2600" +checksum = "c199356c799a8945965bb5f2c55b2ad9d9aa7c4b4f6e587fe9dea0bc715e5f9c" [[package]] name = "tree-sitter-rust" -version = "0.21.2" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "277690f420bf90741dea984f3da038ace46c4fe6047cba57a66822226cde1c93" +checksum = "a4d64d449ca63e683c562c7743946a646671ca23947b9c925c0cfbe65051a4af" dependencies = [ "cc", - "tree-sitter", + "tree-sitter-language", ] [[package]] @@ -2017,6 +2052,18 @@ dependencies = [ "winsafe", ] +[[package]] +name = "which" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b" +dependencies = [ + "either", + "home", + "rustix", + "winsafe", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/cprover_bindings/Cargo.toml b/cprover_bindings/Cargo.toml index e26f23d5c081..a190019d4cc2 100644 --- a/cprover_bindings/Cargo.toml +++ b/cprover_bindings/Cargo.toml @@ -17,7 +17,7 @@ lazy_static = "1.4.0" num = "0.4.0" num-traits = "0.2" serde = {version = "1", features = ["derive"]} -string-interner = "0.17.0" +string-interner = "0.18" tracing = "0.1" linear-map = {version = "1.2", features = ["serde_impl"]} diff --git a/deny.toml b/deny.toml index 0347d4ac177a..f0b9049ffc03 100644 --- a/deny.toml +++ b/deny.toml @@ -16,14 +16,13 @@ yanked = "deny" allow = [ "MIT", "Apache-2.0", - "MPL-2.0", ] confidence-threshold = 0.8 # All these exceptions should probably appear in: tools/build-kani/license-notes.txt exceptions = [ { name = "unicode-ident", allow=["Unicode-3.0"] }, - { name = "rustc_apfloat", allow=["Apache-2.0 WITH LLVM-exception"] }, + { name = "foldhash", allow=["Zlib"] }, ] [licenses.private] @@ -43,4 +42,3 @@ wildcards = "allow" unknown-registry = "deny" unknown-git = "deny" allow-registry = ["https://github.com/rust-lang/crates.io-index"] -allow-git = ["https://github.com/Nadrieril/tracing-tree"] diff --git a/kani-driver/Cargo.toml b/kani-driver/Cargo.toml index 1025b4b201e2..7b4a970a6753 100644 --- a/kani-driver/Cargo.toml +++ b/kani-driver/Cargo.toml @@ -13,7 +13,7 @@ publish = false [dependencies] kani_metadata = { path = "../kani_metadata" } -cargo_metadata = "0.18.0" +cargo_metadata = "0.19" anyhow = "1" console = "0.15.1" once_cell = "1.19.0" @@ -35,7 +35,7 @@ tempfile = "3" tracing = {version = "0.1", features = ["max_level_trace", "release_max_level_debug"]} tracing-subscriber = {version = "0.3.8", features = ["env-filter", "json", "fmt"]} rand = "0.8" -which = "6" +which = "7" time = {version = "0.3.36", features = ["formatting"]} tokio = { version = "1.40.0", features = ["io-util", "process", "rt", "time"] } diff --git a/kani-driver/src/call_cargo.rs b/kani-driver/src/call_cargo.rs index cec8226e5f8e..f26a8e0aa4e8 100644 --- a/kani-driver/src/call_cargo.rs +++ b/kani-driver/src/call_cargo.rs @@ -9,7 +9,8 @@ use crate::util; use anyhow::{Context, Result, bail}; use cargo_metadata::diagnostic::{Diagnostic, DiagnosticLevel}; use cargo_metadata::{ - Artifact as RustcArtifact, Message, Metadata, MetadataCommand, Package, PackageId, Target, + Artifact as RustcArtifact, CrateType, Message, Metadata, MetadataCommand, Package, PackageId, + Target, TargetKind, }; use kani_metadata::{ArtifactType, CompilerArtifactStub}; use std::collections::HashMap; @@ -22,16 +23,6 @@ use std::path::{Path, PathBuf}; use std::process::Command; use tracing::{debug, trace}; -//---- Crate types identifier used by cargo. -const CRATE_TYPE_BIN: &str = "bin"; -const CRATE_TYPE_CDYLIB: &str = "cdylib"; -const CRATE_TYPE_DYLIB: &str = "dylib"; -const CRATE_TYPE_LIB: &str = "lib"; -const CRATE_TYPE_PROC_MACRO: &str = "proc-macro"; -const CRATE_TYPE_RLIB: &str = "rlib"; -const CRATE_TYPE_STATICLIB: &str = "staticlib"; -const CRATE_TYPE_TEST: &str = "test"; - /// The outputs of kani-compiler being invoked via cargo on a project. pub struct CargoOutputs { /// The directory where compiler outputs should be directed. @@ -123,8 +114,8 @@ crate-type = ["lib"] .run_build(cmd)? .into_iter() .filter_map(|artifact| { - if artifact.target.crate_types.contains(&CRATE_TYPE_LIB.to_string()) - || artifact.target.crate_types.contains(&CRATE_TYPE_RLIB.to_string()) + if artifact.target.crate_types.contains(&CrateType::Lib) + || artifact.target.crate_types.contains(&CrateType::RLib) { map_kani_artifact(artifact) } else { @@ -576,26 +567,29 @@ fn package_targets(args: &VerificationArgs, package: &Package) -> Vec { + match kind { + TargetKind::Bin => { if args.target.include_bin(&target.name) { // Binary targets. verification_targets.push(VerificationTarget::Bin(target.clone())); } } - CRATE_TYPE_LIB | CRATE_TYPE_RLIB | CRATE_TYPE_CDYLIB | CRATE_TYPE_DYLIB - | CRATE_TYPE_STATICLIB => { + TargetKind::Lib + | TargetKind::RLib + | TargetKind::CDyLib + | TargetKind::DyLib + | TargetKind::StaticLib => { if args.target.include_lib() { supported_lib = true; } } - CRATE_TYPE_PROC_MACRO => { + TargetKind::ProcMacro => { if args.target.include_lib() { unsupported_lib = true; ignored_unsupported.push(target.name.as_str()); } } - CRATE_TYPE_TEST => { + TargetKind::Test => { // Test target. if args.target.include_tests() { if args.tests { diff --git a/tools/build-kani/Cargo.toml b/tools/build-kani/Cargo.toml index 25e022e70d3f..ee8d842db0eb 100644 --- a/tools/build-kani/Cargo.toml +++ b/tools/build-kani/Cargo.toml @@ -11,6 +11,6 @@ publish = false [dependencies] anyhow = "1" -cargo_metadata = "0.18.0" +cargo_metadata = "0.19" clap = { version = "4.4.11", features=["derive"] } -which = "6" +which = "7" diff --git a/tools/build-kani/src/sysroot.rs b/tools/build-kani/src/sysroot.rs index 29d481e4b9dd..139dce794f13 100644 --- a/tools/build-kani/src/sysroot.rs +++ b/tools/build-kani/src/sysroot.rs @@ -13,7 +13,7 @@ use crate::{AutoRun, cp}; use anyhow::{Result, bail, format_err}; -use cargo_metadata::{Artifact, Message}; +use cargo_metadata::{Artifact, Message, TargetKind}; use std::ffi::OsStr; use std::fs; use std::io::BufReader; @@ -194,9 +194,13 @@ fn copy_artifacts(artifacts: &[Artifact], sysroot_lib: &Path, copy_std: bool) -> /// Check if an artifact is a rust library that can be used by rustc on further crates compilations. /// This inspects the kind of targets that this artifact originates from. fn is_rust_lib(artifact: &Artifact) -> bool { - artifact.target.kind.iter().any(|kind| match kind.as_str() { - "lib" | "rlib" | "proc-macro" => true, - "bin" | "dylib" | "cdylib" | "staticlib" | "custom-build" => false, + artifact.target.kind.iter().any(|kind| match kind { + TargetKind::Lib | TargetKind::RLib | TargetKind::ProcMacro => true, + TargetKind::Bin + | TargetKind::DyLib + | TargetKind::CDyLib + | TargetKind::StaticLib + | TargetKind::CustomBuild => false, _ => unreachable!("Unknown crate type {kind}"), }) } diff --git a/tools/kani-cov/Cargo.toml b/tools/kani-cov/Cargo.toml index 4b9f14cc3ca9..a2764791dcf1 100644 --- a/tools/kani-cov/Cargo.toml +++ b/tools/kani-cov/Cargo.toml @@ -17,5 +17,5 @@ console = "0.15.8" serde = "1.0.197" serde_derive = "1.0.197" serde_json = "1.0.115" -tree-sitter = "0.23.0" -tree-sitter-rust = "0.21.2" +tree-sitter = "0.24" +tree-sitter-rust = "0.23" diff --git a/tools/kani-cov/src/coverage.rs b/tools/kani-cov/src/coverage.rs index 96a3dfdb7353..0898010ea2d0 100644 --- a/tools/kani-cov/src/coverage.rs +++ b/tools/kani-cov/src/coverage.rs @@ -154,7 +154,7 @@ pub struct FunctionInfo { pub fn function_info_from_file(filepath: &PathBuf) -> Vec { let source_code = fs::read_to_string(filepath).expect("could not read source file"); let mut parser = Parser::new(); - parser.set_language(&tree_sitter_rust::language()).expect("Error loading Rust grammar"); + parser.set_language(&tree_sitter_rust::LANGUAGE.into()).expect("Error loading Rust grammar"); let tree = parser.parse(&source_code, None).expect("Failed to parse file");