1 // compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts
3 // FIXME: the pass is unsound and causes ICEs in the MIR validator
5 // EMIT_MIR simplify_try_if_let.{impl#0}-append.SimplifyArmIdentity.diff
9 pub struct LinkedList {
10 head: Option<NonNull<Node>>,
11 tail: Option<NonNull<Node>>,
15 next: Option<NonNull<Node>>,
19 pub fn new() -> Self {
20 Self { head: None, tail: None }
23 pub fn append(&mut self, other: &mut Self) {
27 // `as_mut` is okay here because we have exclusive access to the entirety
29 if let Some(other_head) = other.head.take() {
31 tail.as_mut().next = Some(other_head);
40 let mut one = LinkedList::new();
41 let mut two = LinkedList::new();