[Rust] Add paired doctests for vector unsafe-call contracts
- Dominant language
- C++
- Stars
- 26.5k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
Proposed small documentation/test contribution for `Vector::new`, `follow_cast_ref`, and `VectorIter::from_slice`.
The patch adds three compile-fail examples and three corresponding valid-use examples. The APIs already require `unsafe`. This is preventive coverage of existing contracts, not a newly discovered vulnerability or a runtime fix. No implementation, signature or dependency changes.
Patch: https://github.com/mhusnain8721/data-science/blob/55c1f819f6898f8ba3979e5db9f51271e96fa1f6/contributions/flatbuffers/flatbuffers-rust-unsafe-contract-doctests.patch
Patch SHA-256: `2a8c6f157225de6d5a58eb9762de8e4db99366cdfeb915e168a518da7a8a193e`
Validation against upstream commit `5761d6e67af841d15ee21bc1ce9a78ffa9cf939e`:
- Six new doctests pass with default features and with `--no-default-features`; one pre-existing ignored example in each run.
- Independent checks confirm the three negatives fail specifically with E0133 and the three positives compile and execute in each configuration.
- Patch applicability and whitespace checks passed.
Executed CI: https://github.com/mhusnain8721/data-science/actions/runs/34373711135
The full multi-language suite and Rust minimum-supported-version matrix were not run. Prepared with AI assistance; contributor-agreement status is unconfirmed. The available integration cannot create a fork, so no pull request currently exists.
Would this focused coverage be welcome as a pull request?
Contributor guide
Research direction
Review contributions/flatbuffers/flatbuffers-rust-unsafe-contract-doctests.patch alongside the Rust definitions for Vector::new, follow_cast_ref, and VectorIter::from_slice. Run the doctests with default features and --no-default-features, checking that the three invalid examples produce E0133 and the three valid examples compile and execute.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation, testing
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100