Rollup merge of #46287 - SimonSapin:stable-constness, r=aturon

Stabilize const-calling existing const-fns in std

Fixes #46038
This commit is contained in:
kennytm 2017-11-29 18:37:47 +08:00 committed by GitHub
commit 0e78c29bea
45 changed files with 8 additions and 164 deletions

View file

@ -17,7 +17,6 @@
// for the error message we see here.)
#![feature(rustc_private)]
#![feature(const_atomic_usize_new)]
extern crate arena;

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;

View file

@ -15,7 +15,6 @@
#![allow(dead_code, unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
#![feature(const_unsafe_cell_new)]
#![feature(static_mutex)]
// This test makes sure that the compiler doesn't crash when trying to assign

View file

@ -12,7 +12,6 @@
#![feature(rustc_private)]
#![feature(sort_unstable)]
#![feature(const_atomic_usize_new)]
extern crate rand;

View file

@ -11,7 +11,6 @@
// no-prefer-dynamic
#![allow(dead_code)]
#![feature(const_atomic_usize_new)]
// check dtor calling order when casting enums.

View file

@ -12,8 +12,6 @@
// `Item` originates in a where-clause, not the declaration of
// `T`. Issue #20300.
#![feature(const_atomic_usize_new)]
use std::marker::{PhantomData};
use std::sync::atomic::{AtomicUsize};
use std::sync::atomic::Ordering::SeqCst;

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(const_atomic_usize_new)]
use std::sync::atomic;
pub const C1: usize = 1;

View file

@ -9,7 +9,6 @@
// except according to those terms.
#![feature(cfg_target_thread_local, const_fn, thread_local)]
#![feature(const_cell_new)]
#![crate_type = "lib"]
#[cfg(target_thread_local)]

View file

@ -13,8 +13,6 @@
// ignore-emscripten no threads support
#![feature(const_atomic_usize_new)]
use std::thread;
use std::sync::atomic::{AtomicUsize, Ordering};

View file

@ -13,8 +13,6 @@
// ignore-emscripten no threads support
#![feature(const_atomic_usize_new)]
use std::thread;
use std::sync::atomic::{AtomicUsize, Ordering};

View file

@ -8,9 +8,7 @@
// 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.
#![feature(const_cell_new)]
// Test use of stabilized const fns in std formerly using individual feature gates.
use std::cell::Cell;

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_size_of, const_align_of)]
#![feature(const_fn)]
use std::mem;

View file

@ -10,9 +10,6 @@
// pretty-expanded FIXME #23616
#![feature(core)]
#![feature(const_unsafe_cell_new)]
use std::marker;
use std::cell::UnsafeCell;

View file

@ -10,10 +10,6 @@
// aux-build:issue-17718-aux.rs
#![feature(core)]
#![feature(const_atomic_usize_new)]
extern crate issue_17718_aux as other;
use std::sync::atomic::{AtomicUsize, Ordering};

View file

@ -12,8 +12,6 @@
// created via FRU and control-flow breaks in the middle of
// construction.
#![feature(const_atomic_usize_new)]
use std::sync::atomic::{Ordering, AtomicUsize};
#[derive(Debug)]

View file

@ -12,8 +12,6 @@
// Check that the destructors of simple enums are run on unwinding
#![feature(const_atomic_usize_new)]
use std::sync::atomic::{Ordering, AtomicUsize};
use std::thread;

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(const_atomic_usize_new)]
use std::sync::atomic::{Ordering, AtomicUsize};
use std::mem;

View file

@ -14,8 +14,6 @@
// the contents implement Drop and we hit a panic in the middle of
// construction.
#![feature(const_atomic_usize_new)]
use std::thread;
use std::sync::atomic::{AtomicUsize, Ordering};

View file

@ -11,7 +11,6 @@
// ignore-emscripten no threads support
#![feature(panic_handler, std_panic)]
#![feature(const_atomic_usize_new)]
use std::sync::atomic::{AtomicUsize, Ordering};
use std::panic;

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(panic_handler, std_panic)]
#![feature(const_atomic_usize_new)]
// ignore-emscripten no threads support

View file

@ -11,8 +11,6 @@
// Checks that functional-record-update order-of-eval is as expected
// even when no Drop-implementations are involved.
#![feature(const_atomic_usize_new)]
use std::sync::atomic::{Ordering, AtomicUsize};
struct W { wrapped: u32 }

View file

@ -11,8 +11,6 @@
// Checks that struct-literal expression order-of-eval is as expected
// even when no Drop-implementations are involved.
#![feature(const_atomic_usize_new)]
use std::sync::atomic::{Ordering, AtomicUsize};
struct W { wrapped: u32 }

View file

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

View file

@ -12,7 +12,7 @@
//
// (Compare against compile-fail/dropck_arr_cycle_checked.rs)
#![feature(const_atomic_usize_new)]
use std::cell::Cell;
use id::Id;

View file

@ -23,7 +23,7 @@
// conditions above to be satisfied, meaning that if the dropck is
// sound, it should reject this code.
#![feature(const_atomic_usize_new)]
use std::cell::Cell;
use id::Id;