2022-02-27 00:08:31 -06:00
|
|
|
#![feature(let_chains)]
|
2022-03-15 15:00:16 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let opt = Some(1i32);
|
|
|
|
|
|
|
|
let Some(n) = opt else {
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
let Some(n) = opt && n == 1 else {
|
|
|
|
//~^ ERROR a `&&` expression cannot be directly assigned in `let...else`
|
|
|
|
//~| ERROR mismatched types
|
|
|
|
//~| ERROR mismatched types
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
let Some(n) = opt && let another = n else {
|
|
|
|
//~^ ERROR a `&&` expression cannot be directly assigned in `let...else`
|
|
|
|
//~| ERROR `let` expressions are not supported here
|
|
|
|
//~| ERROR mismatched types
|
|
|
|
//~| ERROR mismatched types
|
2022-06-25 06:08:38 -05:00
|
|
|
//~| ERROR expected expression, found `let` statement
|
2022-03-15 15:00:16 -05:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
|
|
|
if let Some(n) = opt else {
|
2022-05-27 23:58:48 -05:00
|
|
|
//~^ ERROR this `if` expression is missing a block after the condition
|
2022-03-15 15:00:16 -05:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
if let Some(n) = opt && n == 1 else {
|
2022-05-27 23:58:48 -05:00
|
|
|
//~^ ERROR this `if` expression is missing a block after the condition
|
2022-03-15 15:00:16 -05:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
if let Some(n) = opt && let another = n else {
|
2022-05-27 23:58:48 -05:00
|
|
|
//~^ ERROR this `if` expression is missing a block after the condition
|
2022-03-15 15:00:16 -05:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
while let Some(n) = opt else {
|
|
|
|
//~^ ERROR expected `{`, found keyword `else`
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
while let Some(n) = opt && n == 1 else {
|
|
|
|
//~^ ERROR expected `{`, found keyword `else`
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
while let Some(n) = opt && let another = n else {
|
|
|
|
//~^ ERROR expected `{`, found keyword `else`
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|