Commit Graph

841 Commits

Author SHA1 Message Date
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
Josh Stone 313aab8fbe Remove RefCell::borrow_state
[unstable, deprecated since 1.15.0]
2017-04-20 21:16:31 -07:00
Scott McMurray 295bcdb715 Override ToOwned::clone_into for Path and OsStr
The only non-overridden one remaining is the CStr impl, which cannot
be optimized as doing so would break CString's second invariant.
2017-04-18 21:02:18 -07:00
est31 32a43da68a Add functions to safely transmute float to int 2017-04-18 02:43:16 +02:00
bors 1dca19ae3f Auto merge of #40765 - pirate:patch-3, r=aturon
Add contribution instructions to stdlib docs

Generally programming language docs have instructions on how to contribute changes.

I couldn't find any in the rust docs, so I figured I'd add an instructions section, let me know if this belongs somewhere else!
2017-04-12 09:16:14 +00:00
Clar Charr a2b28be3f8 Reduce str transmutes, add mut versions of methods. 2017-04-09 19:13:54 -04:00
Nick Sweeting 9765fbc813 fix build errors 2017-04-07 16:42:56 -04:00
Nick Sweeting 9a50874dd4 tweak links 2017-03-30 21:54:10 -04:00
Nick Sweeting 7665991e3e add link to contribution guidelines and IRC room 2017-03-23 13:48:32 -04:00
Nick Sweeting 425c1a3a05 Add contribution instructions to stdlib docs 2017-03-23 13:29:04 -04:00
Corey Farwell 17656ab328 Rollup merge of #40556 - cramertj:stabilize-pub-restricted, r=petrochenkov
Stabilize pub(restricted)

Fix https://github.com/rust-lang/rust/issues/32409
2017-03-20 23:44:59 -04:00
steveklabnik d1d9626e75 Fix up various links
The unstable book, libstd, libcore, and liballoc all needed some
adjustment.
2017-03-20 10:10:16 -04:00
Corey Farwell 4e9033124b Rollup merge of #40566 - clarcharr:never_error, r=sfackler
Implement std::error::Error for !.
2017-03-19 20:51:11 -04:00
Aaron Turon a8f4a1bd98 Stabilize rc_raw feature, closes #37197 2017-03-17 13:28:53 -07:00
Corey Farwell 69717170a4 Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, r=GuillaumeGomez
Remove function invokation parens from documentation links.

This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-17 08:48:51 -04:00
Taylor Cramer 28626ca5b1 Stabilize pub(restricted) 2017-03-15 22:39:04 -07:00
Clar Charr a5cf55125c Implement Error for !. 2017-03-15 23:09:29 -04:00
Corey Farwell e7b0f2badf Remove function invokation parens from documentation links.
This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13 21:43:18 -04:00
Charlie Fan 584c79888b Implement placement-in protocol for `HashMap` 2017-03-11 21:08:18 +08:00
Steve Klabnik b4cd3d9206 Revert "Fix up links"
This reverts commit 7f1d1c6d9a.

The original commit was created because mdBook and rustdoc had
different generation algorithms for header links; now with
https://github.com/rust-lang/rust/pull/39966 , the algorithms
are the same. So let's undo this change.

... when I came across this problem, I said "eh, this isn't fun,
but it doesn't take that long." I probably should have just actually
taken the time to fix upstream, given that they were amenable. Oh
well!
2017-02-20 09:09:12 -05:00
Steve Klabnik 7f1d1c6d9a Fix up links
mdbook and rustdoc generate links differently, so we need to change all
these links.
2017-02-13 13:41:24 -05:00
whataloadofwhat ca92c51682 Change std::panicking::try::Data into a union
No longer potentially call `mem::uninitialized::<!>()`

Fixes #39432
2017-02-10 19:20:28 +00:00
Corey Farwell 6fb57bf13f Rollup merge of #39431 - alexcrichton:no-more-makefiles, r=brson
Delete the makefile build system

This PR deletes the makefile build system in favor of the rustbuild build system. The beta has now been branched so 1.16 will continue to be buildable from the makefiles, but going forward 1.17 will only be buildable with rustbuild.

Rustbuild has been the default build system [since 1.15.0](https://github.com/rust-lang/rust/pull/37817) and the makefiles were [proposed for deletion](https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368) at this time back in November of last year.

And now with the deletion of these makefiles we can start getting those sweet sweet improvements of using crates.io crates in the compiler!
2017-02-07 22:54:25 -05:00
Alex Crichton 77c3bfa742 std: Remove cfg(cargobuild) annotations
These are all now no longer needed that we've only got rustbuild in tree.
2017-02-06 08:42:54 -08:00
Clar Charr 8b2e334e0e Ipv6Addr <-> u128 2017-02-05 18:55:37 -05:00
Corey Farwell ca202fe181 Rollup merge of #38983 - APTy:udp-peek, r=aturon
Add peek APIs to std::net

Adds "peek" APIs to `std::net` sockets, including:
- `UdpSocket.peek()`
- `UdpSocket.peek_from()`
- `TcpStream.peek()`

These methods enable socket reads without side-effects. That is, repeated calls to `peek()` return identical data. This is accomplished by providing the POSIX flag `MSG_PEEK` to the underlying socket read operations.

This also moves the current implementation of `recv_from` out of the platform-independent `sys_common` and into respective `sys/windows` and `sys/unix` implementations. This allows for more platform-dependent implementations where necessary.

Fixes #38980
2017-02-05 09:14:38 -05:00
Tyler Julian a40be0857c libstd/net: Add `peek` APIs to UdpSocket and TcpStream
These methods enable socket reads without side-effects. That is,
repeated calls to peek() return identical data. This is accomplished
by providing the POSIX flag MSG_PEEK to the underlying socket read
operations.

This also moves the current implementation of recv_from out of the
platform-independent sys_common and into respective sys/windows and
sys/unix implementations. This allows for more platform-dependent
implementations.
2017-02-04 12:00:19 -08:00
Alex Crichton 626e754473 Bump version, upgrade bootstrap
This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.
2017-02-03 13:25:46 -08:00
Aidan Hobson Sayers 70d2372ada Expose a feature to force use of alloc_system, teach rustbuild
This fixes jemalloc-less local rebuilds, where we tell cargo that
we're actually stage1
2017-01-16 03:06:45 +00:00
Seo Sanghyeon d350c9b15f Rollup merge of #38664 - apasel422:may-dangle, r=pnkfelix
Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]`

CC #34761

r? @pnkfelix
2017-01-10 20:27:41 +09:00
bors 7ac9d337dc Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrc
Remove not(stage0) from deny(warnings)

Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2017-01-08 08:22:06 +00:00
Simonas Kazlauskas b0e55a83a8 Such large. Very 128. Much bits.
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which
understands and supports 128-bit integers throughout.

The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to
iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported,
this strategy is good enough to get past the first bootstrap stages to end up with a fully working
128-bit capable compiler.

In order for this strategy to work, number of locations had to be changed to use associated
max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?)
had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works
(former not necessarily producing the right results in stage1).

This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:15:44 +01:00
Alex Crichton 9b0b5b45db Remove not(stage0) from deny(warnings)
Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2016-12-29 21:07:20 -08:00
Andrew Paseltiner ca9b07bbc9
Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]`
CC #34761
2016-12-28 17:47:10 -05:00
Corey Farwell 86fc63e62d Implement `fmt::Debug` for all structures in libstd.
Part of https://github.com/rust-lang/rust/issues/31869.

Also turn on the `missing_debug_implementations` lint at the crate
level.
2016-12-18 14:55:14 -08:00
bors b4b1e5ece2 Auto merge of #38049 - frewsxcv:libunicode, r=alexcrichton
Rename 'librustc_unicode' crate to 'libstd_unicode'.

Fixes https://github.com/rust-lang/rust/issues/26554.
2016-12-12 13:19:33 +00:00
Ulrik Sverdrup 7ba762253c std: Forward ExactSizeIterator::is_empty for Args, ArgsOs iterators 2016-12-04 15:46:36 +01:00
Alex Crichton 2186660b51 Update the bootstrap compiler
Now that we've got a beta build, let's use it!
2016-11-30 10:38:08 -08:00
Corey Farwell 274777a158 Rename 'librustc_unicode' crate to 'libstd_unicode'.
Fixes #26554.
2016-11-30 01:24:01 -05:00
Vadim Petrochenkov 74bb594563 Stabilize `..` in tuple (struct) patterns 2016-11-03 01:38:15 +03:00
Brian Anderson 6135cbc9e2 std: Flatten the num directory to reflect the module layout
This makes it dissimilar to how core is structured on disk, but
more predictable on its own.
2016-11-01 17:08:24 +00:00
Brian Anderson c251884575 Clean up and add more comments to libstd/lib.rs 2016-11-01 17:08:24 +00:00
Brian Anderson 8f5bb1f7c0 std: Remove unused test feature 2016-11-01 17:08:24 +00:00
Brian Anderson ca30691813 std: Move sys_common to libstd/sys_common
Make the directory structure reflect the module structure. I've always
found the existing structure confusing.
2016-11-01 17:08:24 +00:00
Brian Anderson 219c018894 std: Move platform-specific code out of libstd/lib.rs 2016-11-01 17:08:24 +00:00
bors 73f5cad6c4 Auto merge of #37178 - apasel422:issue-37136, r=alexcrichton
Implement `RefUnwindSafe` for atomic types

