Skip to main content

Module attr

Module attr 

Source
Expand description

Parsing utilities for RAPx contract attributes.

Parses raw #[rapx::<name>(...)] attributes (requires / invariant / ensures) and resolves their properties for verification.

The supported shape is:

#[rapx::<name>(property_call, kind = "...")]

where kind = "..." (a string literal) applies to the property in the same attribute.

Re-exportsยง

use syn::Expr; ๐Ÿ”’
use syn::Lit; ๐Ÿ”’
use syn::Result as SynResult; ๐Ÿ”’
use syn::Token; ๐Ÿ”’
use syn::Type; ๐Ÿ”’
use syn::parse::Parse; ๐Ÿ”’
use syn::parse::ParseStream; ๐Ÿ”’
use quote::ToTokens; ๐Ÿ”’
use rustc_attr_ir::Attribute; ๐Ÿ”’
use rustc_hir::def_id::DefId; ๐Ÿ”’
use rustc_middle::ty::TyCtxt; ๐Ÿ”’
use rustc_span::Symbol; ๐Ÿ”’
use super::Property; ๐Ÿ”’

Structsยง

AttrProperty ๐Ÿ”’
The raw syntactic form of a property call tag(arg0, arg1, ...) parsed from an attribute โ€” the unevaluated stage, before semantic resolution into a Property.

Functionsยง

collect_properties_from_named_attrs ๐Ÿ”’
is_expected_syn_rapx_attr ๐Ÿ”’
Check whether an attribute path is exactly rapx::<expected_name>.
is_rapx_named_attr ๐Ÿ”’
parse_outer_attr ๐Ÿ”’
parse_property_arg ๐Ÿ”’
Parse a single property argument as an Expr.
parse_property_head ๐Ÿ”’
Parse a property call head tag(arg0, arg1, ...).
parse_rapx_attr ๐Ÿ”’
Parse a raw attribute string into a structured requires property.
strip_lifetime_ticks ๐Ÿ”’
Strips the leading ' from Rust lifetime tokens so that syn can parse them as regular identifier expressions inside attribute arguments. For example, 'a becomes a, 'static becomes static_lifetime.
type_to_arg_expr ๐Ÿ”’
Convert a parsed argument Type back into the Expr form expected by the property builder: plain paths stay Expr::Path, everything else (generics, arrays, tuples, references) becomes Expr::Verbatim.