2025-06-01 12:51:17 +02:00
|
|
|
//@ check-pass
|
2025-06-01 12:51:17 +02:00
|
|
|
//@ edition: 2024
|
2025-06-01 12:51:17 +02:00
|
|
|
//
|
|
|
|
|
// Check that we don't warn on `as` casts of never to any as unreachable.
|
|
|
|
|
// While they *are* unreachable, sometimes they are required to appeal typeck.
|
2017-03-21 09:41:41 -04:00
|
|
|
#![deny(unreachable_code)]
|
|
|
|
|
|
|
|
|
|
fn a() {
|
2025-06-01 12:51:17 +02:00
|
|
|
_ = {return} as u32;
|
2017-03-21 09:41:41 -04:00
|
|
|
}
|
|
|
|
|
|
2025-06-01 12:51:17 +02:00
|
|
|
fn b() {
|
2025-06-01 12:51:17 +02:00
|
|
|
(return) as u32;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// example that needs an explicit never-to-any `as` cast
|
|
|
|
|
fn example() -> impl Iterator<Item = u8> {
|
|
|
|
|
todo!() as std::iter::Empty<_>
|
2025-06-01 12:51:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {}
|