Skip to content

Commit d96c01c

Browse files
authored
Merge pull request #1571 from Wandalen/variadic_from_1
AUTO : Forward from variadic_from_1 to alpha
2 parents 9eedcae + b49d633 commit d96c01c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2648
-1923
lines changed

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ default-features = false
127127
# features = [ "enabled" ]
128128

129129
[workspace.dependencies.derive_tools_meta]
130-
version = "~0.35.0"
130+
version = "~0.36.0"
131131
path = "module/core/derive_tools_meta"
132132
default-features = false
133133
# features = [ "enabled" ]
@@ -175,18 +175,18 @@ default-features = false
175175
# features = [ "enabled" ]
176176

177177
[workspace.dependencies.clone_dyn]
178-
version = "~0.33.0"
178+
version = "~0.34.0"
179179
path = "module/core/clone_dyn"
180180
default-features = false
181181
# features = [ "enabled" ]
182182

183183
[workspace.dependencies.clone_dyn_meta]
184-
version = "~0.31.0"
184+
version = "~0.32.0"
185185
path = "module/core/clone_dyn_meta"
186186
# features = [ "enabled" ]
187187

188188
[workspace.dependencies.clone_dyn_types]
189-
version = "~0.31.0"
189+
version = "~0.32.0"
190190
path = "module/core/clone_dyn_types"
191191
default-features = false
192192
# features = [ "enabled" ]
@@ -211,7 +211,7 @@ default-features = false
211211
## iter
212212

213213
[workspace.dependencies.iter_tools]
214-
version = "~0.29.0"
214+
version = "~0.30.0"
215215
path = "module/core/iter_tools"
216216
default-features = false
217217

@@ -234,12 +234,12 @@ path = "module/core/former"
234234
default-features = false
235235

236236
[workspace.dependencies.former_meta]
237-
version = "~2.17.0"
237+
version = "~2.18.0"
238238
path = "module/core/former_meta"
239239
default-features = false
240240

241241
[workspace.dependencies.former_types]
242-
version = "~2.16.0"
242+
version = "~2.17.0"
243243
path = "module/core/former_types"
244244
default-features = false
245245

@@ -299,7 +299,7 @@ default-features = false
299299
## macro tools
300300

301301
[workspace.dependencies.macro_tools]
302-
version = "~0.55.0"
302+
version = "~0.56.0"
303303
path = "module/core/macro_tools"
304304
default-features = false
305305

@@ -358,7 +358,7 @@ default-features = false
358358
## error
359359

360360
[workspace.dependencies.error_tools]
361-
version = "~0.22.0"
361+
version = "~0.23.0"
362362
path = "module/core/error_tools"
363363
default-features = false
364364

