2022-02-27 07:08:31 +01:00
|
|
|
#![feature(let_chains)]
|
2022-03-15 17:00:16 -03: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 08:08:38 -03:00
|
|
|
//~| ERROR expected expression, found `let` statement
|
2022-03-15 17:00:16 -03:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
|
|
|
if let Some(n) = opt else {
|
2022-05-27 21:58:48 -07:00
|
|
|
//~^ ERROR this `if` expression is missing a block after the condition
|
2022-03-15 17:00:16 -03:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
if let Some(n) = opt && n == 1 else {
|
2022-05-27 21:58:48 -07:00
|
|
|
//~^ ERROR this `if` expression is missing a block after the condition
|
2022-03-15 17:00:16 -03:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
if let Some(n) = opt && let another = n else {
|
2022-05-27 21:58:48 -07:00
|
|
|
//~^ ERROR this `if` expression is missing a block after the condition
|
2022-03-15 17:00:16 -03: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;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|