rust/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
2024-02-16 20:02:50 +00:00

15 lines
353 B
Rust

//@ run-pass
#![deny(drop_bounds)]
// As a special exemption, `impl Drop` in the return position raises no error.
// This allows a convenient way to return an unnamed drop guard.
fn unnameable_type() -> impl Drop {
struct Unnameable;
impl Drop for Unnameable {
fn drop(&mut self) {}
}
Unnameable
}
fn main() {
let _ = unnameable_type();
}