module/core/clone_dyn/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clone_dyn"
3-
version = "0.33.0"
3+
version = "0.34.0"
44
edition = "2021"
55
authors = [
66
"Kostiantyn Wandalen <[email protected]>",

module/core/clone_dyn_meta/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clone_dyn_meta"
3-
version = "0.31.0"
3+
version = "0.32.0"
44
edition = "2021"
55
authors = [
66
"Kostiantyn Wandalen <[email protected]>",

module/core/clone_dyn_types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clone_dyn_types"
3-
version = "0.31.0"
3+
version = "0.32.0"
44
edition = "2021"
55
authors = [
66
"Kostiantyn Wandalen <[email protected]>",

module/core/derive_tools/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ parse_display = [ "parse-display" ]
194194
[dependencies]
195195

196196
## external
197-
derive_more = { version = "~1.0.0-beta.6", optional = true, default-features = false, features = [ "debug" ] }
197+
derive_more = { version = "~1.0.0-beta.6", optional = true, default-features = false }
198198
strum = { version = "~0.25", optional = true, default-features = false }
199199
# strum_macros = { version = "~0.25.3", optional = true, default-features = false }
200200
parse-display = { version = "~0.8.2", optional = true, default-features = false }
@@ -209,7 +209,7 @@ clone_dyn = { workspace = true, optional = true, features = [ "clone_dyn_types",
209209
[dev-dependencies]
210210

211211
derive_tools_meta = { workspace = true, features = ["enabled"] }
212-
macro_tools = { workspace = true, features = ["enabled", "diag"] }
212+
macro_tools = { workspace = true, features = ["enabled", "diag", "attr"] }
213213
test_tools = { workspace = true }
214214

215215
[build-dependencies]

module/core/derive_tools/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,5 @@
8989
* Restored and validated the entire test suite for `derive_tools` crate.
9090

9191
* [2025-07-05] Finalized test suite restoration and validation, ensuring all tests pass and no linter warnings are present.
92+
93+
* [2025-07-06] Enabled conditional debug output for derive macros.
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Task Plan: Fix errors in derive_tools and derive_tools_meta
2+
3+
### Goal
4+
* To identify and resolve all compilation errors in the `derive_tools` and `derive_tools_meta` crates, ensuring they compile successfully and produce debug output only when the `#[debug]` attribute is present.
5+
6+
### Ubiquitous Language (Vocabulary)
7+
* **derive_tools**: The primary crate providing derive macros.
8+
* **derive_tools_meta**: The proc-macro crate implementing the logic for the derive macros in `derive_tools`.
9+
10+
### Progress
11+
* **Roadmap Milestone:** N/A
12+
* **Primary Editable Crate:** `module/core/derive_tools`
13+
* **Overall Progress:** 3/4 increments complete
14+
* **Increment Status:**
15+
* ✅ Increment 1: Targeted Diagnostics - Identify compilation errors
16+
* ✅ Increment 2: Fix E0597, unused_assignments warning, and typo in derive_tools_meta
17+
* ✅ Increment 3: Enable Conditional Debug Output and Fix Related Errors/Lints
18+
* ⏳ Increment 4: Finalization
19+
20+
### Permissions & Boundaries
21+
* **Mode:** code
22+
* **Run workspace-wise commands:** false
23+
* **Add transient comments:** true
24+
* **Additional Editable Crates:**
25+
* `module/core/derive_tools_meta` (Reason: Proc-macro implementation for the primary crate)
26+
27+
### Relevant Context
28+
* Control Files to Reference (if they exist):
29+
* `./roadmap.md`
30+
* `./spec.md`
31+
* `./spec_addendum.md`
32+
* Files to Include (for AI's reference, if `read_file` is planned):
33+
* `module/core/derive_tools/Cargo.toml`
34+
* `module/core/derive_tools_meta/Cargo.toml`
35+
* `module/core/derive_tools_meta/src/derive/from.rs`
36+
* `module/core/derive_tools/tests/inc/deref/basic_test.rs` (and other relevant test files)
37+
* Crates for Documentation (for AI's reference, if `read_file` on docs is planned):
38+
* `derive_tools`
39+
* `derive_tools_meta`
40+
* External Crates Requiring `task.md` Proposals (if any identified during planning):
41+
* None identified yet.
42+
43+
### Expected Behavior Rules / Specifications
44+
* The `derive_tools` and `derive_tools_meta` crates should compile without any errors or warnings.
45+
* Debug output should be produced during compilation or testing *only* when the `#[debug]` attribute is explicitly present on the item.
46+
47+
### Crate Conformance Check Procedure
48+
* Step 1: Run `cargo check -p derive_tools_meta` and `cargo check -p derive_tools` via `execute_command`. Analyze output for success.
49+
* Step 2: If Step 1 passes, run `cargo test -p derive_tools_meta` and `cargo test -p derive_tools` via `execute_command`. Analyze output for success.
50+
* Step 3: If Step 2 passes, run `cargo clippy -p derive_tools_meta -- -D warnings` and `cargo clippy -p derive_tools -- -D warnings` via `execute_command`. Analyze output for success.
51+
52+
### Increments
53+
##### Increment 1: Targeted Diagnostics - Identify compilation errors
54+
* **Goal:** To run targeted checks on `derive_tools_meta` and `derive_tools` to capture all compilation errors.
55+
* **Specification Reference:** N/A
56+
* **Steps:**
57+
* Step 1: Execute `cargo check -p derive_tools_meta` to get errors from the meta crate.
58+
* Step 2: Execute `cargo check -p derive_tools` to get errors from the main crate.
59+
* Step 3: Analyze the output to identify all errors.
60+
* Step 4: Update `Increment 2` with a detailed plan to fix the identified errors.
61+
* **Increment Verification:**
62+
* Step 1: The `execute_command` for both `cargo check` commands complete.
63+
* Step 2: The output logs containing the errors are successfully analyzed.
64+
* **Commit Message:** "chore(diagnostics): Capture initial compilation errors per-crate"
65+
66+
##### Increment 2: Fix E0597, unused_assignments warning, and typo in derive_tools_meta
67+
* **Goal:** To fix the `E0597: `where_clause` does not live long enough` error, the `unused_assignments` warning, and the `predates` typo in `derive_tools_meta/src/derive/from.rs`.
68+
* **Specification Reference:** N/A
69+
* **Steps:**
70+
* Step 1: Read the file `module/core/derive_tools_meta/src/derive/from.rs`.
71+
* Step 2: Modify the code to directly assign the `Option<syn::WhereClause>` to `where_clause_owned` and then take a reference to it, resolving both the lifetime issue and the `unused_assignments` warning.
72+
* Step 3: Correct the typo `predates` to `predicates` on line 515.
73+
* Step 4: Perform Increment Verification.
74+
* Step 5: Perform Crate Conformance Check.
75+
* **Increment Verification:**
76+
* Step 1: Execute `cargo clippy -p derive_tools_meta -- -D warnings` via `execute_command`.
77+
* Step 2: Analyze the output to confirm that all errors and warnings are resolved.
78+
* **Commit Message:** "fix(derive_tools_meta): Resolve lifetime, unused assignment warning, and typo in From derive"
79+
80+
##### Increment 3: Enable Conditional Debug Output and Fix Related Errors/Lints
81+
* **Goal:** To ensure `diag::report_print` calls are present and conditionally executed based on the `#[debug]` attribute, and fix any related lints/errors.
82+
* **Specification Reference:** User feedback.
83+
* **Steps:**
84+
* Step 1: Revert commenting of `diag::report_print` calls in `module/core/derive_tools_meta/src/derive/from.rs`.
85+
* Step 2: Revert `_original_input` to `original_input` in `module/core/derive_tools_meta/src/derive/from.rs` (struct definitions and local variable assignments).
86+
* Step 3: Ensure `diag` import is present in `module/core/derive_tools_meta/src/derive/from.rs`.
87+
* Step 4: Add `#[debug]` attribute to `MyTuple` struct in `module/core/derive_tools/tests/inc/deref/basic_test.rs` to enable conditional debug output for testing.
88+
* Step 5: Run `cargo clean` to ensure a fresh build.
89+
* Step 6: Perform Crate Conformance Check.
90+
* Step 7: Verify that debug output is produced only when `#[debug]` is present.
91+
* **Increment Verification:**
92+
* Step 1: `cargo check`, `cargo test`, and `cargo clippy` pass without errors or warnings.
93+
* Step 2: Debug output is observed during `cargo test` for items with `#[debug]`, and absent for others.
94+
* **Commit Message:** "feat(debug): Enable conditional debug output for derive macros"
95+
96+
##### Increment 4: Finalization
97+
* **Goal:** To perform a final, holistic review and verification of the entire task's output, ensuring all errors are fixed and the crates are fully compliant.
98+
* **Specification Reference:** N/A
99+
* **Steps:**
100+
* Step 1: Perform a final self-critique against all requirements.
101+
* Step 2: Execute the full `Crate Conformance Check Procedure`.
102+
* Step 3: Execute `git status` to ensure the working directory is clean.
103+
* **Increment Verification:**
104+
* Step 1: All checks in the `Crate Conformance Check Procedure` pass successfully based on `execute_command` output.
105+
* Step 2: `git status` output shows a clean working tree.
106+
* **Commit Message:** "chore(ci): Final verification of derive_tools fixes"
107+
108+
### Task Requirements
109+
* All fixes must adhere to the project's existing code style.
110+
* No new functionality should be introduced; the focus is solely on fixing existing errors.
111+
* Do not run commands with the `--workspace` flag.
112+
113+
### Project Requirements
114+
* All code must strictly adhere to the `codestyle` rulebook provided by the user at the start of the task.
115+
* Must use Rust 2021 edition.
116+
117+
### Assumptions
118+
* The errors are confined to the `derive_tools` and `derive_tools_meta` crates.
119+
* The existing test suite is sufficient to catch regressions introduced by the fixes.
120+
121+
### Out of Scope
122+
* Refactoring code that is not directly related to a compilation error.
123+
* Updating dependencies unless required to fix an error.
124+
125+
### External System Dependencies
126+
* None.
127+
128+
### Notes & Insights
129+
* The errors in the meta crate will likely need to be fixed before the errors in the main crate can be fully resolved.
130+
131+
### Changelog
132+
* [Initial] Plan created.
133+
* [2025-07-05] Updated plan to avoid workspace commands per user instruction.
134+
* [2025-07-05] Identified E0716 in `derive_tools_meta` and planned fix.
135+
* [2025-07-05] Identified E0597 in `derive_tools_meta` and planned fix.
136+
* [2025-07-05] Corrected `timeout` command syntax for Windows.
137+
* [2025-07-05] Removed `timeout` wrapper from commands due to Windows compatibility issues.
138+
* [2025-07-05] Planned fix for `unused_assignments` warning in `derive_tools_meta`.
139+
* [2025-07-05] Planned fix for `predates` typo in `derive_tools_meta`.
140+
* [2025-07-06] Commented out `diag::report_print` calls and related unused variables in `derive_tools_meta/src/derive/from.rs`.
141+
* [2025-07-06] Rewrote `VariantGenerateContext` struct and constructor in `derive_tools_meta/src/derive/from.rs` to fix `E0560`/`E0609` errors.
142+
* [2025-07-06] Reverted commenting of `diag::report_print` calls and `_original_input` to `original_input` in `derive_tools_meta/src/derive/from.rs`.
143+
* [2025-07-06] Added `#[debug]` attribute to `MyTuple` in `derive_tools/tests/inc/deref/basic_test.rs`.
144+
* [2025-07-06] Re-added `#[debug]` attribute to `MyTuple` in `derive_tools/tests/inc/deref/basic_test.rs` to explicitly enable debug output for testing.
145+
* [2025-07-06] Corrected `#[attr::debug]` to `#[debug]` in `derive_tools/tests/inc/deref/basic_test.rs`.
146+
* [2025-07-06] Enabled `attr` feature for `macro_tools` in `derive_tools/Cargo.toml` to resolve `unresolved import `macro_tools::attr`` error.
147+
* [2025-07-06] Added dummy `debug` attribute macro in `derive_tools_meta/src/lib.rs` to resolve `cannot find attribute `debug` in this scope` error.
148+
* [2025-07-06] Addressed `unused_variables` warning in `derive_tools_meta/src/lib.rs` by renaming `attr` to `_attr`.
149+
* [2025-07-06] Corrected `#[debug]` to `#[debug]` in `derive_tools/tests/inc/deref/basic_test.rs`.
150+
* [2025-07-06] Imported `derive_tools_meta::debug` in `derive_tools/tests/inc/deref/basic_test.rs` to resolve attribute error.
151+
* [2025-07-06] Temporarily removed `#[debug]` from `MyTuple` in `derive_tools/tests/inc/deref/basic_test.rs` to isolate `Deref` issue.
152+
* [2025-07-06] Removed `#[automatically_derived]` from generated code in `derive_tools_meta/src/derive/deref.rs` to fix `Deref` issue.
153+
* [2025-07-06] Removed duplicated `#[inline(always)]` from generated code in `derive_tools_meta/src/derive/deref.rs`.
154+
* [2025-07-06] Simplified generated `Deref` implementation in `derive_tools_meta/src/derive/deref.rs` to debug `E0614`.
155+
* [2025-07-06] Passed `has_debug` to `generate` function and made `diag::report_print` conditional in `derive_tools_meta/src/derive/deref.rs`.
156+
* [2025-07-06] Added `#[derive(Deref)]` to `MyTuple` in `derive_tools/tests/inc/deref/basic_test.rs`.
157+
* [2025-07-06] Added `#[allow(clippy::too_many_arguments)]` to `generate` function in `derive_tools_meta/src/derive/deref.rs`.
158+
* [2025-07-06] Updated `proc_macro_derive` for `Deref` to include `debug` attribute in `derive_tools_meta/src/lib.rs`.
159+
* [2025-07-06] Removed dummy `debug` attribute macro from `derive_tools_meta/src/lib.rs`.
160+
* [2025-07-06] Reordered `#[derive(Deref)]` and `#[debug]` attributes on `MyTuple` in `derive_tools/tests/inc/deref/basic_test.rs`.
161+
* [2025-07-06] Verified conditional debug output for `Deref` derive macro.

0 commit comments

Comments
 (0)