]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #62464 - GuillaumeGomez:add-missing-urls-osstr, r=QuietMisdreavus
bors [Sun, 14 Jul 2019 10:23:05 +0000 (10:23 +0000)]
Auto merge of #62464 - GuillaumeGomez:add-missing-urls-osstr, r=QuietMisdreavus

Add missing urls for osstr

r? @QuietMisdreavus

4 years agoAuto merge of #62331 - wesleywiser:fix_early_return_leak, r=matthewjasper
bors [Sun, 14 Jul 2019 05:25:08 +0000 (05:25 +0000)]
Auto merge of #62331 - wesleywiser:fix_early_return_leak, r=matthewjasper

Fix leak when early returning out of `box` syntax

Fixes #62289

r? @matthewjasper

4 years agoAuto merge of #62560 - pietroalbini:tools-builders-on-prs, r=alexcrichton
bors [Sun, 14 Jul 2019 00:20:54 +0000 (00:20 +0000)]
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

4 years agoAuto merge of #62584 - eddyb:circular-math-is-hard, r=pnkfelix
bors [Sat, 13 Jul 2019 20:45:40 +0000 (20:45 +0000)]
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

4 years agoAuto merge of #62659 - Centril:rollup-90oz643, r=Centril
bors [Sat, 13 Jul 2019 17:11:36 +0000 (17:11 +0000)]
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

4 years agoRollup merge of #62651 - matthewjasper:rustc-macro-hygiene, r=petrochenkov
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:41 +0000 (16:18 +0200)]
Rollup merge of #62651 - matthewjasper:rustc-macro-hygiene, r=petrochenkov

Make some rustc macros more hygienic

4 years agoRollup merge of #62636 - alexcrichton:assert-build-cargo-once, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:40 +0000 (16:18 +0200)]
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.

4 years agoRollup merge of #62604 - estebank:unemitted-err-ice, r=pnkfelix
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:38 +0000 (16:18 +0200)]
Rollup merge of #62604 - estebank:unemitted-err-ice, r=pnkfelix

Handle errors during error recovery gracefully

Fix #62546.

4 years agoRollup merge of #62585 - pnkfelix:issue-60431-make-struct-tail-normalize-when-possibl...
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:37 +0000 (16:18 +0200)]
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

4 years agoRollup merge of #62577 - Zoxc:atomic-cell, r=matthewjasper
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:35 +0000 (16:18 +0200)]
Rollup merge of #62577 - Zoxc:atomic-cell, r=matthewjasper

Add an AtomicCell abstraction

Split out from https://github.com/rust-lang/rust/pull/61923.

4 years agoAuto merge of #62468 - rust-lang:mutable-overloaded-operators, r=estebank
bors [Sat, 13 Jul 2019 13:44:40 +0000 (13:44 +0000)]
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

4 years agoAuto merge of #60266 - albins:polonius-liveness, r=nikomatsakis
bors [Sat, 13 Jul 2019 10:15:40 +0000 (10:15 +0000)]
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).

4 years agoMake `register_[long_]diagnostics` hygienic
Matthew Jasper [Sat, 13 Jul 2019 09:02:40 +0000 (10:02 +0100)]
Make `register_[long_]diagnostics` hygienic

4 years agoMake `newtype_index` hygienic and use allow_internal_unstable
Matthew Jasper [Sat, 13 Jul 2019 08:55:14 +0000 (09:55 +0100)]
Make `newtype_index` hygienic and use allow_internal_unstable

4 years agoAuto merge of #61953 - Centril:shared-from-iter, r=RalfJung
bors [Sat, 13 Jul 2019 06:49:02 +0000 (06:49 +0000)]
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

4 years agoAuto merge of #62613 - lzutao:clippy-up, r=Manishearth
bors [Sat, 13 Jul 2019 03:12:20 +0000 (03:12 +0000)]
Auto merge of #62613 - lzutao:clippy-up, r=Manishearth

submodules: Update clippy from 316da7eb to b0290424

r? @Manishearth

4 years agoAuto merge of #62635 - Centril:rollup-potvfnk, r=Centril
bors [Fri, 12 Jul 2019 23:37:39 +0000 (23:37 +0000)]
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

4 years agorustbuild: Improve assert about building tools once
Alex Crichton [Thu, 6 Jun 2019 14:56:07 +0000 (07:56 -0700)]
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.

4 years agorustfmt all the things!
Albin Stjerna [Fri, 12 Jul 2019 20:49:15 +0000 (22:49 +0200)]
rustfmt all the things!

4 years agopolonius: add generation of liveneness-related facts
Albin Stjerna [Fri, 12 Jul 2019 20:48:02 +0000 (22:48 +0200)]
polonius: add generation of liveneness-related facts

Notably contains an ugly hack to generate initialization information for
variables that will go away when we have that functionality in Polonius.

4 years agoRollup merge of #62623 - pnkfelix:issue-62614-downgrade-indirect-structural-match...
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:54 +0000 (22:46 +0200)]
Rollup merge of #62623 - pnkfelix:issue-62614-downgrade-indirect-structural-match-lint-to-allow, r=zackmdavis

downgrade indirect_structural_match lint to allow

This is a short-term band-aid for the regression aspect of #62614.

4 years agoRollup merge of #62608 - delan:async-unsafe-fn-tests, r=Centril
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:53 +0000 (22:46 +0200)]
Rollup merge of #62608 - delan:async-unsafe-fn-tests, r=Centril

`async unsafe fn` tests

- cc #62121

r? @Centril

4 years agoRollup merge of #62607 - estebank:this-mem-is-out-of-control, r=petrochenkov
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:52 +0000 (22:46 +0200)]
Rollup merge of #62607 - estebank:this-mem-is-out-of-control, r=petrochenkov

Correctly break out of recovery loop

Fix #61858.

4 years agoRollup merge of #62605 - estebank:emit-dropped-err, r=pnkfelix
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:50 +0000 (22:46 +0200)]
Rollup merge of #62605 - estebank:emit-dropped-err, r=pnkfelix

Emit dropped unemitted errors to aid in ICE debugging

4 years agoRollup merge of #62599 - RalfJung:uninit, r=cramertj
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:49 +0000 (22:46 +0200)]
Rollup merge of #62599 - RalfJung:uninit, r=cramertj

move mem::uninitialized deprecation back by 1 release, to 1.39

As per discussion at https://github.com/rust-lang/rust/issues/53491#issuecomment-509271182. Three releases also agrees with the precedent from `trim_left/right`. Three releases means that even nightly users (including rustc itself) get a full cycle from when the announcement is made in the stable release to when nightly starts to warn.

4 years agoRollup merge of #62595 - ngoldbaum:path-clarity-doc, r=Centril
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:47 +0000 (22:46 +0200)]
Rollup merge of #62595 - ngoldbaum:path-clarity-doc, r=Centril

Document that the crate keyword refers to the project root

:wave: this is my first rust contribution so I hope I'm doing everything correctly. Help very much appreciated if I'm not.

As far as I can tell this use of `crate` is only documented [in the edition guide for rust 2018](https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#the-crate-keyword-refers-to-the-current-crate). However it should probably be in the documentation for the `crate` keyword itself. This adds that documentation.

4 years agoRollup merge of #62578 - JohnTitor:add-test-for-49919, r=alexcrichton
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:46 +0000 (22:46 +0200)]
Rollup merge of #62578 - JohnTitor:add-test-for-49919, r=alexcrichton

Add test for #49919

Closes #49919

4 years agoRollup merge of #62568 - lzutao:replace_may_dangle, r=matthewjasper
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:44 +0000 (22:46 +0200)]
Rollup merge of #62568 - lzutao:replace_may_dangle, r=matthewjasper

Replace unsafe_destructor_blind_to_params with may_dangle

This PR will completely remove support for `#[unsafe_destructor_blind_to_params]` attribute,
which is deprecated in #38970 by `[may_dangle]` unsafe  attribute.

Closes #34761

4 years agoRollup merge of #62453 - zackmdavis:single_path, r=estebank
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:43 +0000 (22:46 +0200)]
Rollup merge of #62453 - zackmdavis:single_path, r=estebank

in which we suggest anonymizing single-use lifetimes in paths

Following @nikomatsakis's [October 2017 comment](https://github.com/rust-lang/rust/issues/44752#issuecomment-340885834).

![path_anon_suggest](https://user-images.githubusercontent.com/1076988/60761598-e2619180-a000-11e9-9144-1bdf8eb848e3.png)

r? @estebank
cc @eddyb (you were saying something about running single-use-lifetimes against the tree the other week?)

4 years agoRollup merge of #62431 - czipperz:add-messages-to-must-use-is_-methods, r=scottmcm
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:41 +0000 (22:46 +0200)]
Rollup merge of #62431 - czipperz:add-messages-to-must-use-is_-methods, r=scottmcm

Add messages to `Option`'s and `Result`'s `must_use` annotation for `is_*`

r? @RalfJung

4 years agoRollup merge of #62274 - eddyb:const-false-unwind, r=pnkfelix
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:40 +0000 (22:46 +0200)]
Rollup merge of #62274 - eddyb:const-false-unwind, r=pnkfelix

rustc_mir: follow FalseUnwind's real_target edge in qualify_consts.

As far as I can tell, this was accidentally omitted from #47802.
Fixes #62272.

r? @matthewjasper or @nikomatsakis

4 years agoRollup merge of #61535 - ohadravid:test-generic-with-default-assiociated-type-re...
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:38 +0000 (22:46 +0200)]
Rollup merge of #61535 - ohadravid:test-generic-with-default-assiociated-type-re-rebalance-coherence, r=nikomatsakis

Coherence test when a generic type param has a default value from an associated type

A followup on #61400.
Before `re_rebalance_coherence`, this fails to compile (even though it should be accepted).
`re_rebalance_coherence` had no direct test for this, and I wanted to (a) make sure it doesn't regress in the future and (b) get it on record that this is actually the intended behavior.

4 years agoUpgrade Polonius
Albin Stjerna [Fri, 12 Jul 2019 20:41:00 +0000 (22:41 +0200)]
Upgrade Polonius

4 years agoadd test case
Esteban Küber [Fri, 12 Jul 2019 18:13:03 +0000 (11:13 -0700)]
add test case

4 years agorustc_codegen_ssa: fix range check in codegen_get_discr.
Eduard-Mihai Burtescu [Thu, 4 Jul 2019 08:18:06 +0000 (11:18 +0300)]
rustc_codegen_ssa: fix range check in codegen_get_discr.

4 years agoChange `indirect_structural_match` lint to allow-by-default.
Felix S. Klock II [Fri, 12 Jul 2019 13:32:12 +0000 (15:32 +0200)]
Change `indirect_structural_match` lint to allow-by-default.

This is a way to address the regression aspect of rust-lang/rust#62614 in the
short term without actually fixing the bug. (My thinking is that the bug that
this lint detects has gone undetected for this long, it can wait a bit longer
until I or someone else has a chance to put in a proper fix that accounts for
rust-lang/rust#62614.)

4 years agoTurn `indirect_structural_match` lint on explicitly in ui tests.
Felix S. Klock II [Fri, 12 Jul 2019 13:27:21 +0000 (15:27 +0200)]
Turn `indirect_structural_match` lint on explicitly in ui tests.

4 years agoAuto merge of #61462 - GuillaumeGomez:fix-local-storage, r=Manishearth
bors [Fri, 12 Jul 2019 12:04:25 +0000 (12:04 +0000)]
Auto merge of #61462 - GuillaumeGomez:fix-local-storage, r=Manishearth

[rustdoc] Fix storage usage when disabled

Fixes #61239.

@starblue: Can you give a try to this change please? I tried on chrome and firefox and both worked so if you're using another web browser, that might be useful. :)

r? @Manishearth

4 years agoUpdate docs to reflect review feedback.
Felix S. Klock II [Fri, 12 Jul 2019 09:34:23 +0000 (11:34 +0200)]
Update docs to reflect review feedback.

4 years agoRegression test for issue 60431.
Felix S. Klock II [Thu, 11 Jul 2019 11:54:54 +0000 (13:54 +0200)]
Regression test for issue 60431.

4 years agoReplace `struct_tail` and `struct_lockstep_tails` with variants handling normalization.
Felix S. Klock II [Thu, 11 Jul 2019 11:27:41 +0000 (13:27 +0200)]
Replace `struct_tail` and `struct_lockstep_tails` with variants handling normalization.

The old struct tail functions did not deal with `<T as Trait>::A` and `impl
Trait`, at least not explicitly. (We didn't notice this bug before because it
is only exposed when the tail (post deep normalization) is not `Sized`, so it
was a rare case to deal with.)

For post type-checking (i.e. during codegen), there is now
`struct_tail_erasing_lifetimes` and `struct_lockstep_tails_erasing_lifetimes`,
which each take an additional `ParamEnv` argument to drive normalization.

For pre type-checking cases where normalization is not needed, there is
`struct_tail_without_normalization`. (Currently, the only instance of this is
`Expectation::rvalue_hint`.)

All of these new entrypoints work by calling out to common helper routines.
The helpers are parameterized over a closure that handles the normalization.

4 years agosubmodules: Update clippy from 316da7eb to b0290424
Lzu Tao [Fri, 12 Jul 2019 09:30:07 +0000 (09:30 +0000)]
submodules: Update clippy from 316da7eb to b0290424

4 years agoAuto merge of #62549 - ehuss:update-cargo-vendor, r=alexcrichton
bors [Fri, 12 Jul 2019 08:35:46 +0000 (08:35 +0000)]
Auto merge of #62549 - ehuss:update-cargo-vendor, r=alexcrichton

Update cargo-vendor usage

This contains a variety of updates to clean up the usage of cargo-vendor.

- Remove the install step for the old cargo-vendor now that it is built-in to cargo and available in the stage0 install.
- Update installation instructions, dealing with vendoring. The current instructions of running `sudo ./x.py install` is broken, it will almost always fail (since the vendor directory doesn't exist). Since the steps for properly handling this are numerous, I'm recommending removing the suggestion to use `sudo` altogether.
- If the sudo-forced-vendoring detects that the vendor directory is not available, abort with instructions on how to fix.
- Now that cargo-vendor is built-in, automatically run it if it looks like it is needed.
- Update instructions on how to install cargo.
- Remove the unused markdown link references in README/CONTRIBUTING. This reverts most of #44935. These references don't do anything if they are unused.

Closes #49269
cc #61142 #48771 #40108

4 years agotest `unsafe fn` and `async unsafe fn` calls in `unsafe { async || }`
Delan Azabani [Fri, 12 Jul 2019 04:54:52 +0000 (14:54 +1000)]
test `unsafe fn` and `async unsafe fn` calls in `unsafe { async || }`

4 years agoAuto merge of #61590 - matthewjasper:remove-borrowck-mir-dependency, r=pnkfelix
bors [Fri, 12 Jul 2019 04:56:05 +0000 (04:56 +0000)]
Auto merge of #61590 - matthewjasper:remove-borrowck-mir-dependency, r=pnkfelix

Remove rustc_mir dependency from rustc_borrowck

Also renames `rustc_borrowck` to `rustc_ast_borrowck` and removes all error reporting from it.

cc #59193

4 years agoremove redundant async_closure test in async-await.rs
Delan Azabani [Fri, 12 Jul 2019 04:49:22 +0000 (14:49 +1000)]
remove redundant async_closure test in async-await.rs

4 years agotest E0133 when calling free/impl `async unsafe fn` in `async fn`
Delan Azabani [Fri, 12 Jul 2019 04:43:52 +0000 (14:43 +1000)]
test E0133 when calling free/impl `async unsafe fn` in `async fn`

4 years agoremove unused #![feature(async_closure)]
Delan Azabani [Fri, 12 Jul 2019 04:42:44 +0000 (14:42 +1000)]
remove unused #![feature(async_closure)]

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agotest `unsafe fn` and `async unsafe fn` calls in `async` in `unsafe`
Delan Azabani [Fri, 12 Jul 2019 04:08:39 +0000 (14:08 +1000)]
test `unsafe fn` and `async unsafe fn` calls in `async` in `unsafe`

4 years agotest E0133 when calling free/impl `async unsafe fn` in safe code
Delan Azabani [Fri, 12 Jul 2019 03:32:39 +0000 (13:32 +1000)]
test E0133 when calling free/impl `async unsafe fn` in safe code

4 years agoalign async-await.rs and await-macro.rs with one another
Delan Azabani [Fri, 12 Jul 2019 03:04:41 +0000 (13:04 +1000)]
align async-await.rs and await-macro.rs with one another

4 years agoCorrectly break out of recovery loop
Esteban Küber [Fri, 12 Jul 2019 03:02:54 +0000 (20:02 -0700)]
Correctly break out of recovery loop

4 years agoFix leak when early returning out of `box` syntax
Wesley Wiser [Wed, 3 Jul 2019 12:25:27 +0000 (08:25 -0400)]
Fix leak when early returning out of `box` syntax

Fixes #62289

4 years agoEmit dropped unemitted errors to aid in ICE debugging
Esteban Küber [Thu, 11 Jul 2019 23:59:19 +0000 (16:59 -0700)]
Emit dropped unemitted errors to aid in ICE debugging

4 years agoHandle errors during error recovery gracefully
Esteban Küber [Thu, 11 Jul 2019 23:54:33 +0000 (16:54 -0700)]
Handle errors during error recovery gracefully

4 years agoAuto merge of #62594 - JohnTitor:update-miri, r=RalfJung
bors [Thu, 11 Jul 2019 21:54:55 +0000 (21:54 +0000)]
Auto merge of #62594 - JohnTitor:update-miri, r=RalfJung

Update miri

Fixes #62347

r? @RalfJung

4 years agomove mem::uninitialized deprecation back by 1 release, to 1.39
Ralf Jung [Thu, 11 Jul 2019 20:24:01 +0000 (22:24 +0200)]
move mem::uninitialized deprecation back by 1 release, to 1.39

4 years agoRemove feature gate `dropck_parametricity` completely
Lzu Tao [Thu, 11 Jul 2019 18:44:56 +0000 (18:44 +0000)]
Remove feature gate `dropck_parametricity` completely

Therefore we also remove `#[unsafe_destructor_blind_to_params]`
attribute completly.

4 years agodocument that crate refers to the project root
Nathan Goldbaum [Thu, 11 Jul 2019 18:25:53 +0000 (14:25 -0400)]
document that crate refers to the project root

4 years agoReplace unsafe_destructor_blind_to_params with may_dangle
Lzu Tao [Wed, 10 Jul 2019 18:49:05 +0000 (18:49 +0000)]
Replace unsafe_destructor_blind_to_params with may_dangle

4 years agoMove rustc_borrowck -> rustc_ast_borrowck
Matthew Jasper [Sat, 29 Jun 2019 16:37:32 +0000 (17:37 +0100)]
Move rustc_borrowck -> rustc_ast_borrowck

4 years agoRemove rustc_mir dependency from rustc_borrowck
Matthew Jasper [Sat, 29 Jun 2019 16:36:46 +0000 (17:36 +0100)]
Remove rustc_mir dependency from rustc_borrowck

4 years agoUpdate miri
Yuki Okushi [Thu, 11 Jul 2019 17:43:19 +0000 (02:43 +0900)]
Update miri

4 years agorustc_codegen_ssa: try to make codegen_get_discr more readable.
Eduard-Mihai Burtescu [Mon, 1 Jul 2019 16:14:29 +0000 (19:14 +0300)]
rustc_codegen_ssa: try to make codegen_get_discr more readable.

4 years agoAuto merge of #62503 - pnkfelix:dont-recur-infiitely-from-print-def-path, r=eddyb
bors [Thu, 11 Jul 2019 13:34:29 +0000 (13:34 +0000)]
Auto merge of #62503 - pnkfelix:dont-recur-infiitely-from-print-def-path, r=eddyb

Dont recur infinitely from print_def_path

Fix #61711

4 years agoAuto merge of #62574 - petrochenkov:dcrate-40000, r=Mark-Simulacrum
bors [Thu, 11 Jul 2019 10:05:09 +0000 (10:05 +0000)]
Auto merge of #62574 - petrochenkov:dcrate-40000, r=Mark-Simulacrum

pretty-print: Do not lose the `$crate` printing flag in `print_tt`

https://github.com/rust-lang/rust/pull/62393 had this accidental mistake.

Fixes https://github.com/rust-lang/rust/issues/62562
r? @Mark-Simulacrum

4 years agoAddress review comments
Vadim Petrochenkov [Thu, 11 Jul 2019 09:34:57 +0000 (12:34 +0300)]
Address review comments

4 years agorustc_mir: follow FalseUnwind's real_target edge in qualify_consts.
Eduard-Mihai Burtescu [Mon, 1 Jul 2019 16:26:36 +0000 (19:26 +0300)]
rustc_mir: follow FalseUnwind's real_target edge in qualify_consts.

4 years agopretty-print: Merge `print_tts` and `print_tts_ext`
Vadim Petrochenkov [Thu, 11 Jul 2019 00:16:19 +0000 (03:16 +0300)]
pretty-print: Merge `print_tts` and `print_tts_ext`

4 years agopretty-print: Do not lose the `$crate` printing flag in `print_tt`
Vadim Petrochenkov [Wed, 10 Jul 2019 23:01:45 +0000 (02:01 +0300)]
pretty-print: Do not lose the `$crate` printing flag in `print_tt`

4 years agoAuto merge of #62580 - Centril:rollup-remihe0, r=Centril
bors [Thu, 11 Jul 2019 04:45:15 +0000 (04:45 +0000)]
Auto merge of #62580 - Centril:rollup-remihe0, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #61665 (core: check for pointer equality when comparing Eq slices)
 - #61923 (Prerequisites from dep graph refactoring #2)
 - #62270 (Move async-await tests from run-pass to ui)
 - #62425 (filedesc: don't use ioctl(FIOCLEX) on Linux)
 - #62476 (Continue refactoring macro expansion and resolution)
 - #62519 (Regression test for HRTB bug (issue 30786).)
 - #62557 (Fix typo in libcore/intrinsics.rs)

Failed merges:

r? @ghost

5 years agoRollup merge of #62557 - taiki-e:typo, r=Centril
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:20 +0000 (04:33 +0200)]
Rollup merge of #62557 - taiki-e:typo, r=Centril

Fix typo in libcore/intrinsics.rs

5 years agoRollup merge of #62519 - pnkfelix:add-test-for-30786, r=pnkfelix
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:19 +0000 (04:33 +0200)]
Rollup merge of #62519 - pnkfelix:add-test-for-30786, r=pnkfelix

Regression test for HRTB bug (issue 30786).

Close #30786.

5 years agoRollup merge of #62476 - petrochenkov:expref, r=matthewjasper
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:17 +0000 (04:33 +0200)]
Rollup merge of #62476 - petrochenkov:expref, r=matthewjasper

Continue refactoring macro expansion and resolution

This PR continues the work started in https://github.com/rust-lang/rust/pull/62042.
It contains a set of more or less related refactorings with the general goal of making things simpler and more orthogonal.
Along the way most of the issues uncovered in https://github.com/rust-lang/rust/pull/62086 are fixed.

The PR is better read in per-commit fashion with whitespace changes ignored.
I tried to leave some more detailed commit messages describing the motivation behind the individual changes.

Fixes https://github.com/rust-lang/rust/issues/44692
Fixes https://github.com/rust-lang/rust/issues/52363
Unblocks https://github.com/rust-lang/rust/pull/62086
r? @matthewjasper

5 years agoRollup merge of #62425 - cyphar:linux-cloexec-use-fcntl, r=alexcrichton
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:16 +0000 (04:33 +0200)]
Rollup merge of #62425 - cyphar:linux-cloexec-use-fcntl, r=alexcrichton

filedesc: don't use ioctl(FIOCLEX) on Linux

All `ioctl(2)`s will fail on `O_PATH` file descriptors on Linux (because
they use `&empty_fops` as a security measure against `O_PATH` descriptors
affecting the backing file).

As a result, `File::try_clone()` and various other methods would always
fail with `-EBADF` on `O_PATH` file descriptors. The solution is to simply
use `F_SETFD` (as is used on other unices) which works on `O_PATH`
descriptors because it operates through the `fnctl(2)` layer and not
through `ioctl(2)`s.

Since this code is usually only used in strange error paths (a broken or
ancient kernel), the extra overhead of one syscall shouldn't cause any
dramas. Most other systems programming languages also use the fnctl(2)
so this brings us in line with them.

Fixes: rust-lang/rust#62314
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
5 years agoRollup merge of #62270 - agnxy:move-async-test, r=Centril,tmandry
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:14 +0000 (04:33 +0200)]
Rollup merge of #62270 - agnxy:move-async-test, r=Centril,tmandry

Move async-await tests from run-pass to ui

fix #62236

r? @Centril

5 years agoRollup merge of #61923 - Zoxc:dep-stream-prefix-2, r=pnkfelix
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:12 +0000 (04:33 +0200)]
Rollup merge of #61923 - Zoxc:dep-stream-prefix-2, r=pnkfelix

Prerequisites from dep graph refactoring #2

Split out from https://github.com/rust-lang/rust/pull/60035 and overlaps with https://github.com/rust-lang/rust/pull/60559.

5 years agoRollup merge of #61665 - aschampion:slice-eq-ptr, r=sfackler
Mazdak Farrokhzad [Thu, 11 Jul 2019 02:33:11 +0000 (04:33 +0200)]
Rollup merge of #61665 - aschampion:slice-eq-ptr, r=sfackler

core: check for pointer equality when comparing Eq slices

Because `Eq` types must be reflexively equal, an equal-length slice to the same memory location must be equal.

This is related to #33892 (and #32699) answering this comment from that PR:

> Great! One more easy question: why does this optimization not apply in the non-BytewiseEquality implementation directly above?

Because slices of non-reflexively equal types (like `f64`) are not equal even if it's the same slice. But if the types are `Eq`, we can use this same-address optimization, which this PR implements. Obviously this changes behavior if types violate the reflexivity condition of `Eq`, because their impls of `PartialEq` will no longer be called per-item, but 🤷‍♂ .

It's not clear how often this optimization comes up in the real world outside of the same-`&str` case covered by #33892, so **I'm requesting a perf run** (on MacOS today, so can't run `rustc_perf` myself). I'm going ahead and making the PR on the basis of being surprised things didn't already work this way.

This is my first time hacking rust itself, so as a perf sanity check I ran `./x.py bench --stage 0 src/lib{std,alloc}`, but the differences were noisy.

To make the existing specialization for `BytewiseEquality` explicit, it's now a supertrait of `Eq + Copy`. `Eq` should be sufficient, but `Copy` was included for clarity.

5 years agoAdd test for #49919
Yuki Okushi [Thu, 11 Jul 2019 00:58:09 +0000 (09:58 +0900)]
Add test for #49919

5 years agoRefactor diagnostic emission for green nodes
John Kåre Alsaker [Fri, 19 Apr 2019 16:49:15 +0000 (18:49 +0200)]
Refactor diagnostic emission for green nodes

5 years agoAuto merge of #62561 - Centril:rollup-5pxj3bo, r=Centril
bors [Wed, 10 Jul 2019 23:02:44 +0000 (23:02 +0000)]
Auto merge of #62561 - Centril:rollup-5pxj3bo, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62275 (rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts.)
 - #62465 (Sometimes generate storage statements for temporaries with type `!`)
 - #62481 (Use `fold` in `Iterator::last` default implementation)
 - #62493 (#62357: doc(ptr): add example for {read,write}_unaligned)
 - #62532 (Some more cleanups to syntax::print)

Failed merges:

r? @ghost

5 years agoAdd a regression test for #44692
Vadim Petrochenkov [Mon, 8 Jul 2019 18:58:42 +0000 (21:58 +0300)]
Add a regression test for #44692

Add a test for the issue resolved by removing `resolve_macro_path`

Add a test making sure that extern prelude entries introduced from an opaque macro are not visible anywhere, even it that macro

Fix test output after rebase

5 years agoFix failing tests
Vadim Petrochenkov [Sun, 7 Jul 2019 22:00:54 +0000 (01:00 +0300)]
Fix failing tests

5 years agoexpand: Move "derive containers" into a separate `InvocationKind` variant
Vadim Petrochenkov [Sun, 7 Jul 2019 22:00:43 +0000 (01:00 +0300)]
expand: Move "derive containers" into a separate `InvocationKind` variant

`InvocationKind::Attr { attr: None, .. }` meaning something entirely different from a regular attribute was confusing as hell.

5 years agoexpand: Merge `expand_{bang,attr,derive}_invoc` into a single function
Vadim Petrochenkov [Sun, 7 Jul 2019 15:55:29 +0000 (18:55 +0300)]
expand: Merge `expand_{bang,attr,derive}_invoc` into a single function

It's more convenient to have all this highly related stuff together on one screen (for future refactorings).
The `expand_invoc` function is compact enough now, after all the previous refactorings.

5 years agoexpand: It's always possible to create a dummy AST fragment
Vadim Petrochenkov [Sun, 7 Jul 2019 15:29:22 +0000 (18:29 +0300)]
expand: It's always possible to create a dummy AST fragment

Remove a bunch of `Option`s that assumed that dummy fragment creation could fail.

The test output changed due to not performing the expansion in `fn expand_invoc` in case of the recursion limit hit.

5 years agohygiene: Make sure each `Mark` has an associated expansion info
Vadim Petrochenkov [Sun, 7 Jul 2019 13:45:41 +0000 (16:45 +0300)]
hygiene: Make sure each `Mark` has an associated expansion info

The root expansion was missing one.
Expansions created for "derive containers" (see one of the next commits for the description) also didn't get expansion info.

5 years agohygiene: Fix wording of desugaring descriptions
Vadim Petrochenkov [Sun, 7 Jul 2019 10:02:05 +0000 (13:02 +0300)]
hygiene: Fix wording of desugaring descriptions

Use variant names rather than descriptions for identifying desugarings in `#[rustc_on_unimplemented]`.
Both are highly unstable, but variant name is at least a single identifier.

5 years agohygiene: Introduce a helper method for creating new expansions
Vadim Petrochenkov [Sat, 6 Jul 2019 18:02:45 +0000 (21:02 +0300)]
hygiene: Introduce a helper method for creating new expansions

Creating a fresh expansion and immediately generating a span from it is the most common scenario.

Also avoid allocating `allow_internal_unstable` lists for derive markers repeatedly.
And rename `ExpnInfo::with_unstable` to `ExpnInfo::allow_unstable`, seems to be a better fitting name.

5 years agoexpand: Do not overwrite existing `ExpnInfo` when injecting derive markers
Vadim Petrochenkov [Sat, 6 Jul 2019 17:25:34 +0000 (20:25 +0300)]
expand: Do not overwrite existing `ExpnInfo` when injecting derive markers

Create a fresh expansion for them instead - this is the usual way to allow unstable features for generated/desugared code.
Fixes https://github.com/rust-lang/rust/issues/52363

5 years agoresolve: Fix access to extern and stdlib prelude from opaque macros
Vadim Petrochenkov [Sat, 6 Jul 2019 16:45:23 +0000 (19:45 +0300)]
resolve: Fix access to extern and stdlib prelude from opaque macros

Ok, it's hard to explain what happens, but identifier's hygienic contexts need to be "adjusted" to modules/scopes before they are resolved in them.
To be resolved in all kinds on preludes the identifier needs to be adjusted to the root expansion (aka "no expansion").

Previously this was done for the `macro m() { ::my_crate::foo }` case, but forgotten for all other cases.

5 years agoresolve: Divide macro path resolution into speculative and error reporting parts
Vadim Petrochenkov [Wed, 3 Jul 2019 20:59:03 +0000 (23:59 +0300)]
resolve: Divide macro path resolution into speculative and error reporting parts

Also move macro stability checking closer to other checks performed on obtained resolutions.
Tighten the stability spans as well, it is an error to *refer* to and unstable entity in any way, not only "call" it.

5 years agoresolve: Include stdlib prelude into name lookup in macro namespace
Vadim Petrochenkov [Wed, 3 Jul 2019 20:25:46 +0000 (23:25 +0300)]
resolve: Include stdlib prelude into name lookup in macro namespace

This is going to be used when built-in macros are defined through libcore and made available to other crates through standard library prelude

5 years agoresolve/expand: Catch macro kind mismatches early in resolve
Vadim Petrochenkov [Wed, 3 Jul 2019 09:47:24 +0000 (12:47 +0300)]
resolve/expand: Catch macro kind mismatches early in resolve

This way we are processing all of them in a single point, rather than separately for each syntax extension kind.
Also, the standard expected/found wording is used.

5 years agoresolve/expand: `resolve_macro_invocation` no longer returns determinate errors
Vadim Petrochenkov [Wed, 3 Jul 2019 08:44:57 +0000 (11:44 +0300)]
resolve/expand: `resolve_macro_invocation` no longer returns determinate errors

It either returns the indeterminacy error, or valid (but perhaps dummy) `SyntaxExtension`.

With this change enum `Determinacy` is no longer used in libsyntax and can be moved to resolve.

The regressions in diagnosics are fixed in the next commits.

5 years agoresolve: Make proc macro stubs less stubby
Vadim Petrochenkov [Tue, 2 Jul 2019 22:44:04 +0000 (01:44 +0300)]
resolve: Make proc macro stubs less stubby

Create real working and registered (even if dummy) `SyntaxExtension`s for them.
This improves error recovery and allows to avoid all special cases for proc macro stubs (except for the error on use, of course).

The introduced dummy `SyntaxExtension`s can be used for any other inappropriately resolved macros as well.

5 years agodef_collector: `parent_def` is no longer optional
Vadim Petrochenkov [Tue, 2 Jul 2019 20:42:00 +0000 (23:42 +0300)]
def_collector: `parent_def` is no longer optional

5 years agodef_collector: Simplify tracking of macro invocation parents
Vadim Petrochenkov [Tue, 2 Jul 2019 10:47:28 +0000 (13:47 +0300)]
def_collector: Simplify tracking of macro invocation parents

Avoid the tricky scheme with callbacks and keep the invocation parent data where it logically belongs - in `Definitions`.

This also allows to create `InvocationData` entries in resolve when the data is actually ready, and remove cells and "uninitialized" variants from it.

5 years agohygiene: Reuse `MacroKind` in `ExpnKind`
Vadim Petrochenkov [Sun, 30 Jun 2019 12:58:56 +0000 (15:58 +0300)]
hygiene: Reuse `MacroKind` in `ExpnKind`

Orthogonality and reuse are good.

5 years agohygiene: Remove some unused impls
Vadim Petrochenkov [Sun, 30 Jun 2019 11:57:34 +0000 (14:57 +0300)]
hygiene: Remove some unused impls