mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
15 lines
353 B
Rust
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();
|
|
}
|