[][src]Struct syntax::parse::parser::Parser

pub struct Parser<'a> {
    pub sess: &'a ParseSess,
    pub token: Token,
    meta_var_span: Option<Span>,
    pub prev_span: Span,
    prev_token_kind: PrevTokenKind,
    restrictions: Restrictions,
    pub(super) directory: Directory<'a>,
    pub(super) recurse_into_file_modules: bool,
    pub root_module_name: Option<String>,
    expected_tokens: Vec<TokenType>,
    token_cursor: TokenCursor,
    desugar_doc_comments: bool,
    cfg_mods: bool,
    unmatched_angle_bracket_count: u32,
    max_angle_bracket_count: u32,
    pub(super) unclosed_delims: Vec<UnmatchedBrace>,
    last_unexpected_token_span: Option<Span>,
    pub last_type_ascription: Option<(Span, bool)>,
    subparser_name: Option<&'static str>,
}
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Fields

sess: &'a ParseSess
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

token: Token
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The current normalized token. "Normalized" means that some interpolated tokens ($i: ident and $l: lifetime meta-variables) are replaced with non-interpolated identifier and lifetime tokens they refer to. Perhaps the normalized / non-normalized setup can be simplified somehow.

meta_var_span: Option<Span>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The span of the current non-normalized token.

prev_span: Span
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The span of the previous non-normalized token.

prev_token_kind: PrevTokenKind
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The kind of the previous normalized token (in simplified form).

restrictions: Restrictions
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

directory: Directory<'a>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Used to determine the path to externally loaded source files.

recurse_into_file_modules: bool
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

true to parse sub-modules in other files.

root_module_name: Option<String>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Name of the root module this parser originated from. If None, then the name is not known. This does not change while the parser is descending into modules, and sub-parsers have new values for this name.

expected_tokens: Vec<TokenType>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

token_cursor: TokenCursor
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

desugar_doc_comments: bool
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

cfg_mods: bool
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

true we should configure out of line modules as we parse.

unmatched_angle_bracket_count: u32
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

This field is used to keep track of how many left angle brackets we have seen. This is required in order to detect extra leading left angle brackets (< characters) and error appropriately.

See the comments in the parse_path_segment function for more details.

max_angle_bracket_count: u32
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

unclosed_delims: Vec<UnmatchedBrace>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A list of all unclosed delimiters found by the lexer. If an entry is used for error recovery it gets removed from here. Every entry left at the end gets emitted as an independent error.

last_unexpected_token_span: Option<Span>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

last_type_ascription: Option<(Span, bool)>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

subparser_name: Option<&'static str>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If present, this Parser is not parsing Rust code but rather a macro call.

Methods

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

pub(super) fn parse_outer_attributes(
    &mut self
) -> PResult<'a, Vec<Attribute>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses attributes that appear before an item.

pub fn parse_attribute(&mut self, permit_inner: bool) -> PResult<'a, Attribute>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Matches attribute = # ! [ meta_item ].

If permit_inner is true, then a leading ! indicates an inner attribute.

fn parse_attribute_with_inner_parse_policy(
    &mut self,
    inner_parse_policy: InnerAttributeParsePolicy
) -> PResult<'a, Attribute>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The same as parse_attribute, except it takes in an InnerAttributeParsePolicy that prescribes how to handle inner attributes.

pub fn parse_attr_item(&mut self) -> PResult<'a, AttrItem>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an inner part of an attribute (the path and following tokens). The tokens must be either a delimited token stream, or empty token stream, or the "legacy" key-value form. PATH ( TOKEN_STREAM ) PATH [ TOKEN_STREAM ] PATH { TOKEN_STREAM } PATH PATH = UNSUFFIXED_LIT The delimiters or = are still put into the resulting token stream.

pub(crate) fn parse_inner_attributes(&mut self) -> PResult<'a, Vec<Attribute>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses attributes that appear after the opening of an item. These should be preceded by an exclamation mark, but we accept and warn about one terminated by a semicolon.

Matches inner_attrs*.

fn parse_unsuffixed_lit(&mut self) -> PResult<'a, Lit>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn parse_cfg_attr(
    &mut self
) -> PResult<'a, (MetaItem, Vec<(AttrItem, Span)>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses cfg_attr(pred, attr_item_list) where attr_item_list is comma-delimited.

pub fn parse_meta_item(&mut self) -> PResult<'a, MetaItem>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Matches the following grammar (per RFC 1559).

meta_item : PATH ( '=' UNSUFFIXED_LIT | '(' meta_item_inner? ')' )? ;
meta_item_inner : (meta_item | UNSUFFIXED_LIT) (',' meta_item_inner)? ;

pub(crate) fn parse_meta_item_kind(&mut self) -> PResult<'a, MetaItemKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_meta_item_inner(&mut self) -> PResult<'a, NestedMetaItem>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Matches meta_item_inner : (meta_item | UNSUFFIXED_LIT) ;.

fn parse_meta_seq(&mut self) -> PResult<'a, Vec<NestedMetaItem>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Matches meta_seq = ( COMMASEP(meta_item_inner) ).

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

pub fn parse_expr(&mut self) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an expression.

fn parse_paren_expr_seq(&mut self) -> PResult<'a, Vec<P<Expr>>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parse_expr_res(
    &mut self,
    r: Restrictions,
    already_parsed_attrs: Option<ThinVec<Attribute>>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an expression, subject to the given restrictions.