Closes #37136
2016-11-01 00:44:50 -07:00
Ulrik Sverdrup 0a0efcbebf std::collections: Reexport libcollections's range module
This is overdue, even if range and RangeArgument is still unstable.
The stability attributes are the same ones as the other unstable item
(Bound) here, they don't seem to matter.
2016-10-17 21:26:29 +02:00
Andrew Paseltiner f8322035eb
Implement `RefUnwindSafe` for atomic types
Closes #37136
2016-10-16 19:48:59 -04:00
Nick Cameron 14c62f91b7 Deprecate `Reflect`
[tracking issue](https://github.com/rust-lang/rust/issues/27749)
2016-10-12 08:40:22 +13:00
Nick Cameron 9bc6d26092 Stabilise `?`
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-12 08:40:22 +13:00
Alex Crichton 10c3134da0 std: Stabilize and deprecate APIs for 1.13
This commit is intended to be backported to the 1.13 branch, and works with the
following APIs:

Stabilized

* `i32::checked_abs`
* `i32::wrapping_abs`
* `i32::overflowing_abs`
* `RefCell::try_borrow`
* `RefCell::try_borrow_mut`
* `DefaultHasher`
* `DefaultHasher::new`
* `DefaultHasher::default`

Deprecated

* `BinaryHeap::push_pop`
* `BinaryHeap::replace`
* `SipHash13`
* `SipHash24`
* `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map`
  module

Closes #28147
Closes #34767
Closes #35057
Closes #35070
2016-10-03 10:34:34 -07:00
Brian Anderson 3b49c60ab7 Remove stage0 hacks 2016-09-28 23:17:56 +00:00
Ashley Williams 3d8d55787b add assert_ne and debug_assert_ne macros 2016-09-21 14:38:26 +02:00
Alex Crichton 848cfe20a0 Link test to compiler builtins and make unstable
This commit fixes a test which now needs to explicitly link to the
`compiler_builtins` crate as well as makes the `compiler_builtins` crate
unstable.
2016-09-13 12:27:26 -07:00
Jorge Aparicio 3fd5fdd8d3 crate-ify compiler-rt into compiler-builtins
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib

This commit moves the logic that used to build libcompiler-rt.a into a
compiler-builtins crate on top of the core crate and below the std crate.
This new crate still compiles the compiler-rt instrinsics using gcc-rs
but produces an .rlib instead of a static library.

Also, with this commit rustc no longer passes -lcompiler-rt to the
linker. This effectively makes the "no-compiler-rt" field of target
specifications a no-op. Users of `no_std` will have to explicitly add
the compiler-builtins crate to their crate dependency graph *if* they
need the compiler-rt intrinsics. Users of the `std` have to do nothing
extra as the std crate depends on compiler-builtins.

Finally, this a step towards lazy compilation of std with Cargo as the
compiler-rt intrinsics can now be built by Cargo instead of having to
be supplied by the user by some other method.

closes #34400
2016-09-12 21:22:15 -07:00
Vadim Petrochenkov 6f7e51e49b Replace `_, _, _` with `..` 2016-09-04 12:27:01 +03:00
bors eaf71f8d10 Auto merge of #35906 - jseyfried:local_prelude, r=eddyb
Use `#[prelude_import]` in `libcore` and `libstd`

r? @eddyb
2016-08-25 20:45:32 -07:00
Jeffrey Seyfried 9a2c8783d9 Use `#[prelude_import]` in `libstd`. 2016-08-24 22:12:48 +00:00
Eduard Burtescu 119508cdb4 Remove drop flags from structs and enums implementing Drop. 2016-08-24 13:23:37 +03:00
bors 0bd99f9d5c Auto merge of #35656 - Stebalien:fused, r=alexcrichton
Implement 1581 (FusedIterator)

* [ ] Implement on patterns. See https://github.com/rust-lang/rust/issues/27721#issuecomment-239638642.
* [ ] Handle OS Iterators. A bunch of iterators (`Args`, `Env`, etc.) in libstd wrap platform specific iterators. The current ones all appear to be well-behaved but can we assume that future ones will be?
* [ ] Does someone want to audit this? On first glance, all of the iterators on which I implemented `FusedIterator` appear to be well-behaved but there are a *lot* of them so a second pair of eyes would be nice.
* I haven't touched rustc internal iterators (or the internal rand) because rustc doesn't actually call `fuse()`.
* `FusedIterator` can't be implemented on `std::io::{Bytes, Chars}`.

Closes: #35602 (Tracking Issue)
Implements: rust-lang/rfcs#1581
2016-08-23 07:46:52 -07:00
Steven Allen de91872a33 Add a FusedIterator trait.
This trait can be used to avoid the overhead of a fuse wrapper when an iterator
is already well-behaved.

Conforming to: RFC 1581
Closes: #35602
2016-08-18 12:16:29 -04:00
Nick Cameron e6cc4c5d13 Fix links 2016-08-18 15:43:35 +12:00
Nikhil Shagrithaya ea2216cba8 Added an update_panic_count function to handle access to PANIC_COUNT 2016-08-10 22:04:41 +05:30
Andrew Paseltiner a20a1db54a
Implement `RefCell::{try_borrow, try_borrow_mut}` 2016-08-08 23:59:56 -04:00
Tobias Bucher 3d09b4a0d5 Rename `char::escape` to `char::escape_debug` and add tracking issue 2016-07-28 02:20:49 +02:00
Alex Crichton 0c137ab0a6 rustc: Update stage0 to beta-2016-07-06
Hot off the presses, let's update our stage0 compiler!
2016-07-06 09:29:15 -07:00
Sean McArthur db1b1919ba std: use siphash-1-3 for HashMap 2016-06-29 16:08:32 -07:00
Ariel Ben-Yehuda f0174fcbee use the slice_pat hack in libstd too 2016-06-09 00:38:38 +03:00
Alex Crichton fa45670ce4 mk: Prepare for a new stage0 compiler
This commit prepares the source for a new stage0 compiler, the 1.10.0 beta
compiler. These artifacts are hot off the bots and should be ready to go.
2016-05-31 16:11:49 -07:00
Alex Crichton 0ec321f7b5 rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.

[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md

Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.

With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.

Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-05-09 08:22:36 -07:00
Steven Fackler a9779df188 Implement RFC 1542
cc #33417
2016-05-07 08:52:41 -07:00
Alex Crichton 552eda70d3 std: Stabilize APIs for the 1.9 release
This commit applies all stabilizations, renamings, and deprecations that the
library team has decided on for the upcoming 1.9 release. All tracking issues
have gone through a cycle-long "final comment period" and the specific APIs
stabilized/deprecated are:

Stable

* `std::panic`
* `std::panic::catch_unwind` (renamed from `recover`)
* `std::panic::resume_unwind` (renamed from `propagate`)
* `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`)
* `std::panic::UnwindSafe` (renamed from `RecoverSafe`)
* `str::is_char_boundary`
* `<*const T>::as_ref`
* `<*mut T>::as_ref`
* `<*mut T>::as_mut`
* `AsciiExt::make_ascii_uppercase`
* `AsciiExt::make_ascii_lowercase`
* `char::decode_utf16`
* `char::DecodeUtf16`
* `char::DecodeUtf16Error`
* `char::DecodeUtf16Error::unpaired_surrogate`
* `BTreeSet::take`
* `BTreeSet::replace`
* `BTreeSet::get`
* `HashSet::take`
* `HashSet::replace`
* `HashSet::get`
* `OsString::with_capacity`
* `OsString::clear`
* `OsString::capacity`
* `OsString::reserve`
* `OsString::reserve_exact`
* `OsStr::is_empty`
* `OsStr::len`
* `std::os::unix::thread`
* `RawPthread`
* `JoinHandleExt`
* `JoinHandleExt::as_pthread_t`
* `JoinHandleExt::into_pthread_t`
* `HashSet::hasher`
* `HashMap::hasher`
* `CommandExt::exec`
* `File::try_clone`
* `SocketAddr::set_ip`
* `SocketAddr::set_port`
* `SocketAddrV4::set_ip`
* `SocketAddrV4::set_port`
* `SocketAddrV6::set_ip`
* `SocketAddrV6::set_port`
* `SocketAddrV6::set_flowinfo`
* `SocketAddrV6::set_scope_id`
* `<[T]>::copy_from_slice`
* `ptr::read_volatile`
* `ptr::write_volatile`
* The `#[deprecated]` attribute
* `OpenOptions::create_new`

Deprecated

* `std::raw::Slice` - use raw parts of `slice` module instead
* `std::raw::Repr` - use raw parts of `slice` module instead
* `str::char_range_at` - use slicing plus `chars()` plus `len_utf8`
* `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8`
* `str::char_at` - use slicing plus `chars()`
* `str::char_at_reverse` - use slicing plus `chars().rev()`
* `str::slice_shift_char` - use `chars()` plus `Chars::as_str`
* `CommandExt::session_leader` - use `before_exec` instead.

Closes #27719
cc #27751 (deprecating the `Slice` bits)
Closes #27754
Closes #27780
Closes #27809
Closes #27811
Closes #27830
Closes #28050
Closes #29453
Closes #29791
Closes #29935
Closes #30014
Closes #30752
Closes #31262
cc #31398 (still need to deal with `before_exec`)
Closes #31405
Closes #31572
Closes #31755
Closes #31756
2016-04-11 08:57:53 -07:00
Corey Farwell 5972b22b7c Implement `values_mut` on `HashMap`.
https://github.com/rust-lang/rust/issues/32551
2016-04-01 18:35:54 -04:00
mitaa 6a76872d71 Extend linkchecker with anchor checking
This adds checks to ensure that:
* link anchors refer to existing id's on the target page
* id's are unique within an html document
* page redirects are valid
2016-03-27 00:21:00 +01:00
Jorge Aparicio aa7fe93d4a sprinkle feature gates here and there 2016-03-22 22:02:47 -05:00
Eduard Burtescu 473f804491 Add #[rustc_no_mir] to make tests pass with -Z orbit. 2016-03-17 22:48:07 +02:00
Alex Crichton b53764c73b std: Clean out deprecated APIs
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that
are deprecated in the 1.8 release are sticking around for the rest of this
cycle.

Some notable changes are:

* The `dynamic_lib` module was moved into `rustc_back` as the compiler still
  relies on a few bits and pieces.
* The `DebugTuple` formatter now special-cases an empty struct name with only
  one field to append a trailing comma.
2016-03-12 12:31:13 -08:00
bors c6a6053112 Auto merge of #32102 - alexcrichton:assert-safe-closures, r=aturon
std: Add impl of FnOnce to AssertRecoverSafe

This was originally intended, but forgot to land by accident!

cc #27719
2016-03-10 17:52:12 -08:00
Alex Crichton 0d5cfd9117 mk: Distribute fewer TARGET_CRATES
Right now everything in TARGET_CRATES is built by default for all non-fulldeps
tests and is distributed by default for all target standard library packages.
Currenly this includes a number of unstable crates which are rarely used such as
`graphviz` and `rbml`>

This commit trims down the set of `TARGET_CRATES`, moves a number of tests to
`*-fulldeps` as a result, and trims down the dependencies of libtest so we can
distribute fewer crates in the `rust-std` packages.
2016-03-07 13:05:12 -08:00
Alex Crichton ec58f40463 std: Add impl of FnOnce to AssertRecoverSafe
This was originally intended, but forgot to land by accident!

cc #27719
2016-03-07 11:02:43 -08:00
bors 8484831d29 Auto merge of #30884 - durka:inclusive-ranges, r=aturon
This PR implements [RFC 1192](https://github.com/rust-lang/rfcs/blob/master/text/1192-inclusive-ranges.md), which is triple-dot syntax for inclusive range expressions. The new stuff is behind two feature gates (one for the syntax and one for the std::ops types). This replaces the deprecated functionality in std::iter. Along the way I simplified the desugaring for all ranges.

This is my first contribution to rust which changes more than one character outside of a test or comment, so please review carefully! Some of the individual commit messages have more of my notes. Also thanks for putting up with my dumb questions in #rust-internals.

- For implementing `std::ops::RangeInclusive`, I took @Stebalien's suggestion from https://github.com/rust-lang/rfcs/pull/1192#issuecomment-137864421. It seemed to me to make the implementation easier and increase type safety. If that stands, the RFC should be amended to avoid confusion.
- I also kind of like @glaebhoerl's [idea](https://github.com/rust-lang/rfcs/pull/1254#issuecomment-147815299), which is unified inclusive/exclusive range syntax something like `x>..=y`. We can experiment with this while everything is behind a feature gate.
- There are a couple of FIXMEs left (see the last commit). I didn't know what to do about `RangeArgument` and I haven't added `Index` impls yet. Those should be discussed/finished before merging.

cc @Gankro since you [complained](https://www.reddit.com/r/rust/comments/3xkfro/what_happened_to_inclusive_ranges/cy5j0yq)
cc #27777 #30877 rust-lang/rust#1192 rust-lang/rfcs#1254
relevant to #28237 (tracking issue)
2016-03-06 07:16:41 +00:00
Alex Crichton b643782a10 std: Stabilize APIs for the 1.8 release
This commit is the result of the FCPs ending for the 1.8 release cycle for both
the libs and the lang suteams. The full list of changes are:

Stabilized

* `braced_empty_structs`
* `augmented_assignments`
* `str::encode_utf16` - renamed from `utf16_units`
* `str::EncodeUtf16` - renamed from `Utf16Units`
* `Ref::map`
* `RefMut::map`
* `ptr::drop_in_place`
* `time::Instant`
* `time::SystemTime`
* `{Instant,SystemTime}::now`
* `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier`
* `{Instant,SystemTime}::elapsed`
* Various `Add`/`Sub` impls for `Time` and `SystemTime`
* `SystemTimeError`
* `SystemTimeError::duration`
* Various impls for `SystemTimeError`
* `UNIX_EPOCH`
* `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign`

Deprecated

* Scoped TLS (the `scoped_thread_local!` macro)
* `Ref::filter_map`
* `RefMut::filter_map`
* `RwLockReadGuard::map`
* `RwLockWriteGuard::map`
* `Condvar::wait_timeout_with`

Closes #27714
Closes #27715
Closes #27746
Closes #27748
Closes #27908
Closes #29866
2016-02-29 09:05:33 -08:00
Alex Burka 7eb7c56bd4 add indexing with RangeInclusive in libcore and libcollections 2016-02-27 02:01:41 -05:00
Alex Burka c5d58de665 core: add inclusive ranges to core::ops
Since it removes the old iter::{range_inclusive, RangeInclusive} which
were unstable and deprecated, this is a [breaking-change] on nightly.
2016-02-27 02:01:41 -05:00
Ulrik Sverdrup 2d6496dd84 Use .copy_from_slice() where applicable
.copy_from_slice() does the same job of .clone_from_slice(), but the
former is explicitly for Copy elements and calls `memcpy` directly, and
thus is it efficient without optimization too.
2016-02-26 14:51:38 +01:00
John Kåre Alsaker 8ade080412 Fix liballoc dependencies 2016-02-21 15:32:43 +01:00
bors 4b615854f0 Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brson
This commit removes the `-D warnings` flag being passed through the makefiles to
all crates to instead be a crate attribute. We want these attributes always
applied for all our standard builds, and this is more amenable to Cargo-based
builds as well.

Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)`
attribute currently to match the same semantics we have today
2016-01-26 22:10:10 +00:00
Alex Crichton 1fa0be2bc0 std: Stabilize custom hasher support in HashMap
This commit implements the stabilization of the custom hasher support intended
for 1.7 but left out due to some last-minute questions that needed some
decisions. A summary of the actions done in this PR are:

Stable

* `std:#️⃣:BuildHasher`
* `BuildHasher::Hasher`
* `BuildHasher::build_hasher`
* `std:#️⃣:BuildHasherDefault`
* `HashMap::with_hasher`
* `HashMap::with_capacity_and_hasher`
* `HashSet::with_hasher`
* `HashSet::with_capacity_and_hasher`
* `std::collections::hash_map::RandomState`
* `RandomState::new`

Deprecated

* `std::collections::hash_state`
* `std::collections::hash_state::HashState` - this trait was also moved into
  `std::hash` with a reexport here to ensure that we can have a blanket impl to
  prevent immediate breakage on nightly. Note that this is unstable in both
  location.
* `HashMap::with_hash_state` - renamed
* `HashMap::with_capacity_and_hash_state` - renamed
* `HashSet::with_hash_state` - renamed
* `HashSet::with_capacity_and_hash_state` - renamed

Closes #27713
2016-01-26 08:39:07 -08:00
Alex Crichton 2273b52023 mk: Move from `-D warnings` to `#![deny(warnings)]`
This commit removes the `-D warnings` flag being passed through the makefiles to
all crates to instead be a crate attribute. We want these attributes always
applied for all our standard builds, and this is more amenable to Cargo-based
builds as well.

Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)`
attribute currently to match the same semantics we have today
2016-01-24 20:35:55 -08:00
Alex Crichton 9a4f43b9b6 std: Stabilize APIs for the 1.7 release
This commit stabilizes and deprecates the FCP (final comment period) APIs for
the upcoming 1.7 beta release. The specific APIs which changed were:

Stabilized

* `Path::strip_prefix` (renamed from `relative_from`)
* `path::StripPrefixError` (new error type returned from `strip_prefix`)
* `Ipv4Addr::is_loopback`
* `Ipv4Addr::is_private`
* `Ipv4Addr::is_link_local`
* `Ipv4Addr::is_multicast`
* `Ipv4Addr::is_broadcast`
* `Ipv4Addr::is_documentation`
* `Ipv6Addr::is_unspecified`
* `Ipv6Addr::is_loopback`
* `Ipv6Addr::is_unique_local`
* `Ipv6Addr::is_multicast`
* `Vec::as_slice`
* `Vec::as_mut_slice`
* `String::as_str`
* `String::as_mut_str`
* `<[T]>::clone_from_slice` - the `usize` return value is removed
* `<[T]>::sort_by_key`
* `i32::checked_rem` (and other signed types)
* `i32::checked_neg` (and other signed types)
* `i32::checked_shl` (and other signed types)
* `i32::checked_shr` (and other signed types)
* `i32::saturating_mul` (and other signed types)
* `i32::overflowing_add` (and other signed types)
* `i32::overflowing_sub` (and other signed types)
* `i32::overflowing_mul` (and other signed types)
* `i32::overflowing_div` (and other signed types)
* `i32::overflowing_rem` (and other signed types)
* `i32::overflowing_neg` (and other signed types)
* `i32::overflowing_shl` (and other signed types)
* `i32::overflowing_shr` (and other signed types)
* `u32::checked_rem` (and other unsigned types)
* `u32::checked_neg` (and other unsigned types)
* `u32::checked_shl` (and other unsigned types)
* `u32::saturating_mul` (and other unsigned types)
* `u32::overflowing_add` (and other unsigned types)
* `u32::overflowing_sub` (and other unsigned types)
* `u32::overflowing_mul` (and other unsigned types)
* `u32::overflowing_div` (and other unsigned types)
* `u32::overflowing_rem` (and other unsigned types)
* `u32::overflowing_neg` (and other unsigned types)
* `u32::overflowing_shl` (and other unsigned types)
* `u32::overflowing_shr` (and other unsigned types)
* `ffi::IntoStringError`
* `CString::into_string`
* `CString::into_bytes`
* `CString::into_bytes_with_nul`
* `From<CString> for Vec<u8>`
* `From<CString> for Vec<u8>`
* `IntoStringError::into_cstring`
* `IntoStringError::utf8_error`
* `Error for IntoStringError`

Deprecated

* `Path::relative_from` - renamed to `strip_prefix`
* `Path::prefix` - use `components().next()` instead
* `os::unix::fs` constants - moved to the `libc` crate
* `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize
* `IntoCow` - conflicts with `Into` and may come back later
* `i32::{BITS, BYTES}` (and other integers) - not pulling their weight
* `DebugTuple::formatter` - will be removed
* `sync::Semaphore` - not used enough and confused with system semaphores

Closes #23284
cc #27709 (still lots more methods though)
Closes #27712
Closes #27722
Closes #27728
Closes #27735
Closes #27729
Closes #27755
Closes #27782
Closes #27798
2016-01-16 11:03:10 -08:00
Pyfisch 4057808365 fix trailing whitespace 2016-01-07 20:13:59 +01:00
Pyfisch dce47681e2 f32: inline methods with special variant for msvc 2016-01-07 20:13:59 +01:00
Florian Hartwig 0cf5083b24 Fix link that is currently broken due to bad markup 2015-12-26 00:01:10 +01:00
bors 42c3ef8f9f Auto merge of #30417 - alexcrichton:better-detect-elf-tls, r=alexcrichton
Currently a compiler can be built with the `--disable-elf-tls` option for compatibility with OSX 10.6 which doesn't have ELF TLS. This is unfortunate, however, as a whole new compiler must be generated which can take some time. These commits add a new (feature gated) `cfg(target_thread_local)` annotation set by the compiler which indicates whether `#[thread_local]` is available for use. The compiler now interprets `MACOSX_DEPLOYMENT_TARGET` (a standard environment variable) to set this flag on OSX. With this we may want to start compiling our OSX nightlies with `MACOSX_DEPLOYMENT_TARGET` set to 10.6 which would allow the compiler out-of-the-box to generate 10.6-compatible binaries.

For now the compiler still by default targets OSX 10.7 by allowing ELF TLS by default (e.g. if `MACOSX_DEPLOYMENT_TARGET` isn't set).
2015-12-22 09:15:29 +00:00
Alex Crichton cd74364e5d std: Use cfg(target_thread_local) in thread_local!
This transitions the standard library's `thread_local!` macro to use the
freshly-added and gated `#[cfg(target_thread_local)]` attribute. This greatly
simplifies the `#[cfg]` logic in play here, but requires that the standard
library expose both the OS and ELF TLS implementation modules as unstable
implementation details.

The implementation details were shuffled around a bit but end up generally
compiling to the same thing.

Closes #26581 (this supersedes the need for the option)
Closes #27057 (this also starts ignoring the option)
2015-12-21 22:05:37 -08:00
Alex Crichton cd1848a1a6 Register new snapshots
Lots of cruft to remove!
2015-12-21 09:26:21 -08:00
Florian Hahn ca52c56e34 Add memchr implemenation based on rust-memchr to libstd 2015-12-18 13:32:14 +01:00
Tshepang Lekhonkhobe 6fdde01368 doc: add a missing comma 2015-12-17 20:55:20 +02:00
Brian Bowman 73615f7f8a Fix MIN, MAX links
The `MIN` link was broken. Reverts #29624.
2015-12-11 15:00:54 -06:00
Alex Crichton da50f7c288 std: Remove deprecated functionality from 1.5
This is a standard "clean out libstd" commit which removes all 1.5-and-before
deprecated functionality as it's now all been deprecated for at least one entire
cycle.
2015-12-10 11:47:55 -08:00
Alex Crichton 0a13f1abaf std: Rename thread::catch_panic to panic::recover
This commit is an implementation of [RFC 1236] and [RFC 1323] which
rename the `thread::catch_panic` function to `panic::recover` while also
replacing the `Send + 'static` bounds with a new `PanicSafe` bound.

[RFC 1236]: https://github.com/rust-lang/rfcs/pull/1236
[RFC 1323]: https://github.com/rust-lang/rfcs/pull/1323

cc #27719
2015-12-09 07:19:17 -08:00
Alex Crichton 464cdff102 std: Stabilize APIs for the 1.6 release
This commit is the standard API stabilization commit for the 1.6 release cycle.
The list of issues and APIs below have all been through their cycle-long FCP and
the libs team decisions are listed below

Stabilized APIs

* `Read::read_exact`
* `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`)
* libcore -- this was a bit of a nuanced stabilization, the crate itself is now
  marked as `#[stable]` and the methods appearing via traits for primitives like
  `char` and `str` are now also marked as stable. Note that the extension traits
  themeselves are marked as unstable as they're imported via the prelude. The
  `try!` macro was also moved from the standard library into libcore to have the
  same interface. Otherwise the functions all have copied stability from the
  standard library now.
* The `#![no_std]` attribute
* `fs::DirBuilder`
* `fs::DirBuilder::new`
* `fs::DirBuilder::recursive`
* `fs::DirBuilder::create`
* `os::unix::fs::DirBuilderExt`
* `os::unix::fs::DirBuilderExt::mode`
* `vec::Drain`
* `vec::Vec::drain`
* `string::Drain`
* `string::String::drain`
* `vec_deque::Drain`
* `vec_deque::VecDeque::drain`
* `collections::hash_map::Drain`
* `collections::hash_map::HashMap::drain`
* `collections::hash_set::Drain`
* `collections::hash_set::HashSet::drain`
* `collections::binary_heap::Drain`
* `collections::binary_heap::BinaryHeap::drain`
* `Vec::extend_from_slice` (renamed from `push_all`)
* `Mutex::get_mut`
* `Mutex::into_inner`
* `RwLock::get_mut`
* `RwLock::into_inner`
* `Iterator::min_by_key` (renamed from `min_by`)
* `Iterator::max_by_key` (renamed from `max_by`)

Deprecated APIs

* `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`)
* `OsString::from_bytes`
* `OsStr::to_cstring`
* `OsStr::to_bytes`
* `fs::walk_dir` and `fs::WalkDir`
* `path::Components::peek`
* `slice::bytes::MutableByteVector`
* `slice::bytes::copy_memory`
* `Vec::push_all` (renamed to `extend_from_slice`)
* `Duration::span`
* `IpAddr`
* `SocketAddr::ip`
* `Read::tee`
* `io::Tee`
* `Write::broadcast`
* `io::Broadcast`
* `Iterator::min_by` (renamed to `min_by_key`)
* `Iterator::max_by` (renamed to `max_by_key`)
* `net::lookup_addr`

New APIs (still unstable)

* `<[T]>::sort_by_key` (added to mirror `min_by_key`)

Closes #27585
Closes #27704
Closes #27707
Closes #27710
Closes #27711
Closes #27727
Closes #27740
Closes #27744
Closes #27799
Closes #27801
cc #27801 (doesn't close as `Chars` is still unstable)
Closes #28968
2015-12-05 15:09:44 -08:00
Vadim Petrochenkov be8ace8cac Remove all uses of `#[staged_api]` 2015-11-25 21:55:26 +03:00
Vadim Petrochenkov a613059e3f Rename #[deprecated] to #[rustc_deprecated] 2015-11-20 16:11:20 +03:00
Vadim Petrochenkov 7e2ffc7090 Add missing annotations and some tests 2015-11-18 01:24:21 +03:00
Alex Crichton 3d28b8b98e std: Migrate to the new libc
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself
* Update all references to use `libc` as a result.
* Update all references to the new flat namespace.
* Moves all windows bindings into sys::c
2015-11-09 22:55:50 -08:00
Rizky Luthfianto edee023297 doc(lib.rs): fix #L79 with inline link syntax 2015-11-06 00:15:32 +07:00
bors fa7a3c210d Auto merge of #29484 - steveklabnik:gh29330, r=brson
These two commits do a few things:

