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

pub(in ast_validation) 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]

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

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

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

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

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

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

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

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

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

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

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

pub(in ast_validation) fn check_decl_no_pat(
    decl: &FnDecl,
    report_err: impl FnMut(Span, bool)
)
[src]

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

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

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

pub(in ast_validation) 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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]

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]

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

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

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

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

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

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

pub(in ast_validation) 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.