Revert let_chains stabilization
This reverts commit 3266460749
.
This is the revert against master, the beta revert was already done in #100538.
This commit is contained in:
parent
76eb4f3bfd
commit
d1ef8180f9
59 changed files with 825 additions and 430 deletions
|
@ -119,7 +119,33 @@ impl<'a> AstValidator<'a> {
|
|||
|
||||
/// Emits an error banning the `let` expression provided in the given location.
|
||||
fn ban_let_expr(&self, expr: &'a Expr, forbidden_let_reason: ForbiddenLetReason) {
|
||||
self.session.emit_err(ForbiddenLet { span: expr.span, reason: forbidden_let_reason });
|
||||
let sess = &self.session;
|
||||
if sess.opts.unstable_features.is_nightly_build() {
|
||||
let err = "`let` expressions are not supported here";
|
||||
let mut diag = sess.struct_span_err(expr.span, err);
|
||||
diag.note("only supported directly in conditions of `if` and `while` expressions");
|
||||
match forbidden_let_reason {
|
||||
ForbiddenLetReason::GenericForbidden => {}
|
||||
ForbiddenLetReason::NotSupportedOr(span) => {
|
||||
diag.span_note(
|
||||
span,
|
||||
"`||` operators are not supported in let chain expressions",
|
||||
);
|
||||
}
|
||||
ForbiddenLetReason::NotSupportedParentheses(span) => {
|
||||
diag.span_note(
|
||||
span,
|
||||
"`let`s wrapped in parentheses are not supported in a context with let \
|
||||
chains",
|
||||
);
|
||||
}
|
||||
}
|
||||
diag.emit();
|
||||
} else {
|
||||
sess.struct_span_err(expr.span, "expected expression, found statement (`let`)")
|
||||
.note("variable declaration using `let` is a statement")
|
||||
.emit();
|
||||
}
|
||||
}
|
||||
|
||||
fn check_gat_where(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue