about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-30 08:55:07 +0000
committerbors <bors@rust-lang.org>2020-01-30 08:55:07 +0000
commitc4071d09197e22d2fab8334aa8d30659961bb977 (patch)
treeb11aad469f216934a900d150d258a3b40f1e5a41 /src/test
parent3024c4e7396106eacedd7eb94d7b681b3e82f78a (diff)
parent61fecfb82fe088af6d3a7832b72f298064398aff (diff)
Auto merge of #68325 - faern:move-numeric-consts-to-associated-consts-step1, r=LukasKalbertodt
Move numeric consts to associated consts step1

A subset of #67913. Implements the first step of RFC https://github.com/rust-lang/rfcs/pull/2700

This PR adds the new constants as unstable constants and defines the old ones in terms of the new ones. Then fix a tiny bit of code that started having naming collisions because of the new assoc consts.

Removed a test that did not seem relevant any longer. Since doing just `u8::MIN` should now indeed be valid.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/show-const-contents.rs6
-rw-r--r--src/test/ui/issues/issue-22933-3.rs4
-rw-r--r--src/test/ui/issues/issue-22933-3.stderr14
-rw-r--r--src/test/ui/use-module-level-int-consts.rs11
4 files changed, 14 insertions, 21 deletions
diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs
index e84f6e52c75..064c026e6a0 100644
--- a/src/test/rustdoc/show-const-contents.rs
+++ b/src/test/rustdoc/show-const-contents.rs
@@ -47,9 +47,9 @@ pub struct MyTypeWithStr(&'static str);
 // @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '; //'
 pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this");
 
-// @has show_const_contents/constant.EPSILON.html '1.1920929e-7f32;'
-// @!has show_const_contents/constant.EPSILON.html '; //'
-pub use std::f32::EPSILON;
+// @has show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;'
+// @has show_const_contents/constant.PI.html '; // 3.14159274f32'
+pub use std::f32::consts::PI;
 
 // @has show_const_contents/constant.MAX.html '= i32::max_value(); // 2_147_483_647i32'
 pub use std::i32::MAX;
diff --git a/src/test/ui/issues/issue-22933-3.rs b/src/test/ui/issues/issue-22933-3.rs
deleted file mode 100644
index fbcce4b8344..00000000000
--- a/src/test/ui/issues/issue-22933-3.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-const FOO: [u32; u8::MIN as usize] = [];
-//~^ ERROR no associated item named `MIN` found
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr
deleted file mode 100644
index 72bca3b0408..00000000000
--- a/src/test/ui/issues/issue-22933-3.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0599]: no associated item named `MIN` found for type `u8` in the current scope
-  --> $DIR/issue-22933-3.rs:1:22
-   |
-LL | const FOO: [u32; u8::MIN as usize] = [];
-   |                      ^^^ associated item not found in `u8`
-   |
-help: you are looking for the module in `std`, not the primitive type
-   |
-LL | const FOO: [u32; std::u8::MIN as usize] = [];
-   |                  ^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/use-module-level-int-consts.rs b/src/test/ui/use-module-level-int-consts.rs
new file mode 100644
index 00000000000..758fb414ead
--- /dev/null
+++ b/src/test/ui/use-module-level-int-consts.rs
@@ -0,0 +1,11 @@
+// run-pass
+
+// Make sure the module level constants are still there and accessible even after
+// the corresponding associated constants have been added, and later stabilized.
+use std::{u16, f32};
+
+fn main() {
+    let _ = u16::MAX;
+    let _ = f32::EPSILON;
+    let _ = std::f64::MANTISSA_DIGITS;
+}