8000 cargo: patch darling to avoid getters2 breakage by Wenzel · Pull Request #158 · intel/tsffs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cargo: patch darling to avoid getters2 breakage #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025

Conversation

Wenzel
Copy link
Contributor
@Wenzel Wenzel commented Apr 19, 2025
    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 Wenzel force-pushed the fix/darling_patch branch from 13ee4a7 to 070e92a Compare April 19, 2025 10:22
@novafacing
Copy link
Contributor
novafacing commented Apr 21, 2025

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)

@Wenzel Wenzel force-pushed the fix/darling_patch branch 3 times, most recently from b51f9ee to f88b93c Compare April 21, 2025 12:43
@Wenzel
Copy link
Contributor Author
Wenzel commented Apr 22, 2025

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

@Wenzel Wenzel force-pushed the fix/darling_patch branch from f88b93c to ca38e26 Compare April 22, 2025 11:24
@Wenzel
Copy link
Contributor Author
Wenzel commented Apr 22, 2025

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: tsffs@0.2.2: No SIMICS_BASE environment variable found, using ispm to find installed packages and using latest base version
warning: tsffs@0.2.2: 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
Copy link
Contributor Author
Wenzel commented Apr 29, 2025

@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: tsffs@0.2.2: No SIMICS_BASE environment variable found, using ispm to find installed packages and using latest base version
warning: tsffs@0.2.2: 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.

@novafacing
Copy link
Contributor

Are there two versions of ispm_wrapper in your dependency tree?

@Wenzel
Copy link
Contributor Author
Wenzel commented May 5, 2025

@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 Wenzel force-pushed the fix/darling_patch branch 2 times, most recently from 02a7bdd to 4b1ae32 Compare May 16, 2025 08:12
@Wenzel Wenzel force-pushed the fix/darling_patch branch from 4b1ae32 to 561c4a4 Compare May 16, 2025 10:49
[profile.release]
lto = true
codegen-units = 1
opt-level = 3
debug = true

# Temporary patch to pin darling to v0.20.10
[patch.crates-io]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@novafacing i'll merge this patch in the meantime to fix the CI

Copy link
Contributor Author
@Wenzel Wenzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandonmarken can i have your review ?

@Wenzel Wenzel merged commit 1520fb6 into intel:main May 16, 2025
19 checks passed
@Wenzel Wenzel deleted the fix/darling_patch branch May 19, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0