Commit Graph

77172 Commits

Author SHA1 Message Date
bors
1fac3ca9c4 Auto merge of #50129 - wesleywiser:clean_up1, r=michaelwoerister
Clean up `IsolatedEncoder::encode_info_for_impl_item()` a bit

Suggested in the [comments of #49991](4a77d35c1e (r183048939))
2018-04-23 08:26:23 +00:00
bors
f5cf1a8419 Auto merge of #50171 - mattico:update-mdbook, r=Mark-Simulacrum
Update MDBook

Updates MDBook to get some CSS fixes.

#50147, updated to resolve licensing issue.

r? @Mark-Simulacrum
2018-04-23 04:23:42 +00:00
bors
2c57826b92 Auto merge of #48946 - PramodBisht:issues/48636, r=estebank
Doc comments present after a particular syntax error cause an unhelpful error message to be output.

fixed: #48636

r? @estebank
2018-04-23 01:36:51 +00:00
Matt Ickstadt
0ab516fdfc Update MDBook 2018-04-22 20:35:22 -05:00
bors
e02868793b Auto merge of #50144 - sfackler:oom-lang-item, r=alexcrichton
Replace {Alloc,GlobalAlloc}::oom with a lang item.

The decision of what to do after an allocation fails is orthogonal to the decision of how to allocate the memory, so this PR splits them apart. `Alloc::oom` and `GlobalAlloc::oom` have been removed, and a lang item has been added:

```rust
#[lang = "oom"]
fn oom() -> !;
```

It is specifically a weak lang item, like panic_fmt, except that it is required when you depend on liballoc rather than libcore. libstd provides an implementation that aborts with the message `fatal runtime error: memory allocation failed`, matching the current behavior.

The new implementation is also significantly simpler - it's "just another weak lang item". [RFC 2070](https://github.com/rust-lang/rfcs/blob/master/text/2070-panic-implementation.md) specifies a path towards stabilizing panic_fmt, so any complexities around stable weak lang item definition are already being solved.

To bootstrap, oom silently aborts in stage0. alloc_system no longer has a bunch of code to print to stderr, and alloc_jemalloc no longer depends on alloc_system to pull in that code.

One fun note: System's GlobalAlloc implementation didn't override the default implementation of oom, so it currently aborts silently!

r? @alexcrichton
2018-04-22 19:38:32 +00:00
Steven Fackler
5969712c3f Remove unused AllocatorTy::Bang 2018-04-22 10:08:49 -07:00
Steven Fackler
9e8f683476 Remove Alloc::oom 2018-04-22 10:08:49 -07:00
Steven Fackler
e513c1bd31 Replace GlobalAlloc::oom with a lang item 2018-04-22 10:08:17 -07:00
bors
ff48277add Auto merge of #50152 - petrochenkov:nooverhyg, r=alexcrichton
parser: Do not override syntactic context for dummy spans

Fixes https://github.com/rust-lang/rust/issues/50061

e2afefd80b seemingly did everything right, but uncovered a preexisting bug.
2018-04-22 16:58:12 +00:00
bors
8887396513 Auto merge of #50135 - matklad:update-cargo, r=kennytm
Update Cargo

Some noteble changes:

 * ~~regression fix: https://github.com/rust-lang/cargo/pull/5390~~
  * ~~potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5389~~
  * ~~Cargo now caches the result of `rustc -vV`. It checks `rustc` binary
    mtime and rustup toolchain settings, so it should probably "just work"
    with rustbuild.~~

potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5390
2018-04-22 13:23:49 +00:00
bors
28193e873c Auto merge of #49954 - GuillaumeGomez:doc-settings, r=ollie27,QuietMisdreavus
Add rustdoc settings menu

Fixes #18167.

r? @QuietMisdreavus
2018-04-22 11:04:41 +00:00
bors
0cbd310fa7 Auto merge of #50123 - kennytm:do-not-test-rls-if-build-failed, r=alexcrichton
Do not test RLS/Rustfmt if build failed
2018-04-22 08:48:32 +00:00
Pramod Bisht
1bed654053 1) Addresses #48636
2) Changed position of help message, incase comma is missing
3) added few missing spaces and handled span_suggestion for vscode
4) updated stderr file
2018-04-22 11:43:25 +05:30
bors
835b8648c6 Auto merge of #50109 - SimonSapin:copy, r=sfackler
Implement Copy for std::alloc::Layout

Fixes https://github.com/rust-lang/rust/issues/48458
2018-04-22 06:03:20 +00:00
bors
bbdd1cf744 Auto merge of #49757 - GuillaumeGomez:never-search, r=QuietMisdreavus
Add specific never search

Fixes #49529.

r? @QuietMisdreavus
2018-04-22 02:18:41 +00:00
Vadim Petrochenkov
6a4e0b3fae parser: Do not override syntactic context for dummy spans 2018-04-22 04:33:30 +03:00
bors
d5616e1f18 Auto merge of #49896 - SimonSapin:inherent, r=alexcrichton
Add inherent methods in libcore for [T], [u8], str, f32, and f64

# Background

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

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

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

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

# High-level proposal

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

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

# Float methods

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

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

# Change details

For users on the Stable release channel:

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

For Nightly users, additionally:

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

-----

CC @rust-lang/libs for the API changes, @rust-lang/compiler for the new lang items
2018-04-22 00:01:29 +00:00
Guillaume Gomez
1ed3e77b8a Add doc about doc alias feature 2018-04-22 00:30:48 +02:00
Guillaume Gomez
48ab422be4 Add tracking issue number for doc alias feature 2018-04-22 00:30:48 +02:00
bors
aa7ce896f2 Auto merge of #50121 - pnkfelix:revert-stabilization-of-never-type-et-al, r=alexcrichton
Revert stabilization of never_type (!) et al

Fix #49691

I *think* this correctly adopts @nikomatsakis 's desired fix of:
 * reverting stabilization of `!` and `TryFrom`, and
 * returning to the previous fallback semantics (i.e. it is once again dependent on whether the crate has opted into `#[feature(never_type)]`,
 * **without** attempting to put back in the previous future-proofing warnings regarding the change in fallback semantics.

(I'll be away from computers for a week starting now, so any updates to this PR should be either pushed into it, or someone else should adopt the task of polishing this fix and put up their own PR.)
2018-04-21 21:14:53 +00:00
Guillaume Gomez
d0e2d26ceb remove unused condition 2018-04-21 22:02:54 +02:00
Guillaume Gomez
d5eade2b94 Add alias tests 2018-04-21 22:02:54 +02:00
Guillaume Gomez
31e7cc4ba4 update tester 2018-04-21 22:02:54 +02:00
Guillaume Gomez
ca3213c338 fix invalid items removal 2018-04-21 22:02:54 +02:00
Guillaume Gomez
84b91d6f5c add more aliases 2018-04-21 22:02:53 +02:00
Guillaume Gomez
03b0856849 Add aliases in the search as well 2018-04-21 22:02:53 +02:00
Guillaume Gomez
57bcabc108 Generate alias file 2018-04-21 22:02:53 +02:00
Guillaume Gomez
654cb84852 Add specific never search 2018-04-21 22:01:38 +02:00
Guillaume Gomez
1f7892f16a Remove link generation on image, favicon and logo in settings 2018-04-21 21:59:12 +02:00
bors
699eb95ae3 Auto merge of #50039 - ExpHP:quick-50002, r=alexcrichton
smaller PR just to fix #50002

I pulled this out of #50010 to make it easier to backport to beta if necessary, considering that inclusive range syntax is stabilizing soon (?).

It fixes a bug in `<str>::index_mut` with `(..=end)` ranges (#50002), which prior to this fix was not only unusable but also UB in the cases where it "worked" (it gave improperly truncated UTF-8).

(not that I can imagine why anybody would *use* `<str>::index_mut`... but I'm not here to judge)
2018-04-21 18:42:41 +00:00
bors
d2577ca1ec Auto merge of #50093 - alexcrichton:android-uwtable, r=michaelwoerister
rustc: Always emit `uwtable` on Android

Long ago (#40549) we enabled the `uwtable` attribute on Windows by default
(even with `-C panic=abort`) to allow unwinding binaries for [stack unwinding
information][winstack]. It looks like this same issue is [plaguing][arm1]
Gecko's Android platforms [as well][arm2]. This commit applies the same fix
as #40549 except that this time it's applied for all Android targets.

Generating a `-C panic=abort` binary for `armv7-linux-androideabi` before this
commit generated a number of `cantunwind` functions (detected with `readelf -u`)
but after this commit they all list appropriate unwind information.

Closes #49867

[winstack]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
[arm1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1453220
[arm2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1451741
2018-04-21 16:18:22 +00:00
Alex Crichton
f7439a5a45 rustc: Always emit uwtable on Android
Long ago (#40549) we enabled the `uwtable` attribute on Windows by default
(even with `-C panic=abort`) to allow unwinding binaries for [stack unwinding
information][winstack]. It looks like this same issue is [plaguing][arm1]
Gecko's Android platforms [as well][arm2]. This commit applies the same fix
as #40549 except that this time it's applied for all Android targets.

Generating a `-C panic=abort` binary for `armv7-linux-androideabi` before this
commit generated a number of `cantunwind` functions (detected with `readelf -u`)
but after this commit they all list appropriate unwind information.

Closes #49867

[winstack]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
[arm1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1453220
[arm2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1451741
2018-04-21 08:38:44 -07:00
bors
222551f3f3 Auto merge of #50120 - alexcrichton:more-proc-macro-gates, r=petrochenkov
rustc: Tweak custom attribute capabilities

This commit starts to lay some groundwork for the stabilization of custom
attribute invocations and general procedural macros. It applies a number of
changes discussed on [internals] as well as a [recent issue][issue], namely:

* The path used to specify a custom attribute must be of length one and cannot
  be a global path. This'll help future-proof us against any ambiguities and
  give us more time to settle the precise syntax. In the meantime though a bare
  identifier can be used and imported to invoke a custom attribute macro. A new
  feature gate, `proc_macro_path_invoc`, was added to gate multi-segment paths
  and absolute paths.

* The set of items which can be annotated by a custom procedural attribute has
  been restricted. Statements, expressions, and modules are disallowed behind
  two new feature gates: `proc_macro_expr` and `proc_macro_mod`.

* The input to procedural macro attributes has been restricted and adjusted.
  Today an invocation like `#[foo(bar)]` will receive `(bar)` as the input token
  stream, but after this PR it will only receive `bar` (the delimiters were
  removed). Invocations like `#[foo]` are still allowed and will be invoked in
  the same way as `#[foo()]`. This is a **breaking change** for all nightly
  users as the syntax coming in to procedural macros will be tweaked slightly.

* Procedural macros (`foo!()` style) can only be expanded to item-like items by
  default. A separate feature gate, `proc_macro_non_items`, is required to
  expand to items like expressions, statements, etc.

Closes #50038

[internals]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252
[issue]: https://github.com/rust-lang/rust/issues/50038
2018-04-21 13:50:58 +00:00
bors
e59f78fb45 Auto merge of #50076 - spastorino:fix_exhaust_iter_in_debug, r=pnkfelix
Fix Iter exhaustion in prove_predicates when debug is on

Fixes the issue noted in this comment https://github.com/rust-lang/rust/pull/49885/files#r182560268

r? @pnkfelix
/cc @nikomatsakis
2018-04-21 11:26:09 +00:00
Aleksey Kladov
cb46d281f4 Update Cargo
Some noteble changes:

  * regression fix: https://github.com/rust-lang/cargo/pull/5390
  * potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5389
  * Cargo now caches the result of `rustc -vV`. It checks `rustc` binary
    mtime and rustup toolchain settings, so it should probably "just work"
    with rustbuild.
2018-04-21 11:49:06 +03:00
Simon Sapin
70fdd1b5c0 Make the unstable StrExt and SliceExt traits private to libcore in not(stage0)
`Float` still needs to be public for libcore unit tests.
2018-04-21 09:47:38 +02:00
Simon Sapin
18ab16b510 Move intrinsics-based float methods out of libcore into libstd
Affected methods are `abs`, `signum`, and `powi`.
CC https://github.com/rust-lang/rust/issues/32110#issuecomment-379503183
2018-04-21 09:47:37 +02:00
Simon Sapin
8a374f2827 Add some f32 and f64 inherent methods in libcore
… previously in the unstable core::num::Float trait.

Per https://github.com/rust-lang/rust/issues/32110#issuecomment-379503183,
the `abs`, `signum`, and `powi` methods are *not* included for now
since they rely on LLVM intrinsics and we haven’t determined yet whether
those instrinsics lower to calls to libm functions on any platform.
2018-04-21 09:47:37 +02:00
Simon Sapin
f0705bf033 Replace StrExt with inherent str methods in libcore 2018-04-21 09:47:37 +02:00
Simon Sapin
90f29fbdb1 Replace SliceExt with inherent [T] methods in libcore 2018-04-21 09:45:18 +02:00
Simon Sapin
de8ed6a1d6 Move non-allocating [u8] inherent methods to libcore
Fixes #45803
2018-04-21 09:45:18 +02:00
Simon Sapin
572256772e Remove unused methods on the private Wtf8 type
The type and its direct parent module are `pub`, but they’re not reachable outside of std
2018-04-21 09:45:18 +02:00
kennytm
42b6d4653a
Add back missing #![feature(never_type)]s 2018-04-21 15:18:13 +08:00
bors
9af69fe232 Auto merge of #50080 - klnusbaum:edition_49591, r=Manishearth
add --edition option

This adds an official `edition` flag to the rust compiler
2018-04-21 05:28:21 +00:00
Alex Crichton
79630d4fdf rustc: Tweak custom attribute capabilities
This commit starts to lay some groundwork for the stabilization of custom
attribute invocations and general procedural macros. It applies a number of
changes discussed on [internals] as well as a [recent issue][issue], namely:

* The path used to specify a custom attribute must be of length one and cannot
  be a global path. This'll help future-proof us against any ambiguities and
  give us more time to settle the precise syntax. In the meantime though a bare
  identifier can be used and imported to invoke a custom attribute macro. A new
  feature gate, `proc_macro_path_invoc`, was added to gate multi-segment paths
  and absolute paths.

* The set of items which can be annotated by a custom procedural attribute has
  been restricted. Statements, expressions, and modules are disallowed behind
  two new feature gates: `proc_macro_expr` and `proc_macro_mod`.

* The input to procedural macro attributes has been restricted and adjusted.
  Today an invocation like `#[foo(bar)]` will receive `(bar)` as the input token
  stream, but after this PR it will only receive `bar` (the delimiters were
  removed). Invocations like `#[foo]` are still allowed and will be invoked in
  the same way as `#[foo()]`. This is a **breaking change** for all nightly
  users as the syntax coming in to procedural macros will be tweaked slightly.

* Procedural macros (`foo!()` style) can only be expanded to item-like items by
  default. A separate feature gate, `proc_macro_non_items`, is required to
  expand to items like expressions, statements, etc.

Closes #50038

[internals]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252
[issue]: https://github.com/rust-lang/rust/issues/50038
2018-04-20 19:56:16 -07:00
Kurtis Nusbaum
c8c9bf97e3 fix two compile-fail tests that were still using -Zedition 2018-04-20 18:51:59 -07:00
bors
b78853b6fd Auto merge of #50056 - alexcrichton:update-cargo, r=Mark-Simulacrum
Update the Cargo submodule
2018-04-21 00:50:12 +00:00
Wesley Wiser
732cc736c9 Clean up IsolatedEncoder::encode_info_for_impl_item() a bit 2018-04-20 19:05:54 -04:00
Kurtis Nusbaum
c1d8aa829c fix some small compile errors 2018-04-20 14:47:23 -07:00
bors
a10bb6b592 Auto merge of #50088 - alexcrichton:std-tweaks, r=sfackler
Tweak some stabilizations in libstd

This commit tweaks a few stable APIs in the `beta` branch before they hit
stable. The `str::is_whitespace` and `str::is_alphanumeric` functions were
deleted (added in #49381, issue at #49657). The `and_modify` APIs added
in #44734 were altered to take a `FnOnce` closure rather than a `FnMut` closure.

Closes #49581
Closes #49657
2018-04-20 20:40:59 +00:00