Commit Graph

714 Commits

Author SHA1 Message Date
Mark Simulacrum ad97f8b491 Bootstrap from 1.28.0-beta.3 2018-06-30 13:17:49 -07:00
Taylor Cramer ee51a3c10a Review nits and updates
Move future_from_generator out of raw
Update await to use $crate
Renumber errors
2018-06-22 11:36:01 -07:00
Taylor Cramer cf844b547d async await desugaring and tests 2018-06-21 22:36:36 -07:00
Guillaume Gomez 1dd1f95af8 Add doc for fn keyword 2018-06-15 23:23:11 +02:00
bors 4367e41ea2 Auto merge of #51241 - glandium:globalalloc, r=sfackler,SimonSapin
Stabilize GlobalAlloc and #[global_allocator]

This PR implements the changes discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-393263510

Fixes #49668
Fixes #27389

This does not change the default global allocator: #36963
2018-06-12 00:36:21 +00:00
Simon Sapin fd6e08a1e6 Remove some '#[feature]' attributes for stabilized features 2018-06-11 13:48:57 -07:00
Simon Sapin 8c30c51686 Remove deprecated heap modules
The heap.rs file was already unused.
2018-06-11 13:47:27 -07:00
bors 1d4dbf488a Auto merge of #51442 - tinaun:more-future-impls, r=cramertj
[futures] add a few blanket impls to std

these were defined in the futures crate, but with the core definitions moving to std these would need to move too.
2018-06-11 20:14:39 +00:00
CrLF0710 02c96d4733
Add #[doc(inline)] in std::task
Add #[doc(inline)] in `std::task` to make the doc seem right.
2018-06-11 03:09:30 +08:00
tinaun 6e5c18e8dc add a few blanket future impls to std 2018-06-08 17:56:59 -04:00
bors 19d0b539aa Auto merge of #51263 - cramertj:futures-in-core, r=aturon
Add Future and task system to the standard library

