rust/tests/ui/drop/issue-35546.rs

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

21 lines
516 B
Rust
Raw Normal View History

// build-pass
#![allow(dead_code)]
2016-09-13 22:33:35 +00:00
// Regression test for #35546. Check that we are able to codegen
// this. Before we had problems because of the drop glue signature
// around dropping a trait object (specifically, when dropping the
// `value` field of `Node<Send>`).
struct Node<T: ?Sized + Send> {
2019-05-28 18:46:13 +00:00
next: Option<Box<Node<dyn Send>>>,
2016-09-13 22:33:35 +00:00
value: T,
}
2019-05-28 18:46:13 +00:00
fn clear(head: &mut Option<Box<Node<dyn Send>>>) {
2016-09-13 22:33:35 +00:00
match head.take() {
Some(node) => *head = node.next,
None => (),
}
}
fn main() {}