Commit Graph

841 Commits

Author SHA1 Message Date
Vardhan Thigle 4166a4e5d0 Supporting backtrace for x86_64-fortanix-unknown-sgx. 2019-01-08 22:10:55 +05:30
Pietro Albini bc38143ad2
Rollup merge of #57375 - stjepang:duration-constants, r=joshtriplett
Add duration constants

Add constants `SECOND`, `MILLISECOND`, `MICROSECOND`, and `NANOSECOND` to `core::time`.

This will make working with durations more ergonomic. Compare:

```rust
// Convenient, but deprecated function.
thread::sleep_ms(2000);

// The current canonical way to sleep for two seconds.
thread::sleep(Duration::from_secs(2));

// Sleeping using one of the new constants.
thread::sleep(2 * SECOND);
```
2019-01-07 16:25:40 +01:00
Stjepan Glavina 72ec5aa080 Re-export constants from core into std 2019-01-06 14:04:07 +01:00
Yu Ding a3128116d2 Remove min_const_unsafe_fn since it is stable
Signed-off-by: Yu Ding <dingelish@gmail.com>
2019-01-01 11:49:54 -08:00
Yu Ding d04f5208ba Bound sgx target_env with fortanix as target_vendor
Signed-off-by: Yu Ding <dingelish@gmail.com>
2018-12-31 16:32:56 -08:00
Mazdak Farrokhzad 14be8a7f14 const-stabilize Ipv4Addr::new 2018-12-31 16:36:39 +01:00
Mazdak Farrokhzad 2760f87e3a const-stabilize const_int_ops + reverse_bits 2018-12-31 16:11:03 +01:00
Jacob Kiesel eed140792d
Update std/lib.rs docs to reflect Rust 2018 usage 2018-12-28 14:15:55 -07:00
varkor 04c1a92fa0 Fix warning when compiling rustc 2018-12-28 19:28:57 +00:00
bors d2986970ad Auto merge of #57119 - jethrogb:jb/sgx-os-mod2, r=joshtriplett
Add `io` and `arch` modules to `std::os::fortanix_sgx`

This PR adds two more (unstable) modules to `std::os::fortanix_sgx` for the `x86_64-fortanix-unknown-sgx` target.

### io
`io` allows conversion between raw file descriptors and Rust types, similar to `std::os::unix::io`.

