resolved conflict
This commit is contained in:
@@ -675,6 +675,8 @@ parse_note_pattern_alternatives_use_single_vert = alternatives in or-patterns ar
|
||||
|
||||
parse_nul_in_c_str = null characters in C string literals are not supported
|
||||
|
||||
parse_or_in_let_chain = `||` operators are not supported in let chain conditions
|
||||
|
||||
parse_or_pattern_not_allowed_in_fn_parameters = top-level or-patterns are not allowed in function parameters
|
||||
parse_or_pattern_not_allowed_in_let_binding = top-level or-patterns are not allowed in `let` bindings
|
||||
parse_out_of_range_hex_escape = out of range hex escape
|
||||
|
||||
@@ -478,6 +478,13 @@ pub(crate) struct ExpectedExpressionFoundLet {
|
||||
pub comparison: Option<MaybeComparison>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_or_in_let_chain)]
|
||||
pub(crate) struct OrInLetChain {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic, Clone, Copy)]
|
||||
#[multipart_suggestion(
|
||||
parse_maybe_missing_let,
|
||||
|
||||
@@ -4073,14 +4073,18 @@ impl MutVisitor for CondChecker<'_> {
|
||||
match e.kind {
|
||||
ExprKind::Let(_, _, _, ref mut recovered @ Recovered::No) => {
|
||||
if let Some(reason) = self.forbid_let_reason {
|
||||
*recovered = Recovered::Yes(self.parser.dcx().emit_err(
|
||||
errors::ExpectedExpressionFoundLet {
|
||||
let error = match reason {
|
||||
NotSupportedOr(or_span) => {
|
||||
self.parser.dcx().emit_err(errors::OrInLetChain { span: or_span })
|
||||
}
|
||||
_ => self.parser.dcx().emit_err(errors::ExpectedExpressionFoundLet {
|
||||
span,
|
||||
reason,
|
||||
missing_let: self.missing_let,
|
||||
comparison: self.comparison,
|
||||
},
|
||||
));
|
||||
}),
|
||||
};
|
||||
*recovered = Recovered::Yes(error);
|
||||
} else if self.depth > 1 {
|
||||
// Top level `let` is always allowed; only gate chains
|
||||
match self.let_chains_policy {
|
||||
|
||||
Reference in New Issue
Block a user