os-rust/tests/ui/dropck/dropck-empty-array.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
370 B
Rust
Raw Normal View History

2024-07-31 15:55:56 +03:00
//@ 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() {}