1. reformat to 80 cols
2. use the reference-style links where appropriate for improved in-source readability
3. adds a few links, tweaks a couple of words, `3` -> `three`, stuff like that

While the diff is big due to these edits, there's no significant content change.

r? @brson
2015-10-31 04:04:45 +00:00
Steve Klabnik 744df28758 Some fixes to std index docs
Part of https://github.com/rust-lang/rust/issues/29330

Needed because of https://github.com/rust-lang/rust/issues/29481 and https://github.com/rust-lang/rust/issues/29483
2015-10-30 17:43:05 -04:00
Steve Klabnik e2906dbeac Clean up formatting on std main page
Part of #29330
2015-10-30 17:18:26 -04:00
Alexis Beingessner e351595c61 don't use drop_in_place as an intrinsic 2015-10-30 11:24:54 -04:00
Alex Crichton ff49733274 std: Stabilize library APIs for 1.5
This commit stabilizes and deprecates library APIs whose FCP has closed in the
last cycle, specifically:

Stabilized APIs:

* `fs::canonicalize`
* `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists,
   is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait.
* `Formatter::fill`
* `Formatter::width`
* `Formatter::precision`
* `Formatter::sign_plus`
* `Formatter::sign_minus`
* `Formatter::alternate`
* `Formatter::sign_aware_zero_pad`
* `string::ParseError`
* `Utf8Error::valid_up_to`
* `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}`
* `<[T]>::split_{first,last}{,_mut}`
* `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated
  but will be once 1.5 is released.