### arch
`arch` exposes the `ENCLU[EREPORT]` and `ENCLU[EGETKEY]` instructions. The current functions are very likely not going to be the final form of these functions (see also https://github.com/fortanix/rust-sgx/issues/15), but this should be sufficient to enable experimentation in libraries. I tried using the actual types (from the [`sgx-isa` crate](https://crates.io/crates/sgx-isa)) instead of byte arrays, but that would make `std` dependent on the `bitflags` crate which I didn't want to do at this time.
2018-12-27 09:21:06 +00:00
Sunjay Varma 1e82618613 Stabilize duration_as_u128 2018-12-26 12:12:06 -07:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Jethro Beekman 505167d7c5 Fix build on latest git master 2018-12-25 13:10:16 +05:30
Alex Crichton 8d500572fa std: Use backtrace-sys from crates.io
This commit switches the standard library to using the `backtrace-sys`
crate from crates.io instead of duplicating the logic here in the Rust
repositor with the `backtrace-sys`'s crate's logic.

Eventually this will hopefully be a good step towards using the
`backtrace` crate directly from crates.io itself, but we're not quite
there yet! Hopefully this is a small incremental first step we can take.
2018-12-24 08:32:57 -08:00
Mazdak Farrokhzad 05f3b3cbce
Rollup merge of #56978 - jethrogb:jb/sgx-os-mod, r=joshtriplett
Add `std::os::fortanix_sgx` module

This PR adds the `std::os::sgx` module to expose platform-specific APIs behind the `sgx_platform` feature gate.

Depends on https://github.com/rust-lang/rust/pull/56972 to be able to meaningfully build `std::os` documentation for non-standard targets.

Tracking issue: https://github.com/rust-lang/rust/issues/56975
2018-12-24 13:29:30 +01:00
Mazdak Farrokhzad 975a7f01f0
Rollup merge of #57067 - Centril:stabilize-min_const_unsafe_fn, r=oli-obk
Stabilize min_const_unsafe_fn in 1.33

Fixes #55607

r? @oli-obk
2018-12-23 23:09:14 +01:00
Mazdak Farrokhzad 93af1e7369
Rollup merge of #56939 - cramertj:pin-stabilization, r=alexcrichton
Pin stabilization

This implements the changes suggested in https://github.com/rust-lang/rust/issues/55766#issue-378417538 and stabilizes the `pin` feature. @alexcrichton also listed several "blockers" in that issue, but then in [this comment](https://github.com/rust-lang/rust/issues/55766#issuecomment-445074980) mentioned that they're more "TODO items":
>  In that vein I think it's fine for a stabilization PR to be posted at any time now with FCP lapsed for a week or so now. The final points about self/pin/pinned can be briefly discussed there (if even necessary, they could be left as the proposal above).

Let's settle these last bits here and get this thing stabilized! :)

r? @alexcrichton
cc @withoutboats
2018-12-23 23:09:04 +01:00
Mazdak Farrokhzad b42a3acaec stabilize min_const_unsafe_fn in 1.33. 2018-12-23 10:29:38 +01:00
kennytm 14ebca5c19
Rollup merge of #56941 - euclio:deny-libstd-resolution-failures, r=QuietMisdreavus
deny intra-doc link resolution failures in libstd

Fixes #56693.

Until we land a fix for the underlying issue (#56922), we can at least fix the failures in libstd so they don't propagate to downstream crates.
2018-12-23 02:11:59 +08:00
Taylor Cramer 610bcaf6f3 Stabilize Pin 2018-12-21 20:42:50 -08:00
Adrian Budau cc53f4e9f4 Fix pipe2 and accept4 on static linked executables on linux (like musl). 2018-12-20 13:22:31 +02:00
Jethro Beekman dcb5db80b2 Add `std::os::fortanix_sgx` module 2018-12-20 10:09:52 +05:30
Andy Russell 82e55c1bdc
deny intra-doc link resolution failures in libstd 2018-12-17 21:10:24 -05:00
Alex Crichton fcc8bb41e9 std: Use `rustc_demangle` from crates.io
No more need to duplicate the demangling routine between crates.io and
the standard library, we can use the exact same one!
2018-12-14 15:15:53 -08:00
kennytm 27c3631d82
Rollup merge of #56708 - oli-obk:stability_internal_const_fn, r=alexcrichton
Remove some unnecessary feature gates

fixes #56585

cc @jethrogb
2018-12-14 22:10:12 +08:00
Alex Crichton cf47a19305 Bump to 1.33.0
* Update bootstrap compiler
* Update version to 1.33.0
* Remove some `#[cfg(stage0)]` annotations

Actually updating the version number is blocked on updating Cargo
2018-12-12 08:09:26 -08:00
Oliver Scherer 5457b19fe9 Properly stage new feature gates 2018-12-11 10:43:40 +01:00
Oliver Scherer 799cadb2bd Remove unnecessary feature gates from const fns 2018-12-11 10:32:39 +01:00
Alex Crichton b4110900bd Update Cargo submodule and its dependencies
Hopefully just another routine update!

So far this starts to enable the `std::arch` in stage0 builds of rustc.
This means that we may need stage0/not(stage0) in stdsimd itself, but
more and more code is starting to use `std::arch` so I think it's time
to start shifting the balance of work here.
2018-12-10 13:45:22 -08:00
Jethro Beekman 1e44e2de6c SGX target: implement user memory management 2018-12-07 11:26:50 +05:30
Jethro Beekman 4a3505682e Add x86_64-fortanix-unknown-sgx target to libstd and dependencies
The files src/libstd/sys/sgx/*.rs are mostly copied/adapted from
the wasm target.

This also updates the dlmalloc submodule to the very latest version.
2018-12-07 11:26:50 +05:30
bors 8660eba2b9 Auto merge of #56275 - RalfJung:win-mutex, r=SimonSapin
use MaybeUninit instead of mem::uninitialized for Windows Mutex

I hope this builds, I do not have a Windows machine to test...
2018-12-02 13:45:22 +00:00
Ralf Jung 2f2f37983d add missing feature 2018-11-27 16:11:45 +01:00
Dan Robertson 08140878fe
libcore: Add va_list lang item and intrinsics
- Add the llvm intrinsics used to manipulate a va_list.
 - Add the va_list lang item in order to allow implementing
   VaList in libcore.
2018-11-26 22:56:19 +00:00
Steve Klabnik d7b3f5c6ae update various stdlib docs 2018-11-21 06:50:17 -05:00
Steve Klabnik 57b7d55591 fix more links 2018-11-20 21:25:48 -05:00
Alex Crichton cc7590341a std: Delete the `alloc_system` crate
This commit deletes the `alloc_system` crate from the standard
distribution. This unstable crate is no longer needed in the modern
stable global allocator world, but rather its functionality is folded
directly into the standard library. The standard library was already the
only stable location to access this crate, and as a result this should
not affect any stable code.
2018-11-11 09:22:28 -08:00
Bruce Mitchener 9b4d68e53b Fix documentation typos. 2018-11-10 19:31:49 +07:00
bors 1d834550d5 Auto merge of #55366 - Amanieu:stable_layout, r=Amanieu
Add tracking issue for Layout methods (and some API changes)

These methods are already useful when used with the stable global allocator API (stabilized in #51241).

```rust
pub fn align_to(&self, align: usize) -> Result<Layout, LayoutErr>;
pub fn padding_needed_for(&self, align: usize) -> usize;
pub fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>;
pub fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutErr>;
pub fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutErr>;
pub fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutErr>;
pub fn array<T>(n: usize) -> Result<Layout, LayoutErr>;
```

cc #32838

r? @SimonSapin
2018-11-08 06:52:27 +00:00
Amanieu d'Antras 02d50de63e Add a tracking issue for extra Layout methods 2018-11-06 20:36:43 +00:00
Alex Crichton 61e89446ef Remove all jemalloc-related content
This commit removes all jemalloc related submodules, configuration, etc,
from the bootstrap, from the standard library, and from the compiler.
This will be followed up with a change to use jemalloc specifically as
part of rustc on blessed platforms.
2018-11-02 06:52:56 -07:00
bors e800988579 Auto merge of #54043 - fintelia:raw_entry, r=alexcrichton
Add raw_entry API to HashMap

This is a continuation of #50821.
2018-11-02 07:04:07 +00:00
Alex Crichton d0060d72e5 Bump nightly to 1.32.0
* Also update the bootstrap compiler
* Update cargo to 1.32.0
* Clean out stage0 annotations
2018-10-31 11:53:50 -07:00
Oliver Schneider ec74d3533a Stabilize `min_const_fn` 2018-10-05 10:36:14 +02:00
bors b8bea5a0a6 Auto merge of #54017 - alexcrichton:wasm-atomics2, r=sfackler
std: Start implementing wasm32 atomics

This commit is an initial start at implementing the standard library for
wasm32-unknown-unknown with the experimental `atomics` feature enabled. None of
these changes will be visible to users of the wasm32-unknown-unknown target
because they all require recompiling the standard library. The hope with this is
that we can get this support into the standard library and start iterating on it
in-tree to enable experimentation.

Currently there's a few components in this PR:

* Atomic fences are disabled on wasm as there's no corresponding atomic op and
  it's not clear yet what the convention should be, but this will change in the
  future!
* Implementations of `Mutex`, `Condvar`, and `RwLock` were all added based on
  the atomic intrinsics that wasm has.
* The `ReentrantMutex` and thread-local-storage implementations panic currently
  as there's no great way to get a handle on the current thread's "id" yet.

Right now the wasm32 target with atomics is unfortunately pretty unusable,
requiring a lot of manual things here and there to actually get it operational.
This will likely continue to evolve as the story for atomics and wasm unfolds,
but we also need more LLVM support for some operations like custom `global`
directives for this to work best.
2018-10-05 01:57:01 +00:00
Austin Bonander e0caaec6f9 make `CStr::from_bytes_with_nul_unchecked()` a const fn
closes #54678
2018-10-02 04:26:16 -07:00
Austin Bonander 092bf2b500 make `CStr::from_bytes_with_nul_unchecked()` a const fn
closes #54678
2018-10-02 04:25:40 -07:00
Josh Stone ce034951fb Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
Alex Crichton b4877edd67 std: Start implementing wasm32 atomics
This commit is an initial start at implementing the standard library for
wasm32-unknown-unknown with the experimental `atomics` feature enabled. None of
these changes will be visible to users of the wasm32-unknown-unknown target
because they all require recompiling the standard library. The hope with this is
that we can get this support into the standard library and start iterating on it
in-tree to enable experimentation.

Currently there's a few components in this PR:

* Atomic fences are disabled on wasm as there's no corresponding atomic op and
  it's not clear yet what the convention should be, but this will change in the
  future!
* Implementations of `Mutex`, `Condvar`, and `RwLock` were all added based on
  the atomic intrinsics that wasm has.
* The `ReentrantMutex` and thread-local-storage implementations panic currently
  as there's no great way to get a handle on the current thread's "id" yet.

Right now the wasm32 target with atomics is unfortunately pretty unusable,
requiring a lot of manual things here and there to actually get it operational.
This will likely continue to evolve as the story for atomics and wasm unfolds,
but we also need more LLVM support for some operations like custom `global`
directives for this to work best.
2018-09-24 15:55:35 -07:00
bors 1e21c9a297 Auto merge of #53877 - withoutboats:compositional-pin, r=aturon
Update to a new pinning API.

~~Blocked on #53843 because of method resolution problems with new pin type.~~

@r? @cramertj

cc @RalfJung @pythonesque anyone interested in #49150
2018-09-19 06:56:19 +00:00
toidiu 731f4efae5 stabalize infer outlives requirements (RFC 2093).
Co-authored-by: nikomatsakis
2018-09-11 11:40:04 -04:00
Jorge Aparicio 2fb5d5df89 stabilize `#[used]`
closes #40289
2018-09-09 15:43:28 +02:00
Jonathan Behrens ad6c7a9a31 Cleanup API somewhat 2018-09-07 16:47:19 -04:00
Jorge Aparicio 358fc5b621 stabilize `#[panic_handler]` 2018-09-07 13:27:30 +02:00
Alexis Beingessner 9c566e64fa progress on raw_entry 2018-09-05 12:10:09 -04:00
Alexis Beingessner 6af55a7c61 WIP: add raw_entry API to HashMap 2018-09-05 12:10:09 -04:00
Without Boats 974bdc80fe
Update to a new pinning API. 2018-09-01 06:57:58 +02:00
Oliver Schneider 7b3d930ca6 Libstd only has `min_const_fn` const fns 2018-08-31 08:39:59 +02:00
bors 8c2b371ebc Auto merge of #53227 - nivkner:pin_move, r=RalfJung
move the Pin API into its own module for centralized documentation

This implements the change proposed by @withoutboats in #49150, as suggested by @RalfJung in the review of #53104,
along with the documentation that was originally in it, that was deemed more appropriate in module-level documentation.

r? @RalfJung
2018-08-27 22:56:15 +00:00
bors 70a21e89f1 Auto merge of #53441 - toidiu:ak-fix53419, r=nikomatsakis
fix for late-bound regions

Fix for https://github.com/rust-lang/rust/issues/53419

r? @nikomatsakis
2018-08-27 17:42:45 +00:00
bors 691638582a Auto merge of #53619 - japaric:panic-handler, r=SimonSapin
add #[panic_handler]; deprecate #[panic_implementation]

r? @SimonSapin
cc #44489
2018-08-26 04:02:19 +00:00
Niko Matsakis 73fb1622b3 check that adding infer-outlives requirement to all crates works 2018-08-24 17:10:50 -04:00
Sergio Benitez ed0bd38cac Stabilize 'attr_literals' feature. 2018-08-23 19:06:07 -07:00
Jorge Aparicio a774c81f98 add #[panic_handler]; deprecate #[panic_implementation] 2018-08-23 20:58:55 +02:00
Niv Kaminer f9efd0578a move pin module to liballoc and reexport that 2018-08-23 01:37:03 +03:00
Niv Kaminer 13da951868 move PinMut into pin module and export through std 2018-08-23 01:37:03 +03:00
Jakub Kozlowski 00920c0024 Stabilize macro_vis_matcher 2018-08-19 17:08:00 +01:00
Vadim Petrochenkov a0958048b6 Stabilize `use_extern_macros` 2018-08-17 13:14:26 +03:00
varkor ea505fd60b Make std::io::Error #[non_exhaustive] 2018-08-15 17:16:48 +01:00
memoryruins e8d95a5ba1 [nll] libstd: enable feature(nll) for bootstrap 2018-08-10 06:27:10 -04:00
Linus Färnstrand e9a96c0433 Move IPs to assoc consts 2018-08-08 10:52:10 +02:00
Linus Färnstrand 02c272db2d Make Ipv{4,6}Addr::new const fns 2018-08-08 10:52:10 +02:00
varkor d19832105e Remove bad features after rebase 2018-08-05 15:54:49 +01:00
varkor 319b052357 Fix stage 2 tests 2018-08-05 15:54:49 +01:00
varkor 64185f205d Remove unnecessary or invalid feature attributes 2018-08-05 15:54:48 +01:00
Alex Crichton d77defcca1 Update stdsimd to undo an accidental stabilization
Closes #52403
2018-07-20 22:34:09 -07:00
Simon Sapin 239ec7d2dc Implement #[alloc_error_handler]
This to-be-stable attribute is equivalent to `#[lang = "oom"]`.
It is required when using the alloc crate without the std crate.
It is called by `handle_alloc_error`, which is in turned called
by "infallible" allocations APIs such as `Vec::push`.
2018-07-09 23:13:24 +02:00
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