about summary refs log tree commit diff
path: root/tests/ui/dropck/dropck-empty-array.rs
blob: f3eca6aed8d5e4be2d135fb5e3c9fc43dc51fe8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@ run-pass

#[allow(dead_code)]
struct Struct<'s>(&'s str);

impl<'s> Drop for Struct<'s> {
    fn drop(&mut self) {}
}

fn to_array_zero<T>(_: T) -> [T; 0] {
    []
}

pub fn array_zero_in_tuple() {
    let mut x = ([], String::new());
    {
        let s = String::from("temporary");
        let p = Struct(&s);
        x.0 = to_array_zero(p);
    }
}

fn main() {}