* `str::{R,}MatchIndices`
* `str::{r,}match_indices`
* `char::from_u32_unchecked`
* `VecDeque::insert`
* `VecDeque::shrink_to_fit`
* `VecDeque::as_slices`
* `VecDeque::as_mut_slices`
* `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`)
* `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`)
* `Vec::resize`
* `str::slice_mut_unchecked`
* `FileTypeExt`
* `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}`
* `BinaryHeap::from` - `from_vec` deprecated in favor of this
* `BinaryHeap::into_vec` - plus a `Into` impl
* `BinaryHeap::into_sorted_vec`

Deprecated APIs

* `slice::ref_slice`
* `slice::mut_ref_slice`
* `iter::{range_inclusive, RangeInclusive}`
* `std::dynamic_lib`

Closes #27706
Closes #27725
cc #27726 (align not stabilized yet)
Closes #27734
Closes #27737
Closes #27742
Closes #27743
Closes #27772
Closes #27774
Closes #27777
Closes #27781
cc #27788 (a few remaining methods though)
Closes #27790
Closes #27793
Closes #27796
Closes #27810
cc #28147 (not all parts stabilized)
2015-10-25 09:36:32 -07:00
Andrew Paseltiner 1162b3752c Correct spelling in docs 2015-10-13 09:44:11 -04:00
Felix S. Klock II d778e57bf6 Add RFC 1238's `unsafe_destructor_blind_to_params` (UGEH) where needed.
I needed it in `RawVec`, `Vec`, and `TypedArena` for `rustc` to
bootstrap; but of course that alone was not sufficient for `make
check`.

Later I added `unsafe_destructor_blind_to_params` to collections, in
particular `LinkedList` and `RawTable` (the backing representation for
`HashMap` and `HashSet`), to get the regression tests exercising
cyclic structure from PR #27185 building.

----

