[−][src]Struct rustc_ast_passes::ast_validation::AstValidator
Fields
session: &'a Sessionextern_mod: Option<&'a Item>The span of the extern in an extern { ... } block, if any.
in_trait_impl: boolAre we inside a trait impl?
has_proc_macro_decls: boolouter_impl_trait: Option<Span>Used to ban nested impl Trait, e.g., impl Into<impl Debug>.
Nested impl Trait is allowed in associated type position,
e.g., impl Iterator<Item = impl Debug>.
bound_context: Option<BoundContext>Keeps track of the BoundContext as we recurse.
This is used to forbid ?const Trait bounds in, e.g.,
impl Iterator<Item = Box<dyn ?const Trait>.
is_impl_trait_banned: boolUsed to ban impl Trait in path projections like <impl Iterator>::Item
or Foo::Bar<impl Trait>
is_assoc_ty_bound_banned: boolUsed to ban associated type bounds (i.e., Type<AssocType: Bounds>) in
certain positions.
lint_buffer: &'a mut LintBufferImplementations
impl<'a> AstValidator<'a>[src]
pub(in ast_validation) fn with_in_trait_impl(
&mut self,
is_in: bool,
f: impl FnOnce(&mut Self)
)[src]
&mut self,
is_in: bool,
f: impl FnOnce(&mut Self)
)
pub(in ast_validation) fn with_banned_impl_trait(
&mut self,
f: impl FnOnce(&mut Self)
)[src]
&mut self,
f: impl FnOnce(&mut Self)
)
pub(in ast_validation) fn with_banned_assoc_ty_bound(
&mut self,
f: impl FnOnce(&mut Self)
)[src]
&mut self,
f: impl FnOnce(&mut Self)
)
pub(in ast_validation) fn with_impl_trait(
&mut self,
outer: Option<Span>,
f: impl FnOnce(&mut Self)
)[src]
&mut self,
outer: Option<Span>,
f: impl FnOnce(&mut Self)
)
pub(in ast_validation) fn with_bound_context(
&mut self,
ctx: BoundContext,
f: impl FnOnce(&mut Self)
)[src]
&mut self,
ctx: BoundContext,
f: impl FnOnce(&mut Self)
)
pub(in ast_validation) fn visit_assoc_ty_constraint_from_generic_args(
&mut self,
constraint: &'a AssocTyConstraint
)[src]
&mut self,
constraint: &'a AssocTyConstraint
)
pub(in ast_validation) fn walk_ty(
&mut self,
t: &'a Ty
)[src]
&mut self,
t: &'a Ty
)
pub(in ast_validation) fn err_handler(
&self
) -> &Handler[src]
&self
) -> &Handler
pub(in ast_validation) fn check_lifetime(
&self,
ident: Ident
)[src]
&self,
ident: Ident
)
pub(in ast_validation) fn check_label(
&self,
ident: Ident
)[src]
&self,
ident: Ident
)
pub(in ast_validation) fn invalid_visibility(
&self,
vis: &Visibility,
note: Option<&str>
)[src]
&self,
vis: &Visibility,
note: Option<&str>
)
pub(in ast_validation) fn check_decl_no_pat(
decl: &FnDecl,
report_err: impl FnMut(Span, bool)
)[src]
decl: &FnDecl,
report_err: impl FnMut(Span, bool)
)
pub(in ast_validation) fn check_trait_fn_not_async(
&self,
fn_span: Span,
asyncness: Async
)[src]
&self,
fn_span: Span,
asyncness: Async
)
pub(in ast_validation) fn check_trait_fn_not_const(
&self,
constness: Const
)[src]
&self,
constness: Const
)
pub(in ast_validation) fn no_questions_in_bounds(
&self,
bounds: &GenericBounds,
where_: &str,
is_trait: bool
)[src]
&self,
bounds: &GenericBounds,
where_: &str,
is_trait: bool
)
pub(in ast_validation) fn check_expr_within_pat(
&self,
expr: &Expr,
allow_paths: bool
)[src]
&self,
expr: &Expr,
allow_paths: bool
)
Matches '-' lit | lit (cf. parser::Parser::parse_literal_maybe_minus),
or paths for ranges.
pub(in ast_validation) fn check_late_bound_lifetime_defs(
&self,
params: &[GenericParam]
)[src]
&self,
params: &[GenericParam]
)
pub(in ast_validation) fn check_fn_decl(
&self,
fn_decl: &FnDecl,
self_semantic: SelfSemantic
)[src]
&self,
fn_decl: &FnDecl,
self_semantic: SelfSemantic
)
pub(in ast_validation) fn check_decl_cvaradic_pos(
&self,
fn_decl: &FnDecl
)[src]
&self,
fn_decl: &FnDecl
)
pub(in ast_validation) fn check_decl_attrs(
&self,
fn_decl: &FnDecl
)[src]
&self,
fn_decl: &FnDecl
)
pub(in ast_validation) fn check_decl_self_param(
&self,
fn_decl: &FnDecl,
self_semantic: SelfSemantic
)[src]
&self,
fn_decl: &FnDecl,
self_semantic: SelfSemantic
)
pub(in ast_validation) fn check_defaultness(
&self,
span: Span,
defaultness: Defaultness
)[src]
&self,
span: Span,
defaultness: Defaultness
)
pub(in ast_validation) fn error_item_without_body(
&self,
sp: Span,
ctx: &str,
msg: &str,
sugg: &str
)[src]
&self,
sp: Span,
ctx: &str,
msg: &str,
sugg: &str
)
pub(in ast_validation) fn check_impl_item_provided<T>(
&self,
sp: Span,
body: &Option<T>,
ctx: &str,
sugg: &str
)[src]
&self,
sp: Span,
body: &Option<T>,
ctx: &str,
sugg: &str
)
pub(in ast_validation) fn check_type_no_bounds(
&self,
bounds: &[GenericBound],
ctx: &str
)[src]
&self,
bounds: &[GenericBound],
ctx: &str
)
pub(in ast_validation) fn check_foreign_ty_genericless(
&self,
generics: &Generics
)[src]
&self,
generics: &Generics
)
pub(in ast_validation) fn check_foreign_kind_bodyless(
&self,
ident: Ident,
kind: &str,
body: Option<Span>
)[src]
&self,
ident: Ident,
kind: &str,
body: Option<Span>
)
pub(in ast_validation) fn check_foreign_fn_bodyless(
&self,
ident: Ident,
body: Option<&Block>
)[src]
&self,
ident: Ident,
body: Option<&Block>
)
An fn in extern { ... } cannot have a body { ... }.
pub(in ast_validation) fn current_extern_span(
&self
) -> Span[src]
&self
) -> Span
pub(in ast_validation) fn check_foreign_fn_headerless(
&self,
ident: Ident,
span: Span,
header: FnHeader
)[src]
&self,
ident: Ident,
span: Span,
header: FnHeader
)
An fn in extern { ... } cannot have qualifiers, e.g. async fn.
pub(in ast_validation) fn check_c_varadic_type(
&self,
fk: FnKind<'a>
)[src]
&self,
fk: FnKind<'a>
)
Reject C-varadic type unless the function is foreign,
or free and unsafe extern "C" semantically.
pub(in ast_validation) fn check_item_named(
&self,
ident: Ident,
kind: &str
)[src]
&self,
ident: Ident,
kind: &str
)
pub(in ast_validation) fn check_nomangle_item_asciionly(
&self,
ident: Ident,
item_span: Span
)[src]
&self,
ident: Ident,
item_span: Span
)
pub(in ast_validation) fn check_mod_file_item_asciionly(
&self,
ident: Ident
)[src]
&self,
ident: Ident
)
pub(in ast_validation) fn deny_generic_params(
&self,
generics: &Generics,
ident_span: Span
)[src]
&self,
generics: &Generics,
ident_span: Span
)
pub(in ast_validation) fn deny_super_traits(
&self,
bounds: &GenericBounds,
ident_span: Span
)[src]
&self,
bounds: &GenericBounds,
ident_span: Span
)
pub(in ast_validation) fn deny_items(
&self,
trait_items: &[P<AssocItem>],
ident_span: Span
)[src]
&self,
trait_items: &[P<AssocItem>],
ident_span: Span
)
pub(in ast_validation) fn correct_generic_order_suggestion(
&self,
data: &AngleBracketedArgs
) -> String[src]
&self,
data: &AngleBracketedArgs
) -> String
pub(in ast_validation) fn check_generic_args_before_constraints(
&self,
data: &AngleBracketedArgs
)[src]
&self,
data: &AngleBracketedArgs
)
Enforce generic args coming before constraints in <...> of a path segment.
Trait Implementations
impl<'a> Visitor<'a> for AstValidator<'a>[src]
pub fn visit_attribute(&mut self, attr: &Attribute)[src]
pub fn visit_expr(&mut self, expr: &'a Expr)[src]
pub fn visit_ty(&mut self, ty: &'a Ty)[src]
pub fn visit_label(&mut self, label: &'a Label)[src]
pub fn visit_lifetime(&mut self, lifetime: &'a Lifetime)[src]
pub fn visit_item(&mut self, item: &'a Item)[src]
pub fn visit_foreign_item(&mut self, fi: &'a ForeignItem)[src]
pub fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs)[src]
pub fn visit_generics(&mut self, generics: &'a Generics)[src]
pub fn visit_generic_param(&mut self, param: &'a GenericParam)[src]
pub fn visit_param_bound(&mut self, bound: &'a GenericBound)[src]
pub fn visit_pat(&mut self, pat: &'a Pat)[src]
pub fn visit_where_predicate(&mut self, p: &'a WherePredicate)[src]
pub fn visit_poly_trait_ref(
&mut self,
t: &'a PolyTraitRef,
m: &'a TraitBoundModifier
)[src]
&mut self,
t: &'a PolyTraitRef,
m: &'a TraitBoundModifier
)
pub fn visit_variant_data(&mut self, s: &'a VariantData)[src]
pub fn visit_enum_def(
&mut self,
enum_definition: &'a EnumDef,
generics: &'a Generics,
item_id: NodeId,
_: Span
)[src]
&mut self,
enum_definition: &'a EnumDef,
generics: &'a Generics,
item_id: NodeId,
_: Span
)
pub fn visit_fn(&mut self, fk: FnKind<'a>, span: Span, id: NodeId)[src]
pub fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt)[src]
pub fn visit_name(&mut self, _span: Span, _name: Symbol)[src]
pub fn visit_ident(&mut self, ident: Ident)[src]
pub fn visit_mod(
&mut self,
m: &'ast Mod,
_s: Span,
_attrs: &[Attribute],
_n: NodeId
)[src]
&mut self,
m: &'ast Mod,
_s: Span,
_attrs: &[Attribute],
_n: NodeId
)
pub fn visit_global_asm(&mut self, ga: &'ast GlobalAsm)[src]
pub fn visit_local(&mut self, l: &'ast Local)[src]
pub fn visit_block(&mut self, b: &'ast Block)[src]
pub fn visit_stmt(&mut self, s: &'ast Stmt)[src]
pub fn visit_param(&mut self, param: &'ast Param)[src]
pub fn visit_arm(&mut self, a: &'ast Arm)[src]
pub fn visit_anon_const(&mut self, c: &'ast AnonConst)[src]
pub fn visit_expr_post(&mut self, _ex: &'ast Expr)[src]
pub fn visit_trait_ref(&mut self, t: &'ast TraitRef)[src]
pub fn visit_struct_field(&mut self, s: &'ast StructField)[src]
pub fn visit_variant(&mut self, v: &'ast Variant)[src]
pub fn visit_mac_call(&mut self, mac: &'ast MacCall)[src]
pub fn visit_mac_def(&mut self, _mac: &'ast MacroDef, _id: NodeId)[src]
pub fn visit_path(&mut self, path: &'ast Path, _id: NodeId)[src]
pub fn visit_use_tree(
&mut self,
use_tree: &'ast UseTree,
id: NodeId,
_nested: bool
)[src]
&mut self,
use_tree: &'ast UseTree,
id: NodeId,
_nested: bool
)
pub fn visit_path_segment(
&mut self,
path_span: Span,
path_segment: &'ast PathSegment
)[src]
&mut self,
path_span: Span,
path_segment: &'ast PathSegment
)
pub fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg)[src]
pub fn visit_assoc_ty_constraint(&mut self, constraint: &'ast AssocTyConstraint)[src]
pub fn visit_vis(&mut self, vis: &'ast Visibility)[src]
pub fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FnRetTy)[src]
pub fn visit_fn_header(&mut self, _header: &'ast FnHeader)[src]
pub fn visit_field(&mut self, f: &'ast Field)[src]
pub fn visit_field_pattern(&mut self, fp: &'ast FieldPat)[src]
Auto Trait Implementations
impl<'a> !RefUnwindSafe for AstValidator<'a>
impl<'a> !Send for AstValidator<'a>
impl<'a> !Sync for AstValidator<'a>
impl<'a> Unpin for AstValidator<'a>
impl<'a> !UnwindSafe for AstValidator<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,