Function validate_and_find_value_str_builtin_attr

Source
fn validate_and_find_value_str_builtin_attr(
    name: Symbol,
    sess: &Session,
    krate_attrs: &[Attribute],
) -> Option<(Symbol, Span)>
Expand description

Validate all occurrences of the given “value-str” built-in attribute and return the first find.

This validator is intended for built-in attributes whose value needs to be known very early during compilation (namely, before macro expansion) and it mainly exists to reject macro calls inside of the attributes, such as in #![name = expand!()]. Normal attribute validation happens during semantic analysis via TyCtxt::check_mod_attrs which happens after macro expansion when such macro calls (here: expand) have already been expanded and we can no longer check for their presence.