fn parse_assoc_expr(
    &mut self,
    already_parsed_attrs: Option<ThinVec<Attribute>>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an associative expression.

This parses an expression accounting for associativity and precedence of the operators in the expression.

pub(super) fn parse_assoc_expr_with(
    &mut self,
    min_prec: usize,
    lhs: LhsExpr
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an associative expression with operators of at least min_prec precedence.

fn expr_is_complete(&self, e: &Expr) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Checks if this expression is a successfully parsed statement.

fn is_at_start_of_range_notation_rhs(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_prefix_range_expr(
    &mut self,
    already_parsed_attrs: Option<ThinVec<Attribute>>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses prefix-forms of range notation: ..expr, .., ..=expr.

fn parse_prefix_expr(
    &mut self,
    already_parsed_attrs: Option<ThinVec<Attribute>>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a prefix-unary-operator expr.

fn interpolated_or_expr_span(
    &self,
    expr: PResult<'a, P<Expr>>
) -> PResult<'a, (Span, P<Expr>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns the span of expr, if it was not interpolated or the span of the interpolated token.

fn parse_assoc_op_cast(
    &mut self,
    lhs: P<Expr>,
    lhs_span: Span,
    expr_kind: fn(_: P<Expr>, _: P<Ty>) -> ExprKind
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_dot_or_call_expr(
    &mut self,
    already_parsed_attrs: Option<ThinVec<Attribute>>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a.b or a(13) or a[4] or just a.

pub(super) fn parse_dot_or_call_expr_with(
    &mut self,
    e0: P<Expr>,
    lo: Span,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_dot_or_call_expr_with_(
    &mut self,
    e0: P<Expr>,
    lo: Span
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_dot_suffix(
    &mut self,
    self_arg: P<Expr>,
    lo: Span
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Assuming we have just parsed ., continue parsing into an expression.

fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

At the bottom (top?) of the precedence hierarchy, Parses things like parenthesized exprs, macros, return, etc.

N.B., this does not parse outer attributes, and is private because it only works correctly if called from parse_dot_or_call_expr().

pub(super) fn parse_lit(
    &mut self
) -> PResult<'a, Lit>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Matches lit = true | false | token_lit.

fn error_literal_from_token(&self, err: LitError, lit: Lit, span: Span)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn expect_no_suffix(
    &self,
    sp: Span,
    kind: &str,
    suffix: Option<Symbol>
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn parse_literal_maybe_minus(&mut self) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Matches '-' lit | lit (cf. ast_validation::AstValidator::check_expr_within_pat).

pub(super) fn parse_block_expr(
    &mut self,
    opt_label: Option<Label>,
    lo: Span,
    blk_mode: BlockCheckMode,
    outer_attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a block or unsafe block.

fn parse_closure_expr(
    &mut self,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a closure expression (e.g., move |args| expr).

fn parse_capture_clause(&mut self) -> CaptureBy[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an optional move prefix to a closure lke construct.

fn parse_fn_block_decl(&mut self) -> PResult<'a, P<FnDecl>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the |arg, arg| header of a closure.

fn parse_fn_block_param(&mut self) -> PResult<'a, Param>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a parameter in a closure header (e.g., |arg, arg|).

fn parse_if_expr(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an if expression (if token already eaten).

fn parse_cond_expr(&mut self) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the condition of a if or while expression.

fn parse_let_expr(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a let $pat = $expr pseudo-expression. The let token has already been eaten.

fn parse_else_expr(&mut self) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an else { ... } expression (else token already eaten).

fn parse_for_expr(
    &mut self,
    opt_label: Option<Label>,
    span_lo: Span,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a for ... in expression (for token already eaten).

fn parse_while_expr(
    &mut self,
    opt_label: Option<Label>,
    span_lo: Span,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a while or while let expression (while token already eaten).

fn parse_loop_expr(
    &mut self,
    opt_label: Option<Label>,
    span_lo: Span,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses loop { ... } (loop token already eaten).

fn eat_label(&mut self) -> Option<Label>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_match_expr(
    &mut self,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a match ... { ... } expression (match token already eaten).

pub(super) fn parse_arm(
    &mut self
) -> PResult<'a, Arm>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_try_block(
    &mut self,
    span_lo: Span,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a try {...} expression (try token already eaten).

fn is_do_catch_block(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn is_try_block(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_async_block(
    &mut self,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an async move? {...} expression.

fn is_async_block(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn maybe_parse_struct_expr(
    &mut self,
    lo: Span,
    path: &Path,
    attrs: &ThinVec<Attribute>
) -> Option<PResult<'a, P<Expr>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parse_struct_expr(
    &mut self,
    lo: Span,
    pth: Path,
    attrs: ThinVec<Attribute>
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_field(&mut self) -> PResult<'a, Field>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses ident (COLON expr)?.

fn err_dotdotdot_syntax(&self, span: Span)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn err_larrow_operator(&self, span: Span)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_assign_op(&self, binop: BinOp, lhs: P<Expr>, rhs: P<Expr>) -> ExprKind[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_range(
    &self,
    start: Option<P<Expr>>,
    end: Option<P<Expr>>,
    limits: RangeLimits
) -> PResult<'a, ExprKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_unary(&self, unop: UnOp, expr: P<Expr>) -> ExprKind[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_binary(&self, binop: BinOp, lhs: P<Expr>, rhs: P<Expr>) -> ExprKind[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_index(&self, expr: P<Expr>, idx: P<Expr>) -> ExprKind[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_call(&self, f: P<Expr>, args: Vec<P<Expr>>) -> ExprKind[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_await_expr(&mut self, self_arg: P<Expr>, lo: Span) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn mk_expr(
    &self,
    span: Span,
    kind: ExprKind,
    attrs: ThinVec<Attribute>
) -> P<Expr>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn mk_expr_err(
    &self,
    span: Span
) -> P<Expr>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

pub fn parse_pat(
    &mut self,
    expected: Option<&'static str>
) -> PResult<'a, P<Pat>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a pattern.

Corresponds to pat<no_top_alt> in RFC 2535 and does not admit or-patterns at the top level. Used when parsing the parameters of lambda expressions, functions, function pointers, and pat macro fragments.

pub(super) fn parse_top_pat(
    &mut self,
    gate_or: GateOr
) -> PResult<'a, P<Pat>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Entry point to the main pattern parser. Corresponds to top_pat in RFC 2535 and allows or-pattern at the top level.

pub(super) fn parse_fn_param_pat(
    &mut self
) -> PResult<'a, P<Pat>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse the pattern for a function or function pointer parameter. Special recovery is provided for or-patterns and leading |.

fn ban_illegal_fn_param_or_pat(&self, pat: &Pat)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Ban A | B immediately in a parameter pattern and suggest wrapping in parens.

fn parse_pat_with_or(
    &mut self,
    expected: Option<&'static str>,
    gate_or: GateOr,
    rc: RecoverComma
) -> PResult<'a, P<Pat>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a pattern, that may be a or-pattern (e.g. Foo | Bar in Some(Foo | Bar)). Corresponds to pat<allow_top_alt> in RFC 2535.

fn eat_or_separator(&mut self, lo: Option<Span>) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Eat the or-pattern | separator. If instead a || token is encountered, recover and pretend we parsed |.

fn recover_trailing_vert(&mut self, lo: Option<Span>) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recover if | or || is the current token and we have one of the tokens =>, if, =, :, ;, ,, ], ), or } ahead of us.

These tokens all indicate that we reached the end of the or-pattern list and can now reliably say that the | was an illegal trailing vert. Note that there are more tokens such as @ for which we know that the | is an illegal parse. However, the user's intent is less clear in that case.

fn ban_unexpected_or_or(&mut self, lo: Option<Span>)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

We have parsed || instead of |. Error and suggest | instead.

fn maybe_recover_unexpected_comma(
    &mut self,
    lo: Span,
    rc: RecoverComma
) -> PResult<'a, ()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Some special error handling for the "top-level" patterns in a match arm, for loop, let, &c. (in contrast to subpatterns within such).

fn skip_pat_list(&mut self) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse and throw away a parentesized comma separated sequence of patterns until ) is reached.

fn parse_pat_with_or_inner(&mut self) -> PResult<'a, P<Pat>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recursive possibly-or-pattern parser with recovery for an erroneous leading |. See parse_pat_with_or for details on parsing or-patterns.

fn recover_leading_vert(&mut self, lo: Option<Span>, ctx: &str)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recover if | or || is here. The user is thinking that a leading | is allowed in this position.

fn ban_illegal_vert(&mut self, lo: Option<Span>, pos: &str, ctx: &str)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A | or possibly || token shouldn't be here. Ban it.

fn parse_pat_with_range_pat(
    &mut self,
    allow_range_pat: bool,
    expected: Option<&'static str>
) -> PResult<'a, P<Pat>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a pattern, with a setting whether modern range patterns (e.g., a..=b, a..b are allowed).

fn recover_intersection_pat(&mut self, lhs: P<Pat>) -> PResult<'a, P<Pat>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Try to recover the more general form intersect ::= $pat_lhs @ $pat_rhs.

Allowed binding patterns generated by binding ::= ref? mut? $ident @ $pat_rhs should already have been parsed by now at this point, if the next token is @ then we can try to parse the more general form.

Consult parse_pat_ident for the binding grammar.

The notion of intersection patterns are found in e.g. F# where they are called AND-patterns.

fn ban_pat_range_if_ambiguous(&self, pat: &Pat) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Ban a range pattern if it has an ambiguous interpretation.

fn parse_pat_deref(
    &mut self,
    expected: Option<&'static str>
) -> PResult<'a, PatKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse &pat / &mut pat.

fn parse_pat_tuple_or_parens(&mut self) -> PResult<'a, PatKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse a tuple or parenthesis pattern.

fn parse_pat_ident_mut(&mut self) -> PResult<'a, PatKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse a mutable binding with the mut token already eaten.

fn recover_mut_ref_ident(&mut self, lo: Span) -> PResult<'a, PatKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recover on mut ref? ident @ pat and suggest that the order of mut and ref is incorrect.

fn make_all_value_bindings_mutable(pat: &mut P<Pat>) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Turn all by-value immutable bindings in a pattern into mutable bindings. Returns true if any change was made.

fn ban_mut_general_pat(&self, lo: Span, pat: &Pat, changed_any_binding: bool)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Error on mut $pat where $pat is not an ident.

fn recover_additional_muts(&mut self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Eat any extraneous muts and error + recover if we ate any.

fn parse_pat_mac_invoc(&mut self, lo: Span, path: Path) -> PResult<'a, PatKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse macro invocation

fn parse_pat_range_starting_with_path(
    &mut self,
    lo: Span,
    qself: Option<QSelf>,
    path: Path
) -> PResult<'a, PatKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse a range pattern $path $form $end? where $form = ".." | "..." | "..=" ;. The $path has already been parsed and the next token is the $form.

fn parse_pat_range_starting_with_lit(
    &mut self,
    begin: P<Expr>
) -> PResult<'a, PatKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse a range pattern $literal $form $end? where $form = ".." | "..." | "..=" ;. The $path has already been parsed and the next token is the $form.

fn fatal_unexpected_non_pat(
    &mut self,
    err: DiagnosticBuilder<'a>,
    expected: Option<&'static str>
) -> PResult<'a, P<Pat>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn is_pat_range_end_start(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Is the current token suitable as the start of a range patterns end?

fn parse_pat_range_to(
    &mut self,
    re: RangeEnd,
    form: &str
) -> PResult<'a, PatKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse a range-to pattern, e.g. ..X and ..=X for recovery.

fn parse_pat_range_end_opt(
    &mut self,
    begin: &Expr,
    form: &str
) -> PResult<'a, P<Expr>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse the end of a X..Y, X..=Y, or X...Y range pattern or recover if that end is missing treating it as X.., X..=, or X... respectively.

fn parse_pat_range_end(&mut self) -> PResult<'a, P<Expr>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn is_start_of_pat_with_path(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Is this the start of a pattern beginning with a path?

fn can_be_ident_pat(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Would parse_pat_ident be appropriate here?

fn parse_pat_ident(&mut self, binding_mode: BindingMode) -> PResult<'a, PatKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses ident or ident @ pat. Used by the copy foo and ref foo patterns to give a good error message when parsing mistakes like ref foo(a, b).

fn parse_pat_struct(
    &mut self,
    qself: Option<QSelf>,
    path: Path
) -> PResult<'a, PatKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse a struct ("record") pattern (e.g. Foo { ... } or Foo::Bar { ... }).

fn parse_pat_tuple_struct(
    &mut self,
    qself: Option<QSelf>,
    path: Path
) -> PResult<'a, PatKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse tuple struct or tuple variant pattern (e.g. Foo(...) or Foo::Bar(...)).

fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<FieldPat>, bool)>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the fields of a struct-like pattern.

fn recover_one_fewer_dotdot(&self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recover on ... as if it were .. to avoid further errors. See issue #46718.

fn parse_pat_field(
    &mut self,
    lo: Span,
    attrs: Vec<Attribute>
) -> PResult<'a, FieldPat>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn mk_pat_ident(
    &self,
    span: Span,
    bm: BindingMode,
    ident: Ident
) -> P<Pat>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_pat(&self, span: Span, kind: PatKind) -> P<Pat>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

pub fn parse_item(&mut self) -> PResult<'a, Option<P<Item>>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parse_item_(
    &mut self,
    attrs: Vec<Attribute>,
    macros_allowed: bool,
    attributes_allowed: bool
) -> PResult<'a, Option<P<Item>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_item_implementation(
    &mut self,
    attrs: Vec<Attribute>,
    macros_allowed: bool,
    attributes_allowed: bool
) -> PResult<'a, Option<P<Item>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses one of the items allowed by the flags.

pub(super) fn mk_item_with_info(
    &self,
    attrs: Vec<Attribute>,
    lo: Span,
    vis: Visibility,
    info: (Ident, ItemKind, Option<Vec<Attribute>>)
) -> PResult<'a, Option<P<Item>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn maybe_append<T>(lhs: Vec<T>, rhs: Option<Vec<T>>) -> Vec<T>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_macro_use_or_failure(
    &mut self,
    attrs: Vec<Attribute>,
    macros_allowed: bool,
    attributes_allowed: bool,
    lo: Span,
    visibility: Visibility
) -> PResult<'a, Option<P<Item>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

This is the fall-through for parsing items.

fn expected_item_err(&mut self, attrs: &[Attribute]) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Emits an expected-item-after-attributes error.

pub(super) fn is_async_fn(
    &self
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_assoc_macro_invoc(
    &mut self,
    item_kind: &str,
    vis: Option<&Visibility>,
    at_end: &mut bool
) -> PResult<'a, Option<Mac>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a macro invocation inside a trait, impl or extern block.

fn missing_assoc_item_kind_err(
    &self,
    item_type: &str,
    prev_span: Span
) -> DiagnosticBuilder<'a>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_item_impl(
    &mut self,
    unsafety: Unsafety,
    defaultness: Defaultness
) -> PResult<'a, (Ident, ItemKind, Option<Vec<Attribute>>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an implementation item, impl keyword is already parsed.

impl<'a, T> TYPE { /* impl items / } impl<'a, T> TRAIT for TYPE { / impl items / } impl<'a, T> !TRAIT for TYPE { / impl items */ }

We actually parse slightly more relaxed grammar for better error reporting and recovery. impl GENERICS !? TYPE for? (TYPE | ..) (where PREDICATES)? { BODY } impl GENERICS !? TYPE (where PREDICATES)? { BODY }

fn parse_impl_body(&mut self) -> PResult<'a, (Vec<ImplItem>, Vec<Attribute>)>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn parse_impl_item(&mut self, at_end: &mut bool) -> PResult<'a, ImplItem>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an impl item.

fn parse_impl_item_(
    &mut self,
    at_end: &mut bool,
    attrs: Vec<Attribute>
) -> PResult<'a, ImplItem>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_defaultness(&mut self) -> Defaultness[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses defaultness (i.e., default or nothing).

fn is_const_item(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns true if we are looking at const ID (returns false for things like const fn, etc.).

fn parse_impl_const(&mut self) -> PResult<'a, (Ident, ImplItemKind, Generics)>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

This parses the grammar: ImplItemConst = "const" Ident ":" Ty "=" Expr ";"

fn parse_item_trait(
    &mut self,
    unsafety: Unsafety
) -> PResult<'a, (Ident, ItemKind, Option<Vec<Attribute>>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses auto? trait Foo { ... } or trait Foo = Bar;.

pub fn parse_trait_item(&mut self, at_end: &mut bool) -> PResult<'a, TraitItem>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the items in a trait declaration.

fn parse_trait_item_(
    &mut self,
    at_end: &mut bool,
    attrs: Vec<Attribute>
) -> PResult<'a, TraitItem>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_trait_item_const(
    &mut self
) -> PResult<'a, (Ident, TraitItemKind, Generics)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_trait_item_assoc_ty(
    &mut self
) -> PResult<'a, (Ident, TraitItemKind, Generics)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the following grammar:

TraitItemAssocTy = Ident ["<"...">"] [":" [GenericBounds]] ["where" ...] ["=" Ty]

fn parse_use_tree(&mut self) -> PResult<'a, UseTree>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a UseTree.

USE_TREE = [`::`] `*` |
           [`::`] `{` USE_TREE_LIST `}` |
           PATH `::` `*` |
           PATH `::` `{` USE_TREE_LIST `}` |
           PATH [`as` IDENT]

fn parse_use_tree_glob_or_nested(&mut self) -> PResult<'a, UseTreeKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses * or {...}.

fn parse_use_tree_list(&mut self) -> PResult<'a, Vec<(UseTree, NodeId)>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a UseTreeKind::Nested(list).

USE_TREE_LIST = Ø | (USE_TREE `,`)* USE_TREE [`,`]

fn parse_rename(&mut self) -> PResult<'a, Option<Ident>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_ident_or_underscore(&mut self) -> PResult<'a, Ident>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_item_extern_crate(
    &mut self,
    lo: Span,
    visibility: Visibility,
    attrs: Vec<Attribute>
) -> PResult<'a, P<Item>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses extern crate links.

Examples

extern crate foo;
extern crate bar as foo;

fn parse_crate_name_with_dashes(&mut self) -> PResult<'a, Ident>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_item_foreign_mod(
    &mut self,
    lo: Span,
    opt_abi: Option<Abi>,
    visibility: Visibility,
    attrs: Vec<Attribute>,
    extern_sp: Span
) -> PResult<'a, P<Item>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses extern for foreign ABIs modules.

extern is expected to have been consumed before calling this method.

Examples

This example is not tested
extern "C" {}
extern {}

pub fn parse_foreign_item(
    &mut self,
    extern_sp: Span
) -> PResult<'a, ForeignItem>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a foreign item.

fn parse_item_foreign_static(
    &mut self,
    vis: Visibility,
    lo: Span,
    attrs: Vec<Attribute>
) -> PResult<'a, ForeignItem>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a static item from a foreign module. Assumes that the static keyword is already parsed.

fn parse_item_foreign_type(
    &mut self,
    vis: Visibility,
    lo: Span,
    attrs: Vec<Attribute>
) -> PResult<'a, ForeignItem>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a type from a foreign module.

fn is_static_global(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_item_const(
    &mut self,
    m: Option<Mutability>
) -> PResult<'a, (Ident, ItemKind, Option<Vec<Attribute>>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse ["const" | ("static" "mut"?)] $ident ":" $ty = $expr with ["const" | ("static" "mut"?)] already parsed and stored in m.

When m is "const", $ident may also be "_".

fn recover_missing_const_type(
    &mut self,
    id: Ident,
    m: Option<Mutability>
) -> P<Ty>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

We were supposed to parse : but instead, we're already at =. This means that the type is missing.

fn eat_type(&mut self) -> Option<PResult<'a, (Ident, AliasKind, Generics)>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses type Foo = Bar; or returns None without modifying the parser state.

fn parse_type_alias(&mut self) -> PResult<'a, (Ident, AliasKind, Generics)>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a type alias or opaque type.

fn parse_item_enum(
    &mut self
) -> PResult<'a, (Ident, ItemKind, Option<Vec<Attribute>>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an enum declaration.

fn parse_enum_def(&mut self, _generics: &Generics) -> PResult<'a, EnumDef>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the part of an enum declaration following the {.

fn parse_item_struct(
    &mut self
) -> PResult<'a, (Ident, ItemKind, Option<Vec<Attribute>>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses struct Foo { ... }.

fn parse_item_union(
    &mut self
) -> PResult<'a, (Ident, ItemKind, Option<Vec<Attribute>>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses union Foo { ... }.

pub(super) fn is_union_item(
    &self
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_record_struct_body(&mut self) -> PResult<'a, (Vec<StructField>, bool)>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_tuple_struct_body(&mut self) -> PResult<'a, Vec<StructField>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_struct_decl_field(&mut self) -> PResult<'a, StructField>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an element of a struct declaration.

fn parse_single_struct_field(
    &mut self,
    lo: Span,
    vis: Visibility,
    attrs: Vec<Attribute>
) -> PResult<'a, StructField>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a structure field declaration.

fn parse_name_and_ty(
    &mut self,
    lo: Span,
    vis: Visibility,
    attrs: Vec<Attribute>
) -> PResult<'a, StructField>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a structure field.

pub(super) fn eat_macro_def(
    &mut self,
    attrs: &[Attribute],
    vis: &Visibility,
    lo: Span
) -> PResult<'a, Option<P<Item>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn complain_if_pub_macro(&self, vis: &VisibilityKind, sp: Span)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn mk_item(
    &self,
    span: Span,
    ident: Ident,
    kind: ItemKind,
    vis: Visibility,
    attrs: Vec<Attribute>
) -> P<Item>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

Parsing of functions and methods.

fn parse_item_fn(
    &mut self,
    lo: Span,
    vis: Visibility,
    attrs: Vec<Attribute>,
    header: FnHeader
) -> PResult<'a, Option<P<Item>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an item-position function declaration.

fn parse_item_foreign_fn(
    &mut self,
    vis: Visibility,
    lo: Span,
    attrs: Vec<Attribute>,
    extern_sp: Span
) -> PResult<'a, ForeignItem>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a function declaration from a foreign module.

fn parse_impl_method(
    &mut self,
    at_end: &mut bool
) -> PResult<'a, (Ident, Vec<Attribute>, Generics, ImplItemKind)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a method or a macro invocation in a trait impl.

fn parse_trait_item_method(
    &mut self,
    at_end: &mut bool,
    attrs: &mut Vec<Attribute>
) -> PResult<'a, (Ident, TraitItemKind, Generics)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_trait_method_body(
    &mut self,
    at_end: &mut bool,
    attrs: &mut Vec<Attribute>
) -> PResult<'a, Option<P<Block>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse the "body" of a method in a trait item definition. This can either be ; when there's no body, or e.g. a block when the method is a provided one.

fn parse_method_sig(
    &mut self,
    is_name_required: fn(_: &Token) -> bool
) -> PResult<'a, (Ident, MethodSig, Generics)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse the "signature", including the identifier, parameters, and generics of a method. The body is not parsed as that differs between traits and impls.

fn parse_fn_front_matter(&mut self) -> PResult<'a, FnHeader>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses all the "front matter" for a fn declaration, up to and including the fn keyword:

  • const fn
  • unsafe fn
  • const unsafe fn
  • extern fn
  • etc.

fn parse_fn_sig(
    &mut self,
    cfg: ParamCfg
) -> PResult<'a, (Ident, P<FnDecl>, Generics)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse the "signature", including the identifier, parameters, and generics of a function.

pub(super) fn parse_fn_decl(
    &mut self,
    cfg: ParamCfg,
    ret_allow_plus: bool
) -> PResult<'a, P<FnDecl>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the parameter list and result type of a function declaration.

fn parse_fn_params(&mut self, cfg: ParamCfg) -> PResult<'a, Vec<Param>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the parameter list of a function, including the ( and ) delimiters.

fn parse_param_general(
    &mut self,
    cfg: &ParamCfg,
    is_trait_item: bool
) -> PResult<'a, Param>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Skips unexpected attributes and doc comments in this position and emits an appropriate error. This version of parse param doesn't necessarily require identifier names.

fn parse_self_param(&mut self) -> PResult<'a, Option<Param>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns the parsed optional self parameter and whether a self shortcut was used.

See parse_self_param_with_attrs to collect attributes.

fn is_named_param(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn recover_first_param(&mut self) -> &'static str[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

pub fn parse_crate_mod(&mut self) -> PResult<'a, Crate>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a source module as a crate. This is the main entry point for the parser.

pub(super) fn parse_item_mod(
    &mut self,
    outer_attrs: &[Attribute]
) -> PResult<'a, (Ident, ItemKind, Option<Vec<Attribute>>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a mod <foo> { ... } or mod <foo>; item.

fn parse_mod_items(
    &mut self,
    term: &TokenKind,
    inner_lo: Span
) -> PResult<'a, Mod>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Given a termination token, parses all of the items in a module.

fn submod_path(
    &mut self,
    id: Ident,
    outer_attrs: &[Attribute],
    id_sp: Span
) -> PResult<'a, ModulePathSuccess>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn submod_path_from_attr(
    attrs: &[Attribute],
    dir_path: &Path
) -> Option<PathBuf>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn default_submod_path(
    id: Ident,
    relative: Option<Ident>,
    dir_path: &Path,
    source_map: &SourceMap
) -> ModulePath
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns a path to a module.

fn eval_src_mod(
    &mut self,
    path: PathBuf,
    directory_ownership: DirectoryOwnership,
    name: String,
    id_sp: Span
) -> PResult<'a, (Mod, Vec<Attribute>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Reads a module from a source file.

fn push_directory(&mut self, id: Ident, attrs: &[Attribute])[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

pub fn parse_ty(&mut self) -> PResult<'a, P<Ty>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a type.

pub(super) fn parse_ty_no_plus(
    &mut self
) -> PResult<'a, P<Ty>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a type in restricted contexts where + is not permitted.

Example 1: &'a TYPE + is prohibited to maintain operator priority (P(+) < P(&)). Example 2: value1 as TYPE + value2 + is prohibited to avoid interactions with expression grammar.

pub(super) fn parse_ret_ty(
    &mut self,
    allow_plus: bool
) -> PResult<'a, FunctionRetTy>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an optional return type [ -> TY ] in a function declaration.

pub(super) fn parse_ty_common(
    &mut self,
    allow_plus: bool,
    allow_qpath_recovery: bool,
    allow_c_variadic: bool
) -> PResult<'a, P<Ty>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_remaining_bounds(
    &mut self,
    generic_params: Vec<GenericParam>,
    path: Path,
    lo: Span,
    parse_plus: bool
) -> PResult<'a, TyKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_ptr(&mut self) -> PResult<'a, MutTy>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn maybe_parse_fixed_length_of_vec(&mut self) -> PResult<'a, Option<P<Expr>>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_borrowed_pointee(&mut self) -> PResult<'a, TyKind>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn token_is_bare_fn_keyword(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Is the current token one of the keywords that signals a bare function type?

fn parse_ty_bare_fn(
    &mut self,
    generic_params: Vec<GenericParam>
) -> PResult<'a, TyKind>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a TyKind::BareFn type.

pub(super) fn parse_generic_bounds(
    &mut self,
    colon_span: Option<Span>
) -> PResult<'a, GenericBounds>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_generic_bounds_common(
    &mut self,
    allow_plus: bool,
    colon_span: Option<Span>
) -> PResult<'a, GenericBounds>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses bounds of a type parameter BOUND + BOUND + ..., possibly with trailing +.

BOUND = TY_BOUND | LT_BOUND
LT_BOUND = LIFETIME (e.g., `'a`)
TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
TY_BOUND_NOPAREN = [?] [for] SIMPLE_PATH (e.g., `?for<'a: 'b> m::Trait<'a>`)

pub(super) fn parse_late_bound_lifetime_defs(
    &mut self
) -> PResult<'a, Vec<GenericParam>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn check_lifetime(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn expect_lifetime(&mut self) -> Lifetime[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a single lifetime 'a or panics.

pub(super) fn mk_ty(
    &self,
    span: Span,
    kind: TyKind
) -> P<Ty>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

pub(super) fn parse_qpath(
    &mut self,
    style: PathStyle
) -> PResult<'a, (QSelf, Path)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a qualified path. Assumes that the leading < has been parsed already.

qualified_path = <type [as trait_ref]>::path

Examples

<T>::default <T as U>::a <T as U>::F::a<S> (without disambiguator) <T as U>::F::a::<S> (with disambiguator)

pub fn parse_path(&mut self, style: PathStyle) -> PResult<'a, Path>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses simple paths.

path = [::] segment+ segment = ident | ident[::]<args> | ident[::](args) [-> type]

Examples

a::b::C<D> (without disambiguator) a::b::C::<D> (with disambiguator) Fn(Args) (without disambiguator) Fn::(Args) (with disambiguator)

fn parse_path_allowing_meta(&mut self, style: PathStyle) -> PResult<'a, Path>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Like parse_path, but also supports parsing Word meta items into paths for backwards-compatibility. This is used when parsing derive macro paths in #[derive] attributes.

pub(crate) fn parse_derive_paths(&mut self) -> PResult<'a, Vec<Path>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parse a list of paths inside #[derive(path_0, ..., path_n)].

pub(super) fn parse_path_segments(
    &mut self,
    segments: &mut Vec<PathSegment>,
    style: PathStyle
) -> PResult<'a, ()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parse_path_segment(
    &mut self,
    style: PathStyle
) -> PResult<'a, PathSegment>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parse_path_segment_ident(
    &mut self
) -> PResult<'a, Ident>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_generic_args_with_leaning_angle_bracket_recovery(
    &mut self,
    style: PathStyle,
    lo: Span
) -> PResult<'a, (Vec<GenericArg>, Vec<AssocTyConstraint>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses generic args (within a path segment) with recovery for extra leading angle brackets. For the purposes of understanding the parsing logic of generic arguments, this function can be thought of being the same as just calling self.parse_generic_args() if the source had the correct amount of leading angle brackets.

This example is not tested
bar::<<<<T as Foo>::Output>();
     ^^ help: remove extra angle brackets

fn parse_generic_args(
    &mut self
) -> PResult<'a, (Vec<GenericArg>, Vec<AssocTyConstraint>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses (possibly empty) list of lifetime and type arguments and associated type bindings, possibly including trailing comma.

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

pub fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a statement. This stops just before trailing semicolons on everything but items. e.g., a StmtKind::Semi parses to a StmtKind::Expr, leaving the trailing ; unconsumed.

fn parse_stmt_(&mut self, macro_legacy_warnings: bool) -> Option<Stmt>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_stmt_without_recovery(
    &mut self,
    macro_legacy_warnings: bool
) -> PResult<'a, Option<Stmt>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_local(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Local>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a local variable declaration.

fn parse_initializer(&mut self, skip_eq: bool) -> PResult<'a, Option<P<Expr>>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the RHS of a local variable declaration (e.g., '= 14;').

fn is_auto_trait_item(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn parse_block(&mut self) -> PResult<'a, P<Block>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a block. No inner attributes are allowed.

pub(super) fn parse_inner_attrs_and_block(
    &mut self
) -> PResult<'a, (Vec<Attribute>, P<Block>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a block. Inner attributes are allowed.

pub(super) fn parse_block_tail(
    &mut self,
    lo: Span,
    s: BlockCheckMode
) -> PResult<'a, P<Block>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses the rest of a block expression or function body. Precondition: already parsed the '{'.

pub fn parse_full_stmt(
    &mut self,
    macro_legacy_warnings: bool
) -> PResult<'a, Option<Stmt>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a statement, including the trailing semicolon.

fn warn_missing_semicolon(&self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

fn parse_lt_param_bounds(&mut self) -> GenericBounds[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses bounds of a lifetime parameter BOUND + BOUND + BOUND, possibly with trailing +.

BOUND = LT_BOUND (e.g., `'a`)

fn parse_ty_param(
    &mut self,
    preceding_attrs: Vec<Attribute>
) -> PResult<'a, GenericParam>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Matches typaram = IDENT (? unbound)? optbounds ( EQ ty )?.

fn parse_const_param(
    &mut self,
    preceding_attrs: Vec<Attribute>
) -> PResult<'a, GenericParam>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parse_generic_params(
    &mut self
) -> PResult<'a, Vec<GenericParam>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a (possibly empty) list of lifetime and type parameters, possibly including a trailing comma and erroneous trailing attributes.

pub(super) fn parse_generics(
    &mut self
) -> PResult<'a, Generics>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a set of optional generic type parameter declarations. Where clauses are not parsed here, and must be added later via parse_where_clause().

matches generics = ( ) | ( < > ) | ( < typaramseq ( , )? > ) | ( < lifetimes ( , )? > ) | ( < lifetimes , typaramseq ( , )? > ) where typaramseq = ( typaram ) | ( typaram , typaramseq )

pub(super) fn parse_where_clause(
    &mut self
) -> PResult<'a, WhereClause>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses an optional where-clause and places it in generics.

This example is not tested
where T : Trait<U, V> + 'b, 'a : 'b

fn parse_ty_where_predicate(&mut self) -> PResult<'a, WherePredicate>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn choose_generics_over_qpath(
    &self
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

pub fn fatal(&self, m: &str) -> DiagnosticBuilder<'a>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn span_fatal<S: Into<MultiSpan>>(
    &self,
    sp: S,
    m: &str
) -> DiagnosticBuilder<'a>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn span_fatal_err<S: Into<MultiSpan>>(
    &self,
    sp: S,
    err: Error
) -> DiagnosticBuilder<'a>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn bug(
    &self,
    m: &str
) -> !
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn span_err<S: Into<MultiSpan>>(
    &self,
    sp: S,
    m: &str
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn struct_span_err<S: Into<MultiSpan>>(
    &self,
    sp: S,
    m: &str
) -> DiagnosticBuilder<'a>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> ![src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn diagnostic(
    &self
) -> &'a Handler
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn span_to_snippet(
    &self,
    span: Span
) -> Result<String, SpanSnippetError>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn expected_ident_found(
    &self
) -> DiagnosticBuilder<'a>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn expected_one_of_not_found(
    &mut self,
    edible: &[TokenKind],
    inedible: &[TokenKind]
) -> PResult<'a, bool>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn maybe_annotate_with_ascription(
    &self,
    err: &mut DiagnosticBuilder,
    maybe_expected_semicolon: bool
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn eat_to_tokens(
    &mut self,
    kets: &[&TokenKind]
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Eats and discards tokens until one of kets is encountered. Respects token trees, passes through any errors encountered. Used for error recovery.

pub(super) fn check_trailing_angle_brackets(
    &mut self,
    segment: &PathSegment,
    end: TokenKind
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

This function checks if there are trailing angle brackets and produces a diagnostic to suggest removing them.

This example is not tested
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
                                                       ^^ help: remove extra angle brackets

pub(super) fn check_no_chained_comparison(
    &mut self,
    lhs: &Expr,
    outer_op: &AssocOp
) -> PResult<'a, Option<P<Expr>>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Produces an error if comparison operators are chained (RFC #558). We only need to check the LHS, not the RHS, because all comparison ops have same precedence (see fn precedence) and are left-associative (see fn fixity).

This can also be hit if someone incorrectly writes foo<bar>() when they should have used the turbofish (foo::<bar>()) syntax. We attempt some heuristic recovery if that is the case.

Keep in mind that given that outer_op.is_comparison() holds and comparison ops are left associative we can infer that we have:

      outer_op
      /   \
inner_op   r2
   /  \
l1    r1

fn consume_fn_args(&mut self) -> Result<(), ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn maybe_report_ambiguous_plus(
    &mut self,
    allow_plus: bool,
    impl_dyn_multi: bool,
    ty: &Ty
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn maybe_recover_from_bad_type_plus(
    &mut self,
    allow_plus: bool,
    ty: &Ty
) -> PResult<'a, ()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn maybe_recover_from_bad_qpath<T: RecoverQPath>(
    &mut self,
    base: P<T>,
    allow_recovery: bool
) -> PResult<'a, P<T>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Tries to recover from associated item paths like [T]::AssocItem / (T, U)::AssocItem. Attempts to convert the base expression/pattern/type into a type, parses the ::AssocItem tail, and combines them into a <Ty>::AssocItem expression/pattern/type.

pub(super) fn maybe_recover_from_bad_qpath_stage_2<T: RecoverQPath>(
    &mut self,
    ty_span: Span,
    ty: P<Ty>
) -> PResult<'a, P<T>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Given an already parsed Ty, parses the ::AssocItem tail and combines them into a <Ty>::AssocItem expression/pattern/type.

pub(super) fn maybe_consume_incorrect_semicolon(
    &mut self,
    items: &[P<Item>]
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn unexpected_try_recover(
    &mut self,
    t: &TokenKind
) -> PResult<'a, bool>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Creates a DiagnosticBuilder for an unexpected token t and tries to recover if it is a closing delimiter.

pub(super) fn parse_semi_or_incorrect_foreign_fn_body(
    &mut self,
    ident: &Ident,
    extern_sp: Span
) -> PResult<'a, ()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parse_incorrect_await_syntax(
    &mut self,
    lo: Span,
    await_sp: Span
) -> PResult<'a, (Span, ExprKind)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Consumes alternative await syntaxes like await!(<expr>), await <expr>, await? <expr>, await(<expr>), and await { <expr> }.

fn error_on_incorrect_await(
    &self,
    lo: Span,
    hi: Span,
    expr: &Expr,
    is_question: bool
) -> Span
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn recover_from_await_method_call(
    &mut self
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If encountering future.await(), consumes and emits an error.

pub(super) fn recover_parens_around_for_head(
    &mut self,
    pat: P<Pat>,
    expr: &Expr,
    begin_paren: Option<Span>
) -> P<Pat>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recovers a situation like for ( $pat in $expr ) and suggest writing for $pat in $expr instead.

This should be called before parsing the $block.

pub(super) fn could_ascription_be_path(
    &self,
    node: &ExprKind
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn recover_seq_parse_error(
    &mut self,
    delim: DelimToken,
    lo: Span,
    result: PResult<'a, P<Expr>>
) -> P<Expr>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn recover_closing_delimiter(
    &mut self,
    tokens: &[TokenKind],
    err: DiagnosticBuilder<'a>
) -> PResult<'a, bool>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn eat_bad_pub(
    &mut self
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recovers from pub keyword in places where it seems reasonable but isn't valid.

pub(super) fn recover_stmt(
    &mut self
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Eats tokens until we can be relatively sure we reached the end of the statement. This is something of a best-effort heuristic.

We terminate when we find an unmatched } (without consuming it).

pub(super) fn recover_stmt_(
    &mut self,
    break_on_semi: SemiColonMode,
    break_on_block: BlockMode
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If break_on_semi is Break, then we will stop consuming tokens after finding (and consuming) a ; outside of {} or [] (note that this is approximate -- it can mean we break too early due to macros, but that should only lead to sub-optimal recovery, not inaccurate parsing).

If break_on_block is Break, then we will stop consuming tokens after finding (and consuming) a brace-delimited block.

pub(super) fn check_for_for_in_in_typo(
    &mut self,
    in_span: Span
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn expected_semi_or_open_brace<T>(
    &mut self
) -> PResult<'a, T>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn eat_incorrect_doc_comment_for_param_type(
    &mut self
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn parameter_without_type(
    &mut self,
    err: &mut DiagnosticBuilder,
    pat: P<Pat>,
    require_name: bool,
    is_self_allowed: bool,
    is_trait_item: bool
) -> Option<Ident>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn recover_arg_parse(
    &mut self
) -> PResult<'a, (P<Pat>, P<Ty>)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn recover_bad_self_param(
    &mut self,
    param: Param,
    is_trait_item: bool
) -> PResult<'a, Param>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn consume_block(
    &mut self,
    delim: DelimToken
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn expected_expression_found(
    &self
) -> DiagnosticBuilder<'a>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn consume_tts(&mut self, acc: i64, modifier: &[(TokenKind, i64)])[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn deduplicate_recovered_params_names(
    &self,
    fn_inputs: &mut Vec<Param>
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Replace duplicated recovered parameters with _ pattern to avoid unecessary errors.

This is necessary because at this point we don't know whether we parsed a function with anonymous parameters or a function with names but no types. In order to minimize unecessary errors, we assume the parameters are in the shape of fn foo(a, b, c) where the parameters are names (so we don't emit errors about not being able to find b in the local scope), but if we find the same name multiple times, like in fn foo(i8, i8), we deduplicate them to not complain about duplicated parameter names.

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

pub fn new(
    sess: &'a ParseSess,
    tokens: TokenStream,
    directory: Option<Directory<'a>>,
    recurse_into_file_modules: bool,
    desugar_doc_comments: bool,
    subparser_name: Option<&'static str>
) -> Self
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn next_tok(&mut self) -> Token[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn this_token_to_string(&self) -> String[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the current token to a string using self's reader.

fn token_descr(&self) -> Option<&'static str>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(super) fn this_token_descr(
    &self
) -> String
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn unexpected<T>(&mut self) -> PResult<'a, T>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn expect(&mut self, t: &TokenKind) -> PResult<'a, bool>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Expects and consumes the token t. Signals an error if the next token is not t.

pub fn expect_one_of(
    &mut self,
    edible: &[TokenKind],
    inedible: &[TokenKind]
) -> PResult<'a, bool>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Expect next token to be edible or inedible token. If edible, then consume it; if inedible, then return without consuming anything. Signal a fatal error if next token is unexpected.

fn parse_ident(&mut self) -> PResult<'a, Ident>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, Ident>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check(&mut self, tok: &TokenKind) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Checks if the next token is tok, and returns true if so.

This method will automatically add tok to expected_tokens if tok is not encountered.

pub fn eat(&mut self, tok: &TokenKind) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Consumes a token 'tok' if it exists. Returns whether the given token was present.

fn check_keyword(&mut self, kw: Symbol) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If the next token is the given keyword, returns true without eating it. An expectation is also added for diagnostics purposes.

fn eat_keyword(&mut self, kw: Symbol) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If the next token is the given keyword, eats it and returns true. Otherwise, returns false. An expectation is also added for diagnostics purposes.

fn eat_keyword_noexpect(&mut self, kw: Symbol) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn expect_keyword(&mut self, kw: Symbol) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If the given word is not a keyword, signals an error. If the next token is not the given word, signals an error. Otherwise, eats it.

fn check_or_expected(&mut self, ok: bool, typ: TokenType) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_ident(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_path(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_type(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_const_arg(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_plus(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Checks to see if the next token is either + or +=. Otherwise returns false.

fn eat_plus(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Expects and consumes a +. if += is seen, replaces it with a = and continues. If a + is not seen, returns false.

This is used when token-splitting += into +. See issue #47856 for an example of when this may occur.

fn expect_and(&mut self) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Expects and consumes an &. If && is seen, replaces it with a single & and continues. If an & is not seen, signals an error.

fn expect_or(&mut self) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Expects and consumes an |. If || is seen, replaces it with a single | and continues. If an | is not seen, signals an error.

fn eat_lt(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Attempts to consume a <. If << is seen, replaces it with a single < and continue. If <- is seen, replaces it with a single < and continue. If a < is not seen, returns false.

This is meant to be used when parsing generics on a path to get the starting token.

fn expect_lt(&mut self) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn expect_gt(&mut self) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Expects and consumes a single > token. if a >> is seen, replaces it with a single > and continues. If a > is not seen, signals an error.

fn parse_seq_to_end<T>(
    &mut self,
    ket: &TokenKind,
    sep: SeqSep,
    f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>
) -> PResult<'a, Vec<T>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a sequence, including the closing delimiter. The function f must consume tokens until reaching the next separator or closing bracket.

fn parse_seq_to_before_end<T>(
    &mut self,
    ket: &TokenKind,
    sep: SeqSep,
    f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>
) -> PResult<'a, (Vec<T>, bool, bool)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a sequence, not including the closing delimiter. The function f must consume tokens until reaching the next separator or closing bracket.

fn expect_any_with_type(
    &mut self,
    kets: &[&TokenKind],
    expect: TokenExpectType
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_seq_to_before_tokens<T>(
    &mut self,
    kets: &[&TokenKind],
    sep: SeqSep,
    expect: TokenExpectType,
    f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>
) -> PResult<'a, (Vec<T>, bool, bool)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_unspanned_seq<T>(
    &mut self,
    bra: &TokenKind,
    ket: &TokenKind,
    sep: SeqSep,
    f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>
) -> PResult<'a, (Vec<T>, bool)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a sequence, including the closing delimiter. The function f must consume tokens until reaching the next separator or closing bracket.

fn parse_delim_comma_seq<T>(
    &mut self,
    delim: DelimToken,
    f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>
) -> PResult<'a, (Vec<T>, bool)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_paren_comma_seq<T>(
    &mut self,
    f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>
) -> PResult<'a, (Vec<T>, bool)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn bump(&mut self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Advance the parser by one token.

fn bump_with(&mut self, next: TokenKind, span: Span)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Advances the parser using provided token as a next one. Use this when consuming a part of a token. For example a single < from <<.

pub fn look_ahead<R>(&self, dist: usize, looker: impl FnOnce(&Token) -> R) -> R[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Look-ahead dist tokens of self.token and get access to that token there. When dist == 0 then the current token is looked at.

fn is_keyword_ahead(&self, dist: usize, kws: &[Symbol]) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns whether any of the given keywords are dist tokens ahead of the current one.

fn parse_asyncness(&mut self) -> IsAsync[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses asyncness: async or nothing.

fn parse_unsafety(&mut self) -> Unsafety[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses unsafety: unsafe or nothing.

fn parse_mutability(&mut self) -> Mutability[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses mutability (mut or nothing).

fn parse_const_or_mut(&mut self) -> Option<Mutability>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Possibly parses mutability (const or mut).

fn parse_field_name(&mut self) -> PResult<'a, Ident>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn expect_delimited_token_tree(
    &mut self
) -> PResult<'a, (MacDelimiter, TokenStream)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn parse_or_use_outer_attributes(
    &mut self,
    already_parsed_attrs: Option<ThinVec<Attribute>>
) -> PResult<'a, ThinVec<Attribute>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn process_potential_macro_variable(&mut self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn parse_token_tree(&mut self) -> TokenTree[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a single token tree from the input.

pub fn parse_all_token_trees(&mut self) -> PResult<'a, Vec<TokenTree>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a stream of tokens into a list of TokenTrees, up to EOF.

pub fn parse_tokens(&mut self) -> TokenStream[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn with_res<T>(
    &mut self,
    res: Restrictions,
    f: impl FnOnce(&mut Self) -> T
) -> T
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Evaluates the closure with restrictions in place.

Afters the closure is evaluated, restrictions are reset.

fn is_crate_vis(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn parse_visibility(
    &mut self,
    can_take_tuple: bool
) -> PResult<'a, Visibility>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses pub, pub(crate) and pub(in path) plus shortcuts crate for pub(crate), pub(self) for pub(in self) and pub(super) for pub(in super). If the following element can't be a tuple (i.e., it's a function definition), then it's not a tuple struct field), and the contents within the parentheses isn't valid, so emit a proper diagnostic.

fn recover_incorrect_vis_restriction(&mut self) -> PResult<'a, ()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Recovery for e.g. pub(something) fn ... or struct X { pub(something) y: Z }

fn parse_extern_abi(&mut self) -> PResult<'a, Abi>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses extern followed by an optional ABI string, or nothing.

fn parse_opt_abi(&mut self) -> PResult<'a, Option<Abi>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Parses a string as an ABI spec on an extern type or module. Consumes the extern keyword, if one is found.

fn error_on_invalid_abi(&self, symbol: Symbol)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Emit an error where symbol is an invalid ABI.

fn ban_async_in_2015(&self, async_span: Span)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

We are parsing async fn. If we are on Rust 2015, emit an error.

fn collect_tokens<R>(
    &mut self,
    f: impl FnOnce(&mut Self) -> PResult<'a, R>
) -> PResult<'a, (R, TokenStream)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn is_import_coupler(&mut self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

::{ or ::*

fn parse_optional_str(&mut self) -> Option<(Symbol, StrStyle, Option<Name>)>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn parse_str(&mut self) -> PResult<'a, (Symbol, StrStyle)>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn report_invalid_macro_expansion_item(&self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Trait Implementations

impl<'a> Drop for Parser<'a>[src]

impl<'a> Clone for Parser<'a>[src]

Auto Trait Implementations

impl<'a> !Send for Parser<'a>

impl<'a> !Sync for Parser<'a>

impl<'a> Unpin for Parser<'a>

impl<'a> !UnwindSafe for Parser<'a>

impl<'a> !RefUnwindSafe for Parser<'a>

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T[src]

impl<E> SpecializationError for E[src]