Struct rustc_ast_passes::ast_validation::AstValidator[−][src]

struct AstValidator<'a> {
    session: &'a Session,
    extern_mod: Option<&'a Item>,
    in_trait_impl: bool,
    has_proc_macro_decls: bool,
    outer_impl_trait: Option<Span>,
    bound_context: Option<BoundContext>,
    is_impl_trait_banned: bool,
    is_assoc_ty_bound_banned: bool,
    lint_buffer: &'a mut LintBuffer,
}

Fields

session: &'a Sessionextern_mod: Option<&'a Item>

The span of the extern in an extern { ... } block, if any.

in_trait_impl: bool

Are 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: bool

Used to ban impl Trait in path projections like <impl Iterator>::Item or Foo::Bar<impl Trait>

is_assoc_ty_bound_banned: bool

Used to ban associated type bounds (i.e., Type<AssocType: Bounds>) in certain positions.

lint_buffer: &'a mut LintBuffer

Implementations

impl<'a> AstValidator<'a>[src]

fn with_in_trait_impl(&mut self, is_in: bool, f: impl FnOnce(&mut Self))[src]

fn with_banned_impl_trait(&mut self, f: impl FnOnce(&mut Self))[src]

fn with_banned_assoc_ty_bound(&mut self, f: impl FnOnce(&mut Self))[src]

fn with_impl_trait(&mut self, outer: Option<Span>, f: impl FnOnce(&mut Self))[src]

fn with_bound_context(&mut self, ctx: BoundContext, f: impl FnOnce(&mut Self))[src]

fn visit_assoc_ty_constraint_from_generic_args(
    &mut self,
    constraint: &'a AssocTyConstraint
)
[src]

fn walk_ty(&mut self, t: &'a Ty)[src]

fn err_handler(&self) -> &Handler[src]

fn check_lifetime(&self, ident: Ident)[src]

fn check_label(&self, ident: Ident)[src]

fn invalid_visibility(&self, vis: &Visibility, note: Option<&str>)[src]

fn check_decl_no_pat(
    decl: &FnDecl,
    report_err: impl FnMut(Span, Option<Ident>, bool)
)
[src]

fn check_trait_fn_not_async(&self, fn_span: Span, asyncness: Async)[src]

fn check_trait_fn_not_const(&self, constness: Const)[src]

fn no_questions_in_bounds(
    &self,
    bounds: &GenericBounds,
    where_: &str,
    is_trait: bool
)
[src]

fn check_expr_within_pat(&self, expr: &Expr, allow_paths: bool)[src]

Matches '-' lit | lit (cf. parser::Parser::parse_literal_maybe_minus), or paths for ranges.

fn check_late_bound_lifetime_defs(&self, params: &[GenericParam])[src]

fn check_fn_decl(&self, fn_decl: &FnDecl, self_semantic: SelfSemantic)[src]

fn check_decl_cvaradic_pos(&self, fn_decl: &FnDecl)[src]

fn check_decl_attrs(&self, fn_decl: &FnDecl)[src]

fn check_decl_self_param(&self, fn_decl: &FnDecl, self_semantic: SelfSemantic)[src]

fn check_defaultness(&self, span: Span, defaultness: Defaultness)[src]

fn error_item_without_body(&self, sp: Span, ctx: &str, msg: &str, sugg: &str)[src]

fn check_impl_item_provided<T>(
    &self,
    sp: Span,
    body: &Option<T>,
    ctx: &str,
    sugg: &str
)
[src]

fn check_type_no_bounds(&self, bounds: &[GenericBound], ctx: &str)[src]

fn check_foreign_ty_genericless(&self, generics: &Generics)[src]

fn check_foreign_kind_bodyless(
    &self,
    ident: Ident,
    kind: &str,
    body: Option<Span>
)
[src]

fn check_foreign_fn_bodyless(&self, ident: Ident, body: Option<&Block>)[src]

An fn in extern { ... } cannot have a body { ... }.

fn current_extern_span(&self) -> Span[src]

fn check_foreign_fn_headerless(
    &self,
    ident: Ident,
    span: Span,
    header: FnHeader
)
[src]

An fn in extern { ... } cannot have qualifiers, e.g. async fn.

fn check_c_varadic_type(&self, fk: FnKind<'a>)[src]

Reject C-varadic type unless the function is foreign, or free and unsafe extern "C" semantically.

fn check_item_named(&self, ident: Ident, kind: &str)[src]

fn check_nomangle_item_asciionly(&self, ident: Ident, item_span: Span)[src]

fn check_mod_file_item_asciionly(&self, ident: Ident)[src]

fn deny_generic_params(&self, generics: &Generics, ident_span: Span)[src]

fn deny_super_traits(&self, bounds: &GenericBounds, ident_span: Span)[src]

fn deny_items(&self, trait_items: &[P<AssocItem>], ident_span: Span)[src]

fn correct_generic_order_suggestion(&self, data: &AngleBracketedArgs) -> String[src]

fn check_generic_args_before_constraints(&self, data: &AngleBracketedArgs)[src]

Enforce generic args coming before constraints in <...> of a path segment.

Trait Implementations

impl<'a> Visitor<'a> for AstValidator<'a>[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]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.