Skip to content

Use C annotations to produce safer Rust #1302

@thedataking

Description

@thedataking

Attributes such as nonnull, counted_by, sized_by, single, ownership_holds, if present in the source code could be recognized by the transpiler and would ideally enable generation of safer code. For instance, knowing what input parameter counts or sizes a pointer could allow us to emit an array or slice type where we'd normally emit a raw pointer. The single annotation disallows pointer arithmetic.

Useful resources:

A separate but important question is how much code uses these attributes in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions