Переглянути джерело

bump rust to 1.80.1 / 2024-08-08 (#2487)

* bump rust to 1.80

* bump nightly version to 2024-07-21

* bump rust stable to 1.80.1, nightly to 2024-08-08

* clippy: macro_metavars_in_unsafe

* fix unexpected tag

* run anchor downstream test with their master

* add no-entrypoint into workspace level lint

* use correct llvm path for coverage test
Yihau Chen 1 рік тому
батько
коміт
d8e95ac15f
47 змінених файлів з 155 додано та 5 видалено
  1. 1 1
      .github/workflows/downstream-project-anchor.yml
  2. 9 0
      Cargo.toml
  3. 3 0
      account-decoder/Cargo.toml
  4. 3 0
      accounts-db/Cargo.toml
  5. 3 0
      bloom/Cargo.toml
  6. 3 0
      builtins-default-costs/Cargo.toml
  7. 1 1
      ci/docker/Dockerfile
  8. 1 1
      ci/rust-version.sh
  9. 3 0
      compute-budget/Cargo.toml
  10. 3 0
      core/Cargo.toml
  11. 3 0
      cost-model/Cargo.toml
  12. 3 0
      curves/bn254/Cargo.toml
  13. 3 0
      curves/curve25519/Cargo.toml
  14. 3 0
      curves/secp256k1-recover/Cargo.toml
  15. 5 0
      define-syscall/Cargo.toml
  16. 3 0
      frozen-abi/Cargo.toml
  17. 3 0
      frozen-abi/macro/Cargo.toml
  18. 3 0
      gossip/Cargo.toml
  19. 3 0
      ledger/Cargo.toml
  20. 4 1
      metrics/src/counter.rs
  21. 9 0
      perf/Cargo.toml
  22. 3 0
      poseidon/Cargo.toml
  23. 3 0
      program-runtime/Cargo.toml
  24. 3 0
      programs/address-lookup-table/Cargo.toml
  25. 4 0
      programs/sbf/Cargo.toml
  26. 3 0
      programs/sbf/rust/custom_heap/Cargo.toml
  27. 3 0
      programs/sbf/rust/deprecated_loader/Cargo.toml
  28. 3 0
      programs/sbf/rust/membuiltins/Cargo.toml
  29. 3 0
      programs/sbf/rust/panic/Cargo.toml
  30. 3 0
      programs/sbf/rust/ro_modify/Cargo.toml
  31. 3 0
      programs/sbf/rust/sanity/Cargo.toml
  32. 3 0
      programs/stake/Cargo.toml
  33. 3 0
      programs/vote/Cargo.toml
  34. 3 0
      runtime-transaction/Cargo.toml
  35. 3 0
      runtime/Cargo.toml
  36. 1 1
      rust-toolchain.toml
  37. 9 0
      scripts/coverage.sh
  38. 3 0
      sdk/Cargo.toml
  39. 3 0
      sdk/msg/Cargo.toml
  40. 3 0
      sdk/program-memory/Cargo.toml
  41. 3 0
      sdk/program/Cargo.toml
  42. 3 0
      short-vec/Cargo.toml
  43. 3 0
      svm/Cargo.toml
  44. 3 0
      version/Cargo.toml
  45. 3 0
      vote/Cargo.toml
  46. 3 0
      zk-sdk/Cargo.toml
  47. 3 0
      zk-token-sdk/Cargo.toml

+ 1 - 1
.github/workflows/downstream-project-anchor.yml

@@ -41,7 +41,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        version: ["v0.29.0", "v0.30.0"]
+        version: ["master"]
     steps:
       - uses: actions/checkout@v4
 

+ 9 - 0
Cargo.toml

@@ -159,6 +159,15 @@ homepage = "https://anza.xyz/"
 license = "Apache-2.0"
 edition = "2021"
 
+[workspace.lints.rust.unexpected_cfgs]
+level = "warn"
+check-cfg = [
+    'cfg(target_os, values("solana"))',
+    'cfg(feature, values("frozen-abi", "no-entrypoint"))',
+    'cfg(RUSTC_WITH_SPECIALIZATION)',
+    'cfg(RUSTC_WITHOUT_SPECIALIZATION)',
+]
+
 [workspace.dependencies]
 Inflector = "0.11.4"
 agave-transaction-view = { path = "transaction-view", version = "=2.1.0" }

+ 3 - 0
account-decoder/Cargo.toml

@@ -34,3 +34,6 @@ spl-pod = { workspace = true }
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 3 - 0
accounts-db/Cargo.toml

@@ -111,3 +111,6 @@ harness = false
 [[bench]]
 name = "bench_lock_accounts"
 harness = false
+
+[lints]
+workspace = true

+ 3 - 0
bloom/Cargo.toml

@@ -41,3 +41,6 @@ frozen-abi = [
     "dep:solana-frozen-abi-macro",
     "solana-sdk/frozen-abi",
 ]
+
+[lints]
+workspace = true

+ 3 - 0
builtins-default-costs/Cargo.toml

@@ -44,3 +44,6 @@ frozen-abi = [
     "dep:solana-frozen-abi",
     "solana-vote-program/frozen-abi",
 ]
+
+[lints]
+workspace = true

+ 1 - 1
ci/docker/Dockerfile

@@ -70,11 +70,11 @@ RUN \
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- --no-modify-path --profile minimal --default-toolchain $RUST_VERSION -y && \
   rustup component add rustfmt && \
   rustup component add clippy && \
-  rustup component add llvm-tools-preview && \
   rustup install $RUST_NIGHTLY_VERSION && \
   rustup component add clippy --toolchain=$RUST_NIGHTLY_VERSION && \
   rustup component add rustfmt --toolchain=$RUST_NIGHTLY_VERSION && \
   rustup component add miri --toolchain=$RUST_NIGHTLY_VERSION && \
+  rustup component add llvm-tools-preview --toolchain=$RUST_NIGHTLY_VERSION && \
   rustup target add wasm32-unknown-unknown && \
   cargo install cargo-audit && \
   cargo install cargo-hack && \

+ 1 - 1
ci/rust-version.sh

@@ -29,7 +29,7 @@ fi
 if [[ -n $RUST_NIGHTLY_VERSION ]]; then
   nightly_version="$RUST_NIGHTLY_VERSION"
 else
-  nightly_version=2024-05-02
+  nightly_version=2024-08-08
 fi
 
 

+ 3 - 0
compute-budget/Cargo.toml

@@ -22,3 +22,6 @@ frozen-abi = [
     "dep:solana-frozen-abi",
     "solana-sdk/frozen-abi",
 ]
+
+[lints]
+workspace = true

+ 3 - 0
core/Cargo.toml

@@ -153,3 +153,6 @@ name = "sigverify_stage"
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 3 - 0
cost-model/Cargo.toml

@@ -54,3 +54,6 @@ frozen-abi = [
 
 [[bench]]
 name = "cost_tracker"
+
+[lints]
+workspace = true

+ 3 - 0
curves/bn254/Cargo.toml

@@ -25,3 +25,6 @@ array-bytes = { workspace = true }
 serde = { workspace = true }
 serde_derive = { workspace = true }
 serde_json = { workspace = true }
+
+[lints]
+workspace = true

+ 3 - 0
curves/curve25519/Cargo.toml

@@ -19,3 +19,6 @@ solana-program = { workspace = true }
 
 [target.'cfg(not(target_os = "solana"))'.dependencies]
 curve25519-dalek = { workspace = true, features = ["serde"] }
+
+[lints]
+workspace = true

+ 3 - 0
curves/secp256k1-recover/Cargo.toml

@@ -37,3 +37,6 @@ frozen-abi = ["dep:rustc_version", "dep:solana-frozen-abi", "dep:solana-frozen-a
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 5 - 0
define-syscall/Cargo.toml

@@ -11,3 +11,8 @@ edition = { workspace = true }
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints.rust]
+unexpected_cfgs = { level = "warn", check-cfg = [
+  'cfg(target_feature, values("static-syscalls"))',
+] }

+ 3 - 0
frozen-abi/Cargo.toml

@@ -36,3 +36,6 @@ rustc_version = { workspace = true }
 default = ["frozen-abi"]
 # no reason to deactivate this. It's needed because the build.rs is reused elsewhere
 frozen-abi = []
+
+[lints]
+workspace = true

+ 3 - 0
frozen-abi/macro/Cargo.toml

@@ -24,3 +24,6 @@ rustc_version = { workspace = true }
 default = ["frozen-abi"]
 # no reason to deactivate this. It's needed because the build.rs is reused elsewhere
 frozen-abi = []
+
+[lints]
+workspace = true

+ 3 - 0
gossip/Cargo.toml

@@ -94,3 +94,6 @@ path = "src/main.rs"
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 3 - 0
ledger/Cargo.toml

@@ -112,3 +112,6 @@ name = "blockstore"
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 4 - 1
metrics/src/counter.rs

@@ -58,7 +58,10 @@ macro_rules! create_counter {
 #[macro_export]
 macro_rules! inc_counter {
     ($name:expr, $level:expr, $count:expr) => {
-        unsafe { $name.inc($level, $count) };
+        #[allow(clippy::macro_metavars_in_unsafe)]
+        unsafe {
+            $name.inc($level, $count)
+        };
     };
 }
 

+ 9 - 0
perf/Cargo.toml

@@ -64,3 +64,12 @@ name = "discard"
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints.rust.unexpected_cfgs]
+level = "warn"
+check-cfg = [
+    'cfg(build_target_feature_avx)',
+    'cfg(build_target_feature_avx2)',
+    'cfg(RUSTC_WITH_SPECIALIZATION)',
+    'cfg(RUSTC_WITHOUT_SPECIALIZATION)',
+]

+ 3 - 0
poseidon/Cargo.toml

@@ -21,3 +21,6 @@ light-poseidon = { workspace = true }
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 3 - 0
program-runtime/Cargo.toml

@@ -59,3 +59,6 @@ frozen-abi = [
     "solana-sdk/frozen-abi",
 ]
 shuttle-test = ["solana-type-overrides/shuttle-test", "solana_rbpf/shuttle-test"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/address-lookup-table/Cargo.toml

@@ -32,3 +32,6 @@ name = "solana_address_lookup_table_program"
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 4 - 0
programs/sbf/Cargo.toml

@@ -7,6 +7,10 @@ homepage = "https://anza.xyz"
 license = "Apache-2.0"
 edition = "2021"
 
+[workspace.lints.rust.unexpected_cfgs]
+level = "warn"
+check-cfg = ['cfg(target_os, values("solana"))']
+
 [workspace.dependencies]
 array-bytes = "=1.4.1"
 bincode = { version = "1.1.4", default-features = false }

+ 3 - 0
programs/sbf/rust/custom_heap/Cargo.toml

@@ -17,3 +17,6 @@ custom-heap = []
 
 [lib]
 crate-type = ["cdylib"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/sbf/rust/deprecated_loader/Cargo.toml

@@ -13,3 +13,6 @@ solana-program = { workspace = true }
 
 [lib]
 crate-type = ["cdylib"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/sbf/rust/membuiltins/Cargo.toml

@@ -14,3 +14,6 @@ solana-sbf-rust-mem-dep = { workspace = true }
 
 [lib]
 crate-type = ["cdylib"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/sbf/rust/panic/Cargo.toml

@@ -17,3 +17,6 @@ custom-panic = []
 
 [lib]
 crate-type = ["cdylib"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/sbf/rust/ro_modify/Cargo.toml

@@ -13,3 +13,6 @@ solana-program = { workspace = true }
 
 [lib]
 crate-type = ["cdylib"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/sbf/rust/sanity/Cargo.toml

@@ -13,3 +13,6 @@ solana-program = { workspace = true }
 
 [lib]
 crate-type = ["cdylib"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/stake/Cargo.toml

@@ -35,3 +35,6 @@ name = "solana_stake_program"
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 3 - 0
programs/vote/Cargo.toml

@@ -48,3 +48,6 @@ frozen-abi = [
     "solana-program-runtime/frozen-abi",
     "solana-sdk/frozen-abi",
 ]
+
+[lints]
+workspace = true

+ 3 - 0
runtime-transaction/Cargo.toml

@@ -36,3 +36,6 @@ rustc_version = { workspace = true, optional = true }
 [[bench]]
 name = "process_compute_budget_instructions"
 harness = false
+
+[lints]
+workspace = true

+ 3 - 0
runtime/Cargo.toml

@@ -133,3 +133,6 @@ frozen-abi = [
 
 [[bench]]
 name = "prioritization_fee_cache"
+
+[lints]
+workspace = true

+ 1 - 1
rust-toolchain.toml

@@ -1,2 +1,2 @@
 [toolchain]
-channel = "1.78.0"
+channel = "1.80.1"

+ 9 - 0
scripts/coverage.sh

@@ -28,6 +28,14 @@ fi
 # shellcheck source=ci/rust-version.sh
 source "$here/../ci/rust-version.sh" nightly
 
+# Check llvm path
+llvm_profdata="$(find "$(rustc +"$rust_nightly" --print sysroot)" -name llvm-profdata)"
+if [ -z "$llvm_profdata" ]; then
+  echo "Error: couldn't find llvm-profdata. Try installing the llvm-tools component with \`rustup component add llvm-tools-preview --toolchain=$rust_nightly\`"
+  exit 1
+fi
+llvm_path="$(dirname "$llvm_profdata")"
+
 # get commit hash. it will be used to name output folder
 if [ -z "$COMMIT_HASH" ]; then
   COMMIT_HASH=$(git rev-parse --short=9 HEAD)
@@ -66,6 +74,7 @@ grcov_common_args=(
   --source-dir "$here/.."
   --binary-path "$here/../target/cov/debug"
   --llvm
+  --llvm-path "$llvm_path"
   --ignore \*.cargo\*
   --ignore \*build.rs
   --ignore bench-tps\*

+ 3 - 0
sdk/Cargo.toml

@@ -119,3 +119,6 @@ targets = ["x86_64-unknown-linux-gnu"]
 
 [lib]
 crate-type = ["cdylib", "rlib"]
+
+[lints]
+workspace = true

+ 3 - 0
sdk/msg/Cargo.toml

@@ -14,3 +14,6 @@ solana-define-syscall = { workspace = true }
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 3 - 0
sdk/program-memory/Cargo.toml

@@ -17,3 +17,6 @@ targets = ["x86_64-unknown-linux-gnu"]
 
 [target.'cfg(target_os = "solana")'.dependencies]
 solana-define-syscall = { workspace = true }
+
+[lints]
+workspace = true

+ 3 - 0
sdk/program/Cargo.toml

@@ -104,3 +104,6 @@ frozen-abi = [
     "dep:solana-frozen-abi-macro",
     "solana-short-vec/frozen-abi",
 ]
+
+[lints]
+workspace = true

+ 3 - 0
short-vec/Cargo.toml

@@ -27,3 +27,6 @@ frozen-abi = ["dep:rustc_version", "dep:solana-frozen-abi", "dep:solana-frozen-a
 
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
+
+[lints]
+workspace = true

+ 3 - 0
svm/Cargo.toml

@@ -76,3 +76,6 @@ shuttle-test = [
     "solana-bpf-loader-program/shuttle-test",
     "solana-loader-v4-program/shuttle-test",
 ]
+
+[lints]
+workspace = true

+ 3 - 0
version/Cargo.toml

@@ -36,3 +36,6 @@ targets = ["x86_64-unknown-linux-gnu"]
 
 [build-dependencies]
 rustc_version = { workspace = true, optional = true }
+
+[lints]
+workspace = true

+ 3 - 0
vote/Cargo.toml

@@ -41,3 +41,6 @@ frozen-abi = [
     "dep:solana-frozen-abi-macro",
     "solana-sdk/frozen-abi",
 ]
+
+[lints]
+workspace = true

+ 3 - 0
zk-sdk/Cargo.toml

@@ -39,3 +39,6 @@ zeroize = { workspace = true, features = ["zeroize_derive"] }
 
 [lib]
 crate-type = ["cdylib", "rlib"]
+
+[lints]
+workspace = true

+ 3 - 0
zk-token-sdk/Cargo.toml

@@ -41,3 +41,6 @@ zeroize = { workspace = true, features = ["zeroize_derive"] }
 
 [lib]
 crate-type = ["cdylib", "rlib"]
+
+[lints]
+workspace = true