Struct rustc_passes::check_attr::CheckAttrVisitor [−][src]
struct CheckAttrVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
}
Fields
tcx: TyCtxt<'tcx>
Implementations
Checks any attribute.
Checks if an #[inline]
is applied to a function or a closure. Returns true
if valid.
fn check_generic_attr(
&self,
hir_id: HirId,
attr: &Attribute,
target: Target,
allowed_targets: &[Target]
)
Checks if #[naked]
is applied to a function definition.
Checks if #[cmse_nonsecure_entry]
is applied to a function definition.
Checks if a #[track_caller]
is applied to a non-naked function. Returns true
if valid.
Checks if the #[non_exhaustive]
attribute on an item
is valid. Returns true
if valid.
Checks if the #[marker]
attribute on an item
is valid. Returns true
if valid.
Checks if the #[target_feature]
attribute on item
is valid. Returns true
if valid.
fn check_doc_alias_value(
&self,
meta: &NestedMetaItem,
doc_alias: &str,
hir_id: HirId,
target: Target,
is_list: bool,
aliases: &mut FxHashMap<String, Span>
) -> bool
fn check_doc_alias(
&self,
meta: &NestedMetaItem,
hir_id: HirId,
target: Target,
aliases: &mut FxHashMap<String, Span>
) -> bool
Checks #[doc(inline)]
/#[doc(no_inline)]
attributes. Returns true
if valid.
A doc inlining attribute is invalid if it is applied to a non-use
item, or
if there are conflicting attributes for one item.
specified_inline
is used to keep track of whether we have
already seen an inlining attribute for this item.
If so, specified_inline
holds the value and the span of
the first inline
/no_inline
attribute.
fn check_attr_not_crate_level(
&self,
meta: &NestedMetaItem,
hir_id: HirId,
attr_name: &str
) -> bool
fn check_attr_not_crate_level(
&self,
meta: &NestedMetaItem,
hir_id: HirId,
attr_name: &str
) -> bool
Checks that an attribute is not used at the crate level. Returns true
if valid.
fn check_attr_crate_level(
&self,
attr: &Attribute,
meta: &NestedMetaItem,
hir_id: HirId
) -> bool
fn check_attr_crate_level(
&self,
attr: &Attribute,
meta: &NestedMetaItem,
hir_id: HirId
) -> bool
Checks that an attribute is used at the crate level. Returns true
if valid.
Checks that doc(test(...))
attribute contains only valid attributes. Returns true
if
valid.
Runs various checks on #[doc]
attributes. Returns true
if valid.
specified_inline
should be initialized to None
and kept for the scope
of one item. Read the documentation of check_doc_inline
for more information.
Checks if #[must_not_suspend]
is applied to a function. Returns true
if valid.
Checks if #[cold]
is applied to a non-function. Returns true
if valid.
Checks if #[link_name]
is applied to an item other than a foreign function or static.
Checks if #[no_link]
is applied to an extern crate
. Returns true
if valid.
Checks if #[export_name]
is applied to a function or static. Returns true
if valid.
fn check_rustc_layout_scalar_valid_range(
&self,
attr: &Attribute,
span: &Span,
target: Target
) -> bool
Checks if #[rustc_legacy_const_generics]
is applied to a function and has a valid argument.
Checks that the dep-graph debugging attributes are only present when the query-dep-graph option is passed to the compiler.
Checks if #[link_section]
is applied to a function or static.
Checks if #[no_mangle]
is applied to a function or static.
Checks if the #[repr]
attributes on item
are valid.
Outputs an error for #[allow_internal_unstable]
which can only be applied to macros.
(Allows proc_macro functions)
Outputs an error for #[allow_internal_unstable]
which can only be applied to macros.
(Allows proc_macro functions)
default_method_body_is_const should only be applied to trait methods with default bodies.
Trait Implementations
The default versions of the visit_nested_XXX
routines invoke
this method to get a map to use. By selecting an enum variant,
you control which kinds of nested HIR are visited; see
NestedVisitorMap
for details. By “nested HIR”, we are
referring to bits of HIR that are not directly embedded within
one another but rather indirectly, through a table in the
crate. This is done to control dependencies during incremental
compilation: the non-inline bits of HIR can be tracked and
hashed separately. Read more
Visits the top-level item and (optionally) nested items / impl items. See
visit_nested_item
for details. Read more
fn visit_variant(
&mut self,
variant: &'tcx Variant<'tcx>,
generics: &'tcx Generics<'tcx>,
item_id: HirId
)
Invoked when a nested item is encountered. By default does
nothing unless you override nested_visit_map
to return other than
None
, in which case it will walk the item. You probably
don’t want to override this method – instead, override
nested_visit_map
or use the “shallow” or “deep” visit
patterns described on itemlikevisit::ItemLikeVisitor
. The only
reason to override this method is if you want a nested pattern
but cannot supply a Map
; see nested_visit_map
for advice. Read more
Like visit_nested_item()
, but for trait items. See
visit_nested_item()
for advice on when to override this
method. Read more
Like visit_nested_item()
, but for impl items. See
visit_nested_item()
for advice on when to override this
method. Read more
Like visit_nested_item()
, but for foreign items. See
visit_nested_item()
for advice on when to override this
method. Read more
Invoked to visit the body of a function, method or closure. Like
visit_nested_item, does nothing by default unless you override
nested_visit_map
to return other than None
, in which case it will walk
the body. Read more
When invoking visit_all_item_likes()
, you need to supply an
item-like visitor. This method converts an “intra-visit”
visitor into an item-like visitor that walks the entire tree.
If you use this, you probably don’t want to process the
contents of nested item-like things, since the outer loop will
visit them as well. Read more
fn visit_variant_data(
&mut self,
s: &'v VariantData<'v>,
Symbol,
&'v Generics<'v>,
_parent_id: HirId,
Span
)
fn visit_enum_def(
&mut self,
enum_definition: &'v EnumDef<'v>,
generics: &'v Generics<'v>,
item_id: HirId,
Span
)
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for CheckAttrVisitor<'tcx>
impl<'tcx> !Send for CheckAttrVisitor<'tcx>
impl<'tcx> !Sync for CheckAttrVisitor<'tcx>
impl<'tcx> Unpin for CheckAttrVisitor<'tcx>
impl<'tcx> !UnwindSafe for CheckAttrVisitor<'tcx>
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes