]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoupdate/add tests
mark [Tue, 15 Jan 2019 17:31:49 +0000 (11:31 -0600)]
update/add tests

5 years agofix nested matchers with ?
mark [Mon, 14 Jan 2019 21:50:33 +0000 (15:50 -0600)]
fix nested matchers with ?

5 years agoAuto merge of #57630 - Centril:rollup, r=Centril
bors [Tue, 15 Jan 2019 13:56:16 +0000 (13:56 +0000)]
Auto merge of #57630 - Centril:rollup, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #56044 (Drop partially bound function parameters in the expected order)
 - #57352 (forbid manually impl'ing one of an object type's marker traits)
 - #57456 (RawVec doesn't always abort on allocation errors)
 - #57467 (Implement `check_attribute` to forbid `#[allow_internal_unsafe]`)
 - #57579 (Add core::iter::once_with())
 - #57587 (Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test)
 - #57608 (Simplify 'product' factorial example)
 - #57614 ([rustdoc] Fix crates filtering box not being filled)

Failed merges:

r? @ghost

5 years agoRollup merge of #57614 - GuillaumeGomez:fix-crate-filtering, r=QuietMisdreavus
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:14 +0000 (12:42 +0100)]
Rollup merge of #57614 - GuillaumeGomez:fix-crate-filtering, r=QuietMisdreavus

[rustdoc] Fix crates filtering box not being filled

Currently, the filter crate box (at the left of the search input) is always empty. To get the number of keys of dictionary in JS, you need to call `Object.keys()` on it.

r? @QuietMisdreavus

5 years agoRollup merge of #57608 - timvisee:master, r=frewsxcv
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:13 +0000 (12:42 +0100)]
Rollup merge of #57608 - timvisee:master, r=frewsxcv

Simplify 'product' factorial example

This simplifies the [`factorial(n: 32)`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#examples-46) implementation as example for the `Iterator::product()` function.
It currently uses unnecessary additional complexity.

Although very minimal, I do not want to include it in some other irrelevant PR.

5 years agoRollup merge of #57587 - Aaron1011:fix/const-pat-ice, r=alexcrichton
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:12 +0000 (12:42 +0100)]
Rollup merge of #57587 - Aaron1011:fix/const-pat-ice, r=alexcrichton

Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test

This ensures that the test passes, regardless of what the user has set
RUST_BACKTRACE to.

5 years agoRollup merge of #57579 - stjepang:once-with, r=SimonSapin
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:10 +0000 (12:42 +0100)]
Rollup merge of #57579 - stjepang:once-with, r=SimonSapin

Add core::iter::once_with()

Functions `iter::once()` and `iter::repeat()` construct iterators from values. The latter has the lazy variant `iter::repeat_with()`, but the former doesn't. This PR therefore adds `iter::once_with()`.

Another way to think of `iter::once_with()` is that it's a function that converts `FnOnce() -> T` into `Iterator<Item = T>`.

If this seems like a reasonable addition, I'll open a tracking issue and update the `#[feature(...)]` attributes.

5 years agoRollup merge of #57467 - JohnTitor:implement-the-check-attribute-1, r=oli-obk
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:08 +0000 (12:42 +0100)]
Rollup merge of #57467 - JohnTitor:implement-the-check-attribute-1, r=oli-obk

Implement `check_attribute` to forbid `#[allow_internal_unsafe]`

Fixes #56768.

r? @oli-obk

5 years agoRollup merge of #57456 - fintelia:patch-4, r=dtolnay
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:07 +0000 (12:42 +0100)]
Rollup merge of #57456 - fintelia:patch-4, r=dtolnay

RawVec doesn't always abort on allocation errors

5 years agoRollup merge of #57352 - arielb1:no-manual-markers, r=nikomatsakis
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:06 +0000 (12:42 +0100)]
Rollup merge of #57352 - arielb1:no-manual-markers, r=nikomatsakis

forbid manually impl'ing one of an object type's marker traits

This shouldn't break compatibility for crates that do not use
`feature(optin_builtin_traits)`, because as the test shows, it is
only possible to impl a marker trait for a trait object in the crate the
marker trait is defined in, which must define
`feature(optin_builtin_traits)`.

Fixes #56934.

r? @nikomatsakis

5 years agoRollup merge of #56044 - matthewjasper:function-param-drop-order, r=cramertj
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:04 +0000 (12:42 +0100)]
Rollup merge of #56044 - matthewjasper:function-param-drop-order, r=cramertj

Drop partially bound function parameters in the expected order

Given the function

```rust
fn foo((_x, _): (LogDrop, LogDrop), (_, _y): (LogDrop, LogDrop)) {}
```

Prior to 1.12.0 we dropped both `_x` and `_y` before the rest of their
respective parameters, since then we dropped `_x` and `_y` after. The
original order appears to be the correct order, as the value created
later is dropped first, so we revert to that order and add a test for
it.

While this is technically a breaking change, I can't work out how
anyone could be relying on this without making their code very
brittle. If this is considered to be too likely to break real world code
then I can revert the change and change the test to check for the
current order.

5 years agoAuto merge of #57625 - drrlvn:patch-1, r=Centril
bors [Tue, 15 Jan 2019 11:18:24 +0000 (11:18 +0000)]
Auto merge of #57625 - drrlvn:patch-1, r=Centril

Stabilize FileExt::read_exact_at/write_all_at

r? alexcrichton

Closes #51984.

5 years agoFix tests
Yuki Okushi [Tue, 15 Jan 2019 09:02:46 +0000 (18:02 +0900)]
Fix tests

5 years agoChange from _ to None
Yuki Okushi [Tue, 15 Jan 2019 09:02:22 +0000 (18:02 +0900)]
Change from _ to None

5 years agoRestore error message
Yuki Okushi [Tue, 15 Jan 2019 09:01:38 +0000 (18:01 +0900)]
Restore error message

5 years agoStabilize FileExt::read_exact_at/write_all_at
Dror Levin [Tue, 15 Jan 2019 08:33:39 +0000 (10:33 +0200)]
Stabilize FileExt::read_exact_at/write_all_at

Closes #51984.

5 years agoAuto merge of #57130 - VardhanThigle:Vardhan/x86_64-fortanix-unknown-sgx-tier2_suppor...
bors [Tue, 15 Jan 2019 04:06:25 +0000 (04:06 +0000)]
Auto merge of #57130 - VardhanThigle:Vardhan/x86_64-fortanix-unknown-sgx-tier2_support, r=alexcrichton

Upgrade x86_64-fortanix-unknown-sgx platform support to tier 2

## Overview
1. This PR upgrades x86_64-fortanix-unknown-sgx platform support to tier 2 (std only) by setting up build automation for this target.
1. For supporting unwinding, this target needs to link to a port of LLVM's libunwind (more details could be found in #56979), which will be distributed along with the Rust binaries (similar to the extra musl objects)

### Building and copying libunwind:
We have added a new build script  (`build-x86_64-fortanix-unknown-sgx-toolchain.sh`) that will run while the container is built. This will build `libunwind.a` from git source.
While the container is built, the persistent volumes where obj/ gets created aren't yet mapped. As a workaround, we copy the built `libunwind.a` to  `obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-fortanix-unknown-sgx/lib/` after x.py runs.
 If any reviewer knows of a better solution, please do tell.

r? @Mark-Simulacrum

5 years agoFix crates filtering box not being filled
Guillaume Gomez [Mon, 14 Jan 2019 23:41:41 +0000 (00:41 +0100)]
Fix crates filtering box not being filled

5 years agoAuto merge of #57607 - Centril:rollup, r=Centril
bors [Mon, 14 Jan 2019 23:00:50 +0000 (23:00 +0000)]
Auto merge of #57607 - Centril:rollup, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #57043 (Fix poor worst case performance of set intersection)
 - #57480 (Clean up and fix a bug in query plumbing)
 - #57481 (provide suggestion for invalid boolean cast)
 - #57540 (Modify some parser diagnostics to continue evaluating beyond the parser)
 - #57570 (Querify local `plugin_registrar_fn` and `proc_macro_decls_static`)
 - #57572 (Unaccept `extern_in_paths`)
 - #57585 (Recover from item trailing semicolon)
 - #57589 (Add a debug_assert to Vec::set_len)

Failed merges:

r? @ghost

5 years agofix test output changing in rebase
Ariel Ben-Yehuda [Mon, 14 Jan 2019 22:26:50 +0000 (00:26 +0200)]
fix test output changing in rebase

5 years agoAdd error check
Yuki Okushi [Mon, 14 Jan 2019 21:56:21 +0000 (06:56 +0900)]
Add error check

5 years agoAdd test
Yuki Okushi [Mon, 14 Jan 2019 21:55:17 +0000 (06:55 +0900)]
Add test

5 years agoMake UnsafeCode EarlyLintPass
Yuki Okushi [Mon, 14 Jan 2019 21:54:28 +0000 (06:54 +0900)]
Make UnsafeCode EarlyLintPass

5 years agoRun lint for unsafe on the ast
Yuki Okushi [Mon, 14 Jan 2019 20:42:09 +0000 (05:42 +0900)]
Run lint for unsafe on the ast

5 years agoAdd PartialEq
Yuki Okushi [Mon, 14 Jan 2019 20:36:46 +0000 (05:36 +0900)]
Add PartialEq

5 years agoSimplify 'product' factorial example
timvisee [Mon, 14 Jan 2019 20:20:01 +0000 (21:20 +0100)]
Simplify 'product' factorial example

5 years agoRollup merge of #57589 - scottmcm:vec-set_len-debug_assert, r=alexcrichton
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:59 +0000 (20:31 +0100)]
Rollup merge of #57589 - scottmcm:vec-set_len-debug_assert, r=alexcrichton

Add a debug_assert to Vec::set_len

Following the precedent of https://github.com/rust-lang/rust/pull/52972, which found https://github.com/llogiq/bytecount/pull/42.

(This may well make a test fail; let's see what Travis says.)

5 years agoRollup merge of #57585 - estebank:trailing-semicolon, r=petrochenkov
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:58 +0000 (20:31 +0100)]
Rollup merge of #57585 - estebank:trailing-semicolon, r=petrochenkov

Recover from item trailing semicolon

CC https://github.com/rust-lang/rfcs/pull/2479

r? @petrochenkov

5 years agoRollup merge of #57572 - Centril:unaccept-extern-in-path, r=petrochenkov
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:57 +0000 (20:31 +0100)]
Rollup merge of #57572 - Centril:unaccept-extern-in-path, r=petrochenkov

Unaccept `extern_in_paths`

Based on completed fcp-close in https://github.com/rust-lang/rust/issues/55600, this removes `extern_in_path` (e.g. `extern::foo::bar`) from the language. The changes are primarily reversing https://github.com/rust-lang/rust/commit/32db83b16e06cb5cca72d0e6a648a8008eda0fac.

Closes https://github.com/rust-lang/rust/issues/55600

r? @petrochenkov

5 years agoRollup merge of #57570 - Xanewok:querify-some, r=Zoxc
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:56 +0000 (20:31 +0100)]
Rollup merge of #57570 - Xanewok:querify-some, r=Zoxc

Querify local `plugin_registrar_fn` and `proc_macro_decls_static`

Instead of calculating them as part of the `Session`, we do that in the query system.
It's also nice that these queries are already defined for external crates - here, we provide the queries for the local crate.

r? @nikomatsakis

5 years agoRollup merge of #57540 - estebank:eval-more, r=petrochenkov
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:55 +0000 (20:31 +0100)]
Rollup merge of #57540 - estebank:eval-more, r=petrochenkov

Modify some parser diagnostics to continue evaluating beyond the parser

Continue evaluating further errors after parser errors on:
 - trailing type argument attribute
 - lifetime in incorrect location
 - incorrect binary literal
 - missing `for` in `impl Trait for Foo`
 - type argument in `where` clause
 - incorrect float literal
 - incorrect `..` in pattern
 - associated types
 - incorrect discriminator value variant error

and others. All of these were found by making `continue-parse-after-error` `true` by default to identify errors that would need few changes. There are now only a handful of errors that have any change with `continue-parse-after-error` enabled.

These changes make it so `rust` _won't_ stop evaluation after finishing parsing, enabling type checking errors to be displayed on the existing code without having to fix the parse errors.

Each commit has an individual diagnostic change with their corresponding tests.

CC #48724.

5 years agoRollup merge of #57481 - euclio:bool-cast-suggestion, r=estebank
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:53 +0000 (20:31 +0100)]
Rollup merge of #57481 - euclio:bool-cast-suggestion, r=estebank

provide suggestion for invalid boolean cast

Also, don't suggest comparing to zero for non-numeric expressions.

5 years agoRollup merge of #57480 - Zoxc:query-fix, r=michaelwoerister
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:52 +0000 (20:31 +0100)]
Rollup merge of #57480 - Zoxc:query-fix, r=michaelwoerister

Clean up and fix a bug in query plumbing

r? @michaelwoerister

5 years agoRollup merge of #57043 - ssomers:master, r=alexcrichton
Mazdak Farrokhzad [Mon, 14 Jan 2019 19:31:51 +0000 (20:31 +0100)]
Rollup merge of #57043 - ssomers:master, r=alexcrichton

Fix poor worst case performance of set intersection

Specifically, intersection of asymmetrically sized sets when the large set is on the left. See also the [latest answer on stackoverflow](https://stackoverflow.com/questions/35439376/python-set-intersection-is-faster-then-rust-hashset-intersection).

Also applied to the union member, where the effect is much less but still measurable.

Formatted the changed code only, does not increase the error count reported by tidy check, and tried to adhere to the spirit of the unit tests.

5 years agoAuto merge of #57559 - ehuss:update-cargo, r=alexcrichton
bors [Mon, 14 Jan 2019 18:25:46 +0000 (18:25 +0000)]
Auto merge of #57559 - ehuss:update-cargo, r=alexcrichton

Update cargo

13 commits in 34320d212dca8cd27d06ce93c16c6151f46fcf2e..2b4a5f1f0bb6e13759e88ea9512527b0beba154f
2019-01-03 19:12:38 +0000 to 2019-01-12 04:13:12 +0000
- Add test for publish with [patch] + cleanup. (rust-lang/cargo#6544)
- Fix clippy warning (rust-lang/cargo#6546)
- Revert "Workaround by using yesterday's nightly" (rust-lang/cargo#6540)
- Adding feature-flags to `cargo publish` and `cargo package` (rust-lang/cargo#6453)
- Fix the Travis CI badge (rust-lang/cargo#6530)
- Add helpful text for Windows exceptions like Unix (rust-lang/cargo#6532)
- Report fix bugs to Rust instead of Cargo (rust-lang/cargo#6531)
- --{example,bin,bench,test} with no argument now lists all available targets (rust-lang/cargo#6505)
- Rebuild on mid build file modification (rust-lang/cargo#6484)
- Derive Clone for TomlDependency (rust-lang/cargo#6527)
- publish: rework the crates.io detection logic. (rust-lang/cargo#6525)
- avoid duplicates in ignore files (rust-lang/cargo#6521)
- Rustflags in metadata (rust-lang/cargo#6503)

r? @alexcrichton

5 years agoAdd another feature(iter_once_with)
Stjepan Glavina [Mon, 14 Jan 2019 16:36:34 +0000 (17:36 +0100)]
Add another feature(iter_once_with)

5 years agoAdd feature(iter_once_with)
Stjepan Glavina [Mon, 14 Jan 2019 16:20:41 +0000 (17:20 +0100)]
Add feature(iter_once_with)

5 years agoAuto merge of #57592 - Centril:rollup, r=Centril
bors [Mon, 14 Jan 2019 13:03:24 +0000 (13:03 +0000)]
Auto merge of #57592 - Centril:rollup, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #57232 (Parallelize and optimize parts of HIR map creation)
 - #57418 (MetadataOnlyCodegenBackend: run the collector only once)
 - #57465 (Stabilize cfg_target_vendor)
 - #57477 (clarify resolve typo suggestion)
 - #57556 (privacy: Fix private-in-public check for existential types)
 - #57584 (Remove the `connect_timeout_unroutable` test.)

Failed merges:

r? @ghost

5 years agoRemove unnecessary mut
Stjepan Glavina [Mon, 14 Jan 2019 11:23:50 +0000 (12:23 +0100)]
Remove unnecessary mut

5 years agoRollup merge of #57584 - nnethercote:rm-connect_timeout_unroutable, r=sfackler
Mazdak Farrokhzad [Mon, 14 Jan 2019 10:31:55 +0000 (11:31 +0100)]
Rollup merge of #57584 - nnethercote:rm-connect_timeout_unroutable, r=sfackler

Remove the `connect_timeout_unroutable` test.

It requires an unreachable IP address, but there is no such thing, and
this has caused it to fail for multiple people.

Fixes #44698, fixes #50065.

r? @sfackler

5 years agoRollup merge of #57556 - petrochenkov:privexist, r=arielb1
Mazdak Farrokhzad [Mon, 14 Jan 2019 10:31:54 +0000 (11:31 +0100)]
Rollup merge of #57556 - petrochenkov:privexist, r=arielb1

privacy: Fix private-in-public check for existential types

Fixes https://github.com/rust-lang/rust/issues/53546 (regression from https://github.com/rust-lang/rust/pull/56878)

r? @arielb1

5 years agoRollup merge of #57477 - euclio:clarify-lev-suggestion, r=zackmdavis
Mazdak Farrokhzad [Mon, 14 Jan 2019 10:31:53 +0000 (11:31 +0100)]
Rollup merge of #57477 - euclio:clarify-lev-suggestion, r=zackmdavis

clarify resolve typo suggestion

Include the kind of the binding that we're suggesting, and use a
structured suggestion.

Fixes #53445.

5 years agoRollup merge of #57465 - jethrogb:jb/stablize-cfg-target-vendor, r=joshtriplett,Centril
Mazdak Farrokhzad [Mon, 14 Jan 2019 10:31:52 +0000 (11:31 +0100)]
Rollup merge of #57465 - jethrogb:jb/stablize-cfg-target-vendor, r=joshtriplett,Centril

Stabilize cfg_target_vendor

This stabilizes the use of `cfg(target_vendor = "...")` and removes the corresponding `cfg_target_vendor` feature. Other unstable cfgs remain behind their existing feature gates.

This functionality was added back in 2015 in #28612 to complete the coverage of target tuples (`<arch><sub>-<vendor>-<os>-<env>`). [RFC 131](https://github.com/rust-lang/rfcs/blob/master/text/0131-target-specification.md) governs the target specification, not including `target_vendor` seems to have just been an oversight. `target_os`, `target_family`, and `target_arch` are stable as of 1.0.0. `target_env` was also not mentioned in RFC 131, was added in #24777, never behind a feature_gate, and insta-stable at 1.1.0.

The functionality is tested in [test/run-pass/cfg/cfg-target-vendor.rs](https://github.com/rust-lang/rust/blob/master/src/test/run-pass/cfg/cfg-target-vendor.rs).

Closes #29718

5 years agoRollup merge of #57418 - lqd:collector_query, r=michaelwoerister
Mazdak Farrokhzad [Mon, 14 Jan 2019 10:31:50 +0000 (11:31 +0100)]
Rollup merge of #57418 - lqd:collector_query, r=michaelwoerister

MetadataOnlyCodegenBackend: run the collector only once

Use the `collect_and_partition_mono_items` query to avoid calling the collector directly twice.

Fixes #57406.

5 years agoRollup merge of #57232 - Zoxc:par-collector-misc, r=michaelwoerister
Mazdak Farrokhzad [Mon, 14 Jan 2019 10:31:49 +0000 (11:31 +0100)]
Rollup merge of #57232 - Zoxc:par-collector-misc, r=michaelwoerister

Parallelize and optimize parts of HIR map creation

r? @michaelwoerister

5 years agoAuto merge of #57322 - Centril:stabilize-identity, r=SimonSapin
bors [Mon, 14 Jan 2019 10:22:22 +0000 (10:22 +0000)]
Auto merge of #57322 - Centril:stabilize-identity, r=SimonSapin

Stabilize core::convert::identity

r? @SimonSapin

fixes https://github.com/rust-lang/rust/issues/53500

This is waiting for FCP to complete but in the interim it would be good to review.

5 years agoStabilize `cfg_target_vendor`, #29718
Jethro Beekman [Wed, 9 Jan 2019 08:00:34 +0000 (13:30 +0530)]
Stabilize `cfg_target_vendor`, #29718

5 years agoAdd additional human-readable cfg strings to rustdoc
Jethro Beekman [Wed, 9 Jan 2019 07:59:45 +0000 (13:29 +0530)]
Add additional human-readable cfg strings to rustdoc

5 years agoAdd a debug_assert to Vec::set_len
Scott McMurray [Sat, 15 Dec 2018 05:41:18 +0000 (21:41 -0800)]
Add a debug_assert to Vec::set_len

5 years agoAuto merge of #57387 - euclio:nonstandard-style-suggestions, r=oli-obk
bors [Mon, 14 Jan 2019 06:35:51 +0000 (06:35 +0000)]
Auto merge of #57387 - euclio:nonstandard-style-suggestions, r=oli-obk

Use structured suggestions for nonstandard style lints

This PR modifies the lints in the nonstandard_style group to use structured suggestions. Note that there's a bit of tricky span calculation going on for the `crate_name` attribute. It also simplifies the code a bit: I don't think the "fallback" suggestions for these lints can actually be triggered.

Fixes #48103.
Fixes #52414.

5 years agoAdd 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test
Aaron Hill [Mon, 14 Jan 2019 06:16:27 +0000 (01:16 -0500)]
Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test

This ensures that the test passes, regardless of what the user has set
RUST_BACKTRACE to.

5 years agoAuto merge of #57381 - estebank:if-else-308, r=nikomatsakis
bors [Mon, 14 Jan 2019 03:49:25 +0000 (03:49 +0000)]
Auto merge of #57381 - estebank:if-else-308, r=nikomatsakis

Tweak output of type mismatch between "then" and `else` `if` arms

```
error[E0308]: if and else have incompatible types
  --> $DIR/if-else-type-mismatch.rs:5:9
   |
LL |       let _ = if true {
   |  _____________-
LL | |         42i32
   | |         ----- expected because of this
LL | |     } else {
LL | |         42u32
   | |         ^^^^^ expected i32, found u32
LL | |     };
   | |_____- if and else have incompatible types
   |
   = note: expected type `i32`
              found type `u32`

error[E0308]: if and else have incompatible types
  --> file.rs:2:38
   |
LL |     let _ = if false { 3u8; } else { 3u8 };
   |                        ----          ^^^ expected (), found u8
   |                        |  |
   |                        |  help: consider removing this semicolon
   |                        expected because of this
   |
   = note: expected type `()`
              found type `u8`

error[E0308]: if and else have incompatible types
  --> file.rs:3:37
   |
LL |     let _ = if false { 3u8 } else { 3u8; };
   |                        ---          ^^^-
   |                        |            |  |
   |                        |            |  help: consider removing this semicolon
   |                        |            expected u8, found ()
   |                        expected because of this
   |
   = note: expected type `u8`
              found type `()`

error[E0308]: if and else have incompatible types
  --> file.rs:4:37
   |
LL |     let _ = if false { 3i8 } else { 3u8 };
   |                        ---          ^^^ expected i8, found u8
   |                        |
   |                        expected because of this
   |
   = note: expected type `i8`
              found type `u8`
```

Fix #57348.

5 years agoParallelize and optimize parts of HIR map creation
John Kåre Alsaker [Wed, 6 Jun 2018 20:13:52 +0000 (22:13 +0200)]
Parallelize and optimize parts of HIR map creation

5 years agoSuggest removal of semicolon when appropriate
Esteban Küber [Mon, 7 Jan 2019 01:21:43 +0000 (17:21 -0800)]
Suggest removal of semicolon when appropriate

5 years agoTweak output of type mismatch between "then" and `else` `if` arms
Esteban Küber [Sun, 6 Jan 2019 21:37:03 +0000 (13:37 -0800)]
Tweak output of type mismatch between "then" and `else` `if` arms

5 years agoRecover from item trailing semicolon
Esteban Küber [Mon, 14 Jan 2019 01:29:32 +0000 (17:29 -0800)]
Recover from item trailing semicolon

5 years agoAuto merge of #56954 - hug-dev:armv8m-main-ci, r=alexcrichton
bors [Mon, 14 Jan 2019 00:59:54 +0000 (00:59 +0000)]
Auto merge of #56954 - hug-dev:armv8m-main-ci, r=alexcrichton

Add dist builder for Armv8-M Mainline

This commit adds the Armv8-M Mainline target in the list of targets that
get their dist components built. It also update the build-manifest so
that this target gets also its dist components uploaded.

I took example on other pull requests doing the same thing for another target to make the changes. Please feel free to comment if things needs to be added or removed.

Doing `./x.py dist --target thumbv8m.main-none-eabi` worked locally so I assume that this will also work on the CI.
It will (I think) however need a new release of alexcrichton/cc-rs to include the pull request alexcrichton/cc-rs#363 @alexcrichton

I hope to do the HardFloat version (`thumbv8m.main-none-eabihf`) and Baseline (`thumbv8m.base-none-eabi`) later, as fixes need to be done on compiler-builtins first to support those.

5 years agoFix failing test
Stjepan Glavina [Sun, 13 Jan 2019 23:45:57 +0000 (00:45 +0100)]
Fix failing test

5 years agoRetain original pass order
Igor Matuszewski [Sun, 13 Jan 2019 22:55:47 +0000 (23:55 +0100)]
Retain original pass order

It shouldn't matter, but hey - better safe than sorry!

5 years agoQuerify local plugin_registrar_fn
Igor Matuszewski [Sun, 13 Jan 2019 00:06:50 +0000 (01:06 +0100)]
Querify local plugin_registrar_fn

5 years agoQuerify local proc_macro_decls_static
Igor Matuszewski [Sat, 12 Jan 2019 20:49:18 +0000 (21:49 +0100)]
Querify local proc_macro_decls_static

5 years agoRemove the `connect_timeout_unroutable` test.
Nicholas Nethercote [Sun, 13 Jan 2019 22:24:52 +0000 (09:24 +1100)]
Remove the `connect_timeout_unroutable` test.

It requires an unreachable IP address, but there is no such thing, and
this has caused it to fail for multiple people.

Fixes #44698, fixes #50065.

5 years agoAuto merge of #57580 - Centril:rollup, r=Centril
bors [Sun, 13 Jan 2019 22:20:43 +0000 (22:20 +0000)]
Auto merge of #57580 - Centril:rollup, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #56874 (Simplify foreign type rendering.)
 - #57113 (Move diagnostics out from QueryJob and optimize for the case with no diagnostics)
 - #57366 (Point at match discriminant on type error in match arm pattern)
 - #57538 (librustc_mir: Fix ICE with slice patterns)

Failed merges:

 - #57381 (Tweak output of type mismatch between "then" and `else` `if` arms)

r? @ghost

5 years agoFix intradoc link and update issue number
Stjepan Glavina [Sun, 13 Jan 2019 20:24:15 +0000 (21:24 +0100)]
Fix intradoc link and update issue number

5 years agoRollup merge of #57538 - dlrobertson:fix_57472, r=zackmdavis
Mazdak Farrokhzad [Sun, 13 Jan 2019 20:18:13 +0000 (21:18 +0100)]
Rollup merge of #57538 - dlrobertson:fix_57472, r=zackmdavis

librustc_mir: Fix ICE with slice patterns

If a match arm does not include all fields in a structure and a later
pattern includes a field that is an array, we will attempt to use the
array type from the prior arm. When calculating the field type, treat
a array of an unknown size as a `TyErr`.

Fixes: #57472
5 years agoRollup merge of #57366 - estebank:point-match-discrim, r=varkor
Mazdak Farrokhzad [Sun, 13 Jan 2019 20:18:12 +0000 (21:18 +0100)]
Rollup merge of #57366 - estebank:point-match-discrim, r=varkor

Point at match discriminant on type error in match arm pattern

```
error[E0308]: mismatched types
 --> src/main.rs:5:9
  |
4 |    let temp: usize = match a + b {
  |                            ----- this expression has type `usize`
5 |         Ok(num) => num,
  |         ^^^^^^^ expected usize, found enum `std::result::Result`
  |
  = note: expected type `usize`
             found type `std::result::Result<_, _>`
```
Fix #57279.

5 years agoRollup merge of #57113 - Zoxc:query-perf10, r=michaelwoerister
Mazdak Farrokhzad [Sun, 13 Jan 2019 20:18:11 +0000 (21:18 +0100)]
Rollup merge of #57113 - Zoxc:query-perf10, r=michaelwoerister

Move diagnostics out from QueryJob and optimize for the case with no diagnostics

r? @michaelwoerister

5 years agoRollup merge of #56874 - JohnHeitmann:docs-spacing, r=GuillaumeGomez
Mazdak Farrokhzad [Sun, 13 Jan 2019 20:18:09 +0000 (21:18 +0100)]
Rollup merge of #56874 - JohnHeitmann:docs-spacing, r=GuillaumeGomez

Simplify foreign type rendering.

Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans.

Reduces element count on the `std::iter::Iterator` page by 30%. On my laptop it drops Iterator page load time from ~15s to ~10s. Frame times during scrolling are a hair lower too.

Known visual changes (happy to tweak based on feedback):
* The main `impl ...` headers are now getting the default, larger, h3 font size. This was an accident, but I liked how it turned out so I didn't fix it.
* There's a hair less vertical spacing between the end of a where block and the start of the next fn. Now, all spacing is consistent. I think this looks a bit worse. I may tweak vertical spacing more here or in a follow-up that cleans up vertical spacing more broadly.
* "[src]" links are all sized at 17px. A few were 19px in the original.

I haven't yet done heavy cross-browser or cross-crate testing. I was hoping to get a quick thumbs up or thumbs down here at this first draft, then if this is on the right track I'll spend some time on that testing.

TODO:

- [x] Test on Chrome
- [x] Test on Firefox
- [ ] ~~Test on UC Android~~
- [x] Test on Edge
- [x] Test on iOS safari
- [x] Test on desktop safari
- [x] Update automated tests
- [x] Increase vertical margin
- [x] Fix "Important traits for" hover overlap
- [x] Wait for #55798 to land & merge it

5 years agoAuto merge of #51487 - Zoxc:incr-passes, r=michaelwoerister
bors [Sun, 13 Jan 2019 19:43:46 +0000 (19:43 +0000)]
Auto merge of #51487 - Zoxc:incr-passes, r=michaelwoerister

Make more passes incremental

r? @michaelwoerister

5 years agoforbid manually impl'ing one of an object type's marker traits
Ariel Ben-Yehuda [Sat, 5 Jan 2019 14:19:34 +0000 (16:19 +0200)]
forbid manually impl'ing one of an object type's marker traits

This shouldn't break compatibility for crates that do not use
`feature(optin_builtin_traits)`, because as the test shows, it is
only possible to impl a marker trait for a trait object in the crate the
marker trait is defined in, which must define
`feature(optin_builtin_traits)`.

Fixes #56934

5 years agoAuto merge of #57577 - Centril:rollup, r=Centril
bors [Sun, 13 Jan 2019 17:08:24 +0000 (17:08 +0000)]
Auto merge of #57577 - Centril:rollup, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #57004 (Make `TokenStream` less recursive.)
 - #57102 (NLL: Add union justifications to conflicting borrows.)
 - #57337 (rustc: Place wasm linker args first instead of last)
 - #57549 (Add #[must_use] message to Iterator and Future)

Failed merges:

r? @ghost

5 years agoRollup merge of #57549 - taiki-e:must_use, r=estebank
Mazdak Farrokhzad [Sun, 13 Jan 2019 16:21:43 +0000 (17:21 +0100)]
Rollup merge of #57549 - taiki-e:must_use, r=estebank

Add #[must_use] message to Iterator and Future

~~Iterator's message is based on current iterator adaptor's #[must_use] message (added in #15561) and https://github.com/rust-lang/rust/pull/56677/files#r241236020~~
Future's message is the same as those used in [futures-rs](https://github.com/rust-lang-nursery/futures-rs/search?q=must_use&unscoped_q=must_use) and [tokio](https://github.com/tokio-rs/tokio/search?q=must_use&unscoped_q=must_use).

r? @Centril

5 years agoRollup merge of #57337 - alexcrichton:prioritize-another, r=fitzgen
Mazdak Farrokhzad [Sun, 13 Jan 2019 16:21:42 +0000 (17:21 +0100)]
Rollup merge of #57337 - alexcrichton:prioritize-another, r=fitzgen

rustc: Place wasm linker args first instead of last

This ensures that arguments passed via `-C link-arg` can override the
first ones on the command line, for example allowing configuring of the
stack size.

5 years agoRollup merge of #57102 - davidtwco:issue-57100, r=nikomatsakis
Mazdak Farrokhzad [Sun, 13 Jan 2019 16:21:40 +0000 (17:21 +0100)]
Rollup merge of #57102 - davidtwco:issue-57100, r=nikomatsakis

NLL: Add union justifications to conflicting borrows.

Fixes #57100.

This PR adds justifications to error messages for conflicting borrows of union fields.

Where previously an error message would say ``cannot borrow `u.b` as mutable..``, it now says ``cannot borrow `u` (via `u.b`) as mutable..``.

r? @pnkfelix

5 years agoRollup merge of #57004 - nnethercote:TS-change-Stream, r=petrochenkov
Mazdak Farrokhzad [Sun, 13 Jan 2019 16:21:39 +0000 (17:21 +0100)]
Rollup merge of #57004 - nnethercote:TS-change-Stream, r=petrochenkov

Make `TokenStream` less recursive.

`TokenStream` is currently recursive in *two* ways:

- the `TokenTree` variant contains a `ThinTokenStream`, which can
  contain a `TokenStream`;

- the `TokenStream` variant contains a `Vec<TokenStream>`.

The latter is not necessary and causes significant complexity. This
commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`.

This reduces complexity significantly. In particular, `StreamCursor` is
eliminated, and `Cursor` becomes much simpler, consisting now of just a
`TokenStream` and an index.

The commit also removes the `Extend` impl for `TokenStream`, because it
is only used in tests. (The commit also removes those tests.)

Overall, the commit reduces the number of lines of code by almost 200.

5 years agoAdd core::iter::once_with
Stjepan Glavina [Sun, 13 Jan 2019 10:16:14 +0000 (11:16 +0100)]
Add core::iter::once_with

5 years agoAuto merge of #57567 - Centril:stabilize-transpose, r=alexreg
bors [Sun, 13 Jan 2019 14:35:40 +0000 (14:35 +0000)]
Auto merge of #57567 - Centril:stabilize-transpose, r=alexreg

Stabilize `transpose_result` in 1.33

fixes https://github.com/rust-lang/rust/issues/47338.

FCP completed: https://github.com/rust-lang/rust/issues/47338#issuecomment-453762236

r? @alexreg

5 years agolibrustc_mir: Fix ICE with slice patterns
Dan Robertson [Sun, 13 Jan 2019 14:23:32 +0000 (14:23 +0000)]
librustc_mir: Fix ICE with slice patterns

If a match arm does not include all fields in a structure and a later
pattern includes a field that is an array, we will attempt to use the
array type from the prior arm. When calculating the field type, treat
a array of an unknown size as a TyErr.

5 years agoremove extern_in_paths.
Mazdak Farrokhzad [Sun, 13 Jan 2019 13:18:00 +0000 (14:18 +0100)]
remove extern_in_paths.

5 years agoAuto merge of #57568 - Centril:rollup, r=Centril
bors [Sun, 13 Jan 2019 11:54:02 +0000 (11:54 +0000)]
Auto merge of #57568 - Centril:rollup, r=Centril

Rollup of 16 pull requests

Successful merges:

 - #57351 (Don't actually create a full MIR stack frame when not needed)
 - #57353 (Optimise floating point `is_finite` (2x) and `is_infinite` (1.6x).)
 - #57412 (Improve the wording)
 - #57436 (save-analysis: use a fallback when access levels couldn't be computed)
 - #57453 (lldb_batchmode.py: try `import _thread` for Python 3)
 - #57454 (Some cleanups for core::fmt)
 - #57461 (Change `String` to `&'static str` in `ParseResult::Failure`.)
 - #57473 (std: Render large exit codes as hex on Windows)
 - #57474 (save-analysis: Get path def from parent in case there's no def for the path itself.)
 - #57494 (Speed up item_bodies for large match statements involving regions)
 - #57496 (re-do docs for core::cmp)
 - #57508 (rustdoc: Allow inlining of reexported crates and crate items)
 - #57547 (Use `ptr::eq` where applicable)
 - #57557 (resolve: Mark extern crate items as used in more cases)
 - #57560 (hygiene: Do not treat `Self` ctor as a local variable)
 - #57564 (Update the const fn tracking issue to the new metabug)

Failed merges:

r? @ghost

5 years agoAuto merge of #57566 - Centril:const-stabilize-overflowing, r=alexreg
bors [Sun, 13 Jan 2019 09:12:51 +0000 (09:12 +0000)]
Auto merge of #57566 - Centril:const-stabilize-overflowing, r=alexreg

Const-stabilize `const_int_overflowing`

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

r? @alexreg

5 years agoFix breakage from #56988 and workaround for #57569
Vardhan Thigle [Wed, 9 Jan 2019 08:23:46 +0000 (13:53 +0530)]
Fix breakage from #56988 and workaround for #57569

5 years agoAdding Build automation for x86_64-fortanix-unknown-sgx
Vardhan Thigle [Wed, 26 Dec 2018 07:02:45 +0000 (12:32 +0530)]
Adding Build automation for x86_64-fortanix-unknown-sgx

5 years agoChange #[must_use] message of Iterator in documentation
Taiki Endo [Sun, 13 Jan 2019 06:17:57 +0000 (15:17 +0900)]
Change #[must_use] message of Iterator in documentation

5 years agoChange #[must_use] message of Iterator
Taiki Endo [Sun, 13 Jan 2019 05:46:42 +0000 (14:46 +0900)]
Change #[must_use] message of Iterator

5 years agostabilize transpose_result in 1.33
Mazdak Farrokhzad [Sun, 13 Jan 2019 03:34:32 +0000 (04:34 +0100)]
stabilize transpose_result in 1.33

5 years agoRollup merge of #57564 - varkor:update-const_fn-tracking-issue, r=Centril
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:27:01 +0000 (05:27 +0100)]
Rollup merge of #57564 - varkor:update-const_fn-tracking-issue, r=Centril

Update the const fn tracking issue to the new metabug

The new `const fn` tracking issue is #57563. We don't want to point to a closed issue in the diagnostics (or FIXMEs), so these have been updated (from the old issue, #24111).

r? @Centril

5 years agoRollup merge of #57560 - petrochenkov:selfinmac, r=alexreg
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:27:00 +0000 (05:27 +0100)]
Rollup merge of #57560 - petrochenkov:selfinmac, r=alexreg

hygiene: Do not treat `Self` ctor as a local variable

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

5 years agoRollup merge of #57557 - petrochenkov:ecused, r=varkor
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:59 +0000 (05:26 +0100)]
Rollup merge of #57557 - petrochenkov:ecused, r=varkor

resolve: Mark extern crate items as used in more cases

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

5 years agoRollup merge of #57547 - Xanewok:ptr-eq, r=petrochenkov
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:58 +0000 (05:26 +0100)]
Rollup merge of #57547 - Xanewok:ptr-eq, r=petrochenkov

Use `ptr::eq` where applicable

Stumbled upon a few of `A as *const _ as usize == B as *const as usize`, so I decided to follow the programming boy scout rule (:smile:) and replaced the pattern with more widely used `ptr::eq`.

5 years agoRollup merge of #57508 - DebugSteven:inline-extern, r=GuillaumeGomez
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:57 +0000 (05:26 +0100)]
Rollup merge of #57508 - DebugSteven:inline-extern, r=GuillaumeGomez

rustdoc: Allow inlining of reexported crates and crate items

Fixes #46296

This PR checks for when a `pub extern crate` statement has a `#[doc(inline)]` attribute & inlines its contents. Code is based off of the inlining statements for `pub use` statements.

5 years agoRollup merge of #57496 - steveklabnik:gh32934, r=Centril
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:55 +0000 (05:26 +0100)]
Rollup merge of #57496 - steveklabnik:gh32934, r=Centril

re-do docs for core::cmp

Fixes #32934

5 years agoRollup merge of #57494 - dotdash:expand, r=nikomatsakis
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:54 +0000 (05:26 +0100)]
Rollup merge of #57494 - dotdash:expand, r=nikomatsakis

Speed up item_bodies for large match statements involving regions

These changes don't change anything about the complexity of the algorithms, but use some easy shortcuts or modifications to cut down some overhead.

The first change, which incrementally removes the constraints from the set we're iterating over probably introduces some overhead for small to medium sized constraint sets, but it's not big enough for me to observe it in any project I tested against (not that many though).

Though most other crates probably won't improve much at all, because huge matches aren't that common, the changes seemed simple enough for me to make them.

Ref #55528

cc unicode-rs/unicode-normalization#29

r? @nikomatsakis

5 years agoRollup merge of #57474 - emilio:save-analysis-path, r=nrc
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:53 +0000 (05:26 +0100)]
Rollup merge of #57474 - emilio:save-analysis-path, r=nrc

save-analysis: Get path def from parent in case there's no def for the path itself.

This fixes #57462.

The relevant part from the hir type collector is:

```
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(32) => Entry { parent: NodeId(33), dep_node: 4294967040, node: Expr(expr(32: <Foo>::new)) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(48) => Entry { parent: NodeId(32), dep_node: 4294967040, node: Ty(type(Foo)) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(30) => Entry { parent: NodeId(48), dep_node: 4294967040, node: PathSegment(PathSegment { ident: Foo#0, id: Some(NodeId(30)), def: Some(Err), args: None, infer_types: true }) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(31) => Entry { parent: NodeId(32), dep_node: 4294967040, node: PathSegment(PathSegment { ident: new#0, id: Some(NodeId(31)), def: Some(Err), args: None, infer_types: true }) }
```

We have the right ID when looking for NodeId(31) and try with NodeId(32) (which
is the right thing to look for) from get_path_data. But not when we look from `write_sub_paths_truncated`

Basically process_path takes an id which is always the parent, and that we
fall back to in get_path_data(), so we get the right result for the last path
segment, but not for the other segments that get written to from
write_sub_paths_truncated.

I think we can stop passing the explicit `id` around to get_path_data as a followup.

5 years agoRollup merge of #57473 - alexcrichton:hex-display-on-windows, r=Kimundi
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:52 +0000 (05:26 +0100)]
Rollup merge of #57473 - alexcrichton:hex-display-on-windows, r=Kimundi

std: Render large exit codes as hex on Windows

On Windows process exit codes are never signals but rather always 32-bit
integers. Most faults like segfaults and such end up having large
integers used to represent them, like STATUS_ACCESS_VIOLATION being
0xC0000005. Currently, however, when an `ExitStatus` is printed this
ends up getting rendered as 3221225477 which is somewhat more difficult
to debug.

This commit adds a branch in `Display for ExitStatus` on Windows which
handles exit statuses where the high bit is set and prints those exit
statuses as hex instead of with decimals. This will hopefully preserve
the current display for small exit statuses (like `exit code: 22`), but
assist in quickly debugging segfaults/access violations/etc. I've
found at least that the hex codes are easier to search for than decimal.

I wasn't able to find any official documentation saying that all system
exit codes have the high bit set, but I figure it's a good enough
heuristic for now.

5 years agoRollup merge of #57461 - nnethercote:ParseResult-Failure-static-str, r=simulacrum
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:51 +0000 (05:26 +0100)]
Rollup merge of #57461 - nnethercote:ParseResult-Failure-static-str, r=simulacrum

Change `String` to `&'static str` in `ParseResult::Failure`.

This avoids 770,000 allocations when compiling the `html5ever`
benchmark, reducing instruction counts by up to 2%.

5 years agoRollup merge of #57454 - sinkuu:fmt_cleanup, r=joshtriplett
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:49 +0000 (05:26 +0100)]
Rollup merge of #57454 - sinkuu:fmt_cleanup, r=joshtriplett

Some cleanups for core::fmt

5 years agoRollup merge of #57453 - cuviper:python3-thread, r=nikomatsakis
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:48 +0000 (05:26 +0100)]
Rollup merge of #57453 - cuviper:python3-thread, r=nikomatsakis

lldb_batchmode.py: try `import _thread` for Python 3

None

5 years agoRollup merge of #57436 - Xanewok:save-analysis-access-ice-fix, r=nikomatsakis
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:47 +0000 (05:26 +0100)]
Rollup merge of #57436 - Xanewok:save-analysis-access-ice-fix, r=nikomatsakis

save-analysis: use a fallback when access levels couldn't be computed

Fixing an RLS regression I introduced in https://github.com/rust-lang/rust/pull/57343 :cry:

I missed a case where we get [called back with analysis when type checking fails](https://github.com/rust-lang/rust/blob/9d54812829e9d92dac35a4a0f358cdc5a2475371/src/librustc_driver/driver.rs#L1264). Since privacy checking normally is done afterwards, when we execute the `privacy_access_levels` query inside the save_analysis callback we'll calculate it for the first time and since typeck info isn't complete, we'll crash there.

Double-checked locally and it seems to have fixed the problem.

r? @nikomatsakis

5 years agoRollup merge of #57412 - JohnTitor:improve-the-wording-1, r=varkor
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:46 +0000 (05:26 +0100)]
Rollup merge of #57412 - JohnTitor:improve-the-wording-1, r=varkor

Improve the wording

I'm sorry but re-opened the PR because I failed to squash commits(#57397).

Fixes #55752.
r? @varkor