about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-11-26 15:01:40 +0800
committerGitHub <noreply@github.com>2017-11-26 15:01:40 +0800
commit0d664f9d805fa3faa059c792be4ecd47fb4cd1ad (patch)
treeed387effec516be98810544a2a1a41b1f900301c /src
parent1aa4dd028d93514c76a557915779381966f15220 (diff)
parent4e4f8ab712fa80c07b1042b6cfa09b689ed23d56 (diff)
downloadrust-0d664f9d805fa3faa059c792be4ecd47fb4cd1ad.tar.gz
rust-0d664f9d805fa3faa059c792be4ecd47fb4cd1ad.zip
Rollup merge of #46269 - udoprog:check-links, r=KodrAus
Check tail node in check_links
Diffstat (limited to 'src')
-rw-r--r--src/liballoc/linked_list.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/liballoc/linked_list.rs b/src/liballoc/linked_list.rs
index fac6acaca61..99ad424cc20 100644
--- a/src/liballoc/linked_list.rs
+++ b/src/liballoc/linked_list.rs
@@ -1288,6 +1288,8 @@ mod tests {
             let mut node_ptr: &Node<T>;
             match list.head {
                 None => {
+                    // tail node should also be None.
+                    assert!(list.tail.is_none());
                     assert_eq!(0, list.len);
                     return;
                 }
@@ -1314,6 +1316,11 @@ mod tests {
                     }
                 }
             }
+
+            // verify that the tail node points to the last node.
+            let tail = list.tail.as_ref().expect("some tail node").as_ref();
+            assert_eq!(tail as *const Node<T>, node_ptr as *const Node<T>);
+            // check that len matches interior links.
             assert_eq!(len, list.len);
         }
     }