diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index e776513770ec6..97bf582df5a8c 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -77,7 +77,7 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
                 /// Returns the value as a primitive type.
                 #[stable(feature = "nonzero", since = "1.28.0")]
                 #[inline]
-                pub fn get(self) -> $Int {
+                pub const fn get(self) -> $Int {
                     self.0
                 }
 
diff --git a/src/test/ui/consts/const-nonzero.rs b/src/test/ui/consts/const-nonzero.rs
new file mode 100644
index 0000000000000..c06ab227f6463
--- /dev/null
+++ b/src/test/ui/consts/const-nonzero.rs
@@ -0,0 +1,9 @@
+// compile-pass
+
+use std::num::NonZeroU8;
+
+const X: NonZeroU8 = unsafe { NonZeroU8::new_unchecked(5) };
+const Y: u8 = X.get();
+
+fn main() {
+}