rust/tests/ui/drop-bounds/drop-bounds-impl-drop.rs

15 lines
347 B
Rust
Raw Normal View History

2020-08-19 05:05:44 -05:00
// 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 voldemort_type() -> impl Drop {
struct Voldemort;
impl Drop for Voldemort {
fn drop(&mut self) {}
}
Voldemort
}
fn main() {
let _ = voldemort_type();
}