-
Notifications
You must be signed in to change notification settings - Fork 71
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
refactor: Remove lazy static instances #250
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 15 out of 17 changed files in this pull request and generated no suggestions.
Files not reviewed (2)
- crates/wdk-sys/Cargo.toml: Evaluated as low risk
- crates/wdk-build/Cargo.toml: Evaluated as low risk
@@ -74,4 +74,4 @@ redundant_explicit_links = "warn" | |||
unescaped_backticks = "warn" | |||
|
|||
[package.metadata.cargo-machete] | |||
ignored = ["lazy_static"] # lazy_static is used in code generated by build.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this entire line is gone -- there's no reference to lazy_static. why do we need to keep the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is still a machete entry for once_cell. I want a comment documenting why machete needs to ignore once_cell (presumably because its only used in generated code that machete doesn't scan , resulting in a false positive).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without the comment, machete fails, right?
Cargo.toml
Outdated
@@ -45,7 +45,9 @@ cfg-if = "1.0.0" | |||
clap = "4.5.9" | |||
clap-cargo = "0.14.1" | |||
itertools = "0.13.0" | |||
lazy_static = "1.5.0" | |||
once_cell = { version = "1.20.2", default-features = false, features = [ | |||
"alloc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm is alloc required here? this forces there to be an allocator pulled in always. packages without them would fail to compile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be addressed in separate issue: we should add some samples to the top level test that explicitly test this no alloc available case. The current examples all pull in wdk-alloc
but samples should work without it still
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think as it stands, this pr breaks the pure no-std case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leon-xd this was marked as resolved, but i believe its still the case?
Copilot
AI
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 29 out of 44 changed files in this pull request and generated 1 comment.
Files not reviewed (15)
- tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_tuple_struct_shadowing.expanded.rs: Evaluated as low risk
- tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs: Evaluated as low risk
- crates/wdk-sys/src/lib.rs: Evaluated as low risk
- crates/wdk-build/Cargo.toml: Evaluated as low risk
- Cargo.toml: Evaluated as low risk
- crates/wdk-build/src/lib.rs: Evaluated as low risk
- tests/wdk-macros-tests/Cargo.toml: Evaluated as low risk
- crates/wdk-sys/src/wdf.rs: Evaluated as low risk
- tests/wdk-macros-tests/src/lib.rs: Evaluated as low risk
- crates/wdk-sys/Cargo.toml: Evaluated as low risk
- crates/wdk-sys/build.rs: Evaluated as low risk
- tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_verifier_dbg_break_point.expanded.rs: Evaluated as low risk
- tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_spin_lock_acquire.expanded.rs: Evaluated as low risk
- tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_request_retrieve_output_buffer.expanded.rs: Evaluated as low risk
- tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_tuple_struct_shadowing.expanded.rs: Evaluated as low risk
Comments suppressed due to low confidence (1)
tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_device_create.expanded.rs:30
- [nitpick] The error message is too verbose. Consider simplifying it to: 'assertion failed: invalid function count size'.
::core::panicking::panic("assertion failed: isize::try_from(wdf_function_count *\n core::mem::size_of::<wdk_sys::WDFFUNC>()).is_ok()")
@@ -47,8 +47,26 @@ pub extern "system" fn driver_entry( | |||
driver__: *mut WDFDRIVER, | |||
) -> NTSTATUS { | |||
let wdf_function: wdk_sys::PFN_WDFDRIVERCREATE = Some(unsafe { | |||
let wdf_function_table = wdk_sys::WdfFunctions; | |||
let wdf_function_count = wdk_sys::wdf::get_wdf_function_count(); | |||
if true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant if true
condition. This block can be simplified.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Replaced lazy static instances with std::sync::LazyLock in following locations:
Replaced lazy static instances with custom FunctionTable struct in generated code in
crates/wdk-sys/build.rs