Skip to main content

Crate marcellus

Crate marcellus 

Source
Expand description

Fail-closed source-capability gating over a Rust module tree.

rustc grants access to a private field to the defining module tree alone. This crate makes that privacy cone auditable. It loads a module directory, refuses every construction that could route source into or out of it, exposes the declared struct shape, and reports identifier occurrences at token level, so comments and string literals can neither hide nor fabricate a capability site.

The crate is generic machinery. It knows nothing about any particular library; a caller names the module directory, the struct, and the representation identifier, and holds its own classified manifest.

The checks cover source text as parsed, not macro expansion or cfg resolution. Item-position macro invocations and include-family identifiers are therefore refused outright rather than resolved.

Re-exports§

pub use syn;

Structs§

MacroSurface
Every macro reachable from a source file, at token level, each entry carrying its complete path spelling and line. Qualified spellings stay qualified, so evil::assert can never collapse onto assert.
ModuleAudit
The module-shape findings for one file’s items.
ModuleFile
One parsed file of a module tree.
ModuleTree
A loaded module tree: mod.rs first, then every declared file submodule in declaration order.

Functions§

audit_module_items
Audits one file’s items: declared file submodules and refused constructions. Only the root file may declare file submodules.
file_module_binding
Requires the parent file to bind name as one plain file module.
identifier_line_census
Per-line occurrence presence for identifier: the set of source lines naming it, mapped to the line’s trimmed text, counted per distinct text. The shape a classified manifest compares against.
identifier_lines
Every source line on which identifier occurs as a token, one entry per occurrence, in source order. Comments and literals cannot produce or hide an occurrence: the scan walks lexed tokens.
load_module_tree
Loads mod.rs and every file submodule it declares, closing the tree.
macro_surface
The complete macro surface of a source file. Every entry is a site where expansion could manufacture source the gate never scans, so a caller admits each name against an explicit allowlist or fails.
struct_fields
The named struct’s fields. Requires exactly one declaration of that name anywhere in the file, including inline modules.
use_bindings
Every name a use item binds into the file’s scope.
use_statement_count
The number of use declarations the item-level walk can see.