about summary refs log tree commit diff
path: root/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
blob: 9b94e04b118c51447e90b23a863a8f4f0b6853cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//@ 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();
}