mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
15 lines
352 B
Rust
15 lines
352 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();
|
|
}
|