about summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-29 19:38:12 +0000
committerbors <bors@rust-lang.org>2018-09-29 19:38:12 +0000
commitbb0896af11bb6b79051d4b794c70f78cd45d080f (patch)
treeff0704a8ea6fb34f4a7aef0d122e0aac27edad19 /src/libcore/tests
parenteb50e75729bce449272ffb3bfbca2f7234f2ae13 (diff)
parent95c1d817ae6ec50d3c636c54e33b4d51cab57148 (diff)
downloadrust-bb0896af11bb6b79051d4b794c70f78cd45d080f.tar.gz
rust-bb0896af11bb6b79051d4b794c70f78cd45d080f.zip
Auto merge of #54240 - csmoe:nonzero_from, r=alexcrichton
Impl From<NonZero<T>> for T

Closes https://github.com/rust-lang/rust/issues/54171

r? @SimonSapin
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/nonzero.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/tests/nonzero.rs b/src/libcore/tests/nonzero.rs
index 8d39298bac3..bbb1ef76bcc 100644
--- a/src/libcore/tests/nonzero.rs
+++ b/src/libcore/tests/nonzero.rs
@@ -121,3 +121,10 @@ fn test_match_nonzero_const_pattern() {
         _ => panic!("Expected the const item as a pattern to match.")
     }
 }
+
+#[test]
+fn test_from_nonzero() {
+    let nz = NonZeroU32::new(1).unwrap();
+    let num: u32 = nz.into();
+    assert_eq!(num, 1u32);
+}