summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-07-17 14:30:47 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-07-22 20:38:40 +0200
commit13d17adf6059552358c8601aaa407aea5ddddb98 (patch)
tree6ec369e7a5100a7a205b23a2d6e92a2a07d7ccc2 /src/librustc_data_structures
parent938552a2289d6018e78d9626f011d8eea59be7d9 (diff)
downloadrust-13d17adf6059552358c8601aaa407aea5ddddb98.tar.gz
rust-13d17adf6059552358c8601aaa407aea5ddddb98.zip
Use checked NonZero constructor in obligation forest NodeIndex
… to remove an `unsafe` block.
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/obligation_forest/node_index.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_data_structures/obligation_forest/node_index.rs b/src/librustc_data_structures/obligation_forest/node_index.rs
index 9fa6045146d..a72cc6b57ea 100644
--- a/src/librustc_data_structures/obligation_forest/node_index.rs
+++ b/src/librustc_data_structures/obligation_forest/node_index.rs
@@ -19,7 +19,7 @@ pub struct NodeIndex {
 impl NodeIndex {
     pub fn new(value: usize) -> NodeIndex {
         assert!(value < (u32::MAX as usize));
-        unsafe { NodeIndex { index: NonZero::new_unchecked((value as u32) + 1) } }
+        NodeIndex { index: NonZero::new((value as u32) + 1).unwrap() }
     }
 
     pub fn get(self) -> usize {