This adds preliminary versions of the `std::future` and `std::task` modules in order to unblock development of async/await (https://github.com/rust-lang/rust/issues/50547). These shouldn't be considered as final forms of these libraries-- design questions about the libraries should be left on https://github.com/rust-lang/rfcs/pull/2418. Once that RFC (or a successor) is merged, these APIs will be adjusted as necessary.

r? @aturon
2018-06-06 19:42:19 +00:00
Taylor Cramer a6055c8859 Add Future and task system to the standard library 2018-06-06 10:41:52 -07:00
Guillaume Gomez ded5c5a9ee Put doc keyword behind feature flag 2018-06-04 09:52:31 +02:00
Jorge Aparicio e44ad61a2d implement #[panic_implementation] 2018-06-03 13:46:19 +02:00
Mark Simulacrum 9e3432447a Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
Simon Sapin 89d9ca9b50 Stabilize num::NonZeroU*
Tracking issue: https://github.com/rust-lang/rust/issues/49137
2018-05-16 19:11:31 +02:00
kennytm 02f6a0335f
Some final touches to ensure `./x.py test --stage 0 src/lib*` works 2018-05-06 02:34:07 +08:00
Vadim Petrochenkov 730c7222ee Fix an error from "unused" lint + Fix rebase 2018-05-01 17:02:18 +03:00
Vadim Petrochenkov 300b6bb417 Remove `macro_reexport`
It's subsumed by `feature(use_extern_macros)` and `pub use`
2018-05-01 15:58:42 +03:00
kennytm f28f5aa0b2
Rollup merge of #49906 - kennytm:stable-unreachable, r=sfackler
Stabilize `std::hint::unreachable_unchecked`.

Closes #43751.
2018-04-24 11:57:04 +08:00
Steven Fackler e513c1bd31 Replace GlobalAlloc::oom with a lang item 2018-04-22 10:08:17 -07:00
bors bbdd1cf744 Auto merge of #49757 - GuillaumeGomez:never-search, r=QuietMisdreavus
Add specific never search

Fixes #49529.

r? @QuietMisdreavus
2018-04-22 02:18:41 +00:00
bors d5616e1f18 Auto merge of #49896 - SimonSapin:inherent, r=alexcrichton
Add inherent methods in libcore for [T], [u8], str, f32, and f64

# Background

Primitive types are defined by the language, they don’t have a type definition like `pub struct Foo { … }` in any crate. So they don’t “belong” to any crate as far as `impl` coherence is concerned, and on principle no crate would be able to define inherent methods for them, without a trait. Since we want these types to have inherent methods anyway, the standard library (with cooperation from the compiler) bends this rule with code like [`#[lang = "u8"] impl u8 { /*…*/ }`](https://github.com/rust-lang/rust/blob/1.25.0/src/libcore/num/mod.rs#L2244-L2245). The `#[lang]` attribute is permanently-unstable and never intended to be used outside of the standard library.

Each lang item can only be defined once. Before this PR there is one impl-coherence-rule-bending lang item per primitive type (plus one for `[u8]`, which overlaps with `[T]`). And so one `impl` block each. These blocks for `str`, `[T]` and `[u8]` are in liballoc rather than libcore because *some* of the methods (like `<[T]>::to_vec(&self) -> Vec<T> where T: Clone`) need a global memory allocator which we don’t want to make a requirement in libcore. Similarly, `impl f32` and `impl f64` are in libstd because some of the methods are based on FFI calls to C’s `libm` and we want, as much as possible, libcore not to require “runtime support”.

In libcore, the methods of `str` and `[T]` that don’t allocate are made available through two **unstable traits** `StrExt` and `SliceExt` (so the traits can’t be *named* by programs on the Stable release channel) that have **stable methods** and are re-exported in the libcore prelude (so that programs on Stable can *call* these methods anyway). Non-allocating `[u8]` methods are not available in libcore: https://github.com/rust-lang/rust/issues/45803. Some `f32` and `f64` methods are in an unstable `core::num::Float` trait with stable methods, but that one is **not in the libcore prelude**. (So as far as Stable programs are concerns it doesn’t exist, and I don’t know what the point was to mark these methods `#[stable]`.)

https://github.com/rust-lang/rust/issues/32110 is the tracking issue for these unstable traits.

# High-level proposal

Since the standard library is already bending the rules, why not bend them *a little more*? By defining a few additional lang items, the compiler can allow the standard library to have *two* `impl` blocks (in different crates) for some primitive types.

The `StrExt` and `SliceExt` traits still exist for now so that we can bootstrap from a previous-version compiler that doesn’t have these lang items yet, but they can be removed in next release cycle. (`Float` is used internally and needs to be public for libcore unit tests, but was already `#[doc(hidden)]`.) I don’t know if https://github.com/rust-lang/rust/issues/32110 should be closed by this PR, or only when the traits are entirely removed after we make a new bootstrap compiler.

# Float methods

Among the methods of the `core::num::Float` trait, three are based on LLVM intrinsics: `abs`, `signum`, and `powi`. PR https://github.com/rust-lang/rust/pull/27823 “Remove dependencies on libm functions from libcore” moved a bunch of `core::num::Float` methods back to libstd, but left these three behind. However they aren’t specifically discussed in the PR thread. The `compiler_builtins` crate defines `__powisf2` and `__powidf2` functions that look like implementations of `powi`, but I couldn’t find a connection with the `llvm.powi.f32` and `llvm.powi.f32` intrinsics by grepping through LLVM’s code.

In discussion starting at https://github.com/rust-lang/rust/issues/32110#issuecomment-370647922 Alex says that we do not want methods in libcore that require “runtime support”, but it’s not clear whether that applies to these `abs`, `signum`, or `powi`. In doubt, I’ve **removed** them for the trait and moved them to inherent methods in libstd for now. We can move them back later (or in this PR) if we decide that’s appropriate.

# Change details

For users on the Stable release channel:

* I believe this PR does not make any breaking change
* Some methods for `[u8]`, `f32`, and `f64` are newly available to `#![no_std]` users (fixes https://github.com/rust-lang/rust/issues/45803)
* There should be no visible change for `std` users in terms of what programs compile or what their behavior is. (Only in compiler error messages, possibly.)

For Nightly users, additionally:

* The unstable `StrExt` and `SliceExt` traits are gone
* Their methods are now inherent methods of `str` and `[T]` (so only code that explicitly named the traits should be affected, not "normal" method calls)
* The `abs`, `signum` and `powi` methods of the `Float` trait are gone
* The `Float` trait’s unstable feature name changed to `float_internals` with no associated tracking issue, to reflect it being a permanently unstable implementation detail rather than a public API on a path to stabilization.
* Its remaining methods are now inherent methods of `f32` and `f64`.

-----

CC @rust-lang/libs for the API changes, @rust-lang/compiler for the new lang items
2018-04-22 00:01:29 +00:00
Guillaume Gomez 57bcabc108 Generate alias file 2018-04-21 22:02:53 +02:00
Simon Sapin 70fdd1b5c0 Make the unstable StrExt and SliceExt traits private to libcore in not(stage0)
`Float` still needs to be public for libcore unit tests.
2018-04-21 09:47:38 +02:00
Felix S. Klock II d141fdc3bf Revert "Stabilize the TryFrom and TryInto traits"
This reverts commit e53a2a7274.
2018-04-20 18:10:00 +02:00
Felix S. Klock II fadabd6fbb Revert stabilization of `feature(never_type)`.
This commit is just covering the feature gate itself and the tests
that made direct use of `!` and thus need to opt back into the
feature.

A follow on commit brings back the other change that motivates the
revert: Namely, going back to the old rules for falling back to `()`.
2018-04-20 18:09:28 +02:00
bors ac3c2288f9 Auto merge of #50017 - tinaun:stabilize-all-the-things, r=sfackler
stabilize a bunch of minor api additions

besides `ptr::NonNull::cast` (which is 4 days away from end of FCP) all of these have been finished with FCP for a few weeks now with minimal issues raised

* Closes #41020
* Closes #42818
* Closes #44030
* Closes #44400
* Closes #46507
* Closes #47653
* Closes #46344

the following functions will be stabilized in 1.27:
* `[T]::rsplit`
* `[T]::rsplit_mut`
* `[T]::swap_with_slice`
* `ptr::swap_nonoverlapping`
* `NonNull::cast`
* `Duration::from_micros`
* `Duration::from_nanos`
* `Duration::subsec_millis`
* `Duration::subsec_micros`
* `HashMap::remove_entry`
2018-04-18 19:47:56 +00:00
bors 8728c7a726 Auto merge of #49542 - GuillaumeGomez:intra-link-resolution-error, r=GuillaumeGomez
Add warning if a resolution failed

r? @QuietMisdreavus
2018-04-17 09:02:03 +00:00
tinaun b84baf2378 stabilize `nonnull_cast` feature 2018-04-17 01:22:28 -04:00
bors 186db76159 Auto merge of #49664 - alexcrichton:stable-simd, r=BurntSushi
Stabilize x86/x86_64 SIMD

This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably
this commit is stabilizing:

* The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside.
* The `is_x86_feature_detected!` macro in the standard library
* The `#[target_feature(enable = "...")]` attribute
* The `#[cfg(target_feature = "...")]` matcher

Stabilization of the module and intrinsics were primarily done in
rust-lang-nursery/stdsimd#414 and the two attribute stabilizations are done in
this commit. The standard library is also tweaked a bit with the new way that
stdsimd is integrated.

Note that other architectures like `std::arch::arm` are not stabilized as part
of this commit, they will likely stabilize in the future after they've been
implemented and fleshed out. Similarly the `std::simd` module is also not being
stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64`
is stabilized in this commit either (MMX), only SSE and up types and intrinsics
are stabilized.

Closes #29717
Closes #44839
Closes #48556
2018-04-17 03:57:22 +00:00
Guillaume Gomez b2192ae157 Add rustdoc-ui test suite 2018-04-16 23:37:11 +02:00
Alex Crichton 598d836fff Stabilize x86/x86_64 SIMD
This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably
this commit is stabilizing:

* The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside.
* The `is_x86_feature_detected!` macro in the standard library
* The `#[target_feature(enable = "...")]` attribute
* The `#[cfg(target_feature = "...")]` matcher

Stabilization of the module and intrinsics were primarily done in
rust-lang-nursery/stdsimd#414 and the two attribute stabilizations are done in
this commit. The standard library is also tweaked a bit with the new way that
stdsimd is integrated.

Note that other architectures like `std::arch::arm` are not stabilized as part
of this commit, they will likely stabilize in the future after they've been
implemented and fleshed out. Similarly the `std::simd` module is also not being
stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64`
is stabilized in this commit either (MMX), only SSE and up types and intrinsics
are stabilized.

Closes #29717
Closes #44839
Closes #48556
2018-04-16 07:25:10 -07:00
kennytm 5fe8c59f12
Stabilize core::hint::unreachable_unchecked.
Closes #43751.
2018-04-16 18:29:40 +08:00
Alex Crichton c3a5d6b130 std: Minimize size of panicking on wasm
This commit applies a few code size optimizations for the wasm target to
the standard library, namely around panics. We notably know that in most
configurations it's impossible for us to print anything in
wasm32-unknown-unknown so we can skip larger portions of panicking that
are otherwise simply informative. This allows us to get quite a nice
size reduction.

Finally we can also tweak where the allocation happens for the
`Box<Any>` that we panic with. By only allocating once unwinding starts
we can reduce the size of a panicking wasm module from 44k to 350 bytes.
2018-04-13 07:03:00 -07:00
Mike Hommey fddf51ee0b Use NonNull<Void> instead of *mut u8 in the Alloc trait
Fixes #49608
2018-04-12 22:53:22 +02:00
Simon Sapin 743c29bdc5 Actually deprecate heap modules. 2018-04-12 22:52:47 +02:00
Simon Sapin 09e8db1e4f Rename `heap` modules in the core, alloc, and std crates to `alloc` 2018-04-12 22:52:47 +02:00
Simon Sapin 1b895d8b88 Import the `alloc` crate as `alloc_crate` in std
… to make the name `alloc` available.
2018-04-12 22:52:47 +02:00
Simon Sapin ef41788cf3 Mark the rest of the `unicode` feature flag as perma-unstable. 2018-04-12 00:13:53 +02:00
Simon Sapin 939692409d Reexport from core::unicode::char in core::char rather than vice versa 2018-04-12 00:13:52 +02:00
Simon Sapin b2027ef17c Deprecate the std_unicode crate 2018-04-12 00:13:51 +02:00
Mark Simulacrum c115cc655c Move deny(warnings) into rustbuild
This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
2018-04-08 16:59:14 -06:00
bors 8c2d7b2da3 Auto merge of #49661 - alexcrichton:bump-bootstrap, r=nikomatsakis
Bump the bootstrap compiler to 1.26.0 beta

Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language
features!
2018-04-07 11:58:38 +00:00
Oliver Schneider 679657b863
Inject the `compiler_builtins` crate whenever the `core` crate is injected 2018-04-07 09:24:35 +02:00
Alex Crichton 71bf15c6e8 Rollup merge of #49686 - memoryleak47:typo, r=alexcrichton
typos
2018-04-05 11:18:17 -07:00
Alex Crichton 8958815916 Bump the bootstrap compiler to 1.26.0 beta
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language
features!
2018-04-05 07:13:45 -07:00
memoryleak47 64ddb390ef typos 2018-04-05 13:04:00 +02:00
Vadim Petrochenkov 1a2a23447e Stabilize attributes on generic parameters 2018-04-05 02:19:56 +03:00
Aidan Hobson Sayers 9b5859aea1 Remove all unstable placement features
Closes #22181, #27779
2018-04-03 11:02:34 +02:00