Stabilize const-calling existing const-fns in std

Fixes #46038
This commit is contained in:
Simon Sapin 2017-11-26 23:19:18 +01:00
parent 827cb0d61e
commit 6c5f53e65e
45 changed files with 8 additions and 164 deletions

View file

@ -1,24 +0,0 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test use of const fns in std using individual feature gates.
use std::cell::Cell;
const CELL: Cell<i32> = Cell::new(42); //~ERROR not yet stable as a const fn
//~^HELP #![feature(const_cell_new)]
fn main() {
let v = CELL.get();
CELL.set(v+1);
assert_eq!(CELL.get(), v);
}

View file

@ -13,8 +13,6 @@
//
// (Compare against compile-fail/dropck_vec_cycle_checked.rs)
#![feature(const_atomic_usize_new)]
use std::cell::Cell;
use id::Id;

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(const_unsafe_cell_new)]
use std::cell::UnsafeCell;
const A: UnsafeCell<usize> = UnsafeCell::new(1);

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(const_fn, const_cell_new, const_unsafe_cell_new)]
#![feature(const_fn)]
#![feature(cfg_target_thread_local, thread_local_internals)]
// On platforms *without* `#[thread_local]`, use

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax, const_refcell_new)]
#![feature(box_syntax)]
use std::cell::RefCell;