summaryrefslogtreecommitdiffstats
path: root/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
blob: 15aebdf1bc93cc51d21b64731bb1abb7c6f58b65 (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();
}