Commit Graph

720 Commits

Author SHA1 Message Date
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
kennytm 010fb40b44
Rollup merge of #49400 - Diggsey:shrink-to, r=joshtriplett
Implement `shrink_to` method on collections

Fixes #49385
2018-03-28 17:55:09 +02:00
Diggory Blake 04f6692aaf Implement `shrink_to` method on collections 2018-03-27 01:39:11 +01:00
Simon Sapin e53a2a7274 Stabilize the TryFrom and TryInto traits
Tracking issue: https://github.com/rust-lang/rust/issues/33417
2018-03-26 23:36:02 +02:00
Mark Mansi db7d9ea480 Stabilize i128 feature too 2018-03-26 08:37:56 -05:00
Mark Mansi 7ce8191775 Stabilize i128_type 2018-03-26 08:36:50 -05:00
kennytm 8d57071cbb
Rollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakis
Stabilize termination_trait, split out termination_trait_test

For #48453.

First time contribution, so I'd really appreciate any feedback on how this PR can be better.

Not sure exactly what kind of documentation update is needed. If there is no PR to update the reference, I can try doing that this week as I have time.
2018-03-25 01:26:32 +08:00
Alex Crichton 7cf4cb5a7b
Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAus
Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero

RFC: https://github.com/rust-lang/rfcs/pull/2307
Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137
Fixes https://github.com/rust-lang/rust/issues/27730
2018-03-23 09:27:06 -05:00
Tyler Mandry 97b3bf99f6 Stabilize termination_trait
This stabilizes `main` with non-() return types; see #48453.
2018-03-19 01:31:04 -05:00
Simon Sapin f40877feeb Add 12 num::NonZero* types for each primitive integer
RFC: https://github.com/rust-lang/rfcs/pull/2307
2018-03-17 23:07:38 +01:00
Simon Sapin 89ecb0d542 Mark deprecated unstable SipHasher13 as a doc-hidden impl detail of HashMap.
It stays in libcore rather than being private in HashMap’s module
because it shares code with the deprecated *stable* `SipHasher` type.
2018-03-17 13:04:13 +01:00
bors 5f3996c3ec Auto merge of #48813 - sinkuu:build_in_assert_macro, r=alexcrichton
Make `assert` a built-in procedural macro

