Remove NtExpr
and NtLiteral
.
Notes about tests: - tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs: some messages are now duplicated due to repeated parsing. - tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs: ditto. - `tests/ui/proc-macro/macro-rules-derive-cfg.rs`: the diff looks large but the only difference is the insertion of a single invisible-delimited group around a metavar. - `tests/ui/attributes/nonterminal-expansion.rs`: a slight span degradation, somehow related to the recent massive attr parsing rewrite (#135726). I couldn't work out exactly what is going wrong, but I don't think it's worth holding things up for a single slightly suboptimal error message.
This commit is contained in:
parent
0b4a81a4ef
commit
49ed25b5d2
30 changed files with 864 additions and 648 deletions
|
@ -209,13 +209,11 @@ impl HasTokens for Attribute {
|
|||
impl HasTokens for Nonterminal {
|
||||
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
|
||||
match self {
|
||||
Nonterminal::NtExpr(expr) | Nonterminal::NtLiteral(expr) => expr.tokens(),
|
||||
Nonterminal::NtBlock(block) => block.tokens(),
|
||||
}
|
||||
}
|
||||
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
|
||||
match self {
|
||||
Nonterminal::NtExpr(expr) | Nonterminal::NtLiteral(expr) => expr.tokens_mut(),
|
||||
Nonterminal::NtBlock(block) => block.tokens_mut(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -899,8 +899,6 @@ pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
|
|||
fn visit_nonterminal<T: MutVisitor>(vis: &mut T, nt: &mut token::Nonterminal) {
|
||||
match nt {
|
||||
token::NtBlock(block) => vis.visit_block(block),
|
||||
token::NtExpr(expr) => vis.visit_expr(expr),
|
||||
token::NtLiteral(expr) => vis.visit_expr(expr),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,16 +198,17 @@ impl Lit {
|
|||
}
|
||||
}
|
||||
|
||||
/// Keep this in sync with `Token::can_begin_literal_maybe_minus` excluding unary negation.
|
||||
/// Keep this in sync with `Token::can_begin_literal_maybe_minus` and
|
||||
/// `Parser::eat_token_lit` (excluding unary negation).
|
||||
pub fn from_token(token: &Token) -> Option<Lit> {
|
||||
match token.uninterpolate().kind {
|
||||
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => Some(Lit::new(Bool, name, None)),
|
||||
Literal(token_lit) => Some(token_lit),
|
||||
Interpolated(ref nt)
|
||||
if let NtExpr(expr) | NtLiteral(expr) = &**nt
|
||||
&& let ast::ExprKind::Lit(token_lit) = expr.kind =>
|
||||
{
|
||||
Some(token_lit)
|
||||
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
|
||||
MetaVarKind::Literal | MetaVarKind::Expr { .. },
|
||||
))) => {
|
||||
// Unreachable with the current test suite.
|
||||
panic!("from_token metavar");
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
@ -590,6 +591,9 @@ impl Token {
|
|||
/// for which spans affect name resolution and edition checks.
|
||||
/// Note that keywords are also identifiers, so they should use this
|
||||
/// if they keep spans or perform edition checks.
|
||||
//
|
||||
// Note: `Parser::uninterpolated_token_span` may give better information
|
||||
// than this method does.
|
||||
pub fn uninterpolated_span(&self) -> Span {
|
||||
match self.kind {
|
||||
NtIdent(ident, _) | NtLifetime(ident, _) => ident.span,
|
||||
|
@ -642,12 +646,7 @@ impl Token {
|
|||
PathSep | // global path
|
||||
Lifetime(..) | // labeled loop
|
||||
Pound => true, // expression attributes
|
||||
Interpolated(ref nt) =>
|
||||
matches!(&**nt,
|
||||
NtBlock(..) |
|
||||
NtExpr(..) |
|
||||
NtLiteral(..)
|
||||
),
|
||||
Interpolated(ref nt) => matches!(&**nt, NtBlock(..)),
|
||||
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
|
||||
MetaVarKind::Block |
|
||||
MetaVarKind::Expr { .. } |
|
||||
|
@ -677,11 +676,6 @@ impl Token {
|
|||
Lt | // path (UFCS constant)
|
||||
Shl => true, // path (double UFCS)
|
||||
Or => matches!(pat_kind, PatWithOr), // leading vert `|` or-pattern
|
||||
Interpolated(nt) =>
|
||||
matches!(&**nt,
|
||||
| NtExpr(..)
|
||||
| NtLiteral(..)
|
||||
),
|
||||
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
|
||||
MetaVarKind::Expr { .. } |
|
||||
MetaVarKind::Literal |
|
||||
|
@ -724,7 +718,7 @@ impl Token {
|
|||
match self.kind {
|
||||
OpenDelim(Delimiter::Brace) | Literal(..) | Minus => true,
|
||||
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true,
|
||||
Interpolated(ref nt) => matches!(&**nt, NtExpr(..) | NtBlock(..) | NtLiteral(..)),
|
||||
Interpolated(ref nt) => matches!(&**nt, NtBlock(..)),
|
||||
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
|
||||
MetaVarKind::Expr { .. } | MetaVarKind::Block | MetaVarKind::Literal,
|
||||
))) => true,
|
||||
|
@ -768,22 +762,12 @@ impl Token {
|
|||
///
|
||||
/// In other words, would this token be a valid start of `parse_literal_maybe_minus`?
|
||||
///
|
||||
/// Keep this in sync with and `Lit::from_token`, excluding unary negation.
|
||||
/// Keep this in sync with `Lit::from_token` and `Parser::eat_token_lit`
|
||||
/// (excluding unary negation).
|
||||
pub fn can_begin_literal_maybe_minus(&self) -> bool {
|
||||
match self.uninterpolate().kind {
|
||||
Literal(..) | Minus => true,
|
||||
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true,
|
||||
Interpolated(ref nt) => match &**nt {
|
||||
NtLiteral(_) => true,
|
||||
NtExpr(e) => match &e.kind {
|
||||
ast::ExprKind::Lit(_) => true,
|
||||
ast::ExprKind::Unary(ast::UnOp::Neg, e) => {
|
||||
matches!(&e.kind, ast::ExprKind::Lit(_))
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
_ => false,
|
||||
},
|
||||
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(mv_kind))) => match mv_kind {
|
||||
MetaVarKind::Literal => true,
|
||||
MetaVarKind::Expr { can_begin_literal_maybe_minus, .. } => {
|
||||
|
@ -798,14 +782,6 @@ impl Token {
|
|||
pub fn can_begin_string_literal(&self) -> bool {
|
||||
match self.uninterpolate().kind {
|
||||
Literal(..) => true,
|
||||
Interpolated(ref nt) => match &**nt {
|
||||
NtLiteral(_) => true,
|
||||
NtExpr(e) => match &e.kind {
|
||||
ast::ExprKind::Lit(_) => true,
|
||||
_ => false,
|
||||
},
|
||||
_ => false,
|
||||
},
|
||||
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(mv_kind))) => match mv_kind {
|
||||
MetaVarKind::Literal => true,
|
||||
MetaVarKind::Expr { can_begin_string_literal, .. } => can_begin_string_literal,
|
||||
|
@ -869,12 +845,17 @@ impl Token {
|
|||
|
||||
/// Is this a pre-parsed expression dropped into the token stream
|
||||
/// (which happens while parsing the result of macro expansion)?
|
||||
pub fn is_whole_expr(&self) -> bool {
|
||||
pub fn is_metavar_expr(&self) -> bool {
|
||||
#[allow(irrefutable_let_patterns)] // FIXME: temporary
|
||||
if let Interpolated(nt) = &self.kind
|
||||
&& let NtExpr(_) | NtLiteral(_) | NtBlock(_) = &**nt
|
||||
&& let NtBlock(_) = &**nt
|
||||
{
|
||||
true
|
||||
} else if matches!(
|
||||
self.is_metavar_seq(),
|
||||
Some(MetaVarKind::Expr { .. } | MetaVarKind::Literal | MetaVarKind::Path)
|
||||
) {
|
||||
true
|
||||
} else {
|
||||
matches!(self.is_metavar_seq(), Some(MetaVarKind::Path))
|
||||
}
|
||||
|
@ -882,6 +863,7 @@ impl Token {
|
|||
|
||||
/// Is the token an interpolated block (`$b:block`)?
|
||||
pub fn is_whole_block(&self) -> bool {
|
||||
#[allow(irrefutable_let_patterns)] // FIXME: temporary
|
||||
if let Interpolated(nt) = &self.kind
|
||||
&& let NtBlock(..) = &**nt
|
||||
{
|
||||
|
@ -1100,8 +1082,6 @@ pub enum NtExprKind {
|
|||
/// For interpolation during macro expansion.
|
||||
pub enum Nonterminal {
|
||||
NtBlock(P<ast::Block>),
|
||||
NtExpr(P<ast::Expr>),
|
||||
NtLiteral(P<ast::Expr>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
|
||||
|
@ -1191,15 +1171,12 @@ impl Nonterminal {
|
|||
pub fn use_span(&self) -> Span {
|
||||
match self {
|
||||
NtBlock(block) => block.span,
|
||||
NtExpr(expr) | NtLiteral(expr) => expr.span,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn descr(&self) -> &'static str {
|
||||
match self {
|
||||
NtBlock(..) => "block",
|
||||
NtExpr(..) => "expression",
|
||||
NtLiteral(..) => "literal",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1218,8 +1195,6 @@ impl fmt::Debug for Nonterminal {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
NtBlock(..) => f.pad("NtBlock(..)"),
|
||||
NtExpr(..) => f.pad("NtExpr(..)"),
|
||||
NtLiteral(..) => f.pad("NtLiteral(..)"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1242,7 +1217,7 @@ mod size_asserts {
|
|||
// tidy-alphabetical-start
|
||||
static_assert_size!(Lit, 12);
|
||||
static_assert_size!(LitKind, 2);
|
||||
static_assert_size!(Nonterminal, 16);
|
||||
static_assert_size!(Nonterminal, 8);
|
||||
static_assert_size!(Token, 24);
|
||||
static_assert_size!(TokenKind, 16);
|
||||
// tidy-alphabetical-end
|
||||
|
|
|
@ -462,7 +462,6 @@ impl TokenStream {
|
|||
pub fn from_nonterminal_ast(nt: &Nonterminal) -> TokenStream {
|
||||
match nt {
|
||||
Nonterminal::NtBlock(block) => TokenStream::from_ast(block),
|
||||
Nonterminal::NtExpr(expr) | Nonterminal::NtLiteral(expr) => TokenStream::from_ast(expr),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,10 @@ use std::sync::Arc;
|
|||
|
||||
use rustc_ast::mut_visit::{self, MutVisitor};
|
||||
use rustc_ast::token::{
|
||||
self, Delimiter, IdentIsRaw, InvisibleOrigin, Lit, LitKind, MetaVarKind, Nonterminal, Token,
|
||||
TokenKind,
|
||||
self, Delimiter, IdentIsRaw, InvisibleOrigin, Lit, LitKind, MetaVarKind, Token, TokenKind,
|
||||
};
|
||||
use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
|
||||
use rustc_ast::{ExprKind, StmtKind, TyKind};
|
||||
use rustc_ast::{ExprKind, StmtKind, TyKind, UnOp};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{Diag, DiagCtxtHandle, PResult, pluralize};
|
||||
use rustc_parse::lexer::nfc_normalize;
|
||||
|
@ -340,6 +339,30 @@ pub(super) fn transcribe<'a>(
|
|||
MetaVarKind::Pat(*pat_kind),
|
||||
TokenStream::from_ast(pat),
|
||||
),
|
||||
MatchedSingle(ParseNtResult::Expr(expr, kind)) => {
|
||||
let (can_begin_literal_maybe_minus, can_begin_string_literal) =
|
||||
match &expr.kind {
|
||||
ExprKind::Lit(_) => (true, true),
|
||||
ExprKind::Unary(UnOp::Neg, e)
|
||||
if matches!(&e.kind, ExprKind::Lit(_)) =>
|
||||
{
|
||||
(true, false)
|
||||
}
|
||||
_ => (false, false),
|
||||
};
|
||||
mk_delimited(
|
||||
expr.span,
|
||||
MetaVarKind::Expr {
|
||||
kind: *kind,
|
||||
can_begin_literal_maybe_minus,
|
||||
can_begin_string_literal,
|
||||
},
|
||||
TokenStream::from_ast(expr),
|
||||
)
|
||||
}
|
||||
MatchedSingle(ParseNtResult::Literal(lit)) => {
|
||||
mk_delimited(lit.span, MetaVarKind::Literal, TokenStream::from_ast(lit))
|
||||
}
|
||||
MatchedSingle(ParseNtResult::Ty(ty)) => {
|
||||
let is_path = matches!(&ty.kind, TyKind::Path(None, _path));
|
||||
mk_delimited(
|
||||
|
@ -869,10 +892,8 @@ fn extract_symbol_from_pnr<'a>(
|
|||
},
|
||||
_,
|
||||
)) => Ok(*symbol),
|
||||
ParseNtResult::Nt(nt)
|
||||
if let Nonterminal::NtLiteral(expr) = &**nt
|
||||
&& let ExprKind::Lit(Lit { kind: LitKind::Str, symbol, suffix: None }) =
|
||||
&expr.kind =>
|
||||
ParseNtResult::Literal(expr)
|
||||
if let ExprKind::Lit(Lit { kind: LitKind::Str, symbol, suffix: None }) = &expr.kind =>
|
||||
{
|
||||
Ok(*symbol)
|
||||
}
|
||||
|
|
|
@ -858,7 +858,7 @@ parse_unexpected_parentheses_in_match_arm_pattern = unexpected parentheses surro
|
|||
parse_unexpected_self_in_generic_parameters = unexpected keyword `Self` in generic parameters
|
||||
.note = you cannot use `Self` as a generic parameter because it is reserved for associated items
|
||||
|
||||
parse_unexpected_token_after_dot = unexpected token: `{$actual}`
|
||||
parse_unexpected_token_after_dot = unexpected token: {$actual}
|
||||
|
||||
parse_unexpected_token_after_label = expected `while`, `for`, `loop` or `{"{"}` after a label
|
||||
.suggestion_remove_label = consider removing the label
|
||||
|
|
|
@ -1696,10 +1696,10 @@ pub(crate) struct SelfArgumentPointer {
|
|||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_unexpected_token_after_dot)]
|
||||
pub(crate) struct UnexpectedTokenAfterDot<'a> {
|
||||
pub(crate) struct UnexpectedTokenAfterDot {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub actual: Cow<'a, str>,
|
||||
pub actual: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
|
|
@ -4,10 +4,10 @@ use core::mem;
|
|||
use core::ops::{Bound, ControlFlow};
|
||||
|
||||
use ast::mut_visit::{self, MutVisitor};
|
||||
use ast::token::{IdentIsRaw, MetaVarKind};
|
||||
use ast::token::IdentIsRaw;
|
||||
use ast::{CoroutineKind, ForLoopKind, GenBlockKind, MatchKind, Pat, Path, PathSegment, Recovered};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{self, Delimiter, Token, TokenKind};
|
||||
use rustc_ast::token::{self, Delimiter, InvisibleOrigin, MetaVarKind, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::TokenTree;
|
||||
use rustc_ast::util::case::Case;
|
||||
use rustc_ast::util::classify;
|
||||
|
@ -19,7 +19,6 @@ use rustc_ast::{
|
|||
MetaItemLit, Movability, Param, RangeLimits, StmtKind, Ty, TyKind, UnOp, UnsafeBinderCastKind,
|
||||
YieldKind,
|
||||
};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{Applicability, Diag, PResult, StashKey, Subdiagnostic};
|
||||
use rustc_lexer::unescape::unescape_char;
|
||||
|
@ -605,7 +604,7 @@ impl<'a> Parser<'a> {
|
|||
// can't continue an expression after an ident
|
||||
token::Ident(name, is_raw) => token::ident_can_begin_expr(name, t.span, is_raw),
|
||||
token::Literal(..) | token::Pound => true,
|
||||
_ => t.is_whole_expr(),
|
||||
_ => t.is_metavar_expr(),
|
||||
};
|
||||
self.token.is_ident_named(sym::not) && self.look_ahead(1, token_cannot_continue_expr)
|
||||
}
|
||||
|
@ -641,6 +640,13 @@ impl<'a> Parser<'a> {
|
|||
TokenKind::NtIdent(..) | TokenKind::NtLifetime(..) | TokenKind::Interpolated(..) => {
|
||||
self.prev_token.span
|
||||
}
|
||||
TokenKind::CloseDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(_))) => {
|
||||
// `expr.span` is the interpolated span, because invisible open
|
||||
// and close delims both get marked with the same span, one
|
||||
// that covers the entire thing between them. (See
|
||||
// `rustc_expand::mbe::transcribe::transcribe`.)
|
||||
self.prev_token.span
|
||||
}
|
||||
_ => expr.span,
|
||||
}
|
||||
}
|
||||
|
@ -979,12 +985,30 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
fn error_unexpected_after_dot(&self) {
|
||||
let actual = pprust::token_to_string(&self.token);
|
||||
let actual = super::token_descr(&self.token);
|
||||
let span = self.token.span;
|
||||
let sm = self.psess.source_map();
|
||||
let (span, actual) = match (&self.token.kind, self.subparser_name) {
|
||||
(token::Eof, Some(_)) if let Ok(actual) = sm.span_to_snippet(sm.next_point(span)) => {
|
||||
(span.shrink_to_hi(), actual.into())
|
||||
(token::Eof, Some(_)) if let Ok(snippet) = sm.span_to_snippet(sm.next_point(span)) => {
|
||||
(span.shrink_to_hi(), format!("`{}`", snippet))
|
||||
}
|
||||
(token::CloseDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(_))), _) => {
|
||||
// No need to report an error. This case will only occur when parsing a pasted
|
||||
// metavariable, and we should have emitted an error when parsing the macro call in
|
||||
// the first place. E.g. in this code:
|
||||
// ```
|
||||
// macro_rules! m { ($e:expr) => { $e }; }
|
||||
//
|
||||
// fn main() {
|
||||
// let f = 1;
|
||||
// m!(f.);
|
||||
// }
|
||||
// ```
|
||||
// we'll get an error "unexpected token: `)` when parsing the `m!(f.)`, so we don't
|
||||
// want to issue a second error when parsing the expansion `«f.»` (where `«`/`»`
|
||||
// represent the invisible delimiters).
|
||||
self.dcx().span_delayed_bug(span, "bad dot expr in metavariable");
|
||||
return;
|
||||
}
|
||||
_ => (span, actual),
|
||||
};
|
||||
|
@ -1364,17 +1388,31 @@ impl<'a> Parser<'a> {
|
|||
let span = self.token.span;
|
||||
if let token::Interpolated(nt) = &self.token.kind {
|
||||
match &**nt {
|
||||
token::NtExpr(e) | token::NtLiteral(e) => {
|
||||
let e = e.clone();
|
||||
self.bump();
|
||||
return Ok(e);
|
||||
}
|
||||
token::NtBlock(block) => {
|
||||
let block = block.clone();
|
||||
self.bump();
|
||||
return Ok(self.mk_expr(self.prev_token.span, ExprKind::Block(block, None)));
|
||||
}
|
||||
};
|
||||
} else if let Some(expr) = self.eat_metavar_seq_with_matcher(
|
||||
|mv_kind| matches!(mv_kind, MetaVarKind::Expr { .. }),
|
||||
|this| {
|
||||
let expr = this.parse_expr();
|
||||
// FIXME(nnethercote) Sometimes with expressions we get a trailing comma, possibly
|
||||
// related to the FIXME in `collect_tokens_for_expr`. Examples are the multi-line
|
||||
// `assert_eq!` calls involving arguments annotated with `#[rustfmt::skip]` in
|
||||
// `compiler/rustc_index/src/bit_set/tests.rs`.
|
||||
if this.token.kind == token::Comma {
|
||||
this.bump();
|
||||
}
|
||||
expr
|
||||
},
|
||||
) {
|
||||
return Ok(expr);
|
||||
} else if let Some(lit) =
|
||||
self.eat_metavar_seq(MetaVarKind::Literal, |this| this.parse_literal_maybe_minus())
|
||||
{
|
||||
return Ok(lit);
|
||||
} else if let Some(path) = self.eat_metavar_seq(MetaVarKind::Path, |this| {
|
||||
this.collect_tokens_no_attrs(|this| this.parse_path(PathStyle::Type))
|
||||
}) {
|
||||
|
@ -2062,87 +2100,107 @@ impl<'a> Parser<'a> {
|
|||
.or_else(|()| self.handle_missing_lit(Parser::mk_meta_item_lit_char))
|
||||
}
|
||||
|
||||
fn recover_after_dot(&mut self) -> Option<Token> {
|
||||
let mut recovered = None;
|
||||
fn recover_after_dot(&mut self) {
|
||||
if self.token == token::Dot {
|
||||
// Attempt to recover `.4` as `0.4`. We don't currently have any syntax where
|
||||
// dot would follow an optional literal, so we do this unconditionally.
|
||||
recovered = self.look_ahead(1, |next_token| {
|
||||
let recovered = self.look_ahead(1, |next_token| {
|
||||
// If it's an integer that looks like a float, then recover as such.
|
||||
//
|
||||
// We will never encounter the exponent part of a floating
|
||||
// point literal here, since there's no use of the exponent
|
||||
// syntax that also constitutes a valid integer, so we need
|
||||
// not check for that.
|
||||
if let token::Literal(token::Lit { kind: token::Integer, symbol, suffix }) =
|
||||
next_token.kind
|
||||
&& suffix.is_none_or(|s| s == sym::f32 || s == sym::f64)
|
||||
&& symbol.as_str().chars().all(|c| c.is_numeric() || c == '_')
|
||||
&& self.token.span.hi() == next_token.span.lo()
|
||||
{
|
||||
// If this integer looks like a float, then recover as such.
|
||||
//
|
||||
// We will never encounter the exponent part of a floating
|
||||
// point literal here, since there's no use of the exponent
|
||||
// syntax that also constitutes a valid integer, so we need
|
||||
// not check for that.
|
||||
if suffix.is_none_or(|s| s == sym::f32 || s == sym::f64)
|
||||
&& symbol.as_str().chars().all(|c| c.is_numeric() || c == '_')
|
||||
&& self.token.span.hi() == next_token.span.lo()
|
||||
{
|
||||
let s = String::from("0.") + symbol.as_str();
|
||||
let kind = TokenKind::lit(token::Float, Symbol::intern(&s), suffix);
|
||||
return Some(Token::new(kind, self.token.span.to(next_token.span)));
|
||||
}
|
||||
let s = String::from("0.") + symbol.as_str();
|
||||
let kind = TokenKind::lit(token::Float, Symbol::intern(&s), suffix);
|
||||
Some(Token::new(kind, self.token.span.to(next_token.span)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
None
|
||||
});
|
||||
if let Some(token) = &recovered {
|
||||
self.bump();
|
||||
if let Some(recovered) = recovered {
|
||||
self.dcx().emit_err(errors::FloatLiteralRequiresIntegerPart {
|
||||
span: token.span,
|
||||
suggestion: token.span.shrink_to_lo(),
|
||||
span: recovered.span,
|
||||
suggestion: recovered.span.shrink_to_lo(),
|
||||
});
|
||||
self.bump();
|
||||
self.token = recovered;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recovered
|
||||
/// Keep this in sync with `Token::can_begin_literal_maybe_minus` and
|
||||
/// `Lit::from_token` (excluding unary negation).
|
||||
fn eat_token_lit(&mut self) -> Option<token::Lit> {
|
||||
match self.token.uninterpolate().kind {
|
||||
token::Ident(name, IdentIsRaw::No) if name.is_bool_lit() => {
|
||||
self.bump();
|
||||
Some(token::Lit::new(token::Bool, name, None))
|
||||
}
|
||||
token::Literal(token_lit) => {
|
||||
self.bump();
|
||||
Some(token_lit)
|
||||
}
|
||||
token::OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
|
||||
MetaVarKind::Literal,
|
||||
))) => {
|
||||
let lit = self
|
||||
.eat_metavar_seq(MetaVarKind::Literal, |this| this.parse_literal_maybe_minus())
|
||||
.expect("metavar seq literal");
|
||||
let ast::ExprKind::Lit(token_lit) = lit.kind else {
|
||||
panic!("didn't reparse a literal");
|
||||
};
|
||||
Some(token_lit)
|
||||
}
|
||||
token::OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
|
||||
mv_kind @ MetaVarKind::Expr { can_begin_literal_maybe_minus: true, .. },
|
||||
))) => {
|
||||
let expr = self
|
||||
.eat_metavar_seq(mv_kind, |this| this.parse_expr())
|
||||
.expect("metavar seq expr");
|
||||
let ast::ExprKind::Lit(token_lit) = expr.kind else {
|
||||
panic!("didn't reparse an expr");
|
||||
};
|
||||
Some(token_lit)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Matches `lit = true | false | token_lit`.
|
||||
/// Returns `None` if the next token is not a literal.
|
||||
pub(super) fn parse_opt_token_lit(&mut self) -> Option<(token::Lit, Span)> {
|
||||
let recovered = self.recover_after_dot();
|
||||
let token = recovered.as_ref().unwrap_or(&self.token);
|
||||
let span = token.span;
|
||||
|
||||
token::Lit::from_token(token).map(|token_lit| {
|
||||
self.bump();
|
||||
(token_lit, span)
|
||||
})
|
||||
fn parse_opt_token_lit(&mut self) -> Option<(token::Lit, Span)> {
|
||||
self.recover_after_dot();
|
||||
let span = self.token.span;
|
||||
self.eat_token_lit().map(|token_lit| (token_lit, span))
|
||||
}
|
||||
|
||||
/// Matches `lit = true | false | token_lit`.
|
||||
/// Returns `None` if the next token is not a literal.
|
||||
pub(super) fn parse_opt_meta_item_lit(&mut self) -> Option<MetaItemLit> {
|
||||
let recovered = self.recover_after_dot();
|
||||
let token = recovered.as_ref().unwrap_or(&self.token);
|
||||
match token::Lit::from_token(token) {
|
||||
Some(lit) => {
|
||||
match MetaItemLit::from_token_lit(lit, token.span) {
|
||||
Ok(lit) => {
|
||||
self.bump();
|
||||
Some(lit)
|
||||
}
|
||||
Err(err) => {
|
||||
let span = token.uninterpolated_span();
|
||||
self.bump();
|
||||
let guar = report_lit_error(self.psess, err, lit, span);
|
||||
// Pack possible quotes and prefixes from the original literal into
|
||||
// the error literal's symbol so they can be pretty-printed faithfully.
|
||||
let suffixless_lit = token::Lit::new(lit.kind, lit.symbol, None);
|
||||
let symbol = Symbol::intern(&suffixless_lit.to_string());
|
||||
let lit = token::Lit::new(token::Err(guar), symbol, lit.suffix);
|
||||
Some(
|
||||
MetaItemLit::from_token_lit(lit, span)
|
||||
.unwrap_or_else(|_| unreachable!()),
|
||||
)
|
||||
}
|
||||
fn parse_opt_meta_item_lit(&mut self) -> Option<MetaItemLit> {
|
||||
self.recover_after_dot();
|
||||
let span = self.token.span;
|
||||
let uninterpolated_span = self.uninterpolated_token_span();
|
||||
self.eat_token_lit().map(|token_lit| {
|
||||
match MetaItemLit::from_token_lit(token_lit, span) {
|
||||
Ok(lit) => lit,
|
||||
Err(err) => {
|
||||
let guar = report_lit_error(&self.psess, err, token_lit, uninterpolated_span);
|
||||
// Pack possible quotes and prefixes from the original literal into
|
||||
// the error literal's symbol so they can be pretty-printed faithfully.
|
||||
let suffixless_lit = token::Lit::new(token_lit.kind, token_lit.symbol, None);
|
||||
let symbol = Symbol::intern(&suffixless_lit.to_string());
|
||||
let token_lit = token::Lit::new(token::Err(guar), symbol, token_lit.suffix);
|
||||
MetaItemLit::from_token_lit(token_lit, uninterpolated_span).unwrap()
|
||||
}
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn expect_no_tuple_index_suffix(&self, span: Span, suffix: Symbol) {
|
||||
|
@ -2166,9 +2224,10 @@ impl<'a> Parser<'a> {
|
|||
/// Matches `'-' lit | lit` (cf. `ast_validation::AstValidator::check_expr_within_pat`).
|
||||
/// Keep this in sync with `Token::can_begin_literal_maybe_minus`.
|
||||
pub fn parse_literal_maybe_minus(&mut self) -> PResult<'a, P<Expr>> {
|
||||
if let token::Interpolated(nt) = &self.token.kind {
|
||||
match &**nt {
|
||||
// FIXME(nnethercote) The `NtExpr` case should only match if
|
||||
if let Some(expr) = self.eat_metavar_seq_with_matcher(
|
||||
|mv_kind| matches!(mv_kind, MetaVarKind::Expr { .. }),
|
||||
|this| {
|
||||
// FIXME(nnethercote) The `expr` case should only match if
|
||||
// `e` is an `ExprKind::Lit` or an `ExprKind::Unary` containing
|
||||
// an `UnOp::Neg` and an `ExprKind::Lit`, like how
|
||||
// `can_begin_literal_maybe_minus` works. But this method has
|
||||
|
@ -2178,13 +2237,14 @@ impl<'a> Parser<'a> {
|
|||
// `ExprKind::Path` must be accepted when parsing range
|
||||
// patterns. That requires some care. So for now, we continue
|
||||
// being less strict here than we should be.
|
||||
token::NtExpr(e) | token::NtLiteral(e) => {
|
||||
let e = e.clone();
|
||||
self.bump();
|
||||
return Ok(e);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
this.parse_expr()
|
||||
},
|
||||
) {
|
||||
return Ok(expr);
|
||||
} else if let Some(lit) =
|
||||
self.eat_metavar_seq(MetaVarKind::Literal, |this| this.parse_literal_maybe_minus())
|
||||
{
|
||||
return Ok(lit);
|
||||
}
|
||||
|
||||
let lo = self.token.span;
|
||||
|
|
|
@ -1290,12 +1290,24 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
fn is_unsafe_foreign_mod(&self) -> bool {
|
||||
self.token.is_keyword(kw::Unsafe)
|
||||
&& self.is_keyword_ahead(1, &[kw::Extern])
|
||||
&& self.look_ahead(
|
||||
2 + self.look_ahead(2, |t| t.can_begin_string_literal() as usize),
|
||||
|t| *t == token::OpenDelim(Delimiter::Brace),
|
||||
)
|
||||
// Look for `unsafe`.
|
||||
if !self.token.is_keyword(kw::Unsafe) {
|
||||
return false;
|
||||
}
|
||||
// Look for `extern`.
|
||||
if !self.is_keyword_ahead(1, &[kw::Extern]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Look for the optional ABI string literal.
|
||||
let n = if self.look_ahead(2, |t| t.can_begin_string_literal()) { 3 } else { 2 };
|
||||
|
||||
// Look for the `{`. Use `tree_look_ahead` because the ABI (if present)
|
||||
// might be a metavariable i.e. an invisible-delimited sequence, and
|
||||
// `tree_look_ahead` will consider that a single element when looking
|
||||
// ahead.
|
||||
self.tree_look_ahead(n, |t| matches!(t, TokenTree::Delimited(_, _, Delimiter::Brace, _)))
|
||||
== Some(true)
|
||||
}
|
||||
|
||||
fn is_static_global(&mut self) -> bool {
|
||||
|
@ -2604,13 +2616,36 @@ impl<'a> Parser<'a> {
|
|||
})
|
||||
// `extern ABI fn`
|
||||
|| self.check_keyword_case(exp!(Extern), case)
|
||||
// Use `tree_look_ahead` because `ABI` might be a metavariable,
|
||||
// i.e. an invisible-delimited sequence, and `tree_look_ahead`
|
||||
// will consider that a single element when looking ahead.
|
||||
&& self.look_ahead(1, |t| t.can_begin_string_literal())
|
||||
&& (self.look_ahead(2, |t| t.is_keyword_case(kw::Fn, case)) ||
|
||||
&& (self.tree_look_ahead(2, |tt| {
|
||||
match tt {
|
||||
TokenTree::Token(t, _) => t.is_keyword_case(kw::Fn, case),
|
||||
TokenTree::Delimited(..) => false,
|
||||
}
|
||||
}) == Some(true) ||
|
||||
// This branch is only for better diagnostics; `pub`, `unsafe`, etc. are not
|
||||
// allowed here.
|
||||
(self.may_recover()
|
||||
&& self.look_ahead(2, |t| ALL_QUALS.iter().any(|exp| t.is_keyword(exp.kw)))
|
||||
&& self.look_ahead(3, |t| t.is_keyword_case(kw::Fn, case))))
|
||||
&& self.tree_look_ahead(2, |tt| {
|
||||
match tt {
|
||||
TokenTree::Token(t, _) =>
|
||||
ALL_QUALS.iter().any(|exp| {
|
||||
t.is_keyword(exp.kw)
|
||||
}),
|
||||
TokenTree::Delimited(..) => false,
|
||||
}
|
||||
}) == Some(true)
|
||||
&& self.tree_look_ahead(3, |tt| {
|
||||
match tt {
|
||||
TokenTree::Token(t, _) => t.is_keyword_case(kw::Fn, case),
|
||||
TokenTree::Delimited(..) => false,
|
||||
}
|
||||
}) == Some(true)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// Parses all the "front matter" (or "qualifiers") for a `fn` declaration,
|
||||
|
|
|
@ -24,8 +24,8 @@ pub use pat::{CommaRecoveryMode, RecoverColon, RecoverComma};
|
|||
use path::PathStyle;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{
|
||||
self, Delimiter, IdentIsRaw, InvisibleOrigin, MetaVarKind, Nonterminal, NtPatKind, Token,
|
||||
TokenKind,
|
||||
self, Delimiter, IdentIsRaw, InvisibleOrigin, MetaVarKind, Nonterminal, NtExprKind, NtPatKind,
|
||||
Token, TokenKind,
|
||||
};
|
||||
use rustc_ast::tokenstream::{AttrsTarget, Spacing, TokenStream, TokenTree};
|
||||
use rustc_ast::util::case::Case;
|
||||
|
@ -101,6 +101,7 @@ pub enum ForceCollect {
|
|||
#[macro_export]
|
||||
macro_rules! maybe_whole {
|
||||
($p:expr, $constructor:ident, |$x:ident| $e:expr) => {
|
||||
#[allow(irrefutable_let_patterns)] // FIXME: temporary
|
||||
if let token::Interpolated(nt) = &$p.token.kind
|
||||
&& let token::$constructor(x) = &**nt
|
||||
{
|
||||
|
@ -299,6 +300,10 @@ impl TokenTreeCursor {
|
|||
self.stream.get(self.index)
|
||||
}
|
||||
|
||||
fn look_ahead(&self, n: usize) -> Option<&TokenTree> {
|
||||
self.stream.get(self.index + n)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn bump(&mut self) {
|
||||
self.index += 1;
|
||||
|
@ -1290,6 +1295,17 @@ impl<'a> Parser<'a> {
|
|||
looker(&token)
|
||||
}
|
||||
|
||||
/// Like `lookahead`, but skips over token trees rather than tokens. Useful
|
||||
/// when looking past possible metavariable pasting sites.
|
||||
pub fn tree_look_ahead<R>(
|
||||
&self,
|
||||
dist: usize,
|
||||
looker: impl FnOnce(&TokenTree) -> R,
|
||||
) -> Option<R> {
|
||||
assert_ne!(dist, 0);
|
||||
self.token_cursor.curr.look_ahead(dist - 1).map(looker)
|
||||
}
|
||||
|
||||
/// Returns whether any of the given keywords are `dist` tokens ahead of the current one.
|
||||
pub(crate) fn is_keyword_ahead(&self, dist: usize, kws: &[Symbol]) -> bool {
|
||||
self.look_ahead(dist, |t| kws.iter().any(|&kw| t.is_keyword(kw)))
|
||||
|
@ -1706,6 +1722,16 @@ impl<'a> Parser<'a> {
|
|||
pub fn approx_token_stream_pos(&self) -> u32 {
|
||||
self.num_bump_calls
|
||||
}
|
||||
|
||||
pub fn uninterpolated_token_span(&self) -> Span {
|
||||
match &self.token.kind {
|
||||
token::Interpolated(nt) => nt.use_span(),
|
||||
token::OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(_))) => {
|
||||
self.look_ahead(1, |t| t.span)
|
||||
}
|
||||
_ => self.token.span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn make_unclosed_delims_error(
|
||||
|
@ -1758,6 +1784,8 @@ pub enum ParseNtResult {
|
|||
Item(P<ast::Item>),
|
||||
Stmt(P<ast::Stmt>),
|
||||
Pat(P<ast::Pat>, NtPatKind),
|
||||
Expr(P<ast::Expr>, NtExprKind),
|
||||
Literal(P<ast::Expr>),
|
||||
Ty(P<ast::Ty>),
|
||||
Meta(P<ast::AttrItem>),
|
||||
Path(P<ast::Path>),
|
||||
|
|
|
@ -48,10 +48,6 @@ impl<'a> Parser<'a> {
|
|||
/// Old variant of `may_be_ident`. Being phased out.
|
||||
fn nt_may_be_ident(nt: &Nonterminal) -> bool {
|
||||
match nt {
|
||||
NtExpr(_)
|
||||
| NtLiteral(_) // `true`, `false`
|
||||
=> true,
|
||||
|
||||
NtBlock(_) => false,
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +91,7 @@ impl<'a> Parser<'a> {
|
|||
token::OpenDelim(Delimiter::Brace) => true,
|
||||
token::NtLifetime(..) => true,
|
||||
token::Interpolated(nt) => match &**nt {
|
||||
NtBlock(_) | NtExpr(_) | NtLiteral(_) => true,
|
||||
NtBlock(_) => true,
|
||||
},
|
||||
token::OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(k))) => match k {
|
||||
MetaVarKind::Block
|
||||
|
@ -179,10 +175,14 @@ impl<'a> Parser<'a> {
|
|||
pat_kind,
|
||||
));
|
||||
}
|
||||
NonterminalKind::Expr(_) => NtExpr(self.parse_expr_force_collect()?),
|
||||
NonterminalKind::Expr(expr_kind) => {
|
||||
return Ok(ParseNtResult::Expr(self.parse_expr_force_collect()?, expr_kind));
|
||||
}
|
||||
NonterminalKind::Literal => {
|
||||
// The `:literal` matcher does not support attributes
|
||||
NtLiteral(self.collect_tokens_no_attrs(|this| this.parse_literal_maybe_minus())?)
|
||||
// The `:literal` matcher does not support attributes.
|
||||
return Ok(ParseNtResult::Literal(
|
||||
self.collect_tokens_no_attrs(|this| this.parse_literal_maybe_minus())?,
|
||||
));
|
||||
}
|
||||
NonterminalKind::Ty => {
|
||||
return Ok(ParseNtResult::Ty(
|
||||
|
|
|
@ -1252,7 +1252,7 @@ impl<'a> Parser<'a> {
|
|||
|| *t == token::Dot // e.g. `.5` for recovery;
|
||||
|| matches!(t.kind, token::Literal(..) | token::Minus)
|
||||
|| t.is_bool_lit()
|
||||
|| t.is_whole_expr()
|
||||
|| t.is_metavar_expr()
|
||||
|| t.is_lifetime() // recover `'a` instead of `'a'`
|
||||
|| (self.may_recover() // recover leading `(`
|
||||
&& *t == token::OpenDelim(Delimiter::Parenthesis)
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
macro_rules! pass_nonterminal {
|
||||
($n:expr) => {
|
||||
#[repr(align($n))]
|
||||
//~^ ERROR expected unsuffixed literal, found expression `n!()`
|
||||
//~^^ ERROR incorrect `repr(align)` attribute format: `align` expects a literal integer as argument [E0693]
|
||||
//~^ ERROR expected unsuffixed literal, found `expr` metavariable
|
||||
struct S;
|
||||
};
|
||||
}
|
||||
|
@ -16,5 +15,6 @@ macro_rules! n {
|
|||
}
|
||||
|
||||
pass_nonterminal!(n!());
|
||||
//~^ ERROR incorrect `repr(align)` attribute format: `align` expects a literal integer as argument [E0693]
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: expected unsuffixed literal, found expression `n!()`
|
||||
error: expected unsuffixed literal, found `expr` metavariable
|
||||
--> $DIR/nonterminal-expansion.rs:7:22
|
||||
|
|
||||
LL | #[repr(align($n))]
|
||||
|
@ -10,15 +10,10 @@ LL | pass_nonterminal!(n!());
|
|||
= note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument
|
||||
--> $DIR/nonterminal-expansion.rs:7:22
|
||||
--> $DIR/nonterminal-expansion.rs:17:19
|
||||
|
|
||||
LL | #[repr(align($n))]
|
||||
| ^^
|
||||
...
|
||||
LL | pass_nonterminal!(n!());
|
||||
| ----------------------- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
| ^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ struct S9;
|
|||
macro_rules! generate_s10 {
|
||||
($expr: expr) => {
|
||||
#[cfg(feature = $expr)]
|
||||
//~^ ERROR expected unsuffixed literal, found expression `concat!("nonexistent")`
|
||||
//~^ ERROR expected unsuffixed literal, found `expr` metavariable
|
||||
struct S10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ LL | #[cfg(a = b"hi")]
|
|||
| |
|
||||
| help: consider removing the prefix
|
||||
|
||||
error: expected unsuffixed literal, found expression `concat!("nonexistent")`
|
||||
error: expected unsuffixed literal, found `expr` metavariable
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:30:25
|
||||
|
|
||||
LL | #[cfg(feature = $expr)]
|
||||
|
|
|
@ -29,8 +29,8 @@ macro_rules! foo {
|
|||
(ident $x:ident) => { bar!(ident $x); };
|
||||
(lifetime $x:lifetime) => { bar!(lifetime $x); };
|
||||
(tt $x:tt) => { bar!(tt $x); };
|
||||
(expr $x:expr) => { bar!(expr $x); }; //~ ERROR: no rules expected expression `3`
|
||||
(literal $x:literal) => { bar!(literal $x); }; //~ ERROR: no rules expected literal `4`
|
||||
(expr $x:expr) => { bar!(expr $x); }; //~ ERROR: no rules expected `expr` metavariable
|
||||
(literal $x:literal) => { bar!(literal $x); }; //~ ERROR: no rules expected `literal` metavariable
|
||||
(path $x:path) => { bar!(path $x); }; //~ ERROR: no rules expected `path` metavariable
|
||||
(stmt $x:stmt) => { bar!(stmt $x); }; //~ ERROR: no rules expected `stmt` metavariable
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ LL | complex_nonterminal!(enum E {});
|
|||
= help: try using `:tt` instead in the macro definition
|
||||
= note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected expression `3`
|
||||
error: no rules expected `expr` metavariable
|
||||
--> $DIR/nonterminal-matching.rs:32:35
|
||||
|
|
||||
LL | (expr $x:expr) => { bar!(expr $x); };
|
||||
|
@ -45,7 +45,7 @@ LL | (expr 3) => {};
|
|||
= help: try using `:tt` instead in the macro definition
|
||||
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected literal `4`
|
||||
error: no rules expected `literal` metavariable
|
||||
--> $DIR/nonterminal-matching.rs:33:44
|
||||
|
|
||||
LL | (literal $x:literal) => { bar!(literal $x); };
|
||||
|
|
|
@ -12,6 +12,8 @@ macro_rules! abi_from_lit_frag {
|
|||
fn _import();
|
||||
}
|
||||
|
||||
unsafe extern $abi {}
|
||||
|
||||
extern $abi fn _export() {}
|
||||
|
||||
type _PTR = extern $abi fn();
|
||||
|
@ -24,6 +26,8 @@ macro_rules! abi_from_expr_frag {
|
|||
fn _import();
|
||||
}
|
||||
|
||||
unsafe extern $abi {}
|
||||
|
||||
extern $abi fn _export() {}
|
||||
|
||||
type _PTR = extern $abi fn();
|
||||
|
|
|
@ -5,10 +5,10 @@ macro_rules! generate_field_accesses {
|
|||
let s = S(0, (0, 0));
|
||||
|
||||
s.$a; // OK
|
||||
{ s.$b; } //~ ERROR unexpected token: `1.1`
|
||||
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found literal `1.1`
|
||||
{ s.$c; } //~ ERROR unexpected token: `1.1`
|
||||
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found expression `1.1`
|
||||
{ s.$b; } //~ ERROR unexpected token: `literal` metavariable
|
||||
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `literal` metavariable
|
||||
{ s.$c; } //~ ERROR unexpected token: `expr` metavariable
|
||||
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `expr` metavariable
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: unexpected token: `1.1`
|
||||
error: unexpected token: `literal` metavariable
|
||||
--> $DIR/float-field-interpolated.rs:8:13
|
||||
|
|
||||
LL | { s.$b; }
|
||||
|
@ -9,7 +9,7 @@ LL | generate_field_accesses!(1.1, 1.1, 1.1);
|
|||
|
|
||||
= note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found literal `1.1`
|
||||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `literal` metavariable
|
||||
--> $DIR/float-field-interpolated.rs:8:13
|
||||
|
|
||||
LL | { s.$b; }
|
||||
|
@ -20,7 +20,7 @@ LL | generate_field_accesses!(1.1, 1.1, 1.1);
|
|||
|
|
||||
= note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unexpected token: `1.1`
|
||||
error: unexpected token: `expr` metavariable
|
||||
--> $DIR/float-field-interpolated.rs:10:13
|
||||
|
|
||||
LL | { s.$c; }
|
||||
|
@ -31,7 +31,7 @@ LL | generate_field_accesses!(1.1, 1.1, 1.1);
|
|||
|
|
||||
= note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found expression `1.1`
|
||||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `expr` metavariable
|
||||
--> $DIR/float-field-interpolated.rs:10:13
|
||||
|
|
||||
LL | { s.$c; }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
macro_rules! bah {
|
||||
($a:expr) => {
|
||||
$a
|
||||
}; //~^ ERROR macro expansion ignores expression `2` and any tokens following
|
||||
}; //~^ ERROR macro expansion ignores `expr` metavariable and any tokens following
|
||||
}
|
||||
|
||||
trait Bar {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: macro expansion ignores expression `2` and any tokens following
|
||||
error: macro expansion ignores `expr` metavariable and any tokens following
|
||||
--> $DIR/trait-non-item-macros.rs:3:9
|
||||
|
|
||||
LL | $a
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
PRINT-DERIVE INPUT (DISPLAY): struct
|
||||
Foo([bool; #[rustc_dummy(first)] #[rustc_dummy(second)]
|
||||
{ #![rustc_dummy(third)] #[rustc_dummy(fourth)] 30 }]);
|
||||
Foo([bool; #[rustc_dummy(first)]
|
||||
#[rustc_dummy(second)] { #![rustc_dummy(third)] #[rustc_dummy(fourth)] 30 }]);
|
||||
PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): struct
|
||||
Foo([bool; #[rustc_dummy(first)] #[rustc_dummy(second)]
|
||||
Foo([bool; #[rustc_dummy(first)]
|
||||
#[rustc_dummy(second)]
|
||||
{ #! [rustc_dummy(third)] #[rustc_dummy(fourth)] 30 }]);
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
|
@ -53,97 +54,103 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
|||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:21: 18:63 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:13: 23:14 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:36: 23:47 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:48: 23:54 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:47: 23:55 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:14: 23:57 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
delimiter: None,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:5: 24:6 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:6: 24:7 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:13: 23:14 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:29: 24:40 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:36: 23:47 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "third",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:41: 24:46 (#0),
|
||||
ident: "second",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:48: 23:54 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:40: 24:47 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:47: 23:55 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:7: 24:49 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:5: 25:6 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:14: 23:57 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:28: 25:39 (#0),
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:5: 24:6 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:6: 24:7 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "fourth",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:40: 25:46 (#0),
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:29: 24:40 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "third",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:41: 24:46 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:40: 24:47 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:39: 25:47 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:7: 24:49 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:5: 25:6 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:28: 25:39 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "fourth",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:40: 25:46 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:39: 25:47 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:6: 25:49 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "30",
|
||||
suffix: None,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:5: 26:7 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:6: 25:49 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "30",
|
||||
suffix: None,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:5: 26:7 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:58: 27:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:58: 27:2 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:64: 18:69 (#3),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:13: 18:70 (#3),
|
||||
|
|
|
@ -59,8 +59,10 @@ fn _macros() {
|
|||
}
|
||||
use_expr!((let 0 = 1 && 0 == 0));
|
||||
//~^ ERROR expected expression, found `let` statement
|
||||
//~| ERROR expected expression, found `let` statement
|
||||
use_expr!((let 0 = 1));
|
||||
//~^ ERROR expected expression, found `let` statement
|
||||
//~| ERROR expected expression, found `let` statement
|
||||
match () {
|
||||
#[cfg(FALSE)]
|
||||
() if let 0 = 1 => {}
|
||||
|
|
|
@ -124,15 +124,33 @@ LL | use_expr!((let 0 = 1 && 0 == 0));
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/feature-gate.rs:62:16
|
||||
--> $DIR/feature-gate.rs:60:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1 && 0 == 0));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/feature-gate.rs:63:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/feature-gate.rs:63:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: no rules expected keyword `let`
|
||||
--> $DIR/feature-gate.rs:70:15
|
||||
--> $DIR/feature-gate.rs:72:15
|
||||
|
|
||||
LL | macro_rules! use_expr {
|
||||
| --------------------- when calling this macro
|
||||
|
@ -202,7 +220,7 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
|
|||
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
|
||||
|
||||
error[E0658]: `if let` guards are experimental
|
||||
--> $DIR/feature-gate.rs:66:12
|
||||
--> $DIR/feature-gate.rs:68:12
|
||||
|
|
||||
LL | () if let 0 = 1 => {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -262,6 +280,6 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
|
|||
= help: add `#![feature(let_chains)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 23 previous errors
|
||||
error: aborting due to 25 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -233,7 +233,7 @@ LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:99:9
|
||||
--> $DIR/disallowed-positions.rs:103:9
|
||||
|
|
||||
LL | if &let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -241,7 +241,7 @@ LL | if &let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:102:9
|
||||
--> $DIR/disallowed-positions.rs:106:9
|
||||
|
|
||||
LL | if !let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -249,7 +249,7 @@ LL | if !let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:104:9
|
||||
--> $DIR/disallowed-positions.rs:108:9
|
||||
|
|
||||
LL | if *let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -257,7 +257,7 @@ LL | if *let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:106:9
|
||||
--> $DIR/disallowed-positions.rs:110:9
|
||||
|
|
||||
LL | if -let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -265,7 +265,7 @@ LL | if -let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:114:9
|
||||
--> $DIR/disallowed-positions.rs:118:9
|
||||
|
|
||||
LL | if (let 0 = 0)? {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -273,20 +273,20 @@ LL | if (let 0 = 0)? {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:117:16
|
||||
--> $DIR/disallowed-positions.rs:121:16
|
||||
|
|
||||
LL | if true || let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `||` operators are not supported in let chain expressions
|
||||
--> $DIR/disallowed-positions.rs:117:13
|
||||
--> $DIR/disallowed-positions.rs:121:13
|
||||
|
|
||||
LL | if true || let 0 = 0 {}
|
||||
| ^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:119:17
|
||||
--> $DIR/disallowed-positions.rs:123:17
|
||||
|
|
||||
LL | if (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -294,7 +294,7 @@ LL | if (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:121:25
|
||||
--> $DIR/disallowed-positions.rs:125:25
|
||||
|
|
||||
LL | if true && (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -302,7 +302,7 @@ LL | if true && (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:123:25
|
||||
--> $DIR/disallowed-positions.rs:127:25
|
||||
|
|
||||
LL | if true || (true && let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -310,7 +310,7 @@ LL | if true || (true && let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:127:12
|
||||
--> $DIR/disallowed-positions.rs:131:12
|
||||
|
|
||||
LL | if x = let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -318,7 +318,7 @@ LL | if x = let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:130:15
|
||||
--> $DIR/disallowed-positions.rs:134:15
|
||||
|
|
||||
LL | if true..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -326,7 +326,7 @@ LL | if true..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:133:11
|
||||
--> $DIR/disallowed-positions.rs:137:11
|
||||
|
|
||||
LL | if ..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -334,7 +334,7 @@ LL | if ..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:135:9
|
||||
--> $DIR/disallowed-positions.rs:139:9
|
||||
|
|
||||
LL | if (let 0 = 0).. {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -342,7 +342,7 @@ LL | if (let 0 = 0).. {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:139:8
|
||||
--> $DIR/disallowed-positions.rs:143:8
|
||||
|
|
||||
LL | if let Range { start: _, end: _ } = true..true && false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -350,7 +350,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:142:8
|
||||
--> $DIR/disallowed-positions.rs:146:8
|
||||
|
|
||||
LL | if let Range { start: _, end: _ } = true..true || false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -358,7 +358,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:148:8
|
||||
--> $DIR/disallowed-positions.rs:152:8
|
||||
|
|
||||
LL | if let Range { start: F, end } = F..|| true {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -366,7 +366,7 @@ LL | if let Range { start: F, end } = F..|| true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:154:8
|
||||
--> $DIR/disallowed-positions.rs:158:8
|
||||
|
|
||||
LL | if let Range { start: true, end } = t..&&false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -374,7 +374,7 @@ LL | if let Range { start: true, end } = t..&&false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:158:19
|
||||
--> $DIR/disallowed-positions.rs:162:19
|
||||
|
|
||||
LL | if let true = let true = true {}
|
||||
| ^^^
|
||||
|
@ -382,7 +382,7 @@ LL | if let true = let true = true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:161:15
|
||||
--> $DIR/disallowed-positions.rs:165:15
|
||||
|
|
||||
LL | if return let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -390,7 +390,7 @@ LL | if return let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:164:21
|
||||
--> $DIR/disallowed-positions.rs:168:21
|
||||
|
|
||||
LL | loop { if break let 0 = 0 {} }
|
||||
| ^^^
|
||||
|
@ -398,7 +398,7 @@ LL | loop { if break let 0 = 0 {} }
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:167:15
|
||||
--> $DIR/disallowed-positions.rs:171:15
|
||||
|
|
||||
LL | if (match let 0 = 0 { _ => { false } }) {}
|
||||
| ^^^
|
||||
|
@ -406,7 +406,7 @@ LL | if (match let 0 = 0 { _ => { false } }) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:170:9
|
||||
--> $DIR/disallowed-positions.rs:174:9
|
||||
|
|
||||
LL | if (let 0 = 0, false).1 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -414,7 +414,7 @@ LL | if (let 0 = 0, false).1 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:173:9
|
||||
--> $DIR/disallowed-positions.rs:177:9
|
||||
|
|
||||
LL | if (let 0 = 0,) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -422,7 +422,7 @@ LL | if (let 0 = 0,) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:177:13
|
||||
--> $DIR/disallowed-positions.rs:181:13
|
||||
|
|
||||
LL | if (let 0 = 0).await {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -430,7 +430,7 @@ LL | if (let 0 = 0).await {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:181:12
|
||||
--> $DIR/disallowed-positions.rs:185:12
|
||||
|
|
||||
LL | if (|| let 0 = 0) {}
|
||||
| ^^^
|
||||
|
@ -438,7 +438,7 @@ LL | if (|| let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:184:9
|
||||
--> $DIR/disallowed-positions.rs:188:9
|
||||
|
|
||||
LL | if (let 0 = 0)() {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -446,7 +446,7 @@ LL | if (let 0 = 0)() {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:190:12
|
||||
--> $DIR/disallowed-positions.rs:194:12
|
||||
|
|
||||
LL | while &let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -454,7 +454,7 @@ LL | while &let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:193:12
|
||||
--> $DIR/disallowed-positions.rs:197:12
|
||||
|
|
||||
LL | while !let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -462,7 +462,7 @@ LL | while !let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:195:12
|
||||
--> $DIR/disallowed-positions.rs:199:12
|
||||
|
|
||||
LL | while *let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -470,7 +470,7 @@ LL | while *let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:197:12
|
||||
--> $DIR/disallowed-positions.rs:201:12
|
||||
|
|
||||
LL | while -let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -478,7 +478,7 @@ LL | while -let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:205:12
|
||||
--> $DIR/disallowed-positions.rs:209:12
|
||||
|
|
||||
LL | while (let 0 = 0)? {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -486,20 +486,20 @@ LL | while (let 0 = 0)? {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:208:19
|
||||
--> $DIR/disallowed-positions.rs:212:19
|
||||
|
|
||||
LL | while true || let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `||` operators are not supported in let chain expressions
|
||||
--> $DIR/disallowed-positions.rs:208:16
|
||||
--> $DIR/disallowed-positions.rs:212:16
|
||||
|
|
||||
LL | while true || let 0 = 0 {}
|
||||
| ^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:210:20
|
||||
--> $DIR/disallowed-positions.rs:214:20
|
||||
|
|
||||
LL | while (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -507,7 +507,7 @@ LL | while (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:212:28
|
||||
--> $DIR/disallowed-positions.rs:216:28
|
||||
|
|
||||
LL | while true && (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -515,7 +515,7 @@ LL | while true && (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:214:28
|
||||
--> $DIR/disallowed-positions.rs:218:28
|
||||
|
|
||||
LL | while true || (true && let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -523,7 +523,7 @@ LL | while true || (true && let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:218:15
|
||||
--> $DIR/disallowed-positions.rs:222:15
|
||||
|
|
||||
LL | while x = let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -531,7 +531,7 @@ LL | while x = let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:221:18
|
||||
--> $DIR/disallowed-positions.rs:225:18
|
||||
|
|
||||
LL | while true..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -539,7 +539,7 @@ LL | while true..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:224:14
|
||||
--> $DIR/disallowed-positions.rs:228:14
|
||||
|
|
||||
LL | while ..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -547,7 +547,7 @@ LL | while ..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:226:12
|
||||
--> $DIR/disallowed-positions.rs:230:12
|
||||
|
|
||||
LL | while (let 0 = 0).. {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -555,7 +555,7 @@ LL | while (let 0 = 0).. {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:230:11
|
||||
--> $DIR/disallowed-positions.rs:234:11
|
||||
|
|
||||
LL | while let Range { start: _, end: _ } = true..true && false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -563,7 +563,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:233:11
|
||||
--> $DIR/disallowed-positions.rs:237:11
|
||||
|
|
||||
LL | while let Range { start: _, end: _ } = true..true || false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -571,7 +571,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:239:11
|
||||
--> $DIR/disallowed-positions.rs:243:11
|
||||
|
|
||||
LL | while let Range { start: F, end } = F..|| true {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -579,7 +579,7 @@ LL | while let Range { start: F, end } = F..|| true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:245:11
|
||||
--> $DIR/disallowed-positions.rs:249:11
|
||||
|
|
||||
LL | while let Range { start: true, end } = t..&&false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -587,7 +587,7 @@ LL | while let Range { start: true, end } = t..&&false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:249:22
|
||||
--> $DIR/disallowed-positions.rs:253:22
|
||||
|
|
||||
LL | while let true = let true = true {}
|
||||
| ^^^
|
||||
|
@ -595,7 +595,7 @@ LL | while let true = let true = true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:252:18
|
||||
--> $DIR/disallowed-positions.rs:256:18
|
||||
|
|
||||
LL | while return let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -603,7 +603,7 @@ LL | while return let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:255:39
|
||||
--> $DIR/disallowed-positions.rs:259:39
|
||||
|
|
||||
LL | 'outer: loop { while break 'outer let 0 = 0 {} }
|
||||
| ^^^
|
||||
|
@ -611,7 +611,7 @@ LL | 'outer: loop { while break 'outer let 0 = 0 {} }
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:258:18
|
||||
--> $DIR/disallowed-positions.rs:262:18
|
||||
|
|
||||
LL | while (match let 0 = 0 { _ => { false } }) {}
|
||||
| ^^^
|
||||
|
@ -619,7 +619,7 @@ LL | while (match let 0 = 0 { _ => { false } }) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:261:12
|
||||
--> $DIR/disallowed-positions.rs:265:12
|
||||
|
|
||||
LL | while (let 0 = 0, false).1 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -627,7 +627,7 @@ LL | while (let 0 = 0, false).1 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:264:12
|
||||
--> $DIR/disallowed-positions.rs:268:12
|
||||
|
|
||||
LL | while (let 0 = 0,) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -635,7 +635,7 @@ LL | while (let 0 = 0,) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:268:16
|
||||
--> $DIR/disallowed-positions.rs:272:16
|
||||
|
|
||||
LL | while (let 0 = 0).await {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -643,7 +643,7 @@ LL | while (let 0 = 0).await {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:272:15
|
||||
--> $DIR/disallowed-positions.rs:276:15
|
||||
|
|
||||
LL | while (|| let 0 = 0) {}
|
||||
| ^^^
|
||||
|
@ -651,7 +651,7 @@ LL | while (|| let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:275:12
|
||||
--> $DIR/disallowed-positions.rs:279:12
|
||||
|
|
||||
LL | while (let 0 = 0)() {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -659,7 +659,7 @@ LL | while (let 0 = 0)() {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:292:6
|
||||
--> $DIR/disallowed-positions.rs:296:6
|
||||
|
|
||||
LL | &let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -667,7 +667,7 @@ LL | &let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:295:6
|
||||
--> $DIR/disallowed-positions.rs:299:6
|
||||
|
|
||||
LL | !let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -675,7 +675,7 @@ LL | !let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:297:6
|
||||
--> $DIR/disallowed-positions.rs:301:6
|
||||
|
|
||||
LL | *let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -683,7 +683,7 @@ LL | *let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:299:6
|
||||
--> $DIR/disallowed-positions.rs:303:6
|
||||
|
|
||||
LL | -let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -691,7 +691,7 @@ LL | -let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:301:13
|
||||
--> $DIR/disallowed-positions.rs:305:13
|
||||
|
|
||||
LL | let _ = let _ = 3;
|
||||
| ^^^
|
||||
|
@ -699,7 +699,7 @@ LL | let _ = let _ = 3;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:309:6
|
||||
--> $DIR/disallowed-positions.rs:313:6
|
||||
|
|
||||
LL | (let 0 = 0)?;
|
||||
| ^^^
|
||||
|
@ -707,7 +707,7 @@ LL | (let 0 = 0)?;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:312:13
|
||||
--> $DIR/disallowed-positions.rs:316:13
|
||||
|
|
||||
LL | true || let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -715,7 +715,7 @@ LL | true || let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:314:14
|
||||
--> $DIR/disallowed-positions.rs:318:14
|
||||
|
|
||||
LL | (true || let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -723,7 +723,7 @@ LL | (true || let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:316:22
|
||||
--> $DIR/disallowed-positions.rs:320:22
|
||||
|
|
||||
LL | true && (true || let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -731,7 +731,7 @@ LL | true && (true || let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:320:9
|
||||
--> $DIR/disallowed-positions.rs:324:9
|
||||
|
|
||||
LL | x = let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -739,7 +739,7 @@ LL | x = let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:323:12
|
||||
--> $DIR/disallowed-positions.rs:327:12
|
||||
|
|
||||
LL | true..(let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -747,7 +747,7 @@ LL | true..(let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:325:8
|
||||
--> $DIR/disallowed-positions.rs:329:8
|
||||
|
|
||||
LL | ..(let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -755,7 +755,7 @@ LL | ..(let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:327:6
|
||||
--> $DIR/disallowed-positions.rs:331:6
|
||||
|
|
||||
LL | (let 0 = 0)..;
|
||||
| ^^^
|
||||
|
@ -763,7 +763,7 @@ LL | (let 0 = 0)..;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:330:6
|
||||
--> $DIR/disallowed-positions.rs:334:6
|
||||
|
|
||||
LL | (let Range { start: _, end: _ } = true..true || false);
|
||||
| ^^^
|
||||
|
@ -771,7 +771,7 @@ LL | (let Range { start: _, end: _ } = true..true || false);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:334:6
|
||||
--> $DIR/disallowed-positions.rs:338:6
|
||||
|
|
||||
LL | (let true = let true = true);
|
||||
| ^^^
|
||||
|
@ -779,7 +779,7 @@ LL | (let true = let true = true);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:334:17
|
||||
--> $DIR/disallowed-positions.rs:338:17
|
||||
|
|
||||
LL | (let true = let true = true);
|
||||
| ^^^
|
||||
|
@ -787,7 +787,7 @@ LL | (let true = let true = true);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:340:25
|
||||
--> $DIR/disallowed-positions.rs:344:25
|
||||
|
|
||||
LL | let x = true && let y = 1;
|
||||
| ^^^
|
||||
|
@ -795,7 +795,7 @@ LL | let x = true && let y = 1;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:346:19
|
||||
--> $DIR/disallowed-positions.rs:350:19
|
||||
|
|
||||
LL | [1, 2, 3][let _ = ()]
|
||||
| ^^^
|
||||
|
@ -803,7 +803,7 @@ LL | [1, 2, 3][let _ = ()]
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:351:6
|
||||
--> $DIR/disallowed-positions.rs:355:6
|
||||
|
|
||||
LL | &let 0 = 0
|
||||
| ^^^
|
||||
|
@ -811,7 +811,7 @@ LL | &let 0 = 0
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:362:17
|
||||
--> $DIR/disallowed-positions.rs:366:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -819,7 +819,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:367:17
|
||||
--> $DIR/disallowed-positions.rs:371:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -827,7 +827,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:372:17
|
||||
--> $DIR/disallowed-positions.rs:376:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -835,7 +835,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:383:17
|
||||
--> $DIR/disallowed-positions.rs:387:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -843,7 +843,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expressions must be enclosed in braces to be used as const generic arguments
|
||||
--> $DIR/disallowed-positions.rs:383:9
|
||||
--> $DIR/disallowed-positions.rs:387:9
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
@ -854,124 +854,124 @@ LL | { true && let 1 = 1 }
|
|||
| + +
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:393:9
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && true) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:393:9
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && true) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
--> $DIR/disallowed-positions.rs:401:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
--> $DIR/disallowed-positions.rs:401:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:400:9
|
||||
--> $DIR/disallowed-positions.rs:404:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:400:9
|
||||
--> $DIR/disallowed-positions.rs:404:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:400:32
|
||||
--> $DIR/disallowed-positions.rs:404:32
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:400:32
|
||||
--> $DIR/disallowed-positions.rs:404:32
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:408:9
|
||||
--> $DIR/disallowed-positions.rs:412:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:408:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:408:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:408:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:412:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:412:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:412:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:412:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:416:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:416:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:416:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:416:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:420:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (true)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:416:9
|
||||
--> $DIR/disallowed-positions.rs:420:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (true)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:436:22
|
||||
--> $DIR/disallowed-positions.rs:440:22
|
||||
|
|
||||
LL | let x = (true && let y = 1);
|
||||
| ^^^
|
||||
|
@ -979,7 +979,7 @@ LL | let x = (true && let y = 1);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:441:20
|
||||
--> $DIR/disallowed-positions.rs:445:20
|
||||
|
|
||||
LL | ([1, 2, 3][let _ = ()])
|
||||
| ^^^
|
||||
|
@ -995,15 +995,51 @@ LL | use_expr!((let 0 = 1 && 0 == 0));
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:93:16
|
||||
--> $DIR/disallowed-positions.rs:91:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1 && 0 == 0));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:91:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1 && 0 == 0));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:95:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:95:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:95:16
|
||||
|
|
||||
LL | use_expr!((let 0 = 1));
|
||||
| ^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:130:8
|
||||
--> $DIR/disallowed-positions.rs:134:8
|
||||
|
|
||||
LL | if true..(let 0 = 0) {}
|
||||
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
||||
|
@ -1012,7 +1048,7 @@ LL | if true..(let 0 = 0) {}
|
|||
found struct `std::ops::Range<bool>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:139:12
|
||||
--> $DIR/disallowed-positions.rs:143:12
|
||||
|
|
||||
LL | if let Range { start: _, end: _ } = true..true && false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
|
||||
|
@ -1023,7 +1059,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:142:12
|
||||
--> $DIR/disallowed-positions.rs:146:12
|
||||
|
|
||||
LL | if let Range { start: _, end: _ } = true..true || false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
|
||||
|
@ -1034,7 +1070,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:148:12
|
||||
--> $DIR/disallowed-positions.rs:152:12
|
||||
|
|
||||
LL | if let Range { start: F, end } = F..|| true {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
|
||||
|
@ -1045,7 +1081,7 @@ LL | if let Range { start: F, end } = F..|| true {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:154:12
|
||||
--> $DIR/disallowed-positions.rs:158:12
|
||||
|
|
||||
LL | if let Range { start: true, end } = t..&&false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
|
||||
|
@ -1056,7 +1092,7 @@ LL | if let Range { start: true, end } = t..&&false {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0277]: the `?` operator can only be applied to values that implement `Try`
|
||||
--> $DIR/disallowed-positions.rs:110:20
|
||||
--> $DIR/disallowed-positions.rs:114:20
|
||||
|
|
||||
LL | if let 0 = 0? {}
|
||||
| ^^ the `?` operator cannot be applied to type `{integer}`
|
||||
|
@ -1064,7 +1100,7 @@ LL | if let 0 = 0? {}
|
|||
= help: the trait `Try` is not implemented for `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:221:11
|
||||
--> $DIR/disallowed-positions.rs:225:11
|
||||
|
|
||||
LL | while true..(let 0 = 0) {}
|
||||
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
||||
|
@ -1073,7 +1109,7 @@ LL | while true..(let 0 = 0) {}
|
|||
found struct `std::ops::Range<bool>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:230:15
|
||||
--> $DIR/disallowed-positions.rs:234:15
|
||||
|
|
||||
LL | while let Range { start: _, end: _ } = true..true && false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
|
||||
|
@ -1084,7 +1120,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:233:15
|
||||
--> $DIR/disallowed-positions.rs:237:15
|
||||
|
|
||||
LL | while let Range { start: _, end: _ } = true..true || false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
|
||||
|
@ -1095,7 +1131,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:239:15
|
||||
--> $DIR/disallowed-positions.rs:243:15
|
||||
|
|
||||
LL | while let Range { start: F, end } = F..|| true {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
|
||||
|
@ -1106,7 +1142,7 @@ LL | while let Range { start: F, end } = F..|| true {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:245:15
|
||||
--> $DIR/disallowed-positions.rs:249:15
|
||||
|
|
||||
LL | while let Range { start: true, end } = t..&&false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
|
||||
|
@ -1117,7 +1153,7 @@ LL | while let Range { start: true, end } = t..&&false {}
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0277]: the `?` operator can only be applied to values that implement `Try`
|
||||
--> $DIR/disallowed-positions.rs:201:23
|
||||
--> $DIR/disallowed-positions.rs:205:23
|
||||
|
|
||||
LL | while let 0 = 0? {}
|
||||
| ^^ the `?` operator cannot be applied to type `{integer}`
|
||||
|
@ -1125,7 +1161,7 @@ LL | while let 0 = 0? {}
|
|||
= help: the trait `Try` is not implemented for `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/disallowed-positions.rs:330:10
|
||||
--> $DIR/disallowed-positions.rs:334:10
|
||||
|
|
||||
LL | (let Range { start: _, end: _ } = true..true || false);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
|
||||
|
@ -1136,14 +1172,14 @@ LL | (let Range { start: _, end: _ } = true..true || false);
|
|||
found struct `std::ops::Range<_>`
|
||||
|
||||
error[E0277]: the `?` operator can only be applied to values that implement `Try`
|
||||
--> $DIR/disallowed-positions.rs:305:17
|
||||
--> $DIR/disallowed-positions.rs:309:17
|
||||
|
|
||||
LL | let 0 = 0?;
|
||||
| ^^ the `?` operator cannot be applied to type `{integer}`
|
||||
|
|
||||
= help: the trait `Try` is not implemented for `{integer}`
|
||||
|
||||
error: aborting due to 121 previous errors
|
||||
error: aborting due to 125 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0308.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -233,7 +233,7 @@ LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:99:9
|
||||
--> $DIR/disallowed-positions.rs:103:9
|
||||
|
|
||||
LL | if &let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -241,7 +241,7 @@ LL | if &let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:102:9
|
||||
--> $DIR/disallowed-positions.rs:106:9
|
||||
|
|
||||
LL | if !let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -249,7 +249,7 @@ LL | if !let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:104:9
|
||||
--> $DIR/disallowed-positions.rs:108:9
|
||||
|
|
||||
LL | if *let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -257,7 +257,7 @@ LL | if *let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:106:9
|
||||
--> $DIR/disallowed-positions.rs:110:9
|
||||
|
|
||||
LL | if -let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -265,7 +265,7 @@ LL | if -let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:114:9
|
||||
--> $DIR/disallowed-positions.rs:118:9
|
||||
|
|
||||
LL | if (let 0 = 0)? {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -273,20 +273,20 @@ LL | if (let 0 = 0)? {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:117:16
|
||||
--> $DIR/disallowed-positions.rs:121:16
|
||||
|
|
||||
LL | if true || let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `||` operators are not supported in let chain expressions
|
||||
--> $DIR/disallowed-positions.rs:117:13
|
||||
--> $DIR/disallowed-positions.rs:121:13
|
||||
|
|
||||
LL | if true || let 0 = 0 {}
|
||||
| ^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:119:17
|
||||
--> $DIR/disallowed-positions.rs:123:17
|
||||
|
|
||||
LL | if (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -294,7 +294,7 @@ LL | if (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:121:25
|
||||
--> $DIR/disallowed-positions.rs:125:25
|
||||
|
|
||||
LL | if true && (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -302,7 +302,7 @@ LL | if true && (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:123:25
|
||||
--> $DIR/disallowed-positions.rs:127:25
|
||||
|
|
||||
LL | if true || (true && let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -310,7 +310,7 @@ LL | if true || (true && let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:127:12
|
||||
--> $DIR/disallowed-positions.rs:131:12
|
||||
|
|
||||
LL | if x = let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -318,7 +318,7 @@ LL | if x = let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:130:15
|
||||
--> $DIR/disallowed-positions.rs:134:15
|
||||
|
|
||||
LL | if true..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -326,7 +326,7 @@ LL | if true..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:133:11
|
||||
--> $DIR/disallowed-positions.rs:137:11
|
||||
|
|
||||
LL | if ..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -334,7 +334,7 @@ LL | if ..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:135:9
|
||||
--> $DIR/disallowed-positions.rs:139:9
|
||||
|
|
||||
LL | if (let 0 = 0).. {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -342,7 +342,7 @@ LL | if (let 0 = 0).. {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:139:8
|
||||
--> $DIR/disallowed-positions.rs:143:8
|
||||
|
|
||||
LL | if let Range { start: _, end: _ } = true..true && false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -350,7 +350,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:142:8
|
||||
--> $DIR/disallowed-positions.rs:146:8
|
||||
|
|
||||
LL | if let Range { start: _, end: _ } = true..true || false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -358,7 +358,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:148:8
|
||||
--> $DIR/disallowed-positions.rs:152:8
|
||||
|
|
||||
LL | if let Range { start: F, end } = F..|| true {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -366,7 +366,7 @@ LL | if let Range { start: F, end } = F..|| true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:154:8
|
||||
--> $DIR/disallowed-positions.rs:158:8
|
||||
|
|
||||
LL | if let Range { start: true, end } = t..&&false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -374,7 +374,7 @@ LL | if let Range { start: true, end } = t..&&false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:158:19
|
||||
--> $DIR/disallowed-positions.rs:162:19
|
||||
|
|
||||
LL | if let true = let true = true {}
|
||||
| ^^^
|
||||
|
@ -382,7 +382,7 @@ LL | if let true = let true = true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:161:15
|
||||
--> $DIR/disallowed-positions.rs:165:15
|
||||
|
|
||||
LL | if return let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -390,7 +390,7 @@ LL | if return let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:164:21
|
||||
--> $DIR/disallowed-positions.rs:168:21
|
||||
|
|
||||
LL | loop { if break let 0 = 0 {} }
|
||||
| ^^^
|
||||
|
@ -398,7 +398,7 @@ LL | loop { if break let 0 = 0 {} }
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:167:15
|
||||
--> $DIR/disallowed-positions.rs:171:15
|
||||
|
|
||||
LL | if (match let 0 = 0 { _ => { false } }) {}
|
||||
| ^^^
|
||||
|
@ -406,7 +406,7 @@ LL | if (match let 0 = 0 { _ => { false } }) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:170:9
|
||||
--> $DIR/disallowed-positions.rs:174:9
|
||||
|
|
||||
LL | if (let 0 = 0, false).1 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -414,7 +414,7 @@ LL | if (let 0 = 0, false).1 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:173:9
|
||||
--> $DIR/disallowed-positions.rs:177:9
|
||||
|
|
||||
LL | if (let 0 = 0,) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -422,7 +422,7 @@ LL | if (let 0 = 0,) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:177:13
|
||||
--> $DIR/disallowed-positions.rs:181:13
|
||||
|
|
||||
LL | if (let 0 = 0).await {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -430,7 +430,7 @@ LL | if (let 0 = 0).await {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:181:12
|
||||
--> $DIR/disallowed-positions.rs:185:12
|
||||
|
|
||||
LL | if (|| let 0 = 0) {}
|
||||
| ^^^
|
||||
|
@ -438,7 +438,7 @@ LL | if (|| let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:184:9
|
||||
--> $DIR/disallowed-positions.rs:188:9
|
||||
|
|
||||
LL | if (let 0 = 0)() {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -446,7 +446,7 @@ LL | if (let 0 = 0)() {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:190:12
|
||||
--> $DIR/disallowed-positions.rs:194:12
|
||||
|
|
||||
LL | while &let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -454,7 +454,7 @@ LL | while &let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:193:12
|
||||
--> $DIR/disallowed-positions.rs:197:12
|
||||
|
|
||||
LL | while !let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -462,7 +462,7 @@ LL | while !let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:195:12
|
||||
--> $DIR/disallowed-positions.rs:199:12
|
||||
|
|
||||
LL | while *let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -470,7 +470,7 @@ LL | while *let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:197:12
|
||||
--> $DIR/disallowed-positions.rs:201:12
|
||||
|
|
||||
LL | while -let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -478,7 +478,7 @@ LL | while -let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:205:12
|
||||
--> $DIR/disallowed-positions.rs:209:12
|
||||
|
|
||||
LL | while (let 0 = 0)? {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -486,20 +486,20 @@ LL | while (let 0 = 0)? {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:208:19
|
||||
--> $DIR/disallowed-positions.rs:212:19
|
||||
|
|
||||
LL | while true || let 0 = 0 {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `||` operators are not supported in let chain expressions
|
||||
--> $DIR/disallowed-positions.rs:208:16
|
||||
--> $DIR/disallowed-positions.rs:212:16
|
||||
|
|
||||
LL | while true || let 0 = 0 {}
|
||||
| ^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:210:20
|
||||
--> $DIR/disallowed-positions.rs:214:20
|
||||
|
|
||||
LL | while (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -507,7 +507,7 @@ LL | while (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:212:28
|
||||
--> $DIR/disallowed-positions.rs:216:28
|
||||
|
|
||||
LL | while true && (true || let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -515,7 +515,7 @@ LL | while true && (true || let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:214:28
|
||||
--> $DIR/disallowed-positions.rs:218:28
|
||||
|
|
||||
LL | while true || (true && let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -523,7 +523,7 @@ LL | while true || (true && let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:218:15
|
||||
--> $DIR/disallowed-positions.rs:222:15
|
||||
|
|
||||
LL | while x = let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -531,7 +531,7 @@ LL | while x = let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:221:18
|
||||
--> $DIR/disallowed-positions.rs:225:18
|
||||
|
|
||||
LL | while true..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -539,7 +539,7 @@ LL | while true..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:224:14
|
||||
--> $DIR/disallowed-positions.rs:228:14
|
||||
|
|
||||
LL | while ..(let 0 = 0) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -547,7 +547,7 @@ LL | while ..(let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:226:12
|
||||
--> $DIR/disallowed-positions.rs:230:12
|
||||
|
|
||||
LL | while (let 0 = 0).. {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -555,7 +555,7 @@ LL | while (let 0 = 0).. {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:230:11
|
||||
--> $DIR/disallowed-positions.rs:234:11
|
||||
|
|
||||
LL | while let Range { start: _, end: _ } = true..true && false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -563,7 +563,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:233:11
|
||||
--> $DIR/disallowed-positions.rs:237:11
|
||||
|
|
||||
LL | while let Range { start: _, end: _ } = true..true || false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -571,7 +571,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:239:11
|
||||
--> $DIR/disallowed-positions.rs:243:11
|
||||
|
|
||||
LL | while let Range { start: F, end } = F..|| true {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -579,7 +579,7 @@ LL | while let Range { start: F, end } = F..|| true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:245:11
|
||||
--> $DIR/disallowed-positions.rs:249:11
|
||||
|
|
||||
LL | while let Range { start: true, end } = t..&&false {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -587,7 +587,7 @@ LL | while let Range { start: true, end } = t..&&false {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:249:22
|
||||
--> $DIR/disallowed-positions.rs:253:22
|
||||
|
|
||||
LL | while let true = let true = true {}
|
||||
| ^^^
|
||||
|
@ -595,7 +595,7 @@ LL | while let true = let true = true {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:252:18
|
||||
--> $DIR/disallowed-positions.rs:256:18
|
||||
|
|
||||
LL | while return let 0 = 0 {}
|
||||
| ^^^
|
||||
|
@ -603,7 +603,7 @@ LL | while return let 0 = 0 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:255:39
|
||||
--> $DIR/disallowed-positions.rs:259:39
|
||||
|
|
||||
LL | 'outer: loop { while break 'outer let 0 = 0 {} }
|
||||
| ^^^
|
||||
|
@ -611,7 +611,7 @@ LL | 'outer: loop { while break 'outer let 0 = 0 {} }
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:258:18
|
||||
--> $DIR/disallowed-positions.rs:262:18
|
||||
|
|
||||
LL | while (match let 0 = 0 { _ => { false } }) {}
|
||||
| ^^^
|
||||
|
@ -619,7 +619,7 @@ LL | while (match let 0 = 0 { _ => { false } }) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:261:12
|
||||
--> $DIR/disallowed-positions.rs:265:12
|
||||
|
|
||||
LL | while (let 0 = 0, false).1 {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -627,7 +627,7 @@ LL | while (let 0 = 0, false).1 {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:264:12
|
||||
--> $DIR/disallowed-positions.rs:268:12
|
||||
|
|
||||
LL | while (let 0 = 0,) {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -635,7 +635,7 @@ LL | while (let 0 = 0,) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:268:16
|
||||
--> $DIR/disallowed-positions.rs:272:16
|
||||
|
|
||||
LL | while (let 0 = 0).await {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -643,7 +643,7 @@ LL | while (let 0 = 0).await {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:272:15
|
||||
--> $DIR/disallowed-positions.rs:276:15
|
||||
|
|
||||
LL | while (|| let 0 = 0) {}
|
||||
| ^^^
|
||||
|
@ -651,7 +651,7 @@ LL | while (|| let 0 = 0) {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:275:12
|
||||
--> $DIR/disallowed-positions.rs:279:12
|
||||
|
|
||||
LL | while (let 0 = 0)() {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -659,7 +659,7 @@ LL | while (let 0 = 0)() {}
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:292:6
|
||||
--> $DIR/disallowed-positions.rs:296:6
|
||||
|
|
||||
LL | &let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -667,7 +667,7 @@ LL | &let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:295:6
|
||||
--> $DIR/disallowed-positions.rs:299:6
|
||||
|
|
||||
LL | !let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -675,7 +675,7 @@ LL | !let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:297:6
|
||||
--> $DIR/disallowed-positions.rs:301:6
|
||||
|
|
||||
LL | *let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -683,7 +683,7 @@ LL | *let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:299:6
|
||||
--> $DIR/disallowed-positions.rs:303:6
|
||||
|
|
||||
LL | -let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -691,7 +691,7 @@ LL | -let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:301:13
|
||||
--> $DIR/disallowed-positions.rs:305:13
|
||||
|
|
||||
LL | let _ = let _ = 3;
|
||||
| ^^^
|
||||
|
@ -699,7 +699,7 @@ LL | let _ = let _ = 3;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:309:6
|
||||
--> $DIR/disallowed-positions.rs:313:6
|
||||
|
|
||||
LL | (let 0 = 0)?;
|
||||
| ^^^
|
||||
|
@ -707,7 +707,7 @@ LL | (let 0 = 0)?;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:312:13
|
||||
--> $DIR/disallowed-positions.rs:316:13
|
||||
|
|
||||
LL | true || let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -715,7 +715,7 @@ LL | true || let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:314:14
|
||||
--> $DIR/disallowed-positions.rs:318:14
|
||||
|
|
||||
LL | (true || let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -723,7 +723,7 @@ LL | (true || let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:316:22
|
||||
--> $DIR/disallowed-positions.rs:320:22
|
||||
|
|
||||
LL | true && (true || let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -731,7 +731,7 @@ LL | true && (true || let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:320:9
|
||||
--> $DIR/disallowed-positions.rs:324:9
|
||||
|
|
||||
LL | x = let 0 = 0;
|
||||
| ^^^
|
||||
|
@ -739,7 +739,7 @@ LL | x = let 0 = 0;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:323:12
|
||||
--> $DIR/disallowed-positions.rs:327:12
|
||||
|
|
||||
LL | true..(let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -747,7 +747,7 @@ LL | true..(let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:325:8
|
||||
--> $DIR/disallowed-positions.rs:329:8
|
||||
|
|
||||
LL | ..(let 0 = 0);
|
||||
| ^^^
|
||||
|
@ -755,7 +755,7 @@ LL | ..(let 0 = 0);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:327:6
|
||||
--> $DIR/disallowed-positions.rs:331:6
|
||||
|
|
||||
LL | (let 0 = 0)..;
|
||||
| ^^^
|
||||
|
@ -763,7 +763,7 @@ LL | (let 0 = 0)..;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:330:6
|
||||
--> $DIR/disallowed-positions.rs:334:6
|
||||
|
|
||||
LL | (let Range { start: _, end: _ } = true..true || false);
|
||||
| ^^^
|
||||
|
@ -771,7 +771,7 @@ LL | (let Range { start: _, end: _ } = true..true || false);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:334:6
|
||||
--> $DIR/disallowed-positions.rs:338:6
|
||||
|
|
||||
LL | (let true = let true = true);
|
||||
| ^^^
|
||||
|
@ -779,7 +779,7 @@ LL | (let true = let true = true);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:334:17
|
||||
--> $DIR/disallowed-positions.rs:338:17
|
||||
|
|
||||
LL | (let true = let true = true);
|
||||
| ^^^
|
||||
|
@ -787,7 +787,7 @@ LL | (let true = let true = true);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:340:25
|
||||
--> $DIR/disallowed-positions.rs:344:25
|
||||
|
|
||||
LL | let x = true && let y = 1;
|
||||
| ^^^
|
||||
|
@ -795,7 +795,7 @@ LL | let x = true && let y = 1;
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:346:19
|
||||
--> $DIR/disallowed-positions.rs:350:19
|
||||
|
|
||||
LL | [1, 2, 3][let _ = ()]
|
||||
| ^^^
|
||||
|
@ -803,7 +803,7 @@ LL | [1, 2, 3][let _ = ()]
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:351:6
|
||||
--> $DIR/disallowed-positions.rs:355:6
|
||||
|
|
||||
LL | &let 0 = 0
|
||||
| ^^^
|
||||
|
@ -811,7 +811,7 @@ LL | &let 0 = 0
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:362:17
|
||||
--> $DIR/disallowed-positions.rs:366:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -819,7 +819,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:367:17
|
||||
--> $DIR/disallowed-positions.rs:371:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -827,7 +827,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:372:17
|
||||
--> $DIR/disallowed-positions.rs:376:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -835,7 +835,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:383:17
|
||||
--> $DIR/disallowed-positions.rs:387:17
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^
|
||||
|
@ -843,7 +843,7 @@ LL | true && let 1 = 1
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expressions must be enclosed in braces to be used as const generic arguments
|
||||
--> $DIR/disallowed-positions.rs:383:9
|
||||
--> $DIR/disallowed-positions.rs:387:9
|
||||
|
|
||||
LL | true && let 1 = 1
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
@ -854,124 +854,124 @@ LL | { true && let 1 = 1 }
|
|||
| + +
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:393:9
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && true) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:393:9
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && true) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
--> $DIR/disallowed-positions.rs:401:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:397:9
|
||||
--> $DIR/disallowed-positions.rs:401:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:400:9
|
||||
--> $DIR/disallowed-positions.rs:404:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:400:9
|
||||
--> $DIR/disallowed-positions.rs:404:9
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:400:32
|
||||
--> $DIR/disallowed-positions.rs:404:32
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:400:32
|
||||
--> $DIR/disallowed-positions.rs:404:32
|
||||
|
|
||||
LL | if (let Some(a) = opt) && (let Some(b) = a) {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:408:9
|
||||
--> $DIR/disallowed-positions.rs:412:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:408:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:408:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:408:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:412:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:412:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:412:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:412:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:416:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:416:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:416:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:416:31
|
||||
|
|
||||
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:420:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (true)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
note: `let`s wrapped in parentheses are not supported in a context with let chains
|
||||
--> $DIR/disallowed-positions.rs:416:9
|
||||
--> $DIR/disallowed-positions.rs:420:9
|
||||
|
|
||||
LL | if (let Some(a) = opt && (true)) && true {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:436:22
|
||||
--> $DIR/disallowed-positions.rs:440:22
|
||||
|
|
||||
LL | let x = (true && let y = 1);
|
||||
| ^^^
|
||||
|
@ -979,7 +979,7 @@ LL | let x = (true && let y = 1);
|
|||
= note: only supported directly in conditions of `if` and `while` expressions
|
||||
|
||||
error: expected expression, found `let` statement
|
||||
--> $DIR/disallowed-positions.rs:441:20
|
||||
--> $DIR/disallowed-positions.rs:445:20
|
||||
|
|
||||
LL | ([1, 2, 3][let _ = ()])
|
||||
| ^^^
|
||||
|
|
|
@ -90,8 +90,12 @@ fn _macros() {
|
|||
}
|
||||
use_expr!((let 0 = 1 && 0 == 0));
|
||||
//[feature,no_feature]~^ ERROR expected expression, found `let` statement
|
||||
//[feature,no_feature]~| ERROR expected expression, found `let` statement
|
||||
//[feature,no_feature]~| ERROR expected expression, found `let` statement
|
||||
use_expr!((let 0 = 1));
|
||||
//[feature,no_feature]~^ ERROR expected expression, found `let` statement
|
||||
//[feature,no_feature]~| ERROR expected expression, found `let` statement
|
||||
//[feature,no_feature]~| ERROR expected expression, found `let` statement
|
||||
}
|
||||
|
||||
#[cfg(not(nothing))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue