Commit Graph

79662 Commits

Author SHA1 Message Date
Matthew Jasper
2cb0a0631a Update tests for grouped nll move errors 2018-06-27 22:46:58 +01:00
Matthew Jasper
0193d1f736 Group move errors before reporting, add suggestions 2018-06-27 22:46:58 +01:00
Matthew Jasper
43fce075d3 Update MIR opt tests 2018-06-27 22:06:21 +01:00
Matthew Jasper
9185bb3061 Generate a direct assignment in MIR for let x = y; 2018-06-27 22:04:45 +01:00
bors
4aff10bb1b 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.
2018-06-27 17:20:27 +00:00
Adam Barth
a9f7cc3b49 [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.
2018-06-27 08:56:19 -07:00
bors
ed0350e945 Auto merge of #51356 - Zoxc:encode-cleanup, r=michaelwoerister
Make opaque::Encoder append-only and make it infallible
2018-06-27 14:25:52 +00:00
bors
142c98dd5a 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`).
2018-06-27 11:20:16 +00:00
Vadim Petrochenkov
d347270e0c Implement #[macro_export(local_inner_macros)] 2018-06-27 13:10:16 +03:00
John Kåre Alsaker
14d3c6e8f4 Make opaque::Encoder append-only and make it infallible 2018-06-27 11:43:15 +02:00
bors
c20824323c Auto merge of #51835 - tmccombs:stable-int-to-from-bytes, r=joshtriplett
Stabilize to_bytes and from_bytes for integers.

Fixes #49792
2018-06-27 09:21:34 +00:00
bors
971f7d34d4 Auto merge of #51815 - oli-obk:lowering_cleanups2, r=nikomatsakis
Lowering cleanups [2/N]

Double indirections are unnecessary
2018-06-27 07:16:13 +00:00
Thayne McCombs
c8f9b84b39 Stabilize to_bytes and from_bytes for integers.
Fixes #49792
2018-06-26 23:17:56 -06:00
bors
612c28004c 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.
2018-06-27 04:02:05 +00:00
bors
d6e2239a07 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.
2018-06-27 01:49:56 +00:00
bors
0cf0691ea1 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.)
2018-06-26 23:15:30 +00:00
bors
84804c3874 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](433e6b31a7))

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

r? @cramertj
2018-06-26 21:09:52 +00:00
Josef Reinhard Brandl
b39ea1d18f Move spawn errors into executor.rs 2018-06-26 21:13:36 +02:00
Josef Reinhard Brandl
c055fef010 Nested LocalTaskObj in TaskObj, remove SpawnErrorObj conversions 2018-06-26 21:06:20 +02:00
bors
9cc3d44b93 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.
2018-06-26 18:55:09 +00:00
bors
7008a953eb 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.
2018-06-26 16:26:00 +00:00
Oliver Schneider
e65947d701 Update rustdoc 2018-06-26 17:43:46 +02:00
Oliver Schneider
174b761432 Flatten some occurrences of [P<T>] to [T] 2018-06-26 17:07:53 +02:00
Josef Reinhard Brandl
433e6b31a7 Add LocalTaskObj 2018-06-26 17:06:20 +02:00
Zack M. Davis
64365e46f2 driveby status update to 2015 comment about parens in patterns 2018-06-26 07:54:49 -07:00
Zack M. Davis
3fb76f4027 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.
2018-06-26 07:54:49 -07:00
Zack M. Davis
057715557b 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).
2018-06-26 07:53:30 -07:00
Josef Reinhard Brandl
1f9aa1332f Split libcore/task.rs into submodules 2018-06-26 16:40:42 +02:00
Oliver Schneider
28a76a9000 Don't inspect the generated existential type items 2018-06-26 16:36:32 +02:00
bors
2808460e0f Auto merge of #51678 - Zoxc:combine-lints, r=estebank
Combine all builtin late lints
2018-06-26 14:18:13 +00:00
bors
764232cb2a 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
2018-06-26 11:20:18 +00:00
Pietro Albini
a539885450
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
2018-06-26 11:35:45 +02:00
Pietro Albini
f2a099b17f
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
2018-06-26 11:35:44 +02:00
Pietro Albini
8014713805
Rollup merge of #51788 - berkus:fix-typo, r=varkor
Fix typo
2018-06-26 11:35:43 +02:00
Pietro Albini
2348dc5b3f
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.
2018-06-26 11:35:41 +02:00
Pietro Albini
932db193c2
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.
2018-06-26 11:35:40 +02:00
Pietro Albini
b2cf26eec1
Rollup merge of #51747 - varkor:export_name-null-character, r=estebank
Add error for using null characters in #[export_name]

Fixes #51741.
2018-06-26 11:35:39 +02:00
Pietro Albini
7262824128
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
2018-06-26 11:35:38 +02:00
Pietro Albini
b71f6df5dd
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.
2018-06-26 11:35:37 +02:00
Pietro Albini
1215965a12
Rollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=oli-obk
Fix unknown windows build

Fixes #51618.
2018-06-26 11:35:35 +02:00
Pietro Albini
756b69492b
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.
2018-06-26 11:35:34 +02:00
Pietro Albini
d72a67f3bb
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](f0805a4421/src/librustc/traits/error_reporting.rs (L600)) be a [`Predicate::Trait`](f0805a4421/src/librustc/ty/mod.rs (L962)) variant, whose [`Display` implementation](f0805a4421/src/librustc/util/ppaux.rs (L1309)) calls `.print` on its `PolyTraitPredicate` member, [which is a type alias](f0805a4421/src/librustc/ty/mod.rs (L1112)) for `ty::Binder<TraitPredicate<'tcx>>`, whose [`Display` implementation](f0805a4421/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
2018-06-26 11:35:33 +02:00
bors
309fd8a6fb 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)
2018-06-26 09:20:33 +00:00
bors
773ce53ce7 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.
2018-06-26 07:06:18 +00:00
bors
7d2fa4a4d2 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
2018-06-26 03:49:37 +00:00
bors
fdd9cdc879 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
2018-06-26 01:42:14 +00:00
Niko Matsakis
91680347a7
make the while let loop terminate 2018-06-25 17:33:49 -04:00
Guillaume Gomez
f7485df05b Minify css 2018-06-25 23:28:20 +02:00
Mark Simulacrum
557d05b49d 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.
2018-06-25 15:21:13 -06:00
Esteban Küber
7aab3bf863 Don't ICE when performing lower_pattern_unadjusted on a TyError 2018-06-25 13:49:34 -07:00