Skip to content

[Rust] Add paired doctests for vector unsafe-call contracts #9232

Description

@mhusnain8721

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions