From 799cadb2bd980d1bcdcc831c2d0e50ec3b27527b Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 11 Dec 2018 10:32:39 +0100 Subject: Remove unnecessary feature gates from const fns --- src/libstd/io/lazy.rs | 1 - src/libstd/lib.rs | 1 + src/libstd/sys/sgx/condvar.rs | 1 - src/libstd/sys/sgx/mutex.rs | 2 -- src/libstd/sys/sgx/rwlock.rs | 1 - src/libstd/sys/sgx/waitqueue.rs | 3 --- src/libstd/sys_common/condvar.rs | 1 - src/libstd/sys_common/mutex.rs | 1 - src/libstd/sys_common/rwlock.rs | 1 - 9 files changed, 1 insertion(+), 11 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs index c2aaeb98907..24965ff6931 100644 --- a/src/libstd/io/lazy.rs +++ b/src/libstd/io/lazy.rs @@ -26,7 +26,6 @@ const fn done() -> *mut Arc { 1_usize as *mut _ } unsafe impl Sync for Lazy {} impl Lazy { - #[unstable(feature = "sys_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> Lazy { Lazy { lock: Mutex::new(), diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 90c8eaf0f7c..1feb6f268fa 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -271,6 +271,7 @@ #![feature(libc)] #![feature(link_args)] #![feature(linkage)] +#![feature(min_const_unsafe_fn)] #![feature(needs_panic_runtime)] #![feature(never_type)] #![feature(nll)] diff --git a/src/libstd/sys/sgx/condvar.rs b/src/libstd/sys/sgx/condvar.rs index d3e8165f3df..940f50f25b8 100644 --- a/src/libstd/sys/sgx/condvar.rs +++ b/src/libstd/sys/sgx/condvar.rs @@ -18,7 +18,6 @@ pub struct Condvar { } impl Condvar { - #[unstable(feature = "sgx_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> Condvar { Condvar { inner: SpinMutex::new(WaitVariable::new(())) } } diff --git a/src/libstd/sys/sgx/mutex.rs b/src/libstd/sys/sgx/mutex.rs index 663361162bc..994cf91eea0 100644 --- a/src/libstd/sys/sgx/mutex.rs +++ b/src/libstd/sys/sgx/mutex.rs @@ -20,7 +20,6 @@ pub struct Mutex { // Implementation according to “Operating Systems: Three Easy Pieces”, chapter 28 impl Mutex { - #[unstable(feature = "sgx_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> Mutex { Mutex { inner: SpinMutex::new(WaitVariable::new(false)) } } @@ -79,7 +78,6 @@ pub struct ReentrantMutex { } impl ReentrantMutex { - #[unstable(feature = "sgx_internals", issue = "0")] // FIXME: min_const_fn pub const fn uninitialized() -> ReentrantMutex { ReentrantMutex { inner: SpinMutex::new(WaitVariable::new(ReentrantLock { owner: None, count: 0 })) diff --git a/src/libstd/sys/sgx/rwlock.rs b/src/libstd/sys/sgx/rwlock.rs index 7b6970b825f..a1551dbb53b 100644 --- a/src/libstd/sys/sgx/rwlock.rs +++ b/src/libstd/sys/sgx/rwlock.rs @@ -21,7 +21,6 @@ pub struct RWLock { //unsafe impl Sync for RWLock {} // FIXME impl RWLock { - #[unstable(feature = "sgx_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> RWLock { RWLock { readers: SpinMutex::new(WaitVariable::new(None)), diff --git a/src/libstd/sys/sgx/waitqueue.rs b/src/libstd/sys/sgx/waitqueue.rs index ec1135ba30c..ef0def13eee 100644 --- a/src/libstd/sys/sgx/waitqueue.rs +++ b/src/libstd/sys/sgx/waitqueue.rs @@ -50,7 +50,6 @@ pub struct WaitVariable { } impl WaitVariable { - #[unstable(feature = "sgx_internals", issue = "0")] // FIXME: min_const_fn pub const fn new(var: T) -> Self { WaitVariable { queue: WaitQueue::new(), @@ -137,7 +136,6 @@ impl<'a, T> Drop for WaitGuard<'a, T> { } impl WaitQueue { - #[unstable(feature = "sgx_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> Self { WaitQueue { inner: UnsafeList::new() @@ -255,7 +253,6 @@ mod unsafe_list { } impl UnsafeList { - #[unstable(feature = "sgx_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> Self { unsafe { UnsafeList { diff --git a/src/libstd/sys_common/condvar.rs b/src/libstd/sys_common/condvar.rs index 16bf0803a8d..b6f29dd5fc3 100644 --- a/src/libstd/sys_common/condvar.rs +++ b/src/libstd/sys_common/condvar.rs @@ -25,7 +25,6 @@ impl Condvar { /// /// Behavior is undefined if the condition variable is moved after it is /// first used with any of the functions below. - #[unstable(feature = "sys_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> Condvar { Condvar(imp::Condvar::new()) } /// Prepares the condition variable for use. diff --git a/src/libstd/sys_common/mutex.rs b/src/libstd/sys_common/mutex.rs index 87684237638..c6d531c7a1a 100644 --- a/src/libstd/sys_common/mutex.rs +++ b/src/libstd/sys_common/mutex.rs @@ -27,7 +27,6 @@ impl Mutex { /// Also, until `init` is called, behavior is undefined if this /// mutex is ever used reentrantly, i.e., `raw_lock` or `try_lock` /// are called by the thread currently holding the lock. - #[unstable(feature = "sys_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> Mutex { Mutex(imp::Mutex::new()) } /// Prepare the mutex for use. diff --git a/src/libstd/sys_common/rwlock.rs b/src/libstd/sys_common/rwlock.rs index a430c254d3c..71a4f01ec4c 100644 --- a/src/libstd/sys_common/rwlock.rs +++ b/src/libstd/sys_common/rwlock.rs @@ -22,7 +22,6 @@ impl RWLock { /// /// Behavior is undefined if the reader-writer lock is moved after it is /// first used with any of the functions below. - #[unstable(feature = "sys_internals", issue = "0")] // FIXME: min_const_fn pub const fn new() -> RWLock { RWLock(imp::RWLock::new()) } /// Acquires shared access to the underlying lock, blocking the current -- cgit 1.4.1-3-g733a5 From 134661917bf4b086b027a2c58219d50ba57a1453 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 11 Dec 2018 10:33:17 +0100 Subject: Remove some dead code from `sgx` --- src/libstd/sys/sgx/abi/mem.rs | 7 ------- src/libstd/sys/sgx/abi/usercalls/mod.rs | 8 -------- 2 files changed, 15 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/sgx/abi/mem.rs b/src/libstd/sys/sgx/abi/mem.rs index 508f2ff4d4f..bf32c712216 100644 --- a/src/libstd/sys/sgx/abi/mem.rs +++ b/src/libstd/sys/sgx/abi/mem.rs @@ -34,13 +34,6 @@ fn image_base() -> u64 { base } -pub fn is_enclave_range(p: *const u8, len: usize) -> bool { - let start=p as u64; - let end=start + (len as u64); - start >= image_base() && - end <= image_base() + (unsafe { ENCLAVE_SIZE } as u64) // unsafe ok: link-time constant -} - pub fn is_user_range(p: *const u8, len: usize) -> bool { let start=p as u64; let end=start + (len as u64); diff --git a/src/libstd/sys/sgx/abi/usercalls/mod.rs b/src/libstd/sys/sgx/abi/usercalls/mod.rs index 2bc32c9fefb..d1d180e4825 100644 --- a/src/libstd/sys/sgx/abi/usercalls/mod.rs +++ b/src/libstd/sys/sgx/abi/usercalls/mod.rs @@ -33,14 +33,6 @@ pub fn read(fd: Fd, buf: &mut [u8]) -> IoResult { } } -pub fn read_alloc(fd: Fd) -> IoResult> { - unsafe { - let mut userbuf = alloc::User::::uninitialized(); - raw::read_alloc(fd, userbuf.as_raw_mut_ptr()).from_sgx_result()?; - Ok(copy_user_buffer(&userbuf)) - } -} - pub fn write(fd: Fd, buf: &[u8]) -> IoResult { unsafe { let userbuf = alloc::User::new_from_enclave(buf); -- cgit 1.4.1-3-g733a5 From 5457b19fe9ecc936129755005de439d44e27a4ec Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 11 Dec 2018 10:43:40 +0100 Subject: Properly stage new feature gates --- src/libstd/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 1feb6f268fa..a69ec76376a 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -271,7 +271,7 @@ #![feature(libc)] #![feature(link_args)] #![feature(linkage)] -#![feature(min_const_unsafe_fn)] +#![cfg_attr(not(stage0), feature(min_const_unsafe_fn))] #![feature(needs_panic_runtime)] #![feature(never_type)] #![feature(nll)] -- cgit 1.4.1-3-g733a5 From 6057147fde962f2369c61f8dbf74dd2b1b2ce239 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Wed, 12 Dec 2018 14:20:49 +0000 Subject: Update panic message to be clearer about env-vars Esteban Kuber requested that the panic message make it clear that `RUST_BACKTRACE=1` is an environment variable. This change makes that clear. Wording provided in part by David Tolnay. --- src/libstd/panicking.rs | 3 ++- src/test/run-make-fulldeps/libtest-json/output.json | 2 +- src/test/run-pass/multi-panic.rs | 3 ++- src/test/rustdoc-ui/failed-doctest-output.stdout | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 6b47ba6d1cb..b6180fbeb50 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -209,7 +209,8 @@ fn default_hook(info: &PanicInfo) { if let Some(format) = log_backtrace { let _ = backtrace::print(err, format); } else if FIRST_PANIC.compare_and_swap(true, false, Ordering::SeqCst) { - let _ = writeln!(err, "note: Run with `RUST_BACKTRACE=1` for a backtrace."); + let _ = writeln!(err, "note: Run with `RUST_BACKTRACE=1` \ + environment variable to display a backtrace."); } } }; diff --git a/src/test/run-make-fulldeps/libtest-json/output.json b/src/test/run-make-fulldeps/libtest-json/output.json index 80e75c89bfc..2b831ea2bdc 100644 --- a/src/test/run-make-fulldeps/libtest-json/output.json +++ b/src/test/run-make-fulldeps/libtest-json/output.json @@ -2,7 +2,7 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:18:5\nnote: Run with `RUST_BACKTRACE=1` for a backtrace.\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:18:5\nnote: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.\n" } { "type": "test", "event": "started", "name": "c" } { "type": "test", "name": "c", "event": "ok" } { "type": "test", "event": "started", "name": "d" } diff --git a/src/test/run-pass/multi-panic.rs b/src/test/run-pass/multi-panic.rs index 2e6e10935fa..03e58fc2387 100644 --- a/src/test/run-pass/multi-panic.rs +++ b/src/test/run-pass/multi-panic.rs @@ -17,7 +17,8 @@ fn check_for_no_backtrace(test: std::process::Output) { let mut it = err.lines(); assert_eq!(it.next().map(|l| l.starts_with("thread '' panicked at")), Some(true)); - assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` for a backtrace.")); + assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` \ + environment variable to display a backtrace.")); assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true)); assert_eq!(it.next(), None); } diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index cd19099647c..bd6fa1f84b4 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -13,13 +13,13 @@ error[E0425]: cannot find value `no` in this scope | ^^ not found in this scope thread '$DIR/failed-doctest-output.rs - OtherStruct (line 27)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:326:13 -note: Run with `RUST_BACKTRACE=1` for a backtrace. +note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ---- $DIR/failed-doctest-output.rs - SomeStruct (line 21) stdout ---- thread '$DIR/failed-doctest-output.rs - SomeStruct (line 21)' panicked at 'test executable failed: thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1 -note: Run with `RUST_BACKTRACE=1` for a backtrace. +note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ', src/librustdoc/test.rs:361:17 -- cgit 1.4.1-3-g733a5