Commit Graph

76793 Commits

Author SHA1 Message Date
Simon Sapin
743c29bdc5 Actually deprecate heap modules. 2018-04-12 22:52:47 +02:00
Simon Sapin
09e8db1e4f Rename heap modules in the core, alloc, and std crates to alloc 2018-04-12 22:52:47 +02:00
Simon Sapin
1b895d8b88 Import the alloc crate as alloc_crate in std
… to make the name `alloc` available.
2018-04-12 22:52:47 +02:00
Simon Sapin
c660cedc02 Add a GlobalAlloc trait 2018-04-12 22:52:47 +02:00
Simon Sapin
9b068867f0 Add a core::heap::Void extern type. 2018-04-12 22:52:47 +02:00
Simon Sapin
1569f8f812 Inline docs for the heap module’s reexports 2018-04-12 22:52:47 +02:00
bors
6c537493d0 Auto merge of #49558 - Zoxc:sync-misc, r=michaelwoerister
Even more thread-safety changes

r? @michaelwoerister
2018-04-12 16:22:36 +00:00
bors
9afed64645 Auto merge of #49551 - scottmcm:deprecate-offset_to, r=KodrAus
Deprecate offset_to; switch core&alloc to using offset_from instead

Bonus: might make code than uses `.len()` on slice iterators faster

cc https://github.com/rust-lang/rust/issues/41079
2018-04-12 08:29:10 +00:00
bors
252a459d37 Auto merge of #49371 - scottmcm:catch-wrapping, r=nikomatsakis
Add ok-wrapping to catch blocks, per RFC

Updates the `catch{}` lowering to wrap the result in `Try::from_ok`.

r? @nikomatsakis

Fixes #41414
Fixes #43818
2018-04-12 05:38:49 +00:00
bors
47778811d9 Auto merge of #48528 - bitshifter:repr_packed, r=eddyb
Implementation of `#[repr(packed(n))]` RFC 1399.

Tracking issue https://github.com/rust-lang/rust/issues/33158.
2018-04-12 03:08:14 +00:00
bors
d26f9e42df Auto merge of #49698 - SimonSapin:unicode-for-everyone, r=alexcrichton
Merge the std_unicode crate into the core crate

[The standard library facade](https://github.com/rust-lang/rust/issues/27783) has historically contained a number of crates with different roles, but that number has decreased over time. `rand` and `libc` have moved to crates.io, and [`collections` was merged into `alloc`](https://github.com/rust-lang/rust/pull/42648). Today we have `core` that applies everywhere, `std` that expects a full operating system, and `alloc` in-between that only requires a memory allocator (which can be provided by users)… and `std_unicode`, which doesn’t really have a reason to be separate anymore. It contains functionality based on Unicode data tables that can be large, but as long as relevant functions are not called the tables should be removed from binaries by linkers.

This deprecates the unstable `std_unicode` crate and moves all of its contents into `core`, replacing them with `pub use` reexports. The crate can be removed later. This also removes the `CharExt` trait (replaced with inherent methods in libcore) and `UnicodeStr` trait (merged into `StrExt`). There traits were both unstable and not intended to be used or named directly.

A number of new items are newly-available in libcore and instantly stable there, but only if they were already stable in libstd.

Fixes #49319.
2018-04-12 00:35:33 +00:00
Simon Sapin
ef41788cf3 Mark the rest of the unicode feature flag as perma-unstable. 2018-04-12 00:13:53 +02:00
Simon Sapin
1ca2905cda Dedicated tracking issue for UnicodeVersion and UNICODE_VERSION. 2018-04-12 00:13:53 +02:00
Simon Sapin
670e85339a Move core::char::printable to core::unicode::printable 2018-04-12 00:13:53 +02:00
Simon Sapin
d4ed1e6fa4 Merge unstable Utf16Encoder into EncodeUtf16 2018-04-12 00:13:53 +02:00
Simon Sapin
0d9afcd9b9 Merge core::unicode::str into core::str
And the UnicodeStr trait into StrExt
2018-04-12 00:13:52 +02:00
Simon Sapin
33358dc3c5 Remove the CharExt trait, now that libcore has inherent methods for char 2018-04-12 00:13:52 +02:00
Simon Sapin
34c52534f7 Move the rest of core::unicode::char to core::unicode 2018-04-12 00:13:52 +02:00
Simon Sapin
1800d695b9 Move char conversions into a separate private module. 2018-04-12 00:13:52 +02:00
Simon Sapin
955450212a Move char decoding iterators into a separate private module. 2018-04-12 00:13:52 +02:00
Simon Sapin
939692409d Reexport from core::unicode::char in core::char rather than vice versa 2018-04-12 00:13:52 +02:00
Simon Sapin
3613b0b52f Move the core::char module to its own directory 2018-04-12 00:13:52 +02:00
Simon Sapin
b2027ef17c Deprecate the std_unicode crate 2018-04-12 00:13:51 +02:00
Simon Sapin
5807be7ccb Move contents of libstd_unicode into libcore 2018-04-12 00:13:43 +02:00
Simon Sapin
f87d4a15a8 Move Utf8Lossy decoder to libcore 2018-04-12 00:13:43 +02:00
Simon Sapin
ae6adf335c Move char::REPLACEMENT_CHARACTER to libcore 2018-04-12 00:13:43 +02:00
bors
e28ef22ae5 Auto merge of #49875 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

Successful merges:

 - #49525 (Use sort_by_cached_key where appropriate)
 - #49575 (Stabilize `Option::filter`.)
 - #49614 (in which the non-shorthand patterns lint keeps its own counsel in macros)
 - #49665 (Small nits to make couple of tests pass on mips targets.)
 - #49781 (add regression test for #16223 (NLL): use of collaterally moved value)
 - #49795 (Properly look for uninhabitedness of variants in niche-filling check)
 - #49809 (Stop emitting color codes on TERM=dumb)
 - #49856 (Do not uppercase-lint #[no_mangle] statics)
 - #49863 (fixed typo)
 - #49857 (Fix "fp" target feature for AArch64)
 - #49849 (Add --enable-debug flag to musl CI build script)
 - #49734 (proc_macro: Generalize `FromIterator` impl)
 - #49730 (Fix ICE with impl Trait)
 - #48270 (Replace `structurally_resolved_type` in casts check.)

Failed merges:
2018-04-11 21:42:32 +00:00
kennytm
9f6e5ae024
Rollup merge of #48270 - leodasvacas:refactor-casts, r=nikomatsakis
Replace `structurally_resolved_type` in casts check.

The behaviour of `resolve_type_vars_if_possible` is simpler and infallible. Other minor refactorings.

I'm not sure if this is backwards compatible, in theory resolving obligations between two cast checks could solve a dependency between them, but I don't know if that's actually possible and it doesn't sound like something we'd want to support.
2018-04-12 03:41:36 +08:00
kennytm
484e6f0ada
Rollup merge of #49730 - sinkuu:fix_ice_49556, r=cramertj
Fix ICE with impl Trait

Fixes https://github.com/rust-lang/rust/issues/49556#issuecomment-379154713. May or may not fix 49556 itself. Closures like `|x: &'a _| x` has `ClosureSubsts` of `fn(&'a _) -> &'(ReScope) _`, so `tcx.note_and_explain_free_region` (called [here](a143462783/src/librustc/infer/anon_types/mod.rs (L572))) panics.
2018-04-12 03:38:16 +08:00
kennytm
574c0502f1
Rollup merge of #49734 - alexcrichton:generalize-token-stream, r=nikomatsakis
proc_macro: Generalize `FromIterator` impl

While never intended to be stable we forgot that trait impls are insta-stable!
This construction of `FromIterator` wasn't our first choice of how to stabilize
the impl but our hands are tied at this point, so revert back to the original
definition of `FromIterator` before #49597

Closes #49725
2018-04-12 03:37:12 +08:00
kennytm
57b15f62e0
Rollup merge of #49849 - alecmocatta:master, r=alexcrichton
Add --enable-debug flag to musl CI build script

Building for x86_64-unknown-linux-musl currently results in an executable lacking debug information for musl libc itself. If you request a backtrace in GDB while control flow is within musl – including sycalls made by musl – the result looks like:

```
#0  0x0000000000434b46 in __cp_end ()
#1  0x0000000000432dbd in __syscall_cp_c ()
#2  0x0000000000000000 in ?? ()
```

i.e. not very helpful. Adding --enable-debug resolves this, and --enable-optimize re-enables optimisations which default to off given the previous flag.
2018-04-12 03:34:49 +08:00
kennytm
dfdcf63612
Rollup merge of #49857 - Amanieu:aarch64_fp, r=alexcrichton
Fix "fp" target feature for AArch64

This fixes the following warning on AArch64:
```
'+fp' is not a recognized feature for this target (ignoring feature)
```

Fixes #49782
2018-04-12 03:23:22 +08:00
kennytm
7a7092846c
Rollup merge of #49863 - memoryleak47:andorid, r=oli-obk
fixed typo
2018-04-12 03:23:21 +08:00
kennytm
0629309a7d
Rollup merge of #49856 - varkor:no_mangle-statics-unlinted, r=michaelwoerister
Do not uppercase-lint #[no_mangle] statics

The reasoning being that `#[no_mangle]` expresses enough intention that there's likely a good reason for the name.

Fixes #36258.
2018-04-12 03:23:19 +08:00
bors
ad610bed83 Auto merge of #49872 - oli-obk:clippy, r=Manishearth
Update clippy and rls

r? @Manishearth
2018-04-11 18:58:17 +00:00
bors
32428808b4 Auto merge of #49861 - pnkfelix:compare-mode-nll-followup-2, r=nikomatsakis
Blindly checkpoint status of NLL mode ui tests

This takes the next (and potentially final?) step with #48879.

Namely, this PR got things to the point where I can successfully run `compiletest` on `src/test/ui` with `--compile-mode=nll`.

Here are the main pieces of it:

 1. To figure out how to even run `compiletest` normally on the ui directory, I ran `x.py test -vv`, and then looked for the `compiletest` invocation that mentioned `src/test/ui`.
 2. I took the aforementioned `compiletest` invocation and used it, adding `--compile-mode=nll` to the end. It had 170 failing cases.
 3. Due to #49855, I had to edit some of the tests so that they fail even under NLL, via `#[rustc_error]`. That's the first commit. (Then goto 2 to double-check no such tests remain.)
 4. I took the generated `build/target/test/foo.stderr` file for every case that failed, and blindly copied it to `src/test/foo.nll.stderr`. That's the second commit.
 5. Goto 2 until there were no failing cases.
 6. Remove any stamp files, and re-run `x.py test` to make sure that the edits and new `.nll.stderr` files haven't broken the pre-existing test suite.
2018-04-11 14:37:39 +00:00
Cameron Hart
15d1c4d213 Implementation of #[repr(packed(n))] RFC 1399. 2018-04-11 22:13:13 +10:00
kennytm
4dbca4c8ac
Rollup merge of #49809 - Mark-Simulacrum:no-color-for-dumb, r=alexcrichton
Stop emitting color codes on TERM=dumb

These terminals generally don't support color.

Fixes #49191

cc @nikomatsakis

r? @alexcrichton
2018-04-11 19:56:48 +08:00
kennytm
6eb66fc315
Rollup merge of #49795 - nox:niche-with-uninhabited-fields, r=eddyb
Properly look for uninhabitedness of variants in niche-filling check
2018-04-11 19:56:47 +08:00
kennytm
f4b9fdace5
Rollup merge of #49781 - Robbepop:master, r=nikomatsakis
add regression test for #16223 (NLL): use of collaterally moved value

Adds regression test for https://github.com/rust-lang/rust/issues/16223 which NLL fixes.

The current downside of this test is that it uses the `#![feature(box_patterns)]` and I haven't come up with a proper test that only uses the `#![feature(nll)]` - however, I don't know if this is even possible to test without `#![feature(box_syntax)]` or `#![feature(box_patterns)]`.
2018-04-11 19:56:46 +08:00
kennytm
1bdb9a5cfa
Rollup merge of #49665 - draganmladjenovic:mips_tests, r=nikomatsakis
Small nits to make couple of tests pass on mips targets.
2018-04-11 19:56:44 +08:00
kennytm
63c4d50e8a
Rollup merge of #49614 - zackmdavis:the_phantom_menace, r=petrochenkov
in which the non-shorthand patterns lint keeps its own counsel in macros

In issue #49588, Michael Lamparski pointed out a scenario in which the
non-shorthand-field-patterns lint could be triggered by a macro-expanded
pattern, in a way which was direly unwieldy for the macro author to guard
against and unreasonable to expect the macro user to take into account. We can
avoid this by not linting patterns that come from macro-expansions. Although
this entails accepting "false negatives" where the lint could genuinely improve
macro-templated code, avoiding the reported "true-but-super-annoying positive"
may be worth the trade? (Some precedent for these relative priorities exists as
no. 47775 (5985b0b0).)

Resolves #49588.
2018-04-11 19:56:43 +08:00
kennytm
5ee5de10d2
Rollup merge of #49575 - tmccombs:option-filter-stabilize, r=withoutboats
Stabilize `Option::filter`.

Fixes #45860
2018-04-11 19:56:42 +08:00
kennytm
77777b4528
Rollup merge of #49525 - varkor:sort_by_cached_key-conversion, r=scottmcm
Use sort_by_cached_key where appropriate

A follow-up to https://github.com/rust-lang/rust/pull/48639, converting various slice sorting calls to `sort_by_cached_key` when the key functions are more expensive.
2018-04-11 19:56:41 +08:00
Oliver Schneider
3b04823dc1
Update clippy and rls 2018-04-11 13:36:31 +02:00
bors
ca26ef321c Auto merge of #49681 - tmccombs:take-set-limit-stable, r=sfackler
Stabilize take_set_limit

Fixes #42781
2018-04-11 06:03:46 +00:00
bors
43e994c8b8 Auto merge of #49715 - Mark-Simulacrum:deny-warnings, r=alexcrichton
Move deny(warnings) into rustbuild

This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
2018-04-11 03:30:04 +00:00
Scott McMurray
311ff5b441 Tweak span for ok-wrapping in no-tail block 2018-04-10 20:03:40 -07:00
Scott McMurray
c88efe46b8 Fix the unstable book to account for ok-wrapping 2018-04-10 20:03:40 -07:00
Scott McMurray
aeb2353df5 Add a UI test that the span for the catch type error is in the right place 2018-04-10 20:03:40 -07:00