Function rustc_hir::lang_items::extract[][src]

pub fn extract<'a, F>(
    check_name: F,
    attrs: &'a [Attribute]
) -> Option<(Symbol, Span)> where
    F: Fn(&'a Attribute, Symbol) -> bool
Expand description

Extracts the first lang = "$name" out of a list of attributes. The attributes #[panic_handler] and #[alloc_error_handler] are also extracted out when found.

About the check_name argument: passing in a Session would be simpler, because then we could call Session::check_name directly. But we want to avoid the need for rustc_hir to depend on rustc_session, so we use a closure instead.