about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-16 17:02:17 +0000
committerbors <bors@rust-lang.org>2017-09-16 17:02:17 +0000
commitae8efdc87d5f4e22e05e1b60a72272cee87fa74c (patch)
treefc7932f915f347bd68db4143b2e097e620faa538 /src/test/ui
parentb965d55a3214b78ec9ffdd3017cb6aaa62c28059 (diff)
parent332c38cd70e372f56356e02b18b88919fcb58a66 (diff)
downloadrust-ae8efdc87d5f4e22e05e1b60a72272cee87fa74c.tar.gz
rust-ae8efdc87d5f4e22e05e1b60a72272cee87fa74c.zip
Auto merge of #43017 - durka:stabilize-const-invocation, r=eddyb
Individualize feature gates for const fn invocation

This PR changes the meaning of `#![feature(const_fn)]` so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward.

This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review.

- `std::cell`
    - `Cell::new`
    - `RefCell::new`
    - `UnsafeCell::new`
- `std::mem`
    - `size_of`
    - `align_of`
- `std::ptr`
    - `null`
    - `null_mut`
- `std::sync`
    - `atomic`
        - `Atomic{Bool,Ptr,Isize,Usize}::new`
    - `once`
        - `Once::new`
- primitives
    - `{integer}::min_value`
    - `{integer}::max_value`

Some other functions are const but they are also unstable or hidden, e.g. `Unique::new` so they don't have to be considered at this time.

After this stabilization, the following `*_INIT` constants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR.

- `std::sync`
    - `atomic`
        - `ATOMIC_{BOOL,ISIZE,USIZE}_INIT`
    - `once`
        - `ONCE_INIT`
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/span/dropck_arr_cycle_checked.rs2
-rw-r--r--src/test/ui/span/dropck_vec_cycle_checked.rs2
-rw-r--r--src/test/ui/span/vec-must-not-hide-type-from-dropck.rs2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/test/ui/span/dropck_arr_cycle_checked.rs b/src/test/ui/span/dropck_arr_cycle_checked.rs
index 8e8b3c24c76..995a198271c 100644
--- a/src/test/ui/span/dropck_arr_cycle_checked.rs
+++ b/src/test/ui/span/dropck_arr_cycle_checked.rs
@@ -13,7 +13,7 @@
 //
 // (Compare against compile-fail/dropck_vec_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs
index 65db2a56b7d..5bcaa71f73c 100644
--- a/src/test/ui/span/dropck_vec_cycle_checked.rs
+++ b/src/test/ui/span/dropck_vec_cycle_checked.rs
@@ -12,7 +12,7 @@
 //
 // (Compare against compile-fail/dropck_arr_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs
index 310ab20489a..d99f3bb19db 100644
--- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs
+++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs
@@ -23,7 +23,7 @@
 // conditions above to be satisfied, meaning that if the dropck is
 // sound, it should reject this code.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;