Commit Graph

96157 Commits

Author SHA1 Message Date
Esteban Küber
33ec1823d7 Specific error for positional args after named args in format!()
When writing positional arguments after named arguments in the
`format!()` and `println!()` macros, provide a targeted diagnostic.
2019-07-15 20:51:32 -07:00
bors
4b65a86eba Auto merge of #62687 - gnzlbg:stdarch, r=alexcrichton
Update stdsimd to stdarch

The stdsimd repository no longer lives in `rust-lang-nursery/stdsimd` but now lives in `rust-lang/stdarch` instead. This PR updates the stdsimd submodule to the stdarch master branch.
2019-07-15 16:00:48 +00:00
gnzlbg
d2c489a272 Update stdarch 2019-07-15 16:29:12 +02:00
bors
92b0f52584 Auto merge of #62667 - petrochenkov:printattr2, r=Mark-Simulacrum
pprust: Improve pretty-printing of delimited token groups

The commit "Do not convert attributes into `MetaItem`s for printing" fixes https://github.com/rust-lang/rust/issues/62628.

Other commits fix regressions from abandoning `MetaItem`s, and make formatting for attributes, macro calls, macro definitions and other delimited token groups better and more consistent.

r? @Mark-Simulacrum
2019-07-15 12:29:53 +00:00
gnzlbg
677cf3de3a Add rtm and f16c features to libcore 2019-07-15 14:05:39 +02:00
gnzlbg
77c14a5c5f Update the stdarch submodule 2019-07-15 14:05:28 +02:00
Vadim Petrochenkov
0cdd18d0a7 pprust: Support macro macros 2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
a2a1cd1864 pprust: Fix formatting regressions from the previous commits
Fix some remaining cases of bad formatting
Update some failing tests
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
75896011dc pprust: Do not convert attributes into MetaItems for printing
Fixes https://github.com/rust-lang/rust/issues/62628
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
160c40bc88 pprust: Remove the box from print_tts
Wrap the whole attribute into a box instead
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
11585b598c pprust: Use print_mac_common for delimited token groups 2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
23c5c1bfe7 pprust: Use print_mac_common for attributes 2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
500b00127b pprust: Use print_mac_common for macro_rules definitions 2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
65a714a6a0 pprust: Move some methods to the PrintState trait
So that path and macro argument printing code can be shared
2019-07-15 12:42:07 +03:00
bors
5480b47d7f Auto merge of #62629 - matthewjasper:cleanup-borrowck-errors, r=petrochenkov
Cleanup borrowck errors

This removes some of the unnecessary code that allowed sharing error reporting between two borrow checkers.

closes #59193
2019-07-15 09:05:18 +00:00
bors
9bb855cda0 Auto merge of #62674 - RalfJung:miri-abi, r=eddyb
RustIntrinsic and PlatformIntrinsic are also the same ABI as Rust

r? @eddyb
2019-07-15 05:40:41 +00:00
bors
e452e2929d Auto merge of #62670 - estebank:extern-fn-with-body, r=petrochenkov
Detect `fn` with a body in an `extern` block

Fix #62109.
2019-07-15 02:13:55 +00:00
bors
d82fd9ecd3 Auto merge of #62643 - estebank:parse-recovery-type-errs, r=petrochenkov
Do not emit type errors after parse error in last statement of block

When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.

Fix #57383.
2019-07-14 22:51:05 +00:00
Matthew Jasper
9709b73561 pub(crate) -> crate
The borrow checker code is already using `crate` extensively, so prefer
being consistent with it.
2019-07-14 20:22:20 +01:00
Matthew Jasper
abfd4d1e55 Move suggest_ref_mut into rustc_mir::borrow_check 2019-07-14 20:22:19 +01:00
Matthew Jasper
2cc2b942cf Remove BorrowckErrors trait
Its methods are now inherent methods of `MirBorrowckCtxt`
2019-07-14 20:22:19 +01:00
Matthew Jasper
37a99038d0 Remove rustc_mir::borrowck_errors::Origin 2019-07-14 20:20:50 +01:00
Matthew Jasper
2975c01747 Remove unused BorrowckErrors methods 2019-07-14 20:19:16 +01:00
bors
83e4eed16e Auto merge of #62638 - estebank:issue-62554, r=petrochenkov
Use snippet instead of pprinting statement

Fix #62554.
2019-07-14 17:29:17 +00:00
bors
85a360e0ea Auto merge of #62610 - Stargateur:fix-miri-error-cstring-into_inner, r=RalfJung
Fix miri error in into_inner() of CString

Fix #62553

I choice to not transmute because I think it's more unsafe and in case the structure change this code should always work.

r? @RalfJung
2019-07-14 13:52:40 +00:00
Ralf Jung
6c293d8101 remove outdated comment 2019-07-14 12:23:52 +02:00
bors
7d41ebf768 Auto merge of #62464 - GuillaumeGomez:add-missing-urls-osstr, r=QuietMisdreavus
Add missing urls for osstr

r? @QuietMisdreavus
2019-07-14 10:23:05 +00:00
Ralf Jung
26528b969f RustIntrinsic and PlatformIntrinsic are also the same ABI as Rust 2019-07-14 11:58:12 +02:00
Esteban Küber
f2a6a4e5af review comment 2019-07-13 22:25:23 -07:00
bors
03a68d6973 Auto merge of #62331 - wesleywiser:fix_early_return_leak, r=matthewjasper
Fix leak when early returning out of `box` syntax

Fixes #62289

r? @matthewjasper
2019-07-14 05:25:08 +00:00
Esteban Küber
c8d9cd99fa Detect fn with a body in an extern block 2019-07-13 22:24:11 -07:00
bors
fa6b70658e Auto merge of #62560 - pietroalbini:tools-builders-on-prs, r=alexcrichton
ci: add a pr builder to test tools when submodules are updated

This PR adds the x86_64-gnu-tools builders to PRs where submodules are updated.

Since it's not possible to *start* the builder only when submodule changes are detected, I opted into adding a "decider" task at the start of the job which sets the `SKIP_JOB` environment variable when submodules are not updated, and I gated the most time-consuming tasks (the actual build and artifacts upload) on the variable not being there. All of this is conditionally included in the `steps/run.yml` only when a template parameter is present, so it should only affect that builder on PRs.

The cost for this should be a dummy builder running for 2/3 minutes for each PR, and we should be able to handle it.

Fixes https://github.com/rust-lang/rust/issues/61837
r? @alexcrichton
2019-07-14 00:20:54 +00:00
bors
d32a7250db Auto merge of #62584 - eddyb:circular-math-is-hard, r=pnkfelix
rustc_codegen_ssa: fix range check in codegen_get_discr.

Fixes #61696, see https://github.com/rust-lang/rust/issues/61696#issuecomment-505473018 for more details.

In short, I had wanted to use `x - a <= b - a` to check whether `x` is in `a..=b` (as it's 1 comparison instead of 2 *and* `b - a` is guaranteed to fit in the same data type, while `b` itself might not), but I ended up with `x - a + c <= b - a + c` instead, because `x - a + c` was the final value needed.

That latter comparison is equivalent to checking that `x` is in `(a - c)..=b`, i.e. it also includes `(a - c)..a`, not just `a..=b`, so if `c` is not `0`, it will cause false positives.

This presented itself as the non-niche ("dataful") variant sometimes being treated like a niche variant, in the presence of uninhabited variants (which made `c`, aka the index of the first niche variant, arbitrarily large).

r? @nagisa, @rkruppe or @oli-obk
2019-07-13 20:45:40 +00:00
bors
69656fa4cb Auto merge of #62659 - Centril:rollup-90oz643, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #62577 (Add an AtomicCell abstraction)
 - #62585 (Make struct_tail normalize when possible)
 - #62604 (Handle errors during error recovery gracefully)
 - #62636 (rustbuild: Improve assert about building tools once)
 - #62651 (Make some rustc macros more hygienic)

Failed merges:

r? @ghost
2019-07-13 17:11:36 +00:00
Mazdak Farrokhzad
791ceb6a9c
Rollup merge of #62651 - matthewjasper:rustc-macro-hygiene, r=petrochenkov
Make some rustc macros more hygienic
2019-07-13 16:18:41 +02:00
Mazdak Farrokhzad
bafddd4c0a
Rollup merge of #62636 - alexcrichton:assert-build-cargo-once, r=Mark-Simulacrum
rustbuild: Improve assert about building tools once

In developing #61557 I noticed that there were two parts of our tools
that were rebuilt twice on CI. One was rustfmt fixed in #61557, but
another was Cargo. The actual fix for Cargo's double compile was
rust-lang/cargo#7010 and took some time to propagate here. In an effort
to continue to assert that Cargo is itself not compiled twice, I updated
the assertion in rustbuild at the time of working on #61557 but couldn't
land it because the fix wouldn't be ready until the next bootstrap.

The next bootstrap is now here, so the fix can now land! This does not
change the behavior of rustbuild but it is intended to catch the
previous iteration of compiling cargo twice. The main update here was to
consider more files than those in `$target/release/deps` but also
consider those in `$target/release`. That's where, for example,
`libcargo.rlib` shows up and it's the file we learn about, and that's
what we want to deduplicate.
2019-07-13 16:18:40 +02:00
Mazdak Farrokhzad
4fe6e63cd6
Rollup merge of #62604 - estebank:unemitted-err-ice, r=pnkfelix
Handle errors during error recovery gracefully

Fix #62546.
2019-07-13 16:18:38 +02:00
Mazdak Farrokhzad
833dada106
Rollup merge of #62585 - pnkfelix:issue-60431-make-struct-tail-normalize-when-possible, r=eddyb
Make struct_tail normalize when possible

As noted in commit message: this replaces the existing methods to extract the struct tail(s) with new entry points that make the handling of normalization explicit.

Most of the places that call `struct_tail` are during codegen, post type-checking, and therefore they can get away with using `tcx.normalize_erasing_regions` (this is the entry point `struct_tail_erasing_lifetimes`)

For other cases that may arise, one can use the core method, which is parameterized over the normalization `Ty -> Ty` closure (`struct_tail_with_normalize`).

Or one can use the trivial entry point that does not normalization (`struct_tail_without_normalization`)

----

I spent a little while trying to make a test that exposed the bug via `impl Trait` rather than a projection, but I failed to find something that tripped up the current nightly `rustc`.
 * I have *not* spent any time trying to make tests that trip up the other places where `struct_tail` was previously being called. While I do think the task of making such tests could be worthwhile, I am simply running out of time. (Its also possible that the layout code is always the first point called, and thus it may be pointless to try to come up with such tests.)

I also spent a little time discussing with @eddyb where this code should live. They suggested moving `struct_tail` and its sibling `struct_lockstep_tails` to the `LayoutCx`.  But in the interest of time, I have left that refactoring (which may be questionable at this point) to a follow-up task.

----

Fix #60431
2019-07-13 16:18:37 +02:00
Mazdak Farrokhzad
5e1891c474
Rollup merge of #62577 - Zoxc:atomic-cell, r=matthewjasper
Add an AtomicCell abstraction

Split out from https://github.com/rust-lang/rust/pull/61923.
2019-07-13 16:18:35 +02:00
bors
ec30876f30 Auto merge of #62468 - rust-lang:mutable-overloaded-operators, r=estebank
Improve diagnostics for invalid mutation through overloaded operators

Closes #58864
Closes #52941
Closes #57839
2019-07-13 13:44:40 +00:00
bors
6b468c6360 Auto merge of #60266 - albins:polonius-liveness, r=nikomatsakis
Fact generation for liveness calculations in Polonius

This PR tracks ongoing work to extend `rustc` with support for generating variable use, definition, and later also drop output for the Polonius solver, the whole of which is being tracked in [Polonius Issue #104](https://github.com/rust-lang/polonius/issues/104).
2019-07-13 10:15:40 +00:00
Matthew Jasper
199931ce91 Make register_[long_]diagnostics hygienic 2019-07-13 10:25:57 +01:00
Matthew Jasper
313ba7c4d1 Make newtype_index hygienic and use allow_internal_unstable 2019-07-13 10:25:57 +01:00
Antoine PLASKOWSKI
4c4bd34067 Fix miri error in into_inner() of CString 2019-07-13 11:09:46 +02:00
bors
4a95e9704d Auto merge of #61953 - Centril:shared-from-iter, r=RalfJung
Add `impl<T> FromIterator<T> for Arc/Rc<[T]>`

Add implementations of `FromIterator<T> for Arc/Rc<[T]>` with symmetrical logic.

This also takes advantage of specialization in the case of iterators with known length (`TrustedLen`) to elide the final allocation/copying from a `Vec<T>` into `Rc<[T]>` because we can allocate the space for the `Rc<[T]>` directly when the size is known. This is the primary motivation and why this is to be preferred over `iter.collect::<Vec<_>>().into(): Rc<[T]>`.

Moreover, this PR does some refactoring in some places.

r? @RalfJung for the code
cc @alexcrichton from T-libs
2019-07-13 06:49:02 +00:00
bors
a9c7febb87 Auto merge of #62613 - lzutao:clippy-up, r=Manishearth
submodules: Update clippy from 316da7eb to b0290424

r? @Manishearth
2019-07-13 03:12:20 +00:00
Esteban Küber
8259a2dd42 Do not emit type errors after parse error in last statement of block
When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.

Fix #57383.
2019-07-12 18:55:01 -07:00
bors
e13fe7ff5e Auto merge of #62635 - Centril:rollup-potvfnk, r=Centril
Rollup of 12 pull requests

Successful merges:

 - #61535 (Coherence test when a generic type param has a default value from an associated type)
 - #62274 (rustc_mir: follow FalseUnwind's real_target edge in qualify_consts.)
 - #62431 (Add messages to `Option`'s and `Result`'s `must_use` annotation for `is_*`)
 - #62453 (in which we suggest anonymizing single-use lifetimes in paths )
 - #62568 (Replace unsafe_destructor_blind_to_params with may_dangle)
 - #62578 (Add test for #49919)
 - #62595 (Document that the crate keyword refers to the project root)
 - #62599 (move mem::uninitialized deprecation back by 1 release, to 1.39)
 - #62605 (Emit dropped unemitted errors to aid in ICE debugging)
 - #62607 (Correctly break out of recovery loop)
 - #62608 (`async unsafe fn` tests)
 - #62623 (downgrade indirect_structural_match lint to allow)

Failed merges:

r? @ghost
2019-07-12 23:37:39 +00:00
Esteban Küber
a86aac1a67 add tests 2019-07-12 14:31:10 -07:00
Esteban Küber
726aa1437f Use snippet instead of pprinting statement 2019-07-12 14:01:13 -07:00