tsffs icon indicating copy to clipboard operation
tsffs copied to clipboard

cargo: patch darling to avoid getters2 breakage

Open Wenzel opened this issue 8 months ago • 4 comments

    Compiling simics-sign v0.1.1
   Compiling libafl_targets v0.11.2 (https://github.com/AFLplusplus/LibAFL?rev=0f26f6ea32aa74ee526636558842ec06bbfb49bb#0f26f6ea)
   Compiling cargo-simics-build v0.1.1
   Compiling getters2 v0.1.4
error: field will not be populated because `forward_attrs` is not set on the struct
   --> /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getters2-0.1.4/src/lib.rs:293:5
    |
293 |     attrs: Vec<Attribute>,
    |     ^^^^^
error: field will not be populated because `forward_attrs` is not set on the struct
   --> /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getters2-0.1.4/src/lib.rs:310:5
    |
310 |     attrs: Vec<Attribute>,
    |     ^^^^^
error[E0277]: the trait bound `GettersVariant: FromVariant` is not satisfied
   --> /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getters2-0.1.4/src/lib.rs:354:5
    |
354 |     data: Data<GettersVariant, GettersField>,
    |     ^^^^ the trait `FromVariant` is not implemented for `GettersVariant`
    |
    = help: the following other types implement trait `FromVariant`:
              ()
              Ignored
              SpannedValue<T>
              Variant
              Vec<Attribute>
              WithOriginal<T, Variant>
              proc_macro2::Ident
note: required by a bound in `darling::ast::Data::<V, F>::try_from`
   --> /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/darling_core-0.20.11/src/ast/data.rs:122:9
    |
122 | impl<V: FromVariant, F: FromField> Data<V, F> {
    |         ^^^^^^^^^^^ required by this bound in `Data::<V, F>::try_from`
123 |     /// Attempt to convert from a `syn::Data` instance.
124 |     pub fn try_from(body: &syn::Data) -> Result<Self> {
    |            -------- required by a bound in this associated function
error[E0277]: the trait bound `GettersField: FromField` is not satisfied
   --> /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getters2-0.1.4/src/lib.rs:354:5
    |
354 |     data: Data<GettersVariant, GettersField>,
    |     ^^^^ the trait `FromField` is not implemented for `GettersField`
    |
    = help: the following other types implement trait `FromField`:
              ()
              Ignored
              SpannedValue<T>
              Vec<Attribute>
              Visibility
              WithOriginal<T, syn::Field>
              darling_core::options::forwarded_field::ForwardedField
              syn::Field
              syn::Type
note: required by a bound in `darling::ast::Data::<V, F>::try_from`
   --> /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/darling_core-0.20.11/src/ast/data.rs:122:25
    |
122 | impl<V: FromVariant, F: FromField> Data<V, F> {
    |                         ^^^^^^^^^ required by this bound in `Data::<V, F>::try_from`
123 |     /// Attempt to convert from a `syn::Data` instance.
124 |     pub fn try_from(body: &syn::Data) -> Result<Self> {
    |            -------- required by a bound in this associated function
For more information about this error, try `rustc --explain E0277`.
error: could not compile `getters2` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
❗ Tests failed
Error: Process completed with exit code 1.

Wenzel avatar Apr 19 '25 09:04 Wenzel

I own getters2, I can just fix it if that's easier (or if you need it done fast, I'll accept any PR you throw my way)

novafacing avatar Apr 21 '25 07:04 novafacing

@novafacing thanks for telling you had ownership on getters2 ! I'll try to confirm that the fix works here before submitting a PR.

Wenzel avatar Apr 22 '25 00:04 Wenzel

Current status: https://github.com/intel/tsffs/actions/runs/14594500227/job/40937226621?pr=158#step:26:73

    Compiling simics-test v0.1.1 (https://github.com/Wenzel/simulator-bindings.git?rev=efbbec4561a2efe7e87269c239757b1ee4f7060c#efbbec45)
warning: [email protected]: No SIMICS_BASE environment variable found, using ispm to find installed packages and using latest base version
warning: [email protected]: Using Simics base version 6.0.185
   Compiling ispm-wrapper v0.1.1
error[E0277]: the trait bound `HashSet<ispm_wrapper::data::ProjectPackage>: From<[ProjectPackage; 3]>` is not satisfied
   --> tests/riscv_64_kernel_from_userspace_magic_6_0_185.rs:16:19
    |
16  |           .packages([
    |  __________--------_^
    | |          |
    | |          required by a bound introduced by this call
17  | |             ProjectPackage::builder()
18  | |                 .package_number(1000)
19  | |                 .version("6.0.185")
...   |
28  | |                 .build(),
29  | |         ])
    | |_________^ the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
    |
    = help: the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
            but trait `From<[ispm_wrapper::data::ProjectPackage; _]>` is implemented for it
    = help: for that trait implementation, expected `ispm_wrapper::data::ProjectPackage`, found `ProjectPackage`
    = note: required for `[ProjectPackage; 3]` to implement `Into<HashSet<ispm_wrapper::data::ProjectPackage>>`
note: required by a bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
   --> /github/home/.cargo/git/checkouts/simulator-bindings-33fb754bb701870e/efbbec4/simics-test/src/lib.rs:170:10
    |
170 | #[derive(TypedBuilder, Debug)]
    |          ^^^^^^^^^^^^ required by this bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
...
178 |     packages: HashSet<ProjectPackage>,
    |     -------- required by a bound in this associated function
    = note: this error originates in the derive macro `TypedBuilder` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `HashSet<ispm_wrapper::data::ProjectPackage>: From<[ProjectPackage; 5]>` is not satisfied
   --> tests/x86_userspace_magic_6_0_185.rs:16:19
    |
16  |           .packages([
    |  __________--------_^
    | |          |
    | |          required by a bound introduced by this call
17  | |             ProjectPackage::builder()
18  | |                 .package_number(1000)
19  | |                 .version("6.0.185")
...   |
36  | |                 .build(),
37  | |         ])
    | |_________^ the trait `From<[ProjectPackage; 5]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
    |
    = help: the trait `From<[ProjectPackage; 5]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
            but trait `From<[ispm_wrapper::data::ProjectPackage; _]>` is implemented for it
    = help: for that trait implementation, expected `ispm_wrapper::data::ProjectPackage`, found `ProjectPackage`
    = note: required for `[ProjectPackage; 5]` to implement `Into<HashSet<ispm_wrapper::data::ProjectPackage>>`
note: required by a bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
   --> /github/home/.cargo/git/checkouts/simulator-bindings-33fb754bb701870e/efbbec4/simics-test/src/lib.rs:170:10
    |
170 | #[derive(TypedBuilder, Debug)]
    |          ^^^^^^^^^^^^ required by this bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
...
178 |     packages: HashSet<ProjectPackage>,
    |     -------- required by a bound in this associated function
    = note: this error originates in the derive macro `TypedBuilder` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `HashSet<ispm_wrapper::data::ProjectPackage>: From<[ProjectPackage; 3]>` is not satisfied
   --> tests/riscv_64_userspace_magic_6_0_185.rs:16:19
    |
16  |           .packages([
    |  __________--------_^
    | |          |
    | |          required by a bound introduced by this call
17  | |             ProjectPackage::builder()
18  | |                 .package_number(1000)
19  | |                 .version("6.0.185")
...   |
28  | |                 .build(),
29  | |         ])
    | |_________^ the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
    |
    = help: the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
            but trait `From<[ispm_wrapper::data::ProjectPackage; _]>` is implemented for it
    = help: for that trait implementation, expected `ispm_wrapper::data::ProjectPackage`, found `ProjectPackage`
    = note: required for `[ProjectPackage; 3]` to implement `Into<HashSet<ispm_wrapper::data::ProjectPackage>>`
note: required by a bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
   --> /github/home/.cargo/git/checkouts/simulator-bindings-33fb754bb701870e/efbbec4/simics-test/src/lib.rs:170:10
    |
170 | #[derive(TypedBuilder, Debug)]
    |          ^^^^^^^^^^^^ required by this bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
...
178 |     packages: HashSet<ProjectPackage>,
    |     -------- required by a bound in this associated function
    = note: this error originates in the derive macro `TypedBuilder` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `HashSet<ispm_wrapper::data::ProjectPackage>: From<[ProjectPackage; 3]>` is not satisfied
   --> tests/riscv_64_kernel_from_userspace_magic_6_0_185.rs:85:19
    |
85  |           .packages([
    |  __________--------_^
    | |          |
    | |          required by a bound introduced by this call
86  | |             ProjectPackage::builder()
87  | |                 .package_number(1000)
88  | |                 .version("6.0.185")
...   |
97  | |                 .build(),
98  | |         ])
    | |_________^ the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
    |
    = help: the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
            but trait `From<[ispm_wrapper::data::ProjectPackage; _]>` is implemented for it
    = help: for that trait implementation, expected `ispm_wrapper::data::ProjectPackage`, found `ProjectPackage`
    = note: required for `[ProjectPackage; 3]` to implement `Into<HashSet<ispm_wrapper::data::ProjectPackage>>`
note: required by a bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
   --> /github/home/.cargo/git/checkouts/simulator-bindings-33fb754bb701870e/efbbec4/simics-test/src/lib.rs:170:10
    |
170 | #[derive(TypedBuilder, Debug)]
    |          ^^^^^^^^^^^^ required by this bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
...
178 |     packages: HashSet<ProjectPackage>,
    |     -------- required by a bound in this associated function
    = note: this error originates in the derive macro `TypedBuilder` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.

Wenzel avatar Apr 22 '25 22:04 Wenzel

@novafacing could you help me figure out this one ?

    Compiling simics-test v0.1.1 (https://github.com/Wenzel/simulator-bindings.git?rev=efbbec4561a2efe7e87269c239757b1ee4f7060c#efbbec45)
warning: [email protected]: No SIMICS_BASE environment variable found, using ispm to find installed packages and using latest base version
warning: [email protected]: Using Simics base version 6.0.185
   Compiling ispm-wrapper v0.1.1
error[E0277]: the trait bound `HashSet<ispm_wrapper::data::ProjectPackage>: From<[ProjectPackage; 3]>` is not satisfied
   --> tests/riscv_64_kernel_from_userspace_magic_6_0_185.rs:16:19
    |
16  |           .packages([
    |  __________--------_^
    | |          |
    | |          required by a bound introduced by this call
17  | |             ProjectPackage::builder()
18  | |                 .package_number(1000)
19  | |                 .version("6.0.185")
...   |
28  | |                 .build(),
29  | |         ])
    | |_________^ the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
    |
    = help: the trait `From<[ProjectPackage; 3]>` is not implemented for `HashSet<ispm_wrapper::data::ProjectPackage>`
            but trait `From<[ispm_wrapper::data::ProjectPackage; _]>` is implemented for it
    = help: for that trait implementation, expected `ispm_wrapper::data::ProjectPackage`, found `ProjectPackage`
    = note: required for `[ProjectPackage; 3]` to implement `Into<HashSet<ispm_wrapper::data::ProjectPackage>>`
note: required by a bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
   --> /github/home/.cargo/git/checkouts/simulator-bindings-33fb754bb701870e/efbbec4/simics-test/src/lib.rs:170:10
    |
170 | #[derive(TypedBuilder, Debug)]
    |          ^^^^^^^^^^^^ required by this bound in `TestEnvSpecBuilder::<(__cargo_target_tmpdir, __name, (), __nonrepo_packages, __files, __directories, __simics_home, __package_repo, __install_all, __package_crates, __build_simics_version, __run_simics_version)>::packages`
...
178 |     packages: HashSet<ProjectPackage>,
    |     -------- required by a bound in this associated function
    = note: this error originates in the derive macro `TypedBuilder` (in Nightly builds, run with -Z macro-backtrace for more info)

I'm clueless as to why this suddenly breaks ? Already tried to pin the typed-builder dependency, without luck.

Wenzel avatar Apr 29 '25 12:04 Wenzel

Are there two versions of ispm_wrapper in your dependency tree?

novafacing avatar May 01 '25 23:05 novafacing

@novafacing thanks, i had multiple references to the online crate while i was using a local copy:

[build-dependencies]
├── simics v0.1.2 (/workspace/tsffs/simulator-bindings/simics) (*)
└── simics-build-utils v0.1.1
    ├── anyhow v1.0.98
    ├── ispm-wrapper v0.1.1 <---
    │   ├── anyhow v1.0.98
    │   ├── command-ext v0.1.2 (*)
    │   ├── serde v1.0.219 (*)
    │   ├── serde_json v1.0.140 (*)
    │   ├── typed-builder v0.20.0 (*)
    │   └── versions v6.3.2 (*)
    ├── simics-api-sys v0.1.2
    │   [build-dependencies]
    │   ├── anyhow v1.0.98
    │   ├── bindgen v0.70.1 (*)
    │   ├── ispm-wrapper v0.1.1 (*) <---
    │   ├── scraper v0.20.0 (*)
    │   └── walkdir v2.5.0 (*)
    └── versions v6.3.2 (*)
[dev-dependencies]
├── anyhow v1.0.98
├── command-ext v0.1.2 (*)
├── indoc v2.0.6 (proc-macro)
├── ispm-wrapper v0.1.1 (*) <--
├── simics-test v0.1.1 (/workspace/tsffs/simulator-bindings/simics-test)
│   ├── anyhow v1.0.98
│   ├── cargo-simics-build v0.1.1 (/workspace/tsffs/simulator-bindings/cargo-simics-build)
│   │   ├── anyhow v1.0.98
│   │   ├── artifact-dependency v0.1.7

The build passes now:

diff --git a/Cargo.toml b/Cargo.toml
index f622a8f..b5ad1d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -64,12 +64,12 @@ yaxpeax-riscv = { git = "https://github.com/DrChat/yaxpeax-riscv", version = "0.
     "serde",
 ], rev = "5973ff8" }
 crc32fast = "1.4.2"
-simics = "0.1.2"
+simics = { path = "./simulator-bindings/simics" }
 indoc = "2.0.5"
 serde = { version = "1.0.210", features = ["derive"] }
 serde_json = "1.0.128"
 versions = { version = "6.2.0", features = ["serde"] }
-ffi = "0.1.1"
+ffi = { git = "https://github.com/Wenzel/ffi", rev = "496832d73717bb8e1ec82ea6603bbf393f451167" }
 num-traits = "0.2.19"
 num-derive = "0.4.2"
 tracing-subscriber = "0.3.18"
@@ -105,16 +105,16 @@ thiserror = "1.0.63"
 lcov2 = "0.1.0"

 [dev-dependencies]
-simics-test = { git = "https://github.com/Wenzel/simulator-bindings.git", rev = "4a33e71c3f688fd889924a357f742378cfd2ccc9" }
+simics-test = { path = "./simulator-bindings/simics-test" }
 anyhow = "1.0.86"
 command-ext = "0.1.2"
 indoc = "2.0.5"
-ispm-wrapper = "0.1.1"
+ispm-wrapper = { path = "./simulator-bindings/ispm-wrapper" }
 versions = { version = "6.2.0", features = ["serde"] }

 [build-dependencies]
-simics = "0.1.2"
-simics-build-utils = "0.1.1"
+simics = { path = "./simulator-bindings/simics" }
+simics-build-utils = { path = "./simulator-bindings/simics-build-utils" }
   Compiling tsffs v0.2.2 (/workspace/tsffs)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 23.39s

PRs to pin darling are on the way

Wenzel avatar May 05 '25 11:05 Wenzel