Skip to main content

Crate path_match

Crate path_match 

Source
Expand description

syn::Path matching helpers shared by capability-attr (call-path detection for its allocation/IO/raw-pointer vocabulary) and taint-check (sink/sanitizer call-path detection).

This crate is unpublished and has no design doc of its own: every function here was a private, non-pub helper inside capability-attr’s inspector.rs before this extraction, never reachable from outside that crate — doubly so since a proc-macro = true crate can only export its #[proc_macro_attribute] entry points to begin with. Moving them here changes no public API of either dependent crate.

Functions§

path_has_segment
true if any segment of path is exactly marker.
path_last_segment
The trailing segment’s identifier, as a String.
path_last_two
Join just the trailing one or two segments of path with ::, so Vec::new() and std::vec::Vec::new() both match the same "Vec::new" check regardless of how fully-qualified the call is written.
path_to_string
Join every segment of path with :: (e.g. std::fs::read_to_string).