Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1c34569
component_model_types-v0.3.0
Wandalen May 18, 2025
613aa85
strs_tools-v0.19.0
Wandalen May 18, 2025
db254f7
plan
Wandalen May 18, 2025
9c335c9
refactor(unilang_parser): Adapt core types to strs_tools::string::spl…
Wandalen May 18, 2025
345e758
feat(unilang_parser): Implement parser entry points and RichItem stre…
Wandalen May 18, 2025
e92d23a
feat(unilang_parser): Implement instruction grouping by ';;' delimite…
Wandalen May 18, 2025
5ac5c48
feat(unilang_parser): Implement command path and help operator parsing
Wandalen May 18, 2025
4822a82
wip
Wandalen May 18, 2025
fcc6d53
feat(unilang_parser): Implement named and positional argument parsing…
Wandalen May 18, 2025
434b76a
feat(unilang_parser): Implement multi-segment command path parsing
Wandalen May 19, 2025
56cd8d0
feat(unilang_parser): Implement multi-segment command path parsing
Wandalen May 19, 2025
4fd1a54
feat(unilang_parser): Enhance error reporting with precise locations …
Wandalen May 19, 2025
8d2d422
test(unilang_parser): Add initial comprehensive test suite based on T…
Wandalen May 19, 2025
e7f7b31
unilang_instruction_parser wip
Wandalen May 24, 2025
c1d30f6
docs(unilang_parser): Add crate and API documentation, Readme, and ba…
Wandalen May 24, 2025
faacfbe
chore(unilang_parser): Update plan with final status and notes
Wandalen May 24, 2025
61d40d9
fix(unilang_parser): Correct path parsing logic and test assertions, …
Wandalen May 24, 2025
928eda8
fix(unilang_parser): Improve comment handling, align config entry tests
Wandalen May 24, 2025
adcc5b3
fix(unilang_parser): Improve comment handling, align config entry tests
Wandalen May 24, 2025
9ef9b80
test(unilang_parser): Verify argument_parsing_tests stability, confir…
Wandalen May 24, 2025
25bb5e3
test(unilang_parser): Align and verify Test Matrix CT2.1 (slice input…
Wandalen May 24, 2025
df06335
wip
Wandalen May 24, 2025
67dc1a3
fixing
Wandalen May 24, 2025
ee23fbf
feat(module/core/test_tools): Create task.md
wanguardd May 24, 2025
144c60e
fix test_tools
wanguardd May 24, 2025
730b79b
feat(mem_tools): Initial build check
wanguardd May 24, 2025
0daf88a
fix(mem_tools): Remove empty line after doc comment
wanguardd May 24, 2025
6400f8b
fix(mem_tools): Correct same_ptr and same_data implementations
wanguardd May 24, 2025
d23c0d2
docs(mem_tools): Update plan for clippy fixes
wanguardd May 24, 2025
ff3cce1
fix(mem_tools): Apply clippy auto-fixes for pointer casts
wanguardd May 24, 2025
04df80b
fix(mem_tools): Suppress unsafe_code warning and enhance safety proof
wanguardd May 24, 2025
a7d66b7
fix(unilang_instruction_parser): Address clippy warnings and compilat…
wanguardd May 24, 2025
f29695c
fix(unilang_instruction_parser): Enable and fix failing tests
wanguardd May 24, 2025
10ad337
refactor(unilang_instruction_parser): Refine test specifications and …
wanguardd May 24, 2025
d4816d8
docs(unilang_instruction_parser): Update Readme.md for clarity and co…
wanguardd May 24, 2025
60e34f9
feat(unilang_instruction_parser): Organize and improve examples
wanguardd May 24, 2025
5525648
fix(unilang_instruction_parser): Restore unescaping logic and re-igno…
wanguardd May 24, 2025
0d32de5
fix(strs_tools): Address clippy warnings and typo in split.rs
wanguardd May 24, 2025
df07391
fix(strs_tools): Resolve string unescaping issues for unilang_instruc…
wanguardd May 24, 2025
bcea197
fix(unilang_instruction_parser): Resolve trailing semicolon error and…
wanguardd May 24, 2025
682ba82
feat(unilang_instruction_parser): Propose strs_tools fix to enable al…
wanguardd May 24, 2025
c251615
docs(unilang_instruction_parser): Refine Readme for clarity and conci…
wanguardd May 24, 2025
73e0a6f
docs(unilang_instruction_parser): Organize and improve examples
wanguardd May 24, 2025
c2a7d72
fix(unilang_instruction_parser): Resolve remaining clippy warnings an…
wanguardd May 24, 2025
b964c88
chore(unilang_instruction_parser): Revert strs_tools fix and re-ignor…
wanguardd May 24, 2025
c11581f
chore(unilang_instruction_parser): Task blocked by strs_tools issue; …
wanguardd May 25, 2025
03ca117
strs_tools : cover issue by test
wanguardd May 25, 2025
51113ef
refactor(strs_tools): Stabilize quote handling, address warnings, tem…
wanguardd May 25, 2025
88ee94f
refactor(strs_tools): Stabilize quote handling, address warnings, tem…
wanguardd May 25, 2025
c3bfc63
fix(strs_tools): Correct empty segment handling with quoting and pres…
wanguardd May 25, 2025
4669ebb
wip
wanguardd May 25, 2025
ec999ae
fix(strs_tools): Correct span and content for quoted segments and res…
wanguardd May 27, 2025
3eeef64
chore(strs_tools): Propose fix to unilang_instruction_parser for span…
wanguardd May 27, 2025
ef7c5fe
style(strs_tools): Address clippy code style and refactoring lints
wanguardd May 27, 2025
d683d34
docs(strs_tools): Add missing documentation and panic docs for split …
wanguardd May 27, 2025
90a7363
docs(strs_tools): Add missing documentation and panic docs for split …
wanguardd May 27, 2025
696b9b9
refactor(strs_tools): Refine visibility of private module in split.rs…
wanguardd May 27, 2025
1a8738c
fix(unilang_instruction_parser): Enable and verify escaped quote hand…
wanguardd May 27, 2025
2c1ea57
chore(unilang_instruction_parser): Final checks, clippy, all tests pa…
wanguardd May 27, 2025
183d3e1
new plan
wanguardd May 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ path = "module/core/component_model_meta"
default-features = false

[workspace.dependencies.component_model_types]
version = "~0.2.0"
version = "~0.3.0"
path = "module/core/component_model_types"
default-features = false

Expand Down Expand Up @@ -369,7 +369,7 @@ path = "module/alias/werror"
## string tools

[workspace.dependencies.strs_tools]
version = "~0.18.0"
version = "~0.19.0"
path = "module/core/strs_tools"
default-features = false

Expand Down
2 changes: 1 addition & 1 deletion module/core/component_model_types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "component_model_types"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
authors = [
"Kostiantyn Wandalen <[email protected]>",
Expand Down
44 changes: 44 additions & 0 deletions module/core/former_meta/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Change Proposal for `former_meta`

### Task ID
* `TASK-20250524-FORMER-META-COMPILATION-FIX`

### Requesting Context
* **Requesting Crate/Project:** `module/move/unilang_instruction_parser` (and potentially other workspace crates)
* **Driving Feature/Task:** Final verification of `unilang_instruction_parser` requires a clean workspace build, which is currently blocked by compilation errors and warnings in `former_meta`.
* **Link to Requester's Plan:** `../../move/unilang_instruction_parser/plan.md`
* **Date Proposed:** 2025-05-24

### Overall Goal of Proposed Change
* Resolve compilation error `E0554` and clippy warnings in `former_meta` to allow successful compilation on stable Rust.

### Problem Statement / Justification
* During `cargo test --workspace`, `former_meta` fails to compile with `error[E0554]: #![feature]` may not be used on the stable release channel` due to `#![ feature( proc_macro_totokens ) ]` being used. This unstable feature is not available on stable Rust, blocking compilation for any dependent crates.
* Additionally, `former_meta` generates clippy warnings: `unused import: quote::quote_spanned`, `unreachable expression`, and `unused variable: attr_property`. These warnings prevent clean builds when `-D warnings` is enabled.

### Proposed Solution / Specific Changes
* **File:** `src/lib.rs`
* **Change:** Remove or conditionally compile `#![ feature( proc_macro_totokens ) ]`. If `proc_macro_totokens` is strictly necessary, `former_meta` should require a nightly toolchain, or an alternative stable API should be used.
* **File:** `src/derive_former/former_enum/unit_variant_handler.rs`
* **Change:** Remove `quote::quote_spanned` import if unused.
* **Change:** Refactor `return diag::return_syn_err!( ... )` to avoid `unreachable expression` warning.
* **Change:** Prefix `attr_property` with `_` if it's intentionally unused, or use it.

### Expected Behavior & Usage Examples (from Requester's Perspective)
* `cargo build -p former_meta` and `cargo clippy -p former_meta -- -D warnings` should complete successfully on a stable Rust toolchain.
* Dependent crates like `unilang_instruction_parser` should be able to compile without errors or warnings originating from `former_meta`.

### Acceptance Criteria (for this proposed change)
* `cargo build -p former_meta` exits with code 0.
* `cargo clippy -p former_meta -- -D warnings` exits with code 0 and no warnings.
* The functionality of `former_meta` remains unchanged.

### Potential Impact & Considerations
* **Breaking Changes:** No breaking changes are anticipated if the `proc_macro_totokens` feature can be removed or replaced without affecting core functionality.
* **Dependencies:** No new dependencies.
* **Performance:** No significant performance impact.
* **Security:** No security implications.
* **Testing:** Existing tests for `former_meta` should continue to pass.

### Notes & Open Questions
* Clarification is needed on the necessity of `proc_macro_totokens`. If it's critical, the crate might need to explicitly state nightly toolchain requirement.
11 changes: 6 additions & 5 deletions module/core/impls_index/tests/inc/impls1_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ fn impls_basic()
{
fn f1()
{
macro_rules! macro1
{
( $( $Arg : tt )* ) => { };
}
macro1!();
// xxx : qqq : uncomment and fix
// macro_rules! macro1
// {
// ( $( $Arg : tt )* ) => { { $( $Arg )* } };
// }
// macro1!();
}
}

Expand Down
1 change: 0 additions & 1 deletion module/core/inspect_type/tests/inc/inspect_type_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#[ allow( unused_imports ) ]
use super::*;

//
Expand Down
3 changes: 1 addition & 2 deletions module/core/inspect_type/tests/inc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#[ allow( unused_imports ) ]
use super::own::*;
use super::*;
109 changes: 109 additions & 0 deletions module/core/mem_tools/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Project Plan: Fix `mem_tools` crate

### Goal
* Ensure `module/core/mem_tools` compiles without errors or warnings.

### Progress
* ✅ Increment 1: Initial Build and Error Analysis.
* ✅ Increment 2: Lint Configuration Review and Cleanup.
* ✅ Increment 3: Fix `empty_line_after_doc_comments` lint.
* ✅ Increment 4: Fix `same_ptr` and `same_data` implementations.
* ✅ Increment 5: Apply Clippy auto-fixes.
* ✅ Increment 6: Suppress `unsafe_code` warning and enhance safety proof.

### Target Crate
* `module/core/mem_tools`

### Relevant Context
* Files to Include:
* `module/core/mem_tools/Cargo.toml`
* `module/core/mem_tools/src/lib.rs`
* `module/core/mem_tools/src/mem.rs`
* `module/core/mem_tools/tests/inc/mem_test.rs`
* `Cargo.toml` (workspace root)

### Expected Behavior Rules / Specifications (for Target Crate)
* The crate should compile successfully with `cargo build -p mem_tools`.
* No compilation errors or warnings should be reported.
* Lint configurations should align with workspace settings, without redundant or conflicting local attributes.
* `same_ptr` should return true if two references point to the same memory location.
* `same_data` should return true if two references point to data with the same content and size.
* All tests in `mem_tools` should pass.
* All Clippy warnings should be resolved.
* The `unsafe` block in `same_data` should have a clear and comprehensive safety justification.

### Target File Structure (If Applicable)
* (No structural changes planned initially)

### Increments

* ✅ Increment 1: Initial Build and Error Analysis.
* Detailed Plan Step 1: Execute `cargo build -p mem_tools` to check for compilation errors.
* Pre-Analysis: The `Cargo.toml` and `src/lib.rs` / `src/mem.rs` files have been reviewed. The `memcmp` FFI usage and module re-exports are noted as potential areas of interest.
* Crucial Design Rules: [Error Handling: Use a Centralized Approach], [Visibility: Keep Implementation Details Private]
* Relevant Behavior Rules: The crate should compile without errors.
* Verification Strategy: Execute `cargo build -p mem_tools` via `execute_command`. Analyze `execute_command` output critically for errors and warnings.
* Commit Message: `feat(mem_tools): Initial build check`

* ✅ Increment 2: Lint Configuration Review and Cleanup.
* Detailed Plan Step 1: Read `Cargo.toml` at the workspace root to check `[workspace.lints]`. (Already done in previous step)
* Detailed Plan Step 2: Remove commented-out `#![deny]` attributes from `module/core/mem_tools/src/lib.rs`.
* Detailed Plan Step 3: Remove `#[allow(unsafe_code)]` attribute from `module/core/mem_tools/src/mem.rs`.
* Pre-Analysis: Workspace lints for `rust_2018_idioms`, `future_incompatible` are `deny`, `missing_docs`, `missing_debug_implementations`, `unsafe-code` are `warn`, and `undocumented_unsafe_blocks` is `deny`. The local `#[allow(unsafe_code)]` is redundant given the `unsafe` block is documented and `unsafe-code` is only a warning. The commented-out `#![deny]` are also redundant.
* Crucial Design Rules: [Prefer workspace lints over entry file lints], [Comments: Focus on Rationale, Preserve Existing Tasks]
* Relevant Behavior Rules: Lints should be consistent with workspace settings.
* Verification Strategy: Execute `cargo build -p mem_tools` and `cargo clippy -p mem_tools` via `execute_command`. Analyze `execute_command` output for errors or warnings.
* Commit Message: `refactor(mem_tools): Clean up lint configurations`

* ✅ Increment 3: Fix `empty_line_after_doc_comments` lint.
* Detailed Plan Step 1: Remove the empty line after the doc comment for `pub mod dependency` in `module/core/mem_tools/src/lib.rs`.
* Pre-Analysis: The `cargo clippy` output indicated an `empty_line_after_doc_comments` warning at `src/lib.rs:12`.
* Crucial Design Rules: [Comments and Documentation], [Lints and warnings]
* Relevant Behavior Rules: No `empty_line_after_doc_comments` warning should be reported.
* Verification Strategy: Execute `cargo build -p mem_tools` and `cargo clippy -p mem_tools` via `execute_command`. Analyze `execute_command` output for errors or warnings.
* Commit Message: `fix(mem_tools): Remove empty line after doc comment`

* ✅ Increment 4: Fix `same_ptr` and `same_data` implementations.
* Detailed Plan Step 1: Modify `same_ptr` to use `src1 as *const ()` and `src2 as *const ()`.
* Detailed Plan Step 2: Modify `same_data` to use `src1 as *const u8` and `src2 as *const u8`.
* Pre-Analysis: The current implementation of `same_ptr` and `same_data` incorrectly takes the address of the *reference* itself instead of the *data* it points to, leading to incorrect comparisons and test failures.
* Crucial Design Rules: [Lifetimes: Keep Them Explicit], [Handling Panics vs Recoverable Errors]
* Relevant Behavior Rules: `same_ptr` should return true if two references point to the same memory location. `same_data` should return true if two references point to data with the same content and size.
* Verification Strategy: Execute `cargo test -p mem_tools --all-targets` via `execute_command`. Analyze `execute_command` output for test failures.
* Commit Message: `fix(mem_tools): Correct same_ptr and same_data implementations`

* ✅ Increment 5: Apply Clippy auto-fixes.
* Detailed Plan Step 1: Execute `cargo clippy --fix --lib -p mem_tools` to apply the suggested fixes.
* Pre-Analysis: `cargo clippy` reported multiple warnings related to `as` casting between raw pointers and `reference as raw pointer`, with suggestions for `pointer::cast` and `std::ptr::from_ref`.
* Crucial Design Rules: [Lints and warnings], [Prioritize Reuse and Minimal Change]
* Relevant Behavior Rules: All Clippy warnings (except `unsafe-code`) should be resolved.
* Verification Strategy: Execute `cargo build -p mem_tools` and `cargo clippy -p mem_tools` via `execute_command`. Analyze `execute_command` output for errors or warnings.
* Commit Message: `fix(mem_tools): Apply clippy auto-fixes for pointer casts`

* ✅ Increment 6: Suppress `unsafe_code` warning and enhance safety proof.
* Detailed Plan Step 1: Add `#[allow(unsafe_code)]` attribute to the `pub fn same_data` function in `module/core/mem_tools/src/mem.rs`.
* Detailed Plan Step 2: Enhance the safety comment for the `unsafe` block in `same_data` to explicitly detail the validity of pointers and size.
* Pre-Analysis: The `unsafe` block is necessary for `memcmp`. The workspace `unsafe-code` is a warning. Explicitly allowing it at the function level with a detailed safety proof will address the user's feedback.
* Crucial Design Rules: [Handling Panics vs Recoverable Errors], [Comments and Documentation]
* Relevant Behavior Rules: No `unsafe_code` warning should be reported for `mem_tools`. The safety justification for the `unsafe` block should be clear and comprehensive.
* Verification Strategy: Execute `cargo build -p mem_tools` and `cargo clippy -p mem_tools` via `execute_command`. Analyze `execute_command` output for errors or warnings.
* Commit Message: `fix(mem_tools): Suppress unsafe_code warning and enhance safety proof`

### Task Requirements
* Fix any compilation errors.
* Address any lint warnings.

### Project Requirements
* Must use Rust 2021 edition.
* All new APIs must be async (if applicable).
* Lints from `[workspace.lints]` must be respected.

### Notes & Insights
* The `Cargo.toml` includes `/rust/impl/mem` which is unusual, but `src/mem.rs` exists.
* The `exposed` module in `src/mem.rs` re-exports `super::super::mem`, which might be problematic.
* Initial build passed without errors or warnings.
* Lint cleanup for `unsafe_code` and commented-out denies is complete.
* `empty_line_after_doc_comments` lint has been fixed.
* Tests are now passing after correcting pointer comparison logic in `same_ptr` and `same_data`.
* Clippy reported additional warnings related to pointer casting, which have been auto-fixed.
* The user explicitly requested to fix all warnings and provide more proof for `unsafe` code, which has now been addressed by suppressing the `unsafe_code` warning and enhancing the safety comment.
4 changes: 0 additions & 4 deletions module/core/mem_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ]
#![ doc( html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico" ) ]
#![ doc( html_root_url = "https://docs.rs/mem_tools/latest/mem_tools/" ) ]
// #![ deny( rust_2018_idioms ) ]
// #![ deny( missing_debug_implementations ) ]
// #![ deny( missing_docs ) ]

//!
//! Collection of tools to manipulate memory.
Expand All @@ -13,7 +10,6 @@
#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ]

/// Namespace with dependencies.

#[ cfg( feature = "enabled" ) ]
pub mod dependency
{
Expand Down
25 changes: 16 additions & 9 deletions module/core/mem_tools/src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,31 @@ mod private
/// Are two pointers points on the same data.
///
/// Does not require arguments to have the same type.
#[ allow( unsafe_code ) ]
pub fn same_data< T1 : ?Sized, T2 : ?Sized >( src1 : &T1, src2 : &T2 ) -> bool
{
extern "C" { fn memcmp( s1 : *const u8, s2 : *const u8, n : usize ) -> i32; }

let mem1 = std::ptr::addr_of!(src1).cast::<u8>();
let mem2 = std::ptr::addr_of!(src2).cast::<u8>();
let mem1 = core::ptr::from_ref::<T1>(src1).cast::<u8>();
let mem2 = core::ptr::from_ref::<T2>(src2).cast::<u8>();

if !same_size( src1, src2 )
{
return false;
}

// Unsafe block is required because we're calling a foreign function (memcmp)
// Safety:
// The `unsafe` block is required because we're calling a foreign function (`memcmp`)
// and manually managing memory addresses.
// Safety: The unsafe block is required because we're calling a foreign function (memcmp)
// and manually managing memory addresses. We ensure that the pointers are valid and
// the size is correct by checking the size with `same_size` before calling `memcmp`.
#[ allow( unsafe_code ) ]
// `mem1` and `mem2` are obtained from valid references `src1` and `src2` using `core::ptr::from_ref`
// and then cast to `*const u8`. This ensures they are valid, non-null, and properly aligned
// pointers to the start of the data.
// The size `n` is obtained from `core::mem::size_of_val(src1)`, which is the correct
// size of the data pointed to by `src1`.
// The `same_size` check (which compares `core::mem::size_of_val(src1)` and `core::mem::size_of_val(src2)`)
// ensures that both memory regions have the same length. This guarantees that `memcmp`
// will not read out of bounds for `src2` when comparing `n` bytes, as both `mem1` and `mem2`
// are guaranteed to point to at least `n` bytes of valid memory.
unsafe { memcmp( mem1, mem2, core::mem::size_of_val( src1 ) ) == 0 }
}

Expand All @@ -36,8 +43,8 @@ mod private
/// Unlike `std::ptr::eq()` does not require arguments to have the same type.
pub fn same_ptr< T1 : ?Sized, T2 : ?Sized >( src1 : &T1, src2 : &T2 ) -> bool
{
let mem1 = std::ptr::addr_of!(src1).cast::<()>();
let mem2 = std::ptr::addr_of!(src2).cast::<()>();
let mem1 = core::ptr::from_ref::<T1>(src1).cast::<()>();
let mem2 = core::ptr::from_ref::<T2>(src2).cast::<()>();
mem1 == mem2
}

Expand Down
3 changes: 2 additions & 1 deletion module/core/strs_tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "strs_tools"
version = "0.18.0"
version = "0.19.0"
edition = "2021"
authors = [
"Kostiantyn Wandalen <[email protected]>",
Expand Down Expand Up @@ -59,6 +59,7 @@ string_parse = []
[dependencies]
lexical = { version = "7.0.4", optional = true }
component_model_types = { workspace = true, features = ["enabled"] }
bitflags = "2.5.0"

[dev-dependencies]
test_tools = { workspace = true }
Loading