mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
15 lines
347 B
Rust
15 lines
347 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 voldemort_type() -> impl Drop {
|
|
struct Voldemort;
|
|
impl Drop for Voldemort {
|
|
fn drop(&mut self) {}
|
|
}
|
|
Voldemort
|
|
}
|
|
fn main() {
|
|
let _ = voldemort_type();
|
|
}
|