Makes `assert` macro a built-in one without touching its functionality. This is a prerequisite for RFC 2011 (#44838).
2018-03-16 08:22:11 +00:00
bors 3926453944 Auto merge of #47813 - kennytm:stable-incl-range, r=nrc
Stabilize inclusive range (`..=`)

Stabilize the followings:

* `inclusive_range` — The `std::ops::RangeInclusive` and `std::ops::RangeInclusiveTo` types, except its fields (tracked by #49022 separately).
* `inclusive_range_syntax` — The `a..=b` and `..=b` expression syntax
* `dotdoteq_in_patterns` — Using `a..=b` in a pattern

cc #28237
r? @rust-lang/lang
2018-03-15 16:00:40 +00:00
kennytm b5913f2e76
Stabilize `inclusive_range` library feature.
Stabilize std::ops::RangeInclusive and std::ops::RangeInclusiveTo.
2018-03-15 16:58:01 +08:00
bors a4af6f089b Auto merge of #48648 - snf:fallible_allocation, r=Kimundi
Fallible allocation

Implementing RFC#2116 [Fallible Allocation](https://github.com/rust-lang/rust/issues/48043) .
Work in progress. Initially adding @Gankro's try_reserve for Vec.
2018-03-15 08:18:58 +00:00
snf 92bfcd2b19 implementing fallible allocation API (try_reserve) for Vec, String and HashMap 2018-03-14 03:48:42 -07:00
Andrew Cann a9fc3901b0 stabilise feature(never_type)
Replace feature(never_type) with feature(exhaustive_patterns).
feature(exhaustive_patterns) only covers the pattern-exhaustives checks
that used to be covered by feature(never_type)
2018-03-14 12:44:51 +08:00
Shotaro Yamada 517083fbad Make `assert` macro a built-in procedural macro 2018-03-07 17:22:58 +09:00
kennytm 8e3493d459
Rollup merge of #47463 - bluss:fused-iterator, r=alexcrichton
Stabilize FusedIterator

FusedIterator is a marker trait that promises that the implementing
iterator continues to return `None` from `.next()` once it has returned
`None` once (and/or `.next_back()`, if implemented).

The effects of FusedIterator are already widely available through
`.fuse()`, but with stable `FusedIterator`, stable Rust users can
implement this trait for their iterators when appropriate.

Closes #35602
2018-03-06 20:52:37 +08:00
Ulrik Sverdrup bc651cac8d core: Stabilize FusedIterator
FusedIterator is a marker trait that promises that the implementing
iterator continues to return `None` from `.next()` once it has returned
`None` once (and/or `.next_back()`, if implemented).

The effects of FusedIterator are already widely available through
`.fuse()`, but with stable `FusedIterator`, stable Rust users can
implement this trait for their iterators when appropriate.
2018-03-03 14:14:03 +01:00
Alex Crichton c72537f204 std: Add `arch` and `simd` modules
This commit imports the `stdsimd` crate into the standard library,
creating an `arch` and `simd` module inside of both libcore and libstd.
Both of these modules are **unstable** and will continue to be so until
RFC 2335 is stabilized.

As a brief recap, the modules are organized as so:

* `arch` contains all current architectures with intrinsics, for example
  `std::arch::x86`, `std::arch::x86_64`, `std::arch::arm`, etc. These
  modules contain all of the intrinsics defined for the platform, like
  `_mm_set1_epi8`.
* In the standard library, the `arch` module also exports a
  `is_target_feature_detected` macro which performs runtime detection to
  determine whether a target feature is available at runtime.
* The `simd` module contains experimental versions of strongly-typed
  lane-aware SIMD primitives, to be fully fleshed out in a future RFC.

The main purpose of this commit is to start pulling in all these
intrinsics and such into the standard library on nightly and allow
testing and such. This'll help allow users to easily kick the tires and
see if intrinsics work as well as allow us to test out all the
infrastructure for moving the intrinsics into the standard library.
2018-03-02 14:34:07 -08:00
Manish Goregaokar b52b33a386 Rollup merge of #48143 - nikomatsakis:termination_trait_in_tests, r=eddyb
Termination trait in tests

Support the `Termination` trait in unit tests (cc https://github.com/rust-lang/rust/issues/43301)

Also, a drive-by fix for #47075.

This is joint work with @bkchr.
2018-02-24 12:47:58 -08:00
Niko Matsakis 5f1e78f19a move Termination trait to std::process 2018-02-22 17:57:08 -05:00
Niko Matsakis e446f706a8 put the "unit test" logic into libtest
Also make `std::termination` module public and rename feature.

The lib feature needs a different name from the language feature.
2018-02-22 17:56:24 -05:00
Mark Simulacrum 33f5ceee1f stage0 cfg cleanup 2018-02-20 08:52:33 -07:00
bors 1ad094d81c Auto merge of #47687 - SimonSapin:panic-impl, r=sfackler
RFC 2070 part 1: PanicInfo and Location API changes

This implements part of https://rust-lang.github.io/rfcs/2070-panic-implementation.html
Tracking issue: https://github.com/rust-lang/rust/issues/44489

* Move `std::panic::PanicInfo` and `std::panic::Location` to a new `core::panic` module. The two types and the `std` module were already `#[stable]` and stay that way, the new `core` module is `#[unstable]`.
* Add a new `PanicInfo::message(&self) -> Option<&fmt::Arguments>` method, which is `#[unstable]`.
* Implement `Display` for `PanicInfo` and `Location`
2018-02-18 06:02:35 +00:00
Clar Charr 1a043533f5 Document std::os::raw. 2018-01-29 17:44:12 -05:00
Simon Sapin 2f98f4b12b Move PanicInfo and Location to libcore
Per https://rust-lang.github.io/rfcs/2070-panic-implementation.html
2018-01-23 16:38:26 +01:00
Cameron Hart 651ea8ea44 Stabilized `#[repr(align(x))]` attribute (RFC 1358) 2018-01-23 08:36:13 +11:00
Simon Sapin 55c50cd8ac Stabilize std::ptr::NonNull 2018-01-20 11:09:23 +01:00
Simon Sapin c97c1f7dc3 Mark Unique as perma-unstable, with the feature renamed to ptr_internals. 2018-01-20 11:09:23 +01:00
Simon Sapin f19baf0977 Rename std::ptr::Shared to NonNull
`Shared` is now a deprecated `type` alias.

CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
2018-01-20 10:55:16 +01:00
Carol (Nichols || Goulding) e168aa385b
Reexport -> re-export in prose and documentation comments 2018-01-15 13:36:53 -05:00
bors 6eff103aa1 Auto merge of #46461 - zackmdavis:elemental_method_suggestion_jamboree, r=estebank
type error method suggestions use whitelisted identity-like conversions

![method_jamboree_summit](https://user-images.githubusercontent.com/1076988/33523646-e5c43184-d7c0-11e7-98e5-1bff426ade86.png)

Previously, on a type mismatch (and if this wasn't preëmpted by a
higher-priority suggestion), we would look for argumentless methods
returning the expected type, and list them in a `help` note. This had two
major shortcomings: firstly, a lot of the suggestions didn't really make
sense (if you used a &str where a String was expected,
`.to_ascii_uppercase()` is probably not the solution you were hoping
for). Secondly, we weren't generating suggestions from the most useful
traits! We address the first problem with an internal
`#[rustc_conversion_suggestion]` attribute meant to mark methods that keep
the "same value" in the relevant sense, just converting the type. We
address the second problem by making `FnCtxt.probe_for_return_type` pass
the `ProbeScope::AllTraits` to `probe_op`: this would seem to be safe
because grep reveals no other callers of `probe_for_return_type`.

Also, structured suggestions are pretty and good for RLS and friends.

Unfortunately, the trait probing is still not all one would hope for: at a
minimum, we don't know how to rule out `into()` in cases where it wouldn't
actually work, and we don't know how to rule in `.to_owned()` where it
would. Issues #46459 and #46460 have been filed and are ref'd in a FIXME.

This is hoped to resolve #42929, #44672, and #45777.
2018-01-13 02:15:19 +00:00
Robin Kruppe 9e4a692e56 Replace empty array hack with repr(align)
As a side effect, this fixes the warning about repr(C, simd) that has been reported during x86_64 windows builds since #47111 (see also: #47103)
2018-01-07 20:25:37 +01:00
Zack M. Davis aba56ddd05 type error method suggestions use whitelisted identity-like conversions
Previously, on a type mismatch (and if this wasn't preëmpted by a
higher-priority suggestion), we would look for argumentless methods
returning the expected type, and list them in a `help` note.

This had two major shortcomings. Firstly, a lot of the suggestions didn't
really make sense (if you used a &str where a String was expected,
`.to_ascii_uppercase()` is probably not the solution you were hoping
for). Secondly, we weren't generating suggestions from the most useful
traits!

We address the first problem with an internal
`#[rustc_conversion_suggestion]` attribute meant to mark methods that keep
the "same value" in the relevant sense, just converting the type. We
address the second problem by making `FnCtxt.probe_for_return_type` pass
the `ProbeScope::AllTraits` to `probe_op`: this would seem to be safe
because grep reveals no other callers of `probe_for_return_type`.

Also, structured suggestions are preferred (because they're pretty, but
also for RLS and friends).

Also also, we make the E0055 autoderef recursion limit error use the
one-time-diagnostics set, because we can potentially hit the limit a lot
during probing. (Without this,
test/ui/did_you_mean/recursion_limit_deref.rs would report "aborting due to
51 errors").

Unfortunately, the trait probing is still not all one would hope for: at a
minimum, we don't know how to rule out `into()` in cases where it wouldn't
actually work, and we don't know how to rule in `.to_owned()` where it
would. Issues #46459 and #46460 have been filed and are ref'd in a FIXME.

This is hoped to resolve #42929, #44672, and #45777.
2018-01-06 17:15:59 -08:00
bors 8c59418962 Auto merge of #46713 - Manishearth:memchr, r=bluss
Use memchr to speed up [u8]::contains 3x

None
2017-12-31 16:38:10 +00:00
Bastian Köcher c7a57d2855 Adds termination_trait feature gate 2017-12-26 12:26:39 +01:00
Bastian Köcher d7918fb2e8 Implements RFC 1937: `?` in `main`
This is the first part of the RFC 1937 that supports new
`Termination` trait in the rust `main` function.
2017-12-26 12:26:39 +01:00
Manish Goregaokar 2bf0df777b Move rust memchr impl to libcore 2017-12-13 01:15:18 -06:00
bors c7b6d8263b Auto merge of #45837 - SimonSapin:file_read_write, r=dtolnay
Add read, read_string, and write functions to std::fs

New APIs in `std::fs`:

```rust
pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> { … }
pub fn read_string<P: AsRef<Path>>(path: P) -> io::Result<String> { … }
pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> { ... }
```

(`read_string` is based on `read_to_string` and so returns an error on non-UTF-8 content.)

Before:

```rust
use std::fs::File;
use std::io::Read;

let mut bytes = Vec::new();
File::open(filename)?.read_to_end(&mut bytes)?;
do_something_with(bytes)
```

After:

```rust
use std::fs;

do_something_with(fs::read(filename)?)
```
2017-12-08 21:33:50 +00:00
Simon Sapin 6c5f53e65e Stabilize const-calling existing const-fns in std
Fixes #46038
2017-11-26 23:43:44 +01:00
Alex Crichton 95e9609b9d std: Flag Windows TLS dtor symbol as #[used]
Turns out ThinLTO was internalizing this symbol and eliminating it. Worse yet if
you compiled with LTO turns out no TLS destructors would run on Windows! The
`#[used]` annotation should be a more bulletproof implementation (in the face of
LTO) of preserving this symbol all the way through in LLVM and ensuring it makes
it all the way to the linker which will take care of it.
2017-11-24 14:28:12 -08:00
QuietMisdreavus 831fd78341 add doc_highlight feature flag and tests 2017-11-17 22:50:15 +01:00
Alex Crichton 6bc8f164b0 std: Remove `rand` crate and module
This commit removes the `rand` crate from the standard library facade as
well as the `__rand` module in the standard library. Neither of these
were used in any meaningful way in the standard library itself. The only
need for randomness in libstd is to initialize the thread-local keys of
a `HashMap`, and that unconditionally used `OsRng` defined in the
standard library anyway.

The cruft of the `rand` crate and the extra `rand` support in the
standard library makes libstd slightly more difficult to port to new
platforms, namely WebAssembly which doesn't have any randomness at all
(without interfacing with JS). The purpose of this commit is to clarify
and streamline randomness in libstd, focusing on how it's only required
in one location, hashmap seeds.

Note that the `rand` crate out of tree has almost always been a drop-in
replacement for the `rand` crate in-tree, so any usage (accidental or
purposeful) of the crate in-tree should switch to the `rand` crate on
crates.io. This then also has the further benefit of avoiding
duplication (mostly) between the two crates!
2017-11-08 20:41:17 -08:00
Simon Sapin c670424cbe Move `File::{read,write}_contents` to `fs::{read,write}` free functions. 2017-11-07 18:42:06 +01:00
Simon Sapin fd518ac4b0 Add File::read_contents and File::write_contents convenience functions.
Before:

```rust
use std::fs::File;
use std::io::Read;

let mut bytes = Vec::new();
File::open(filename)?.read_to_end(&mut bytes)?;
do_something_with(bytes)
```

After:

```rust
use std::fs::File;

do_something_with(File::read_contents(filename)?)
```
2017-11-07 17:52:07 +01:00
Lukas Kalbertodt 259c125267 Mark several ascii methods as unstable again
We don't want to stabilize them now already. The goal of this set of
commits is just to add inherent methods to the four types. Stabilizing
all of those methods can be done later.
2017-11-03 21:28:04 +01:00
bors f3b900cc3b Auto merge of #44764 - nvzqz:master, r=alexcrichton
Implement TryFrom<&[T]> for &[T; N]

There are many cases where a buffer with a static compile-time size is preferred over a slice with a dynamic size. This allows for performing a checked conversion from `&[T]` to `&[T; N]`. This may also lead to compile-time optimizations involving `[T; N]` such as loop unrolling.

This is my first PR to Rust, so I'm not sure if discussion of this change should happen here or does it need its own RFC? I figured these changes would be a subset of #33417.
2017-10-31 23:06:37 +00:00
Alex Crichton ca18537197 Bump to 1.23 and update bootstrap
This commit updates the bootstrap compiler, bumps the version to 1.23, updates
Cargo, updates books, and updates crates.io dependencies
2017-10-26 13:59:18 -07:00
Joshua Lockerman 68341a91ee Improve performance of spsc_queue and stream.
This commit makes two main changes.
1. It switches the spsc_queue node caching strategy from keeping a shared
counter of the number of nodes in the cache to keeping a consumer only counter
of the number of node eligible to be cached.
2. It separate the consumer and producers fields of spsc_queue and stream into
a producer cache line and consumer cache line.
2017-10-01 12:15:35 -04:00
Nikolai Vazquez d9d877221f Enable required features for core::array in libstd 2017-09-29 13:30:03 -04:00
bors 9a00f3cc30 Auto merge of #44026 - QuietMisdreavus:trimmed-std, r=steveklabnik
hide internal types/traits from std docs via new #[doc(masked)] attribute

Fixes #43701 (hopefully for good this time)

This PR introduces a new parameter to the `#[doc]` attribute that rustdoc looks for on `extern crate` statements. When it sees `#[doc(masked)]` on such a statement, it hides traits and types from that crate from appearing in either the "Trait Implementations" section of many type pages, or the "Implementors" section of trait pages. This is then applied to the `libc`/`rand`/`compiler_builtins` imports in libstd to prevent those crates from creating broken links in the std docs.

Like in #43348, this also introduces a feature gate, `doc_masked`, that controls the use of this parameter.

To view the std docs generated with this change, head to https://tonberry.quietmisdreavus.net/std-43701/std/index.html.
2017-09-19 04:20:56 +00:00
Oliver Schneider 2787a285bd
Add `<*const T>::align_offset` and use it in `memchr` 2017-09-17 21:30:58 +02:00
Michal Budzynski 04855950b9 stabilized needs_drop (fixes #41890) 2017-09-16 23:41:04 +02:00
Alex Burka 681e5da61e change #![feature(const_fn)] to specific gates 2017-09-16 15:53:02 +00:00
bors 929b878262 Auto merge of #44438 - Xaeroxe:clamp, r=Mark-Simulacrum
Revert clamp

Revert clamp per https://github.com/rust-lang/rust/issues/44095#issuecomment-328218316 while we take time to assess the potential backwards compatibility damage done by it.
2017-09-09 09:13:03 +00:00
Jacob Kiesel 67283fa8e6 Revert "Add panic unit tests"
This reverts commit b762283e57.
2017-09-08 16:07:09 -06:00
Mark Simulacrum 44351edb64 Rollup merge of #44097 - Xaeroxe:clamp, r=burntsushi
Add clamp functions

Implementation of clamp feature:

Tracking issue: https://github.com/rust-lang/rust/issues/44095
RFC: https://github.com/rust-lang/rfcs/pull/1961
2017-09-06 18:27:45 -06:00
QuietMisdreavus bb6de3c9ce add feature gate doc_masked and tests 2017-09-05 13:51:08 -05:00
QuietMisdreavus c491e195c4 new attribute #[doc(masked)] to hide internal crates from std docs 2017-09-05 13:50:37 -05:00
Jacob Kiesel b762283e57 Add panic unit tests 2017-09-04 21:39:46 -06:00
Alex Crichton 9e5a7e9472 Bring back stage0 allocator logic on MSVC
I think there may still be bugs preventing its removal..
2017-08-31 18:20:52 -07:00
Alex Crichton 7a2a8d7d60 Update Cargo to 0.23.0 and our lockfile 2017-08-31 07:02:50 -07:00
Alex Crichton 9b9de27101 Bump to 1.22.0 2017-08-31 06:58:58 -07:00
Tatsuyuki Ishi bf9bdefe8a Whitelist unwind import in std
This is a part of libbacktrace linkage and thus the compiler cannot detect if it's used or not.
2017-08-27 19:02:24 +09:00
Tatsuyuki Ishi 611b111139 Move unused-extern-crate to late pass 2017-08-27 19:02:24 +09:00
Tamir Duberstein b3f50caee0
*: remove crate_{name,type} attributes
Fixes #41701.
2017-08-25 16:18:21 -04:00
Ruud van Asseldonk e63d979e22 Docs: restore link text after renaming anchor
The text does not need the hyphen, but the anchor name does.
2017-08-13 11:20:52 +02:00
Ruud van Asseldonk 01000fb5c6 Replace space in Markdown link label
With the space, the tidy check does not recognize it as
a link label. See also the comment above in line_is_url()
in src/tools/tidy/src/style.rs.
2017-08-13 11:20:52 +02:00
Ruud van Asseldonk f51e64f7e9 Point "deref coercions" links to new book
Currently the link on doc.rust-lang.org is semi-broken; it links to a
page that links to the exact page in the first edition in the book, or
to the index of the second edition of the book. If the second editions
is the recommended one now, we should point the links at that one. It
seems that in the mean time, the links have been updated to point
directly to the first edition of the book, but that hasn't made it onto
the stable channel yet. By the time this commit makes it onto the stable
channel, the second edition of the book should be complete enough. At
least the part about deref coercions is.
2017-08-13 11:20:52 +02:00
bors 0ed03e5490 Auto merge of #43348 - kennytm:fix-24658-doc-every-platform, r=alexcrichton
Expose all OS-specific modules in libstd doc.

1. Uses the special `--cfg dox` configuration passed by rustbuild when running `rustdoc`. Changes the `#[cfg(platform)]` into `#[cfg(any(dox, platform))]` so that platform-specific API are visible to rustdoc.

2. Since platform-specific implementations often won't compile correctly on other platforms, `rustdoc` is changed to apply `everybody_loops` to the functions during documentation and doc-test harness.

3. Since platform-specific code are documented on all platforms now, it could confuse users who found a useful API but is non-portable. Also, their examples will be doc-tested, so must be excluded when not testing on the native platform. An undocumented attribute `#[doc(cfg(...))]` is introduced to serve the above purposed.

Fixes #24658 (Does _not_ fully implement #1998).
2017-08-13 03:00:20 +00:00
Eduard-Mihai Burtescu 92892d3beb Check #[thread_local] statics correctly in the compiler. 2017-08-12 12:58:07 +03:00
Aidan Hobson Sayers 56a07539c0 Fix cross-crate global allocators on windows 2017-08-10 16:22:09 +01:00
kennytm b4114ebe3a
Exposed all platform-specific documentation. 2017-08-10 13:43:59 +08:00
Aidan Hobson Sayers 458ba7aeb5 Make a disable-jemalloc build work
Fixes #43510
2017-08-07 21:44:02 +01:00
bors ddaab61101 Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturon
Stabilize more APIs for the 1.20.0 release

In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
2017-07-26 23:40:48 +00:00
Alex Crichton 16707d4348 std: Stabilize the `str_{mut,box}_extras` feature
Stabilizes

* `<&mut str>::as_bytes_mut`
* `<Box<str>>::into_boxed_bytes`
* `std::str::from_boxed_utf8_unchecked`
* `std::str::from_utf8_mut`
* `std::str::from_utf8_unchecked_mut`

Closes #41119
2017-07-25 07:10:42 -07:00
Alex Crichton 4c9c6e824b std: Stabilize `char_escape_debug`
Stabilizes:

* `<char>::escape_debug`
* `std::char::EscapeDebug`

Closes #35068
2017-07-25 07:09:31 -07:00
Alex Crichton 9010567dcc Bump master to 1.21.0
This commit bumps the master branch's version to 1.21.0 and also updates the
bootstrap compiler from the freshly minted beta release.
2017-07-25 07:03:19 -07:00
bors 56071f6879 Auto merge of #43055 - est31:stabilize_float_bits_conv, r=sfackler
Stabilize float_bits_conv for Rust 1.21

Stabilizes the `float_bits_conv` lib feature for the 1.20 release of Rust. I've initially implemented the feature in #39271 and later made PR #43025 to output quiet NaNs even on platforms with different encodings, which seems to have been the only unresolved issue of the API.

Due to PR #43025 being only applied to master this stabilisation can't happen for Rust 1.19 through the usual "stabilisation on beta" system that is being done for library APIs.

r? @BurntSushi

closes #40470.
2017-07-17 00:19:43 +00:00
Alex Burka 8cce5bc7ab use :vis in thread_local! 2017-07-11 20:27:55 +00:00
Sean McArthur 74b2d69358 remove associated_consts feature gate 2017-07-06 11:52:25 -07:00
est31 010dea13ee Stabilize float_bits_conv 2017-07-06 15:18:06 +02:00
Alex Crichton 695dee063b rustc: Implement the #[global_allocator] attribute
This PR is an implementation of [RFC 1974] which specifies a new method of
defining a global allocator for a program. This obsoletes the old
`#![allocator]` attribute and also removes support for it.

[RFC 1974]: https://github.com/rust-lang/rfcs/pull/197

The new `#[global_allocator]` attribute solves many issues encountered with the
`#![allocator]` attribute such as composition and restrictions on the crate
graph itself. The compiler now has much more control over the ABI of the
allocator and how it's implemented, allowing much more freedom in terms of how
this feature is implemented.

cc #27389
2017-07-05 14:37:01 -07:00
Corey Farwell 4c43bc32b7 Rollup merge of #42271 - tinaun:charfromstr, r=alexcrichton
add `FromStr` Impl for `char`

fixes #24939.

is it possible to use pub(restricted) instead of using a stability attribute for the internal error representation? is it needed at all?
2017-06-20 16:28:25 -04:00
tinaun fd9d7aa2cf added `FromStr` Impl for `char` 2017-06-20 04:38:02 -04:00
bors 1143eb26a2 Auto merge of #42313 - pnkfelix:allocator-integration, r=alexcrichton
Allocator integration

Lets start getting some feedback on `trait Alloc`.

Here is:
 *  the `trait Alloc` itself,
 * the `struct Layout` and `enum AllocErr` that its API relies on
 * a `struct HeapAlloc` that exposes the system allocator as an instance of `Alloc`
 * an integration of `Alloc` with `RawVec`
 * ~~an integration of `Alloc` with `Vec`~~

 TODO
 * [x] split `fn realloc_in_place` into `grow` and `shrink` variants
 * [x] add `# Unsafety` and `# Errors` sections to documentation for all relevant methods
 * [x] remove `Vec` integration with `Allocator`
 * [x] add `allocate_zeroed` impl to `HeapAllocator`
 * [x] remove typedefs e.g. `type Size = usize;`
 * [x] impl `trait Error` for all error types in PR
 * [x] make `Layout::from_size_align` public
 * [x] clarify docs of `fn padding_needed_for`.
 * [x] revise `Layout` constructors to ensure that [size+align combination is valid](https://github.com/rust-lang/rust/pull/42313#issuecomment-306845446)
 * [x] resolve mismatch re requirements of align on dealloc. See [comment](https://github.com/rust-lang/rust/pull/42313#issuecomment-306202489).
2017-06-20 05:02:19 +00:00
est31 c6afde6c46 Introduce tidy lint to check for inconsistent tracking issues
This commit
    * Refactors the collect_lib_features function to work in a
      non-checking mode (no bad pointer needed, and list of
      lang features).
    * Introduces checking whether unstable/stable tags for a
      given feature have inconsistent tracking issues.
    * Fixes such inconsistencies throughout the codebase.
2017-06-16 20:40:40 +02:00
Felix S. Klock II 12d4d12fef implement Error trait for error structs added in allocator API. 2017-06-15 23:48:31 +02:00
Murarth eadda7665e Merge crate `collections` into `alloc` 2017-06-13 23:37:34 -07:00
Alexis Beingessner e847d46bcb migrate everything to using mem::needs_drop 2017-05-20 19:27:30 -04:00
Alex Crichton 5daf557a77 Update stage0 bootstrap compiler
We've got a freshly minted beta compiler, let's update to use that on nightly!
This has a few other changes associated with it as well

* A bump to the rustc version number (to 1.19.0)
* Movement of the `cargo` and `rls` submodules to their "proper" location in
  `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude`
  option this can work.
* Updates of the `cargo` and `rls` submodules to their master branches.
* Tweak to the `src/stage0.txt` format to be more amenable for Cargo version
  numbers. On the beta channel Cargo will bootstrap from a different version
  than rustc (e.g. the version numbers are different), so we need different
  configuration for this.
* Addition of `dev` as a readable key in the `src/stage0.txt` format. If present
  then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead
  of `static.rust-lang.org`. This is added to accomodate our updated release
  process with Travis and AppVeyor.
2017-04-29 12:11:14 -07:00
Josh Stone c1aaa60d8d Remove float_extras
[unstable, deprecated since 1.11.0]
2017-04-20 21:16:31 -07:00
Josh Stone c903ac64e5 Remove num::{Zero,One}
[unstable, deprecated since 1.11.0]
2017-04-20 21:16:31 -07:00