-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't suggest break through nested items
- Loading branch information
1 parent
ad8304a
commit 0a51ab9
Showing
3 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// edition:2021 | ||
|
||
#![feature(inline_const)] | ||
|
||
fn closure() { | ||
loop { | ||
let closure = || { | ||
if true { | ||
Err(1) | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
Ok(()) | ||
}; | ||
} | ||
} | ||
|
||
fn async_block() { | ||
loop { | ||
let fut = async { | ||
if true { | ||
Err(1) | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
Ok(()) | ||
}; | ||
} | ||
} | ||
|
||
fn fn_item() { | ||
let _ = loop { | ||
fn foo() -> Result<(), ()> { | ||
if true { | ||
Err(1) | ||
//~^ ERROR mismatched types | ||
} | ||
Err(()) | ||
} | ||
}; | ||
} | ||
|
||
fn const_block() { | ||
let _ = loop { | ||
const { | ||
if true { | ||
Err(1) | ||
//~^ ERROR mismatched types | ||
} | ||
Err(()) | ||
}; | ||
}; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/dont-suggest-break-thru-item.rs:9:17 | ||
| | ||
LL | / if true { | ||
LL | | Err(1) | ||
| | ^^^^^^ expected `()`, found `Result<_, {integer}>` | ||
LL | | | ||
LL | | } | ||
| |_____________- expected this to be `()` | ||
| | ||
= note: expected unit type `()` | ||
found enum `Result<_, {integer}>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/dont-suggest-break-thru-item.rs:22:17 | ||
| | ||
LL | / if true { | ||
LL | | Err(1) | ||
| | ^^^^^^ expected `()`, found `Result<_, {integer}>` | ||
LL | | | ||
LL | | } | ||
| |_____________- expected this to be `()` | ||
| | ||
= note: expected unit type `()` | ||
found enum `Result<_, {integer}>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/dont-suggest-break-thru-item.rs:35:17 | ||
| | ||
LL | / if true { | ||
LL | | Err(1) | ||
| | ^^^^^^ expected `()`, found `Result<_, {integer}>` | ||
LL | | | ||
LL | | } | ||
| |_____________- expected this to be `()` | ||
| | ||
= note: expected unit type `()` | ||
found enum `Result<_, {integer}>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/dont-suggest-break-thru-item.rs:47:17 | ||
| | ||
LL | / if true { | ||
LL | | Err(1) | ||
| | ^^^^^^ expected `()`, found `Result<_, {integer}>` | ||
LL | | | ||
LL | | } | ||
| |_____________- expected this to be `()` | ||
| | ||
= note: expected unit type `()` | ||
found enum `Result<_, {integer}>` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |