1
Fork 0

Move /src/test to /tests

This commit is contained in:
Albert Larsan 2023-01-05 09:13:28 +01:00
commit cf2dff2b1e
No known key found for this signature in database
GPG key ID: 92709B88BB8F13EA
27592 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,37 @@
// run-pass
#![allow(non_camel_case_types)]
// Ensures that class dtors run if the object is inside an enum
// variant
use std::cell::Cell;
type closable<'a> = &'a Cell<bool>;
struct close_res<'a> {
i: closable<'a>,
}
impl<'a> Drop for close_res<'a> {
fn drop(&mut self) {
self.i.set(false);
}
}
fn close_res(i: closable) -> close_res {
close_res {
i: i
}
}
enum option<T> { none, some(#[allow(unused_tuple_struct_fields)] T), }
fn sink(_res: option<close_res>) { }
pub fn main() {
let c = &Cell::new(true);
sink(option::none);
sink(option::some(close_res(c)));
assert!(!c.get());
}