Note that the feature is `dropck_parametricity` (which is not the same
as the attribute's name). We will almost certainly vary our strategy
here in the future, so it makes some sense to have a not-as-ugly name
for the feature gate. (The attribute name was deliberately selected to
be ugly looking.)
2015-10-06 14:16:49 +02:00
Manish Goregaokar 30b43c1b12 Rollup merge of #28682 - apasel422:features, r=steveklabnik 2015-09-27 15:05:18 +05:30
Andrew Paseltiner 589c82449a Remove unnecessary `#![feature]` attributes 2015-09-26 15:59:31 -04:00
Sebastian Wicki c099cfab06 Add support for the rumprun unikernel
For most parts, rumprun currently looks like NetBSD, as they share the same
libc and drivers. However, being a unikernel, rumprun does not support
process management, signals or virtual memory, so related functions
might fail at runtime. Stack guards are disabled exactly for this reason.

Code for rumprun is always cross-compiled, it uses always static
linking and needs a custom linker.
2015-09-26 14:10:14 +02:00
Simon Mazur 970b86b1bb doc: Fix broken links 2015-09-20 13:24:47 +03:00
bors 2d4ae52cbd Auto merge of #28358 - dotdash:nounwind, r=alexcrichton
This allows to skip the codegen for all the unneeded landing pads, reducing code size across the board by about 2-5%, depending on the crate. Compile times seem to be pretty unaffected though :-/
2015-09-14 11:05:34 +00:00
Björn Steinbrink 3ef75d5774 Mark all extern functions as nounwind
Unwinding across an FFI boundary is undefined behaviour, so we can mark
all external function as nounwind. The obvious exception are those
functions that actually perform the unwinding.
2015-09-14 11:36:09 +02:00
Alex Crichton f0b1326dc7 std: Stabilize/deprecate features for 1.4
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the
libs team decision for all library features this cycle.

Stabilized APIs:

* `<Box<str>>::into_string`
* `Arc::downgrade`
* `Arc::get_mut`
* `Arc::make_mut`
* `Arc::try_unwrap`
* `Box::from_raw`
* `Box::into_raw`
* `CStr::to_str`
* `CStr::to_string_lossy`
* `CString::from_raw`
* `CString::into_raw`
* `IntoRawFd::into_raw_fd`
* `IntoRawFd`
* `IntoRawHandle::into_raw_handle`
* `IntoRawHandle`
* `IntoRawSocket::into_raw_socket`
* `IntoRawSocket`
* `Rc::downgrade`
* `Rc::get_mut`
* `Rc::make_mut`
* `Rc::try_unwrap`
* `Result::expect`
* `String::into_boxed_slice`
* `TcpSocket::read_timeout`
* `TcpSocket::set_read_timeout`
* `TcpSocket::set_write_timeout`
* `TcpSocket::write_timeout`
* `UdpSocket::read_timeout`
* `UdpSocket::set_read_timeout`
* `UdpSocket::set_write_timeout`
* `UdpSocket::write_timeout`
* `Vec::append`
* `Vec::split_off`
* `VecDeque::append`
* `VecDeque::retain`
* `VecDeque::split_off`
* `rc::Weak::upgrade`
* `rc::Weak`
* `slice::Iter::as_slice`
* `slice::IterMut::into_slice`
* `str::CharIndices::as_str`
* `str::Chars::as_str`
* `str::split_at_mut`
* `str::split_at`
* `sync::Weak::upgrade`
* `sync::Weak`
* `thread::park_timeout`
* `thread::sleep`

Deprecated APIs

* `BTreeMap::with_b`
* `BTreeSet::with_b`
* `Option::as_mut_slice`
* `Option::as_slice`
* `Result::as_mut_slice`
* `Result::as_slice`
* `f32::from_str_radix`
* `f64::from_str_radix`

Closes #27277
Closes #27718
Closes #27736
Closes #27764
Closes #27765
Closes #27766
Closes #27767
Closes #27768
Closes #27769
Closes #27771
Closes #27773
Closes #27775
Closes #27776
Closes #27785
Closes #27792
Closes #27795
Closes #27797
2015-09-11 09:48:48 -07:00
Simon Sapin 6174b8d726 Refactor low-level UTF-16 decoding.
* Rename `utf16_items` to `decode_utf16`. "Items" is meaningless.
* Move it to `rustc_unicode::char`, exposed in `std::char`.
* Generalize it to any `u16` iterable, not just `&[u16]`.
* Make it yield `Result` instead of a custom `Utf16Item` enum that was isomorphic to `Result`. This enable using the `FromIterator for Result` impl.
* Add a `REPLACEMENT_CHARACTER` constant.
* Document how `result.unwrap_or(REPLACEMENT_CHARACTER)` replaces `Utf16Item::to_char_lossy`.
2015-08-23 00:28:56 +02:00
bors 94ee3b5a54 Auto merge of #27871 - alexcrichton:stabilize-libcore, r=aturon
These commits move libcore into a state so that it's ready for stabilization, performing some minor cleanup:

* The primitive modules for integers in the standard library were all removed from the source tree as they were just straight reexports of the libcore variants.
* The `core::atomic` module now lives in `core::sync::atomic`. The `core::sync` module is otherwise empty, but ripe for expansion!
* The `core::prelude::v1` module was stabilized after auditing that it is a subset of the standard library's prelude plus some primitive extension traits (char, str, and slice)
* Some unstable-hacks for float parsing errors were shifted around to not use the same unstable hacks (e.g. the `flt2dec` module is now used for "privacy").


After this commit, the remaining large unstable functionality specific to libcore is:

* `raw`, `intrinsics`, `nonzero`, `array`, `panicking`, `simd` -- these modules are all unstable or not reexported in the standard library, so they're just remaining in the same status quo as before
* `num::Float` - this extension trait for floats needs to be audited for functionality (much of that is happening in #27823)  and may also want to be renamed to `FloatExt` or `F32Ext`/`F64Ext`.
* Should the extension traits for primitives be stabilized in libcore?

I believe other unstable pieces are not isolated to just libcore but also affect the standard library.

cc #27701
2015-08-22 09:59:07 +00:00
bors e9b74a9017 Auto merge of #27860 - m4rw3r:rustdoc_unstable_feature_issue, r=alexcrichton
Implemented #27759 

Example:

![screen shot 2015-08-16 at 21 45 17](https://cloud.githubusercontent.com/assets/108100/9295040/1fb24d50-4460-11e5-8ab8-81ac5330974a.png)
2015-08-22 08:16:53 +00:00
Huon Wilson c66554cab3 switch core::simd to repr(simd) and deprecate it.
This functionality will be available out of tree in the `simd` crate on
crates.io.

[breaking-change]
2015-08-17 14:41:37 -07:00
Alex Crichton 8cb4d8671a std: Clean up primitive integer modules
All of the modules in the standard library were just straight reexports of those
in libcore, so remove all the "macro modules" from the standard library and just
reexport what's in core directly.
2015-08-17 14:03:32 -07:00
Martin Wernstål 7fdbe69996 rustdoc: Added issue_tracker_base_url annotations to crates 2015-08-16 22:15:26 +02:00
Alex Crichton 5f625620b5 std: Add issues to all unstable features 2015-08-15 18:09:17 -07:00
Alex Crichton 45bf1ed1a1 rustc: Allow changing the default allocator
This commit is an implementation of [RFC 1183][rfc] which allows swapping out
the default allocator on nightly Rust. No new stable surface area should be
added as a part of this commit.

[rfc]: https://github.com/rust-lang/rfcs/pull/1183

Two new attributes have been added to the compiler:

* `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to
  indicate that it requires an allocator crate to be in scope.
* `#![allocator]` - this is a indicator that the crate is an allocator which can
  satisfy the `needs_allocator` attribute above.

The ABI of the allocator crate is defined to be a set of symbols that implement
the standard Rust allocation/deallocation functions. The symbols are not
currently checked for exhaustiveness or typechecked. There are also a number of
restrictions on these crates:

* An allocator crate cannot transitively depend on a crate that is flagged as
  needing an allocator (e.g. allocator crates can't depend on liballoc).
* There can only be one explicitly linked allocator in a final image.
* If no allocator is explicitly requested one will be injected on behalf of the
  compiler. Binaries and Rust dylibs will use jemalloc by default where
  available and staticlibs/other dylibs will use the system allocator by
  default.

Two allocators are provided by the distribution by default, `alloc_system` and
`alloc_jemalloc` which operate as advertised.

Closes #27389
2015-08-14 15:13:10 -07:00
Alex Crichton 8d90d3f368 Remove all unstable deprecated functionality
This commit removes all unstable and deprecated functions in the standard
library. A release was recently cut (1.3) which makes this a good time for some
spring cleaning of the deprecated functions.
2015-08-12 14:55:17 -07:00
Alex Crichton 837ae4f3d4 rollup merge of #27678: alexcrichton/snapshots
* Lots of core prelude imports removed
* Makefile support for MSVC env vars and Rust crates removed
* Makefile support for morestack removed
2015-08-11 22:42:22 -07:00
Alex Crichton 938099a7eb Register new snapshots
* Lots of core prelude imports removed
* Makefile support for MSVC env vars and Rust crates removed
* Makefile support for morestack removed
2015-08-11 15:11:13 -07:00
Eli Friedman bbbfed2f93 Use https URLs to refer to rust-lang.org where appropriate.
Also fixes a few outdated links.
2015-08-09 14:28:46 -07:00
Alex Crichton 0d8340327c syntax: Don't assume `std` exists for tests
This commit removes the injection of `std::env::args()` from `--test` expanded
code, relying on the test runner itself to call this funciton. This is more
hygienic because we can't assume that `std` exists at the top layer all the
time, and it meaks the injected test module entirely self contained.
2015-08-04 14:02:36 -07:00
Alex Crichton 5cccf3cd25 syntax: Implement #![no_core]
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of
the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The
`#![no_std]` attribute now injects `extern crate core` at the top of the crate
as well as the libcore prelude into all modules (in the same manner as the
standard library's prelude). The `#![no_core]` attribute disables both std and
core injection.

[rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-08-03 17:23:01 -07:00
Brian Anderson ffa21217d2 std: Tighten up crate docs 2015-08-02 11:09:37 -07:00
FuGangqiang b399729298 trpl: fix link error 2015-07-31 16:25:17 +08:00
bors 6edc994021 Auto merge of #27388 - alexcrichton:remove-curious-inner, r=brson
This isn't actually necessary any more with the advent of `$crate` and changes
in the compiler to expand macros to `::core::$foo` in the context of a
`#![no_std]` crate.

The libcore inner module was also trimmed down a bit to the bare bones.
2015-07-30 18:42:32 +00:00
Alex Crichton 5af6cf9fa4 std: Remove the curious inner module
This isn't actually necessary any more with the advent of `$crate` and changes
in the compiler to expand macros to `::core::$foo` in the context of a
`#![no_std]` crate.

The libcore inner module was also trimmed down a bit to the bare bones.
2015-07-29 14:18:24 -07:00
Manish Goregaokar 35d95515f3 Rollup merge of #27369 - brson:realstd, r=alexcrichton
Since most lang items are actually defined in core, these hack reexports don't actually
do anything useful.
2015-07-30 01:43:53 +05:30
Brian Anderson 6464198508 std: Remove some old #[cfg(test) hacks
Since most lang items are actually defined in core, these hack reexports don't actually
do anything useful.
2015-07-28 16:22:05 -07:00
bors 5b72fa42d4 Auto merge of #27309 - eddyb:snapshot-infdef, r=alexcrichton
FreeBSD i386 snapshot is missing, failed tests (possibly spurious).
r? @alexcrichton
2015-07-28 08:51:21 +00:00
Alex Crichton b3aa1a6d4a std: Deprecate a number of unstable features
Many of these have long since reached their stage of being obsolete, so this
commit starts the removal process for all of them. The unstable features that
were deprecated are:

* cmp_partial
* fs_time
* hash_default
* int_slice
* iter_min_max
* iter_reset_fuse
* iter_to_vec
* map_in_place
* move_from
* owned_ascii_ext
* page_size
* read_and_zero
* scan_state
* slice_chars
* slice_position_elem
* subslice_offset
2015-07-27 16:38:25 -07:00
Eduard Burtescu 5720f7055a Register new snapshots (2015-07-26 a5c12f4). 2015-07-27 13:31:48 +03:00
bors e4f044662b Auto merge of #27233 - tbu-:pr_wtf8, r=alexcrichton 2015-07-25 04:25:33 +00:00
Tobias Bucher c2fca7c957 Add unstable attribute to `char::from_u32_unchecked` 2015-07-24 01:58:38 +02:00
Felix S. Klock II cb5f0b4971 Avoid feature-warnings on stage0. 2015-07-22 15:34:00 +02:00
Felix S. Klock II b325e4f28e Add feature-gates for desugaring-based `box` and placement-`in`.
update test/compile-fail/feature-gate-box-expr.rs to reflect new feature gates.

Part of what lands with Issue 22181.
2015-07-22 15:33:59 +02:00
Brian Anderson 778c89c1bb Address feedback 2015-07-20 17:12:59 -07:00
Brian Anderson 8497c428e5 std: Create separate docs for the primitives
Having the primitive and module docs derived from the same source
causes problems, primarily that they can't contain hyperlinks
cross-referencing each other.

This crates dedicated private modules in `std` to document the
primitive types, then for all primitives that have a corresponding
module, puts hyperlinks in moth the primitive docs and the module docs
cross-linking each other.

This should help clear up confusion when readers find themselves on
the wrong page.
2015-07-20 13:18:06 -07:00
Manish Goregaokar 3a5bc736ae Rollup merge of #26977 - brson:stddoc, r=Gankro
Yet another attempt to make the prose on the std crate page
clearer and more informative.

This does a lot of things: tightens up the opening, adds useful links
(including a link to the search bar), offers guidance on how to use
the docs, and expands the prelude docs as a useful newbie entrypoint.

r? @steveklabnik cc @aturon
2015-07-16 10:48:47 +05:30
Brian Anderson 2881bbad59 Address more feedback 2015-07-14 14:41:50 -07:00
Brian Anderson 6d5ae6b20d Address more feedback 2015-07-14 10:27:33 -07:00
Ulrik Sverdrup 7b51c1c573 Use Vec::drain in BufWriter
I happened past a comment that asked for functionality that we now have.
2015-07-14 11:43:24 +02:00
Brian Anderson 3a180d15f8 Address feedback 2015-07-13 18:38:00 -07:00
Brian Anderson 4089ba873e Fix local path 2015-07-13 17:56:47 -07:00
Brian Anderson 68781e25c5 std: Refining crate docs
Yet another attempt to make the prose on the std crate page
clearer and more informative.

This does a lot of things: tightens up the opening, adds useful links
(including a link to the search bar), offers guidance on how to use
the docs, and expands the prelude docs as a useful newbie entrypoint.
2015-07-13 17:56:47 -07:00
Jonathan Reem 69579e4d37 Test that CStr and CString have equivalent hashes. 2015-07-09 17:41:09 -07:00
Ulrik Sverdrup 6ac0ba3c3a Improve Vec::resize so that it can be used in Read::read_to_end
We needed a more efficient way to zerofill the vector in read_to_end.
This to reduce the memory intialization overhead to a minimum.

Use the implementation of `std::vec::from_elem` (used for the vec![]
macro) for Vec::resize as well. For simple element types like u8, this
compiles to memset, so it makes Vec::resize much more efficient.
2015-07-08 19:40:40 +02:00
Alex Crichton ae0eb675db msvc: Fix TLS destructors
Just like the original article our Windows TLS support is based on predicted,
this symbol must be linked in on MSVC to pull in the necessary support for TLS
variables. This commit fixes a number of unit tests which require that TLS
destructors are run.
2015-07-01 09:35:55 -07:00
Brian Anderson 9b30eabc22 Fix capitalization in std docs
"Rust" and "The Rust Standard Library" are capitalized.
2015-06-24 14:33:41 -07:00
Geoffrey Thomas e13642163a sys/unix/c.rs: Remove unused code
It looks like a lot of this dated to previous incarnations of the io
module, etc., and went unused in the reworking leading up to 1.0. Remove
everything we're not actively using (except for signal handling, which
will be reworked in the next commit).
2015-06-22 00:55:42 -04:00
Alex Crichton ec333380e0 Fix libstd tests 2015-06-18 10:51:31 -07:00
Alex Crichton b4a2823cd6 More test fixes and fallout of stability changes 2015-06-17 09:07:17 -07:00
Alex Crichton ce1a965cf5 Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
Alex Crichton 6895311e85 std: Split the `std_misc` feature 2015-06-17 09:06:59 -07:00
Alex Crichton d444d0c357 collections: Split the `collections` feature
This commit also deprecates the `as_string` and `as_slice` free functions in the
`string` and `vec` modules.
2015-06-17 09:06:59 -07:00
Alex Crichton c44f5399e4 alloc: Split apart the global `alloc` feature 2015-06-17 09:06:59 -07:00
Alex Crichton c14d86fd3f core: Split apart the global `core` feature
This commit shards the broad `core` feature of the libcore library into finer
grained features. This split groups together similar APIs and enables tracking
each API separately, giving a better sense of where each feature is within the
stabilization process.

A few minor APIs were deprecated along the way:

* Iterator::reverse_in_place
* marker::NoCopy
2015-06-17 09:06:59 -07:00
Eduard Burtescu 377b0900ae Use `const fn` to abstract away the contents of UnsafeCell & friends. 2015-05-27 11:19:03 +03:00
Oliver Schneider d5985d3036 Rollup merge of #25709 - MatejLach:stdlib_style, r=steveklabnik
Sounds better to me this way.
r @steveklabnik ?
2015-05-23 19:03:19 +02:00
Matej Ľach e790db7518 better describe the stdlib 2015-05-22 16:42:57 +01:00
Steven Fackler e161d5cf73 Stabilize debug builders for 1.2.0 2015-05-19 21:57:39 -07:00
bors 6403a2fc32 Auto merge of #25462 - alexcrichton:favicon-https, r=nrc
Helps prevent mixed content warnings if accessing docs over HTTPS.

Closes #25459
2015-05-16 17:41:28 +00:00
Alex Crichton 0e21beb761 libs: Move favicon URLs to HTTPS
Helps prevent mixed content warnings if accessing docs over HTTPS.

Closes #25459
2015-05-15 16:04:01 -07:00
Ivan Ukhov a8260fe752 std: fix a link 2015-05-15 14:46:51 -04:00
Steve Klabnik 8d522746f3 Rollup merge of #25414 - apasel422:patch-1, r=alexcrichton 2015-05-14 20:30:43 -04:00
Andrew Paseltiner 50fb669241 s/Iterater/Iterator/ 2015-05-14 15:57:33 -04:00
Wangshan Lu 62d0ef41c1 Fix crates.io link. 2015-05-14 21:08:20 +08:00
Brian Anderson 6ebba71a75 doc: Address feedback 2015-05-12 10:53:57 -07:00