Skip to content

Feat: Dynamic safety properties #26

@zjp-CN

Description

@zjp-CN

Safety properties may vary in projects: libcore, Rust for Linux, and Asterinas all have their own properties.

And if we want non-customed attributes (i.e. non-Memo), the only choice for now is to define builtin ones in safety-macro crates.

But it is awkward:

  • safety-macro versioning will be a mess: when to bump a major version?
  • once a property is newly added or modified, safety-macro and safety-lib need to update as well

So a solution to this is support a safety configuration system:

  1. a project-aware configuration file, in toml or json format, mapping property name, arguments, and description (including string interpolation)
  2. when compiling safety-macro, its build.rs will read the project mapping, and auto generate macros
  3. future proofing: a LSP tool to analyze safety properties and offer safety attributes autocompletion
  • RA may fail to expand macro-generated safety comments (rustdoc won't fail!)
  • it's lovely to see safety properties, including descriptions and transitive safety relation, in a separate view and have context-aware diagnostics and completion

We're trying to experiment on this soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions