]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoGenerate a direct assignment in MIR for `let x = y;`
Matthew Jasper [Wed, 27 Jun 2018 21:04:45 +0000 (22:04 +0100)]
Generate a direct assignment in MIR for `let x = y;`

6 years agoAuto merge of #51850 - abarth:draw_again, r=cramertj
bors [Wed, 27 Jun 2018 17:20:27 +0000 (17:20 +0000)]
Auto merge of #51850 - abarth:draw_again, r=cramertj

[fuchsia] Update zx_cprng_draw to target semantics

This change is the final step in improving the semantics of
zx_cprng_draw. Now the syscall always generates the requested number of
bytes. If the syscall would have failed to generate the requested number
of bytes, the syscall either terminates the entire operating system or
terminates the calling process, depending on whether the error is a
result of the kernel misbehaving or the userspace program misbehaving.

6 years ago[fuchsia] Update zx_cprng_draw to target semantics
Adam Barth [Wed, 27 Jun 2018 15:56:19 +0000 (08:56 -0700)]
[fuchsia] Update zx_cprng_draw to target semantics

This change is the final step in improving the semantics of
zx_cprng_draw. Now the syscall always generates the requested number of
bytes. If the syscall would have failed to generate the requested number
of bytes, the syscall either terminates the entire operating system or
terminates the calling process, depending on whether the error is a
result of the kernel misbehaving or the userspace program misbehaving.

6 years agoAuto merge of #51356 - Zoxc:encode-cleanup, r=michaelwoerister
bors [Wed, 27 Jun 2018 14:25:52 +0000 (14:25 +0000)]
Auto merge of #51356 - Zoxc:encode-cleanup, r=michaelwoerister

Make opaque::Encoder append-only and make it infallible

6 years agoAuto merge of #51496 - petrochenkov:mhelper2, r=nikomatsakis
bors [Wed, 27 Jun 2018 11:20:16 +0000 (11:20 +0000)]
Auto merge of #51496 - petrochenkov:mhelper2, r=nikomatsakis

Implement `#[macro_export(local_inner_macros)]` (a solution for the macro helper import problem)

Implement a solution for the macro helper issue discussed in https://github.com/rust-lang/rust/issues/35896 as described in https://github.com/rust-lang/rust/issues/35896#issuecomment-395977901.

Macros exported from libraries can be marked with `#[macro_export(local_inner_macros)]` and this annotation changes how nested macros in them are resolved.

If we have a fn-like macro call `ident!(...)` and `ident` comes from a `macro_rules!` macro marked with  `#[macro_export(local_inner_macros)]` then it's replaced with `$crate::ident!(...)` and resolved as such (`$crate` gets the same context as `ident`).

6 years agoImplement `#[macro_export(local_inner_macros)]`
Vadim Petrochenkov [Mon, 11 Jun 2018 11:21:36 +0000 (14:21 +0300)]
Implement `#[macro_export(local_inner_macros)]`

6 years agoMake opaque::Encoder append-only and make it infallible
John Kåre Alsaker [Mon, 4 Jun 2018 20:14:02 +0000 (22:14 +0200)]
Make opaque::Encoder append-only and make it infallible

6 years agoAuto merge of #51835 - tmccombs:stable-int-to-from-bytes, r=joshtriplett
bors [Wed, 27 Jun 2018 09:21:34 +0000 (09:21 +0000)]
Auto merge of #51835 - tmccombs:stable-int-to-from-bytes, r=joshtriplett

Stabilize to_bytes and from_bytes for integers.

Fixes #49792

6 years agoAuto merge of #51815 - oli-obk:lowering_cleanups2, r=nikomatsakis
bors [Wed, 27 Jun 2018 07:16:13 +0000 (07:16 +0000)]
Auto merge of #51815 - oli-obk:lowering_cleanups2, r=nikomatsakis

Lowering cleanups [2/N]

Double indirections are unnecessary

6 years agoStabilize to_bytes and from_bytes for integers.
Thayne McCombs [Wed, 27 Jun 2018 05:17:56 +0000 (23:17 -0600)]
Stabilize to_bytes and from_bytes for integers.

Fixes #49792

6 years agoAuto merge of #51598 - Pazzaz:master, r=sfackler
bors [Wed, 27 Jun 2018 04:02:05 +0000 (04:02 +0000)]
Auto merge of #51598 - Pazzaz:master, r=sfackler

Optimize sum of Durations by using custom function

The current `impl Sum for Duration` uses `fold` to perform several `add`s (or really `checked_add`s) of durations. In doing so, it has to guarantee the number of nanoseconds is valid after every addition. If you squeese the current implementation into a single function it looks kind of like this:
````rust
fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration {
    let mut sum = Duration::new(0, 0);
    for rhs in iter {
        if let Some(mut secs) = sum.secs.checked_add(rhs.secs) {
            let mut nanos = sum.nanos + rhs.nanos;
            if nanos >= NANOS_PER_SEC {
                nanos -= NANOS_PER_SEC;
                if let Some(new_secs) = secs.checked_add(1) {
                    secs = new_secs;
                } else {
                    panic!("overflow when adding durations");
                }
            }
            sum = Duration { secs, nanos }
        } else {
            panic!("overflow when adding durations");
        }
    }
    sum
}
````
We only need to check if `nanos` is in the correct range when giving our final answer so we can have a more optimized version like so:
````rust
fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration {
    let mut total_secs: u64 = 0;
    let mut total_nanos: u64 = 0;

    for entry in iter {
        total_secs = total_secs
            .checked_add(entry.secs)
            .expect("overflow in iter::sum over durations");
        total_nanos = match total_nanos.checked_add(entry.nanos as u64) {
            Some(n) => n,
            None => {
                total_secs = total_secs
                    .checked_add(total_nanos / NANOS_PER_SEC as u64)
                    .expect("overflow in iter::sum over durations");
                (total_nanos % NANOS_PER_SEC as u64) + entry.nanos as u64
            }
        };
    }
    total_secs = total_secs
        .checked_add(total_nanos / NANOS_PER_SEC as u64)
        .expect("overflow in iter::sum over durations");
    total_nanos = total_nanos % NANOS_PER_SEC as u64;
    Duration {
        secs: total_secs,
        nanos: total_nanos as u32,
    }
}
````
We now only convert `total_nanos` to `total_secs` (1) if `total_nanos` overflows and (2) at the end of the function when we have to output a valid `Duration`. This gave a 5-22% performance improvement when I benchmarked it, depending on how big the `nano` value of the `Duration`s in `iter` were.

6 years agoAuto merge of #51773 - oli-obk:cleanup_impl_trait, r=nikomatsakis
bors [Wed, 27 Jun 2018 01:49:56 +0000 (01:49 +0000)]
Auto merge of #51773 - oli-obk:cleanup_impl_trait, r=nikomatsakis

Don't inspect the generated existential type items

r? @nikomatsakis

My debugging led me to the `hir::ItemExistential(..)` checks, which are entirely unnecessary because we never use the items directly. The issue was that items were iterated over in a random order (due to hashmaps), so if you checked the `ItemExistential` before the function that has the actual return `impl Trait`, you'd run into those ICEs you encountered.

6 years agoAuto merge of #51149 - zackmdavis:․․․_to_․․=, r=nikomatsakis
bors [Tue, 26 Jun 2018 23:15:30 +0000 (23:15 +0000)]
Auto merge of #51149 - zackmdavis:․․․_to_․․=, r=nikomatsakis

lint to favor `..=` over `...` range patterns; migrate to `..=` throughout codebase

We probably need an RFC to actually deprecate the `...` syntax, but here's a candidate implementation for the lint considered in #51043. (My local build is super flaky, but hopefully I got all of the test revisions.)

6 years agoAuto merge of #51814 - MajorBreakfast:local-task-obj, r=cramertj
bors [Tue, 26 Jun 2018 21:09:52 +0000 (21:09 +0000)]
Auto merge of #51814 - MajorBreakfast:local-task-obj, r=cramertj

Add `LocalTaskObj` to `core::task`

- Splits `libcore/task.rs` into submodules
- Adds `LocalTaskObj` and `SpawnLocalObjError` (-> [Commit for this](https://github.com/rust-lang/rust/commit/433e6b31a75eea5ce45493acc63eae462d740338))

Note: To make reviewing easy, both actions have their own commit

r? @cramertj

6 years agoMove spawn errors into executor.rs
Josef Reinhard Brandl [Tue, 26 Jun 2018 19:13:36 +0000 (21:13 +0200)]
Move spawn errors into executor.rs

6 years agoNested `LocalTaskObj` in `TaskObj`, remove `SpawnErrorObj` conversions
Josef Reinhard Brandl [Tue, 26 Jun 2018 19:06:20 +0000 (21:06 +0200)]
Nested `LocalTaskObj` in `TaskObj`, remove `SpawnErrorObj` conversions

6 years agoAuto merge of #51756 - nielx:fix/librustdoc, r=GuillaumeGomez
bors [Tue, 26 Jun 2018 18:55:09 +0000 (18:55 +0000)]
Auto merge of #51756 - nielx:fix/librustdoc, r=GuillaumeGomez

Haiku: set stack size to 16 MB on Haiku, use 32 MB on other platforms

The maximum stack size on Haiku is set to 16 MB (see [the Haiku source](https://git.haiku-os.org/haiku/tree/headers/private/system/thread_defs.h#n17)). With this change rustdoc will also work on Haiku.

6 years agoAuto merge of #51725 - Mark-Simulacrum:no-llvm, r=kennytm
bors [Tue, 26 Jun 2018 16:26:00 +0000 (16:26 +0000)]
Auto merge of #51725 - Mark-Simulacrum:no-llvm, r=kennytm

Do not build LLVM tools for any of the tools

None of the tools in the list should need LLVM tools themselves as far as I can
tell; if this is incorrect, we can re-enable the tool building later.

The primary reason for doing this is that rust-central-station uses the
BuildManifest tool and building LLVM there is not cached: it takes ~1.5
hours on the 2 core machine. This commit should make nightlies and
stable releases much faster.

Followup to https://github.com/rust-lang/rust/pull/51459, r? @kennytm

I'm mostly relying on CI to test this so probably don't roll it up; I'm not sure how to (and not particularly inclined to) wait for multiple hours to test this locally. I imagine that the failures should be fairly obvious when/if encountered.

6 years agoUpdate rustdoc
Oliver Schneider [Thu, 21 Jun 2018 16:49:34 +0000 (18:49 +0200)]
Update rustdoc

6 years agoFlatten some occurrences of `[P<T>]` to `[T]`
Oliver Schneider [Wed, 20 Jun 2018 17:05:27 +0000 (19:05 +0200)]
Flatten some occurrences of `[P<T>]` to `[T]`

6 years agoAdd `LocalTaskObj`
Josef Reinhard Brandl [Tue, 26 Jun 2018 15:06:20 +0000 (17:06 +0200)]
Add `LocalTaskObj`

6 years agodriveby status update to 2015 comment about parens in patterns
Zack M. Davis [Sun, 3 Jun 2018 19:42:05 +0000 (12:42 -0700)]
driveby status update to 2015 comment about parens in patterns

6 years agoinclusive range syntax lint (`...` → `..=`)
Zack M. Davis [Tue, 29 May 2018 02:32:03 +0000 (19:32 -0700)]
inclusive range syntax lint (`...` → `..=`)

Our implementation ends up changing the `PatKind::Range` variant in the
AST to take a `Spanned<RangeEnd>` instead of just a `RangeEnd`, because
the alternative would be to try to infer the span of the range operator
from the spans of the start and end subexpressions, which is both
hideous and nontrivial to get right (whereas getting the change to the
AST right was a simple game of type tennis).

This is concerning #51043.

6 years agomigrate codebase to `..=` inclusive range patterns
Zack M. Davis [Tue, 29 May 2018 02:42:11 +0000 (19:42 -0700)]
migrate codebase to `..=` inclusive range patterns

These were stabilized in March 2018's #47813, and are the Preferred Way
to Do It going forward (q.v. #51043).

6 years agoSplit libcore/task.rs into submodules
Josef Reinhard Brandl [Tue, 26 Jun 2018 14:40:42 +0000 (16:40 +0200)]
Split libcore/task.rs into submodules

6 years agoDon't inspect the generated existential type items
Oliver Schneider [Tue, 26 Jun 2018 11:28:02 +0000 (13:28 +0200)]
Don't inspect the generated existential type items

6 years agoAuto merge of #51678 - Zoxc:combine-lints, r=estebank
bors [Tue, 26 Jun 2018 14:18:13 +0000 (14:18 +0000)]
Auto merge of #51678 - Zoxc:combine-lints, r=estebank

Combine all builtin late lints

6 years agoAuto merge of #51805 - pietroalbini:rollup, r=pietroalbini
bors [Tue, 26 Jun 2018 11:20:18 +0000 (11:20 +0000)]
Auto merge of #51805 - pietroalbini:rollup, r=pietroalbini

Rollup of 11 pull requests

Successful merges:

 - #51104 (add `dyn ` to display of dynamic (trait) types)
 - #51153 (Link panic and compile_error docs)
 - #51642 (Fix unknown windows build)
 - #51730 (New safe associated functions for PinMut)
 - #51731 (Fix ICEs when using continue as an array length inside closures (inside loop conditions))
 - #51747 (Add error for using null characters in #[export_name])
 - #51769 (Update broken rustc-guide links)
 - #51786 (Remove unnecessary stat64 pointer casts)
 - #51788 (Fix typo)
 - #51789 (Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`)
 - #51791 (Minify css)

Failed merges:

r? @ghost

6 years agoRollup merge of #51791 - GuillaumeGomez:minify-css, r=estebank
Pietro Albini [Tue, 26 Jun 2018 09:35:45 +0000 (11:35 +0200)]
Rollup merge of #51791 - GuillaumeGomez:minify-css, r=estebank

Minify css

Sizes changes:

```
dark.css: 8821 => 7804 (~11%)
light.css: 8587 => 7565 (~11%)
rustdoc.css: 22364 => 17818 (~20%)
settings.css: 1384 => 1236 (~10%)
```

So obviously, the bigger the file, the bigger minification.

r? @QuietMisdreavus

6 years agoRollup merge of #51789 - estebank:issue-50577, r=oli-obk
Pietro Albini [Tue, 26 Jun 2018 09:35:44 +0000 (11:35 +0200)]
Rollup merge of #51789 - estebank:issue-50577, r=oli-obk

Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`

Fix #50577. CC #51696.

r? @oli-obk

6 years agoRollup merge of #51788 - berkus:fix-typo, r=varkor
Pietro Albini [Tue, 26 Jun 2018 09:35:43 +0000 (11:35 +0200)]
Rollup merge of #51788 - berkus:fix-typo, r=varkor

Fix typo

6 years agoRollup merge of #51786 - cuviper:stat64-pointers, r=Mark-Simulacrum
Pietro Albini [Tue, 26 Jun 2018 09:35:41 +0000 (11:35 +0200)]
Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-Simulacrum

Remove unnecessary stat64 pointer casts

In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.

6 years agoRollup merge of #51769 - alexcameron89:update_rustc_guide_links, r=frewsxcv
Pietro Albini [Tue, 26 Jun 2018 09:35:40 +0000 (11:35 +0200)]
Rollup merge of #51769 - alexcameron89:update_rustc_guide_links, r=frewsxcv

Update broken rustc-guide links

Recently, there has been some rearrangement of the content in the Rustc
Guide, and this commit changes the urls the match the updated guide.

6 years agoRollup merge of #51747 - varkor:export_name-null-character, r=estebank
Pietro Albini [Tue, 26 Jun 2018 09:35:39 +0000 (11:35 +0200)]
Rollup merge of #51747 - varkor:export_name-null-character, r=estebank

Add error for using null characters in #[export_name]

Fixes #51741.

6 years agoRollup merge of #51731 - varkor:closure-array-break-length, r=estebank
Pietro Albini [Tue, 26 Jun 2018 09:35:38 +0000 (11:35 +0200)]
Rollup merge of #51731 - varkor:closure-array-break-length, r=estebank

Fix ICEs when using continue as an array length inside closures (inside loop conditions)

Fixes #51707.
Fixes #51708.

r? @estebank

6 years agoRollup merge of #51730 - MajorBreakfast:pin-get-mut-unchecked, r=withoutboats
Pietro Albini [Tue, 26 Jun 2018 09:35:37 +0000 (11:35 +0200)]
Rollup merge of #51730 - MajorBreakfast:pin-get-mut-unchecked, r=withoutboats

New safe associated functions for PinMut

- Add safe `get_mut` and `map`
- Rename unsafe equivalents to `get_mut_unchecked` and `map_unchecked`

The discussion about this starts [in this comment](https://github.com/rust-lang/rust/issues/49150#issuecomment-399604573) on the tracking issue.

6 years agoRollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=oli-obk
Pietro Albini [Tue, 26 Jun 2018 09:35:35 +0000 (11:35 +0200)]
Rollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=oli-obk

Fix unknown windows build

Fixes #51618.

6 years agoRollup merge of #51153 - ogham:panic-and-compile_error-docs, r=GuillaumeGomez
Pietro Albini [Tue, 26 Jun 2018 09:35:34 +0000 (11:35 +0200)]
Rollup merge of #51153 - ogham:panic-and-compile_error-docs, r=GuillaumeGomez

Link panic and compile_error docs

This adds documentation links between `panic!()` and `compile_error!()` as per #47275, which points out that they’re similar. It also adds a sentence to the `compile_error()` docs I thought could be added.

6 years agoRollup merge of #51104 - zackmdavis:dynamo, r=nikomatsakis
Pietro Albini [Tue, 26 Jun 2018 09:35:33 +0000 (11:35 +0200)]
Rollup merge of #51104 - zackmdavis:dynamo, r=nikomatsakis

add `dyn ` to display of dynamic (trait) types

~~I'm not sure we want the `dyn` in the E0277 "trait bound [...] is not satisfied" messages ("bound" sounds like a different thing in contrast to the names of specific trait-object types like `Box<dyn Trait>`), but I'm finding the code I would need to change that hard to follow—the [display object seems to](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/traits/error_reporting.rs#L600) be a [`Predicate::Trait`](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L962) variant, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L1309) calls `.print` on its `PolyTraitPredicate` member, [which is a type alias](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L1112) for `ty::Binder<TraitPredicate<'tcx>>`, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L975-L985) ... _&c._— so maybe it's time to pull-request this and see what reviewers think.~~

 Resolves #49277 (?).

r? @nikomatsakis

6 years agoAuto merge of #49469 - Nokel81:allow-irrefutable-let-patterns, r=nikomatsakis
bors [Tue, 26 Jun 2018 09:20:33 +0000 (09:20 +0000)]
Auto merge of #49469 - Nokel81:allow-irrefutable-let-patterns, r=nikomatsakis

Implementation of RFC 2086 - Allow Irrefutable Let patterns

This is the set of changes for RFC2086. Tracking issue #44495. Rendered [here](https://github.com/rust-lang/rfcs/pull/2086)

6 years agoAuto merge of #51613 - nnethercote:ob-forest-cleanup, r=nikomatsakis
bors [Tue, 26 Jun 2018 07:06:18 +0000 (07:06 +0000)]
Auto merge of #51613 - nnethercote:ob-forest-cleanup, r=nikomatsakis

Obligation forest cleanup

While looking at this code I was scratching my head about whether a node could appear in both `parent` and `dependents`. Turns out it can, but it's not useful to do so, so this PR cleans things up so it's no longer possible.

6 years agoAuto merge of #50630 - sharkdp:fix-50619, r=sfackler
bors [Tue, 26 Jun 2018 03:49:37 +0000 (03:49 +0000)]
Auto merge of #50630 - sharkdp:fix-50619, r=sfackler

Fix possibly endless loop in ReadDir iterator

Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream.

This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`.

fixes #50619

6 years agoAuto merge of #50966 - leodasvacas:self-in-where-clauses-is-not-object-safe, r=nikoma...
bors [Tue, 26 Jun 2018 01:42:14 +0000 (01:42 +0000)]
Auto merge of #50966 - leodasvacas:self-in-where-clauses-is-not-object-safe, r=nikomatsakis

`Self` in where clauses may not be object safe

Needs crater, virtually certain to cause regressions.

In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses.

This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error.

Part of #50781.

r? @nikomatsakis

6 years agomake the `while let` loop terminate
Niko Matsakis [Mon, 25 Jun 2018 21:33:49 +0000 (17:33 -0400)]
make the `while let` loop terminate

6 years agoMinify css
Guillaume Gomez [Mon, 25 Jun 2018 21:28:20 +0000 (23:28 +0200)]
Minify css

6 years agoDo not build LLVM tools for any of the tools
Mark Simulacrum [Sat, 23 Jun 2018 01:42:22 +0000 (19:42 -0600)]
Do not build LLVM tools for any of the tools

None of the tools in the list should need LLVM tools themselves as far as I can
tell; if this is incorrect, we can re-enable the tool building later.

The primary reason for doing this is that rust-central-station uses the
BuildManifest tool and building LLVM there is not cached: it takes ~1.5
hours on the 2 core machine. This commit should make nightlies and
stable releases much faster.

6 years agoDon't ICE when performing `lower_pattern_unadjusted` on a `TyError`
Esteban Küber [Mon, 25 Jun 2018 20:44:57 +0000 (13:44 -0700)]
Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`

6 years agoFix typo
Berkus Karchebnyy [Mon, 25 Jun 2018 20:44:48 +0000 (23:44 +0300)]
Fix typo

6 years agoAuto merge of #51785 - cuviper:fstatat64, r=Mark-Simulacrum
bors [Mon, 25 Jun 2018 19:40:56 +0000 (19:40 +0000)]
Auto merge of #51785 - cuviper:fstatat64, r=Mark-Simulacrum

Use fstatat64 where available

None

6 years agoRemove unnecessary stat64 pointer casts
Josh Stone [Mon, 25 Jun 2018 19:34:33 +0000 (12:34 -0700)]
Remove unnecessary stat64 pointer casts

In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.

6 years agoUse fstatat64 where available
Josh Stone [Mon, 25 Jun 2018 18:42:27 +0000 (11:42 -0700)]
Use fstatat64 where available

6 years agoAdd missing \[allow(missing_docs)\]
Guillaume Gomez [Mon, 25 Jun 2018 18:38:29 +0000 (20:38 +0200)]
Add missing \[allow(missing_docs)\]

6 years agoAuto merge of #51728 - bradjc:llvm-tools2, r=kennytm
bors [Mon, 25 Jun 2018 17:22:12 +0000 (17:22 +0000)]
Auto merge of #51728 - bradjc:llvm-tools2, r=kennytm

build: add llvm-tools to manifest

This commit expands on a previous commit to build llvm-tools as a rustup component. It causes the llvm-tools component to be built if the extended step is active. It also adds llvm-tools to the build manifest so rustup can find it.

I tested this as far as I could, but had to hack `build-manifest/src/main.rs` a bit as it is not supported on MacOS. The main change I am not sure about is this line:

```rust
self.package("llvm-tools", &mut manifest.pkg, TARGETS);
```

There are numerous calls to `self.package()`, and I'm not sure if `TARGETS`, `HOSTS`, or `["*"]` is appropriate for llvm-tools.

Otherwise I mostly copied the example set by `rustfmt-preview`.

6 years agoMake find_breakable_scope non-mutable
varkor [Mon, 25 Jun 2018 14:27:37 +0000 (15:27 +0100)]
Make find_breakable_scope non-mutable

6 years agoAuto merge of #51750 - zackmdavis:superstructure, r=oli-obk
bors [Mon, 25 Jun 2018 13:43:22 +0000 (13:43 +0000)]
Auto merge of #51750 - zackmdavis:superstructure, r=oli-obk

three diagnostics upgrades

 * reword `...` expression syntax error to not imply that you should use it in patterns either (#51043) and make it a structured suggestion
 * shorten the top-line message for the trivial-casts lint by tucking the advisory sentence into a help note
 * structured suggestion for pattern-named-the-same-as-variant warning

r? @oli-obk

6 years agoAuto merge of #51733 - varkor:ice-match-slice, r=oli-obk
bors [Mon, 25 Jun 2018 11:36:13 +0000 (11:36 +0000)]
Auto merge of #51733 - varkor:ice-match-slice, r=oli-obk

Fix an ICE when matching over const slices

Fixes #51655. I'm not super familiar with this code, so tell me if this is the wrong approach 😅

r? @oli-obk

6 years agoFill in tracking issue for WHERE_CLAUSES_OBJECT_SAFETY future compat lint
leonardo.yvens [Fri, 8 Jun 2018 21:26:37 +0000 (18:26 -0300)]
Fill in tracking issue for WHERE_CLAUSES_OBJECT_SAFETY future compat lint

6 years agoMake where clause object safety be a warn-by-default lint
leonardo.yvens [Wed, 30 May 2018 12:06:08 +0000 (09:06 -0300)]
Make where clause object safety be a warn-by-default lint

6 years ago`Self` in where clauses may not be object safe
leonardo.yvens [Tue, 22 May 2018 15:09:35 +0000 (12:09 -0300)]
`Self` in where clauses may not be object safe

This is virtually certain to cause regressions, needs crater.

In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses.

This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error.

Fixes #50781.

r? @nikomatsakis

6 years agoAuto merge of #51335 - mark-i-m:allocator, r=oli-obk
bors [Mon, 25 Jun 2018 08:54:16 +0000 (08:54 +0000)]
Auto merge of #51335 - mark-i-m:allocator, r=oli-obk

Prohibit `global_allocator` in submodules

Background: #44113 is caused by weird interactions with hygiene. Hygiene is hard. After a lot of playing around, we decided that the best path forward would be to prohibit `global_allocator`s from being in submodules for now. When somebody gets it working, we can re-enable it.

This PR contains the following
- Some hygiene "fixes" -- things I suspect are the correct thing to do that will make life easier in the future. This includes using call_site hygiene for the generated module and passing the correct crate name to the expansion config.
- Comments and minor formatting fixes
- Some debugging code
- Code to prohibit `global_allocator` in submodules
- Test checking that the proper error occurs.

cc #44113 #49320 #51241

r? @alexcrichton

6 years agoAdd sentence to compile_error!() docs
Benjamin Sago [Tue, 29 May 2018 08:07:14 +0000 (10:07 +0200)]
Add sentence to compile_error!() docs

It now details why using compile_error!() is different from just not having the final macro_rules!() branch.

6 years agoLink the docs of panic!() and compile_error!()
Benjamin Sago [Tue, 29 May 2018 08:06:13 +0000 (10:06 +0200)]
Link the docs of panic!() and compile_error!()

Fixes #47275. These two macros are similar, but different, and could do with documentation links to each other.

6 years agoAuto merge of #51688 - spastorino:error-note-field-after-move, r=nikomatsakis
bors [Mon, 25 Jun 2018 06:44:08 +0000 (06:44 +0000)]
Auto merge of #51688 - spastorino:error-note-field-after-move, r=nikomatsakis

Fix erroneous error note when using field after move

Closes #51512

r? @nikomatsakis

6 years agoUpdate broken rustc-guide links
Alex Kitchens [Mon, 25 Jun 2018 03:00:39 +0000 (22:00 -0500)]
Update broken rustc-guide links

Recently, there has been some rearrangement of the content in the Rustc
Guide, and this commit changes the urls the match the updated guide.

6 years agoused debug, not info
mark [Sat, 23 Jun 2018 00:59:29 +0000 (19:59 -0500)]
used debug, not info

6 years agoactually fix test
mark [Tue, 19 Jun 2018 02:59:32 +0000 (21:59 -0500)]
actually fix test

6 years agofix test
mark [Tue, 19 Jun 2018 02:11:59 +0000 (21:11 -0500)]
fix test

6 years agoenable fold_mac
Mark Mansi [Wed, 6 Jun 2018 00:24:10 +0000 (19:24 -0500)]
enable fold_mac

6 years agoProhibit global_allocator in submodules for now
Mark Mansi [Sun, 20 May 2018 22:04:00 +0000 (17:04 -0500)]
Prohibit global_allocator in submodules for now

- we need to figure out hygiene first
- change the test to check that the prohibition works with a good error
  msg
- leaves some comments and debugging code
- leaves some of our supposed fixes

6 years agoAttempt to fix hygiene for global_allocator
Mark Mansi [Fri, 13 Apr 2018 20:58:16 +0000 (15:58 -0500)]
Attempt to fix hygiene for global_allocator

6 years agoAdd item after attribute
varkor [Sun, 24 Jun 2018 17:20:25 +0000 (18:20 +0100)]
Add item after attribute

6 years agoAuto merge of #51740 - GuillaumeGomez:fix-error-code-numbers, r=cramertj
bors [Sun, 24 Jun 2018 15:08:48 +0000 (15:08 +0000)]
Auto merge of #51740 - GuillaumeGomez:fix-error-code-numbers, r=cramertj

Fix error code numbers

Fixes issue created by #51580.

r? @cramertj

6 years agoHaiku: set stack size to 16 MB on Haiku, use 32 MB on other platforms
Niels Sascha Reedijk [Sun, 24 Jun 2018 07:16:08 +0000 (09:16 +0200)]
Haiku: set stack size to 16 MB on Haiku, use 32 MB on other platforms

6 years agoin which the trivial-casts word to the wise is tucked into a help note
Zack M. Davis [Sat, 23 Jun 2018 23:57:23 +0000 (16:57 -0700)]
in which the trivial-casts word to the wise is tucked into a help note

The top level message shouldn't be too long; the
replaced-by-coercion/temporary-variable advice can live in a note. Also,
don't mention type ascription when it's not actually available as a real
thing. (The current state of discussion on the type ascription tracking
issue #23416 makes one rather suspect it will never be a stable thing in
its current form, but that's not for us to adjudicate in this commit.)

While we're here, yank out the differentiating parts of the
numeric/other conditional and only have one codepath emitting the
diagnostic.

6 years agostructured suggestion and rewording for `...` expression syntax error
Zack M. Davis [Sat, 23 Jun 2018 23:49:09 +0000 (16:49 -0700)]
structured suggestion and rewording for `...` expression syntax error

Now that `..=` inclusive ranges are stabilized, people probably
shouldn't be using `...` even in patterns, even if it's still legal
there (see #51043). To avoid drawing attention to `...` being a real
thing, let's reword this message to just say "unexpected token" rather
"cannot be used in expressions".

6 years agouse structured suggestion for pattern-named-the-same-as-variant warning
Zack M. Davis [Sat, 23 Jun 2018 23:46:41 +0000 (16:46 -0700)]
use structured suggestion for pattern-named-the-same-as-variant warning

6 years agoadd `dyn` to display of dynamic (trait) type names
Zack M. Davis [Sun, 27 May 2018 03:51:50 +0000 (20:51 -0700)]
add `dyn` to display of dynamic (trait) type names

The `dyn Trait` syntax was stabilized in 199ee327. Resolves #49277.

6 years agoAuto merge of #51726 - petrochenkov:hygclean, r=oli-obk
bors [Sun, 24 Jun 2018 01:06:21 +0000 (01:06 +0000)]
Auto merge of #51726 - petrochenkov:hygclean, r=oli-obk

expansion/hygiene: Some renaming, refactoring and comments

Pure refactoring, no functional changes.
Commits are isolated and self-descriptive.

6 years agoAdd backticks to E0558
varkor [Sat, 23 Jun 2018 21:33:36 +0000 (22:33 +0100)]
Add backticks to E0558

6 years agoAuto merge of #51739 - Amanieu:update_rustfmt, r=Mark-Simulacrum
bors [Sat, 23 Jun 2018 22:27:30 +0000 (22:27 +0000)]
Auto merge of #51739 - Amanieu:update_rustfmt, r=Mark-Simulacrum

Update rustfmt submodule

The version of rustfmt currently shipped with nightly breaks code that uses `break 'label`. This PR updates the submodule to include the fix (https://github.com/rust-lang-nursery/rustfmt/pull/2774).

6 years agobuild: llvm-tools: replace compiler.host
Brad Campbell [Sat, 23 Jun 2018 21:32:25 +0000 (17:32 -0400)]
build: llvm-tools: replace compiler.host

Use `target` instead.

6 years agoAdd error for using null characters in export_name
varkor [Sat, 23 Jun 2018 21:31:31 +0000 (22:31 +0100)]
Add error for using null characters in export_name

6 years agoAuto merge of #51653 - mglagla:option-unreachable, r=dtolnay
bors [Sat, 23 Jun 2018 20:10:35 +0000 (20:10 +0000)]
Auto merge of #51653 - mglagla:option-unreachable, r=dtolnay

Option::get_or_insert(_with): Replace unreachable! with unreachable_unchecked

Optimize codegen for both functions as the None branch is trivially not reachable.

6 years agoFix error code numbers
Guillaume Gomez [Sat, 23 Jun 2018 18:14:04 +0000 (20:14 +0200)]
Fix error code numbers

6 years agohygiene: Merge `NameAndSpan` into `ExpnInfo`
Vadim Petrochenkov [Sat, 23 Jun 2018 18:41:39 +0000 (21:41 +0300)]
hygiene: Merge `NameAndSpan` into `ExpnInfo`

6 years agoUpdate Cargo.lock
Amanieu d'Antras [Sat, 23 Jun 2018 18:15:34 +0000 (19:15 +0100)]
Update Cargo.lock

6 years agoUpdate rustfmt submodule
Amanieu d'Antras [Sat, 23 Jun 2018 17:54:42 +0000 (18:54 +0100)]
Update rustfmt submodule

6 years agohygiene: Make sure transparency of `Mark::root()` is an implementation detail and...
Vadim Petrochenkov [Sat, 23 Jun 2018 17:42:25 +0000 (20:42 +0300)]
hygiene: Make sure transparency of `Mark::root()` is an implementation detail and cannot be inspected outside of `hygiene.rs`

6 years agohygiene: Do not reset expansion info for `quote!`
Vadim Petrochenkov [Sat, 23 Jun 2018 17:09:11 +0000 (20:09 +0300)]
hygiene: Do not reset expansion info for `quote!`

6 years agohygiene: More descriptive names for things involved in late hygienic name resolution
Vadim Petrochenkov [Sat, 23 Jun 2018 16:27:28 +0000 (19:27 +0300)]
hygiene: More descriptive names for things involved in late hygienic name resolution

6 years agoexpansion: Add some comments
Vadim Petrochenkov [Sat, 23 Jun 2018 16:27:01 +0000 (19:27 +0300)]
expansion: Add some comments

6 years agoexpansion: Improve searchability for `AstFragments` methods
Vadim Petrochenkov [Fri, 22 Jun 2018 22:05:07 +0000 (01:05 +0300)]
expansion: Improve searchability for `AstFragments` methods

6 years agoexpansion: Rename `Expansion` to `AstFragment`
Vadim Petrochenkov [Tue, 19 Jun 2018 23:08:08 +0000 (02:08 +0300)]
expansion: Rename `Expansion` to `AstFragment`

6 years agohygiene: Rename `MarkKind` to `Transparency`
Vadim Petrochenkov [Tue, 19 Jun 2018 21:54:17 +0000 (00:54 +0300)]
hygiene: Rename `MarkKind` to `Transparency`

Move `is_builtin` for `Mark` to a separate flag

6 years agohygiene: Make sure expansion info is set at most once for a given `Mark`
Vadim Petrochenkov [Tue, 19 Jun 2018 21:13:11 +0000 (00:13 +0300)]
hygiene: Make sure expansion info is set at most once for a given `Mark`

6 years agoexpansion: Remove unnecessary override from `impl Folder for Marker`
Vadim Petrochenkov [Tue, 19 Jun 2018 21:09:56 +0000 (00:09 +0300)]
expansion: Remove unnecessary override from `impl Folder for Marker`

6 years agohygiene: Give `Debug` impls to hygiene structures
Vadim Petrochenkov [Tue, 19 Jun 2018 21:08:14 +0000 (00:08 +0300)]
hygiene: Give `Debug` impls to hygiene structures

6 years agoFix codegen tests
varkor [Sat, 23 Jun 2018 15:32:32 +0000 (16:32 +0100)]
Fix codegen tests

6 years agoAdd a test for break
varkor [Sat, 23 Jun 2018 12:21:09 +0000 (13:21 +0100)]
Add a test for break

6 years agoFix an ICE with continue inside a closure inside a loop condition
varkor [Sat, 23 Jun 2018 12:12:15 +0000 (13:12 +0100)]
Fix an ICE with continue inside a closure inside a loop condition