]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #61941 - cramertj:no-more-yield-errors, r=centril
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:13 +0000 (01:52 +0200)]
Rollup merge of #61941 - cramertj:no-more-yield-errors, r=centril

Preserve generator and yield source for error messages

Previously, error messages after HIR lowering all referred
to generators and yield, regardless of whether the original
source was a generator or an async/await body. This change
tracks the kind of each generator and yield source in order
to provide appropriately tailored error messages.

Fixes #60615.

5 years agoRollup merge of #61938 - RalfJung:miri-toolstate, r=kennytm
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:12 +0000 (01:52 +0200)]
Rollup merge of #61938 - RalfJung:miri-toolstate, r=kennytm

create an issue for miri even in status test-fail

I fired up python to see that this parses, but I wouldn't know how to test this script.

5 years agoRollup merge of #61898 - petrochenkov:sekind, r=eddyb
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:10 +0000 (01:52 +0200)]
Rollup merge of #61898 - petrochenkov:sekind, r=eddyb

syntax: Factor out common fields from `SyntaxExtension` variants

And some other related cleanups.

Continuation of https://github.com/rust-lang/rust/pull/61606.
This will also help to unblock https://github.com/rust-lang/rust/pull/61877.

5 years agoRollup merge of #61896 - eddyb:correct-self-ctor, r=petrochenkov
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:09 +0000 (01:52 +0200)]
Rollup merge of #61896 - eddyb:correct-self-ctor, r=petrochenkov

rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`.

Fixes #61882.

r? @petrochenkov cc @varkor

5 years agoRollup merge of #61843 - alexcrichton:disable-myriad-closures, r=pietroalbini
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:07 +0000 (01:52 +0200)]
Rollup merge of #61843 - alexcrichton:disable-myriad-closures, r=pietroalbini

Turn down the myriad-closures test

This tests takes nearly 5 minutes to compile on CI where the CPUs we
have aren't exactly the fastest. This test does actually require all
closures to exist to exhibit the original bug, but it seems a little
excessive to test a single bug on CI on all platforms which simply pegs
a single CPU for 5 minutes with no parallelism opportunities, so this
turns down the test to still exercise it somewhat at least.

5 years agoRollup merge of #61842 - Zoxc:trim-lift, r=eddyb
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:06 +0000 (01:52 +0200)]
Rollup merge of #61842 - Zoxc:trim-lift, r=eddyb

Remove unnecessary lift calls

Note that some of these might be useful for sanity checking that there's no infer types or regions.

r? @eddyb

5 years agoRollup merge of #61839 - alexcrichton:pr-and-master-builds, r=pietroalbini
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:04 +0000 (01:52 +0200)]
Rollup merge of #61839 - alexcrichton:pr-and-master-builds, r=pietroalbini

ci: Add a script for generating CPU usage graphs

This commit checks in a script which generates CPU usage graphs over
time, expanding on the previous comment that was include in the
collection file.

Some example graphs from the [latest build](https://dev.azure.com/rust-lang/rust/_build/results?buildId=717) look like:

![dist-x86_64-apple](https://user-images.githubusercontent.com/64996/59520676-16c5b000-8e90-11e9-9188-27001911f270.png)

![x86_64-msvc-1](https://user-images.githubusercontent.com/64996/59520677-175e4680-8e90-11e9-8568-4b564807324e.png)

![x86_64-mingw-1](https://user-images.githubusercontent.com/64996/59520680-175e4680-8e90-11e9-939d-a73c7224582f.png)

![test-various](https://user-images.githubusercontent.com/64996/59520682-175e4680-8e90-11e9-9980-900ed4eeb8f4.png)

5 years agoRollup merge of #61802 - mjbshaw:maybe-uninit-transparent, r=cramertj
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:03 +0000 (01:52 +0200)]
Rollup merge of #61802 - mjbshaw:maybe-uninit-transparent, r=cramertj

Make MaybeUninit #[repr(transparent)]

Tracking issue: #60405

5 years agoRollup merge of #61748 - estebank:transparent-span, r=Centril
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:52:01 +0000 (01:52 +0200)]
Rollup merge of #61748 - estebank:transparent-span, r=Centril

Tweak transparent enums and unions diagnostic spans

5 years agoRollup merge of #61701 - RalfJung:const-tests, r=cramertj
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:51:59 +0000 (01:51 +0200)]
Rollup merge of #61701 - RalfJung:const-tests, r=cramertj

move stray run-pass const tests into const/ folder

r? @oli-obk

5 years agoRollup merge of #61505 - ebarnard:doc-shrink, r=GuillaumeGomez
Mazdak Farrokhzad [Tue, 18 Jun 2019 23:51:58 +0000 (01:51 +0200)]
Rollup merge of #61505 - ebarnard:doc-shrink, r=GuillaumeGomez

Only show methods that appear in `impl` blocks in the Implementors sections of trait doc pages

In the "Implementors" and "Implementations on Foreign Types" sections, only show methods that appear in the `impl` block for that type. This has the benefit of
- Reducing the size of the Iterator page, and other large trait documentation pages.
- Retaining documentation on the `impl` blocks and functions in the `impl` blocks.
- Indicating which provided methods are overridden.
- Making the documentation match the structure of the code being documented.
- Being a small change that can be easily backed out if issues arise.

A set of Rust stdlib docs build with this change are [available here](https://ebarnard.github.io/2019-06-03-rust-smaller-trait-implementers-docs/).

The size of the [`Iterator` doc page](https://ebarnard.github.io/2019-06-03-rust-smaller-trait-implementers-docs/std/iter/trait.Iterator.html) is reduced from 14.4MB (latest nightly) to 724kB.

Before:
<img width="1411" alt="Screenshot 2019-06-03 at 23 12 17" src="https://user-images.githubusercontent.com/1059683/58837971-1722a780-8655-11e9-8d81-51e48130951d.png">

After:
<img width="1428" alt="Screenshot 2019-06-03 at 16 41 27" src="https://user-images.githubusercontent.com/1059683/58814907-84ffac80-861e-11e9-8692-79be473a5299.png">

cc #55900

5 years agoPreserve generator and yield source for error messages
Taylor Cramer [Tue, 18 Jun 2019 21:34:51 +0000 (14:34 -0700)]
Preserve generator and yield source for error messages

Previously, error messages after HIR lowering all referred
to generators and yield, regardless of whether the original
source was a generator or an async/await body. This change
tracks the kind of each generator and yield source in order
to provide appropriately tailored error messages.

5 years agocreate an issue for miri even in status test-fail
Ralf Jung [Tue, 18 Jun 2019 19:57:31 +0000 (21:57 +0200)]
create an issue for miri even in status test-fail

5 years agoAuto merge of #61891 - eddyb:lifetime-cleanups, r=oli-obk
bors [Tue, 18 Jun 2019 19:04:15 +0000 (19:04 +0000)]
Auto merge of #61891 - eddyb:lifetime-cleanups, r=oli-obk

rustc: remove 'x: 'y bounds (except where necessary or from comments/strings).

This PR removes all lifetime-lifetime "outlives" bounds (e.g. `'tcx: 'a`) bounds except a few necessary ones (see the `reintroduce lifetime bounds where necessary` commit).

Some of these bounds kept around otherwise-unused lifetimes (e.g. `<'a, 'tcx: 'a>` followed by uses of `'tcx` but not `'a`) - these lifetimes (i.e. `'a`) were then removed.
(maybe they should be considered unused by the lint? cc @matthewjasper @zackmdavis)

r? @oli-obk cc @rust-lang/compiler

5 years agoci: Add a script for generating CPU usage graphs
Alex Crichton [Fri, 14 Jun 2019 15:31:43 +0000 (08:31 -0700)]
ci: Add a script for generating CPU usage graphs

This commit checks in a script which generates CPU usage graphs over
time, expanding on the previous comment that was include in the
collection file.

5 years agoAuto merge of #61932 - matthiaskrgr:submodule_upd, r=oli-obk
bors [Tue, 18 Jun 2019 16:08:17 +0000 (16:08 +0000)]
Auto merge of #61932 - matthiaskrgr:submodule_upd, r=oli-obk

submodules: update clippy from be5d17fe to 868f168c

Changes:
````
rustup https://github.com/rust-lang/rust/pull/61836/
fix suggestion for floating points inequality
````
r? @oli-obk

5 years agotest: normalize away the line/column info in ui/pattern/const-pat-ice.
Eduard-Mihai Burtescu [Sun, 16 Jun 2019 11:11:20 +0000 (14:11 +0300)]
test: normalize away the line/column info in ui/pattern/const-pat-ice.

5 years agoRun `rustfmt --file-lines ...` for changes from previous commits.
Eduard-Mihai Burtescu [Sun, 16 Jun 2019 09:41:24 +0000 (12:41 +0300)]
Run `rustfmt --file-lines ...` for changes from previous commits.

5 years agorustc: reintroduce lifetime bounds where necessary.
Eduard-Mihai Burtescu [Sun, 16 Jun 2019 09:33:47 +0000 (12:33 +0300)]
rustc: reintroduce lifetime bounds where necessary.

5 years agorustc: remove unused lifetimes.
Eduard-Mihai Burtescu [Sun, 16 Jun 2019 09:33:21 +0000 (12:33 +0300)]
rustc: remove unused lifetimes.

5 years agorustc: remove leftover lifetimes with no bounds from where clauses.
Eduard-Mihai Burtescu [Fri, 14 Jun 2019 16:43:53 +0000 (19:43 +0300)]
rustc: remove leftover lifetimes with no bounds from where clauses.

5 years agorustc: remove 'x: 'y bounds (except from comments/strings).
Eduard-Mihai Burtescu [Fri, 14 Jun 2019 16:39:39 +0000 (19:39 +0300)]
rustc: remove 'x: 'y bounds (except from comments/strings).

5 years agorustc_typeck: correctly compute `Substs` for `Res::SelfCtor`.
Eduard-Mihai Burtescu [Sun, 16 Jun 2019 14:23:41 +0000 (17:23 +0300)]
rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`.

5 years agosubmodules: update clippy from be5d17fe to 868f168c
Matthias Krüger [Tue, 18 Jun 2019 13:43:41 +0000 (15:43 +0200)]
submodules: update clippy from be5d17fe to 868f168c

Changes:
````
rustup https://github.com/rust-lang/rust/pull/61836/
fix suggestion for floating points inequality
````

5 years agoMake MaybeUninit #[repr(transparent)]
Michael Bradshaw [Wed, 12 Jun 2019 02:04:02 +0000 (19:04 -0700)]
Make MaybeUninit #[repr(transparent)]

Tracking issue: #60405

5 years agoAuto merge of #61927 - RalfJung:miri, r=oli-obk
bors [Tue, 18 Jun 2019 11:18:45 +0000 (11:18 +0000)]
Auto merge of #61927 - RalfJung:miri, r=oli-obk

update miri

Tests fail since https://github.com/rust-lang/rust/pull/61885, this should fix that.

r? @oli-obk

5 years agoAuto merge of #61822 - JohnTitor:add-long-e0592, r=GuillaumeGomez,Centril
bors [Tue, 18 Jun 2019 08:30:38 +0000 (08:30 +0000)]
Auto merge of #61822 - JohnTitor:add-long-e0592, r=GuillaumeGomez,Centril

Add explanation for E0592

This is a part of #61137

r? @GuillaumeGomez

5 years agoresolve/expand: Move expansion info setting to a single earlier point
Vadim Petrochenkov [Tue, 18 Jun 2019 07:48:44 +0000 (10:48 +0300)]
resolve/expand: Move expansion info setting to a single earlier point

5 years agohygiene: Avoid some unnecessary `ExpnInfo` clones
Vadim Petrochenkov [Mon, 17 Jun 2019 22:36:44 +0000 (01:36 +0300)]
hygiene: Avoid some unnecessary `ExpnInfo` clones

5 years agosyntax: Move `default_transparency` into `ExpnInfo`
Vadim Petrochenkov [Mon, 17 Jun 2019 20:55:22 +0000 (23:55 +0300)]
syntax: Move `default_transparency` into `ExpnInfo`

5 years agosyntax: Introduce `default`/`with_unstable` constructors for `ExpnInfo`
Vadim Petrochenkov [Mon, 17 Jun 2019 19:18:56 +0000 (22:18 +0300)]
syntax: Introduce `default`/`with_unstable` constructors for `ExpnInfo`

5 years agoresolve: Avoid creating fresh syntax extensions for all non-macro attributes
Vadim Petrochenkov [Mon, 17 Jun 2019 09:29:56 +0000 (12:29 +0300)]
resolve: Avoid creating fresh syntax extensions for all non-macro attributes

5 years agosyntax: Remove `DummyResolver`
Vadim Petrochenkov [Mon, 17 Jun 2019 08:10:48 +0000 (11:10 +0300)]
syntax: Remove `DummyResolver`

5 years agoallow_internal_unstable: Avoid some more allocations
Vadim Petrochenkov [Sun, 16 Jun 2019 21:31:46 +0000 (00:31 +0300)]
allow_internal_unstable: Avoid some more allocations

5 years agosyntax: Factor out common fields from `SyntaxExtension` variants
Vadim Petrochenkov [Sun, 16 Jun 2019 15:58:39 +0000 (18:58 +0300)]
syntax: Factor out common fields from `SyntaxExtension` variants

5 years agoupdate miri
Ralf Jung [Tue, 18 Jun 2019 06:14:03 +0000 (08:14 +0200)]
update miri

5 years agoAuto merge of #61864 - lzutao:ptr-null, r=sfackler
bors [Tue, 18 Jun 2019 05:16:26 +0000 (05:16 +0000)]
Auto merge of #61864 - lzutao:ptr-null, r=sfackler

Make use of `ptr::null(_mut)` instead of casting zero

There are few places that I don't replace the zero casting pointer with `ptr::null`
or `ptr::null_mut`:
```bash
% git grep -E '[ ([{]0 as \*'
src/libcore/ptr/mod.rs:216:pub const fn null<T>() -> *const T { 0 as *const T }
src/libcore/ptr/mod.rs:231:pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
src/test/run-pass/consts/const-cast-ptr-int.rs:12:static a: TestStruct = TestStruct{x: 0 as *const u8};
src/test/ui/issues/issue-45730.rs:5:    let x: *const _ = 0 as *const _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.rs:8:    let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast
src/test/ui/issues/issue-45730.stderr:14:LL |     let x: *const _ = 0 as *const _;
src/test/ui/issues/issue-45730.stderr:24:LL |     let x = 0 as *const i32 as *const _ as *mut _;
src/test/ui/lint/lint-forbid-internal-unsafe.rs:15:    println!("{}", evil!(*(0 as *const u8)));
src/test/ui/order-dependent-cast-inference.rs:5:    let mut y = 0 as *const _;
src/test/ui/order-dependent-cast-inference.stderr:4:LL |     let mut y = 0 as *const _;
```

r? @sfackler

5 years agoAuto merge of #61771 - ehuss:update-cargo, r=alexcrichton
bors [Tue, 18 Jun 2019 02:17:17 +0000 (02:17 +0000)]
Auto merge of #61771 - ehuss:update-cargo, r=alexcrichton

Update cargo

Update cargo

19 commits in 545f354259be4e9745ea00a524c0e4c51df01aa6..807429e1b6da4e2ec52488ef2f59e77068c31e1f
2019-05-23 17:45:30 +0000 to 2019-06-11 14:06:10 +0000
- Stabilize publish-lockfile. (rust-lang/cargo#7026)
- change package cache lock message (rust-lang/cargo#7029)
- Fix documenting an example. (rust-lang/cargo#7023)
- Fix nonconcurrent tests (rust-lang/cargo#6900)
- Update git2 crates for libgit2 0.28 (rust-lang/cargo#7018)
- fix bunch of clippy warnings (rust-lang/cargo#7019)
- Ignore remap-path-prefix in metadata hash. (rust-lang/cargo#6966)
- Don't synthesize feature diretives for non-optional deps (rust-lang/cargo#7010)
- Handle pipelined tests of libraries (rust-lang/cargo#7008)
- Import the cargo-vendor subcommand into Cargo (rust-lang/cargo#6869)
- Remove unnecessary outlives bounds (rust-lang/cargo#7000)
- Catch filename output collisions in rustdoc. (rust-lang/cargo#6998)
- the testing SAT solver was messed up by a refactor (rust-lang/cargo#6995)
- Add some hints to the docs for `cfg()` targets (rust-lang/cargo#6990)
- Test the Resolver against the varisat Library (rust-lang/cargo#6980)
- Update changelog. (rust-lang/cargo#6984)
- Update cache-messages tracking issue. (rust-lang/cargo#6987)
- zsh: Add --all-targets option to cargo-check and cargo-build (rust-lang/cargo#6985)
- Fix typo (rust-lang/cargo#6982)

5 years agoAuto merge of #61915 - Centril:rollup-oire3i8, r=Centril
bors [Mon, 17 Jun 2019 23:30:37 +0000 (23:30 +0000)]
Auto merge of #61915 - Centril:rollup-oire3i8, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #61702 (test more variants of enum-int-casting)
 - #61836 (Replace some uses of NodeId with HirId)
 - #61885 (Help LLVM better optimize slice::Iter(Mut)::len)
 - #61893 (make `Weak::ptr_eq`s into methods)
 - #61908 (don't ICE on large files)

Failed merges:

r? @ghost

5 years agoImprove wording
Yuki Okushi [Mon, 17 Jun 2019 22:53:27 +0000 (07:53 +0900)]
Improve wording

5 years agoBump libgit2-sys to get it to compile on i686-pc-windows-gnu.
Eric Huss [Mon, 17 Jun 2019 21:34:24 +0000 (14:34 -0700)]
Bump libgit2-sys to get it to compile on i686-pc-windows-gnu.

5 years agoAdd `syn` to workspace hack.
Eric Huss [Fri, 14 Jun 2019 05:35:27 +0000 (22:35 -0700)]
Add `syn` to workspace hack.

Cargo's syn now has the `full` feature, so add it here to keep it in sync.

5 years agoUpdate cargo
Eric Huss [Wed, 12 Jun 2019 14:37:30 +0000 (07:37 -0700)]
Update cargo

5 years agoRollup merge of #61908 - matklad:overflow, r=petrochenkov
Mazdak Farrokhzad [Mon, 17 Jun 2019 18:56:01 +0000 (20:56 +0200)]
Rollup merge of #61908 - matklad:overflow, r=petrochenkov

don't ICE on large files

This is an extremely marginal error, so the cost of properly threading
`Handler` everywhere just not seemed justified. However, it's useful
to panic when we create a file, and not when we slice strings with
overflown indexes somewhere in the guts of the compiler.

For this reason, while we provide safe `try_new_source_file`, we don't
change the existing public interface and just panic more or less
cleanly.

closes #61904

r? @petrochenkov

5 years agoRollup merge of #61893 - chpio:weak_ptr_eq_methods, r=rkruppe
Mazdak Farrokhzad [Mon, 17 Jun 2019 18:56:00 +0000 (20:56 +0200)]
Rollup merge of #61893 - chpio:weak_ptr_eq_methods, r=rkruppe

make `Weak::ptr_eq`s into methods

This makes the `Weak::ptr_eq`s associated function into methods. There's no reason for methods on `Weak`s to be associated functions, as there is no `Dered` thus no possibility of a collision. Also: methods can be called using the associated function syntax.

follow up on https://github.com/rust-lang/rust/pull/55987
[Tracking issue for weak_ptr_eq](https://github.com/rust-lang/rust/issues/55981)

5 years agoRollup merge of #61885 - scottmcm:slice-iter-len-opt, r=rkruppe,RalfJung
Mazdak Farrokhzad [Mon, 17 Jun 2019 18:55:58 +0000 (20:55 +0200)]
Rollup merge of #61885 - scottmcm:slice-iter-len-opt, r=rkruppe,RalfJung

Help LLVM better optimize slice::Iter(Mut)::len

r? @RalfJung

I've included a codegen test that fails without this change as a demonstration of usefulness.

5 years agoRollup merge of #61836 - ljedrz:i_still_hate_node_ids, r=ljedrz
Mazdak Farrokhzad [Mon, 17 Jun 2019 18:55:57 +0000 (20:55 +0200)]
Rollup merge of #61836 - ljedrz:i_still_hate_node_ids, r=ljedrz

Replace some uses of NodeId with HirId

We are still using `NodeId` in some spots where we could use `HirId` instead; this PR targets some of these spots and removes some of the associated `hir::map` functions.

5 years agoRollup merge of #61702 - RalfJung:const-enum-cast, r=oli-obk
Mazdak Farrokhzad [Mon, 17 Jun 2019 18:55:55 +0000 (20:55 +0200)]
Rollup merge of #61702 - RalfJung:const-enum-cast, r=oli-obk

test more variants of enum-int-casting

As I learned in https://github.com/rust-lang/rust/pull/61673#issuecomment-500213506, there is a code path we are not testing yet. Looks like enum-int-casting with and without an intermediate let-binding is totally different.

EDIT: The reason for this is to get rid of the cycle in definitions such as:
```rust
enum Foo {
    A = 0,
    B = Foo::A as isize + 2,
}
```
This has historically been supported, so a hack adding special treatment to `Enum::Variant as _` was added to keep supporting it.

5 years agoremove superfluous space
ljedrz [Mon, 17 Jun 2019 18:31:26 +0000 (20:31 +0200)]
remove superfluous space

5 years agoAuto merge of #61781 - christianpoveda:intptrcast-model, r=oli-obk,RalfJung
bors [Mon, 17 Jun 2019 18:04:15 +0000 (18:04 +0000)]
Auto merge of #61781 - christianpoveda:intptrcast-model, r=oli-obk,RalfJung

prepare for Intptrcast model

https://github.com/rust-lang/rust/pull/61668 done right (I hope so). r? @RalfJung @oli-obk

5 years agofix rebase fallout
ljedrz [Mon, 17 Jun 2019 17:01:41 +0000 (19:01 +0200)]
fix rebase fallout

5 years agochange NodeId to HirId in some HIR docs
ljedrz [Sun, 16 Jun 2019 15:44:19 +0000 (17:44 +0200)]
change NodeId to HirId in some HIR docs

5 years agosimplify ICE handling in HirIdValidator
ljedrz [Sun, 16 Jun 2019 15:37:58 +0000 (17:37 +0200)]
simplify ICE handling in HirIdValidator

5 years agofix a HIR doc, simplify one HIR-related function call
ljedrz [Sun, 16 Jun 2019 15:30:53 +0000 (17:30 +0200)]
fix a HIR doc, simplify one HIR-related function call

5 years agorenamve hir_to_string to node_to_string
ljedrz [Sun, 16 Jun 2019 15:30:02 +0000 (17:30 +0200)]
renamve hir_to_string to node_to_string

5 years agoremove _by_hir_id if there is no NodeId counterpart
ljedrz [Fri, 14 Jun 2019 16:58:55 +0000 (18:58 +0200)]
remove _by_hir_id if there is no NodeId counterpart

5 years agoreplace some uses of NodeId with HirId
ljedrz [Fri, 14 Jun 2019 10:28:47 +0000 (12:28 +0200)]
replace some uses of NodeId with HirId

5 years agodon't ICE on large files
Aleksey Kladov [Mon, 17 Jun 2019 08:35:26 +0000 (11:35 +0300)]
don't ICE on large files

This is an extremely marginal error, so the cost of properly threading
`Handler` everywhere just not seemed justified. However, it's useful
to panic when we create a file, and not when we slice strings with
overflown indexes somewhere in the guts of the compiler.

For this reason, while we provide safe `try_new_source_file`, we don't
change the existing public interface and just panic more or less
cleanly.

5 years agoAuto merge of #61857 - Centril:typeck-extract-expr, r=oli-obk
bors [Mon, 17 Jun 2019 13:32:35 +0000 (13:32 +0000)]
Auto merge of #61857 - Centril:typeck-extract-expr, r=oli-obk

typeck: extract expr type-checking to expr.rs + refactor check_expr_kind

In this PR we:

- Extract out the bulk of the expression type checking logic from `check/mod.rs` into a new file `check/expr.rs`.

- Refactor `fn check_expr_kind` into several smaller functions.

More functions should probably be moved but I think this is a reasonable start.

r? @oli-obk
cc @eddyb

5 years agoMake use of `ptr::null(_mut)` instead of casting zero
Lzu Tao [Mon, 17 Jun 2019 10:52:37 +0000 (10:52 +0000)]
Make use of `ptr::null(_mut)` instead of casting zero

5 years agoAuto merge of #58508 - Zoxc:time-crate, r=oli-obk
bors [Mon, 17 Jun 2019 09:59:57 +0000 (09:59 +0000)]
Auto merge of #58508 - Zoxc:time-crate, r=oli-obk

Add a RUSTC_TIME env var to time rust crates during bootstrap

Blocked on https://github.com/rust-lang/cargo/pull/6674

r? @michaelwoerister

Example for rustc with https://github.com/rust-lang/rust/pull/58507:
```
  time: 0.460; rss: 94MB parsing
  time: 0.000; rss: 94MB attributes injection
  time: 0.000; rss: 94MB recursion limit
  time: 0.000; rss: 94MB crate injection
  time: 0.000; rss: 94MB plugin loading
  time: 0.000; rss: 94MB plugin registration
  time: 0.044; rss: 94MB pre ast expansion lint checks
    time: 1.999; rss: 316MB expand crate
    time: 0.000; rss: 316MB check unused macros
  time: 2.000; rss: 316MB expansion
  time: 0.000; rss: 316MB maybe building test harness
  time: 0.053; rss: 316MB AST validation
  time: 0.000; rss: 316MB maybe creating a macro crate
  time: 1.515; rss: 397MB name resolution
  time: 0.122; rss: 397MB complete gated feature checking
  time: 0.655; rss: 546MB lowering ast -> hir
  time: 0.136; rss: 550MB early lint checks
    time: 0.117; rss: 540MB validate hir map
  time: 0.606; rss: 540MB indexing hir
  time: 0.000; rss: 480MB load query result cache
  time: 0.000; rss: 478MB dep graph tcx init
  time: 0.000; rss: 478MB looking for entry point
  time: 0.001; rss: 478MB looking for plugin registrar
  time: 0.001; rss: 478MB looking for derive registrar
  time: 0.049; rss: 478MB loop checking
  time: 0.064; rss: 479MB attribute checking
  time: 0.166; rss: 484MB stability checking
  time: 0.699; rss: 566MB type collecting
  time: 0.006; rss: 566MB outlives testing
  time: 0.018; rss: 568MB impl wf inference
    time: 0.002; rss: 583MB unsafety checking
    time: 0.005; rss: 583MB orphan checking
  time: 0.227; rss: 583MB coherence checking
  time: 0.006; rss: 583MB variance testing
  time: 1.546; rss: 657MB wf checking
  time: 0.389; rss: 665MB item-types checking
  time: 13.999; rss: 837MB item-bodies checking
    time: 1.692; rss: 883MB rvalue promotion
    time: 0.067; rss: 883MB intrinsic checking
    time: 0.624; rss: 887MB match checking
    time: 0.246; rss: 889MB liveness checking
  time: 2.629; rss: 889MB misc checking
  time: 0.000; rss: 889MB borrow checking
  time: 16.754; rss: 1242MB MIR borrow checking
  time: 0.050; rss: 1242MB dumping chalk-like clauses
  time: 0.010; rss: 1242MB MIR effect checking
  time: 0.001; rss: 1242MB layout testing
    time: 0.829; rss: 1244MB privacy checking
    time: 0.183; rss: 1247MB death checking
    time: 0.100; rss: 1248MB unused lib feature checking
    time: 0.405; rss: 1250MB lint checking
  time: 1.518; rss: 1250MB misc checking
  time: 0.000; rss: 1250MB resolving dependency formats
    time: 2.928; rss: 1332MB write metadata
      time: 0.014; rss: 1332MB collecting roots
      time: 7.621; rss: 1488MB collecting mono items
    time: 7.635; rss: 1488MB monomorphization collection
    time: 0.557; rss: 1567MB codegen unit partitioning
    time: 27.971; rss: 2656MB codegen to LLVM IR
    time: 0.056; rss: 2656MB assert dep graph
    time: 0.000; rss: 2656MB serialize dep graph
  time: 195.414; rss: 2656MB codegen
  time: 0.000; rss: 329MB serialize work products
    time: 1.664; rss: 331MB running linker
  time: 1.965; rss: 331MB linking
[RUSTC-TIMING] rustc test:false 950.103
```
It doesn't really look like the times add up here.

5 years agoAuto merge of #61889 - matthiaskrgr:submodule_upd, r=oli-obk
bors [Mon, 17 Jun 2019 07:12:03 +0000 (07:12 +0000)]
Auto merge of #61889 - matthiaskrgr:submodule_upd, r=oli-obk

submodules: update clippy from 7b2a7a22 to be5d17fe

Changes:
````
Fix wrong lifetime of TyCtxt
Use replace_region_in_file for creating the lint list
Restructure rename tests
Register rename to the LintStore.
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES.
Remove pub from RedundantStaticLifetime.visit_type function.
Rename const_static_lifetime to redundant_static_lifetime.
Merge StaticConst and StaticStatic lints into StaticConst.
Use RedundantStaticLifetime in StaticStatic.
Move type-checking logic in StaticConst to RedundantStaticLifetime.
Add lint for statics with explicit static lifetime.
minor fix
make it pass dogfood
run rustfmt
fix padding and put clippy someplaces
show default lint levels
group printing
prelim arg parse
move Lint static def into its own module
switch to sorted usable lints
Update clippy_dev/src/main.rs
initial commit for help improvements on clippy-driver
````

Fixes clippy toolstate.
r? @oli-obk

5 years agoAuto merge of #61892 - rijenkii:master, r=Centril
bors [Sun, 16 Jun 2019 23:25:12 +0000 (23:25 +0000)]
Auto merge of #61892 - rijenkii:master, r=Centril

weird-exprs: if if if if

The `if` keyword can be chained as long as there are enough `{...} else {...}` following, and they all return a `bool` (not required for the last one).
`if` expression can be also put inside a `match` arm guard, thus making the whole thing a little bit more confusing.

Discovered this clusterfunk while reading the reference because I have nothing better to do.

5 years agoAuto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkov
bors [Sun, 16 Jun 2019 20:33:55 +0000 (20:33 +0000)]
Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkov

Stabilize underscore_const_names in 1.37.0

You are now permitted to write:

```rust
const _: $type_expression = $term_expression;
```

That is, we change the [grammar of items](https://github.com/rust-lang-nursery/wg-grammar/blob/9d1984d7ae8d6576f943566539a31a5800644c57/grammar/item.lyg#L3-L42), as written in [the *`.lyg`* notation](https://github.com/rust-lang/gll/tree/263bf161dad903e67aa65fc591ced3cab18afa2a#grammar), from:

```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
  | ...
  | Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" }
  | ...
  ;
```

into:

```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
  | ...
  | Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" }
  | ...
  ;

IdentOrUnderscore =
  | Named:IDENT
  | NoName:"_"
  ;
```

r? @petrochenkov

5 years agoAuto merge of #61881 - glaubitz:sparc64-ffi-abi, r=petrochenkov
bors [Sun, 16 Jun 2019 17:48:24 +0000 (17:48 +0000)]
Auto merge of #61881 - glaubitz:sparc64-ffi-abi, r=petrochenkov

librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C…

…) (#61306)

In order to make sure that Rust's bitflags types are passed the same way in the Rust ABI as they are in the C ABI, we need to use the attribute repr(transparent) over the repr(C) attribute for the single-field bitflags structs in in order to prevent ABI mismatches. Thanks to Michael Karcher for finding this bug.

5 years agoAuto merge of #61754 - nikomatsakis:trait-caching-perf-3, r=pnkfelix
bors [Sun, 16 Jun 2019 14:58:05 +0000 (14:58 +0000)]
Auto merge of #61754 - nikomatsakis:trait-caching-perf-3, r=pnkfelix

create a "provisional cache" to restore performance in the case of cycles

Introduce a "provisional cache" that caches the results of auto trait resolutions but keeps them from entering the *main* cache until everything is ready. This turned out a bit more complex than I hoped, but I don't see another short term fix -- happy to take suggestions! In the meantime, it's very clear we need to rework the trait solver. This resolves the extreme performance slowdown experienced in #60846 -- I plan to add a perf.rust-lang.org regression test to track this.

Caveat: I've not run `x.py test` in full yet.

r? @pnkfelix
cc @arielb1

Fixes #60846

5 years agoAuto merge of #61739 - chansuke:separate-unit-tests, r=petrochenkov
bors [Sun, 16 Jun 2019 12:15:01 +0000 (12:15 +0000)]
Auto merge of #61739 - chansuke:separate-unit-tests, r=petrochenkov

Separate unit tests

I'm working on #61097.

About half of the modules are done but dozens of modules are still remaining. I will rebase and squash the commits later.

5 years agomake `Weak::ptr_eq`s into methods
Thomas Heck [Sun, 16 Jun 2019 11:57:07 +0000 (13:57 +0200)]
make `Weak::ptr_eq`s into methods

5 years agoif if if if
Rijenkii [Sun, 16 Jun 2019 12:01:05 +0000 (19:01 +0700)]
if if if if

5 years agoFix tidy
Vadim Petrochenkov [Sun, 16 Jun 2019 11:15:11 +0000 (14:15 +0300)]
Fix tidy

5 years agoSeparate libsyntax_ext module
chansuke [Sun, 16 Jun 2019 01:12:26 +0000 (10:12 +0900)]
Separate libsyntax_ext module

5 years agoSeparate libfmt_macros module
chansuke [Sat, 15 Jun 2019 19:54:46 +0000 (04:54 +0900)]
Separate libfmt_macros module

5 years agoSeparate bootstrap module
chansuke [Sat, 15 Jun 2019 19:21:51 +0000 (04:21 +0900)]
Separate bootstrap module

5 years agoSeparate libtest module
chansuke [Tue, 11 Jun 2019 17:34:34 +0000 (02:34 +0900)]
Separate libtest module

5 years agoSeparate libserialize module
chansuke [Wed, 5 Jun 2019 19:20:49 +0000 (04:20 +0900)]
Separate libserialize module

5 years agoSeparate librustcdoc module
chansuke [Wed, 5 Jun 2019 18:33:39 +0000 (03:33 +0900)]
Separate librustcdoc module

5 years agoSeparate librustc module
chansuke [Wed, 5 Jun 2019 18:16:41 +0000 (03:16 +0900)]
Separate librustc module

5 years agoSeparate librustc_metadata module
chansuke [Wed, 5 Jun 2019 17:53:24 +0000 (02:53 +0900)]
Separate librustc_metadata module

5 years agoSeparate librustc_lint module
chansuke [Wed, 5 Jun 2019 17:39:56 +0000 (02:39 +0900)]
Separate librustc_lint module

5 years agoSeparate librustc_data_structures module
chansuke [Wed, 5 Jun 2019 16:44:33 +0000 (01:44 +0900)]
Separate librustc_data_structures module

5 years agoSeparate librustc_codegen_ssa module
chansuke [Wed, 5 Jun 2019 16:11:43 +0000 (01:11 +0900)]
Separate librustc_codegen_ssa module

5 years agosubmodules: update clippy from 7b2a7a22 to be5d17fe
Matthias Krüger [Sun, 16 Jun 2019 10:40:22 +0000 (12:40 +0200)]
submodules: update clippy from 7b2a7a22 to be5d17fe

Changes:
````
Fix wrong lifetime of TyCtxt
Use replace_region_in_file for creating the lint list
Restructure rename tests
Register rename to the LintStore.
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES.
Remove pub from RedundantStaticLifetime.visit_type function.
Rename const_static_lifetime to redundant_static_lifetime.
Merge StaticConst and StaticStatic lints into StaticConst.
Use RedundantStaticLifetime in StaticStatic.
Move type-checking logic in StaticConst to RedundantStaticLifetime.
Add lint for statics with explicit static lifetime.
minor fix
make it pass dogfood
run rustfmt
fix padding and put clippy someplaces
show default lint levels
group printing
prelim arg parse
move Lint static def into its own module
switch to sorted usable lints
Update clippy_dev/src/main.rs
initial commit for help improvements on clippy-driver
````

5 years agoSeparate libgraphviz module
chansuke [Wed, 5 Jun 2019 15:55:07 +0000 (00:55 +0900)]
Separate libgraphviz module

5 years agoSeparate libarena::lib module
chansuke [Mon, 3 Jun 2019 17:58:27 +0000 (02:58 +0900)]
Separate libarena::lib module

5 years agoSeparate liballoc module
chansuke [Sat, 1 Jun 2019 16:50:10 +0000 (01:50 +0900)]
Separate liballoc module

5 years agoAuto merge of #60730 - matthewjasper:optimize-false-edges, r=pnkfelix
bors [Sun, 16 Jun 2019 09:30:34 +0000 (09:30 +0000)]
Auto merge of #60730 - matthewjasper:optimize-false-edges, r=pnkfelix

Optimize matches

Attempt to fix or improve #60571

This is breaking some diagnostics because the MIR for match arms isn't in source order any more.

cc @centril

5 years agoAdd special behaviour when int is zero
Christian Poveda [Sun, 16 Jun 2019 08:48:40 +0000 (03:48 -0500)]
Add special behaviour when int is zero

5 years agoReplace to_bits by force_bits and move size as parameter
Christian Poveda [Thu, 13 Jun 2019 17:26:10 +0000 (12:26 -0500)]
Replace to_bits by force_bits and move size as parameter

5 years agoChange to_ptr by force_ptr
Christian Poveda [Wed, 12 Jun 2019 18:08:09 +0000 (13:08 -0500)]
Change to_ptr by force_ptr

5 years agoAdd force_bits and force_ptr methods
Christian Poveda [Wed, 12 Jun 2019 17:49:46 +0000 (12:49 -0500)]
Add force_bits and force_ptr methods

5 years agoAuto merge of #61886 - Centril:rollup-3p3m2fu, r=Centril
bors [Sun, 16 Jun 2019 04:46:14 +0000 (04:46 +0000)]
Auto merge of #61886 - Centril:rollup-3p3m2fu, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #61447 (Add some Vec <-> VecDeque documentation)
 - #61704 (Pass LLVM linker flags to librustc_llvm build)
 - #61829 (rustbuild: include llvm-libunwind in dist tarball)
 - #61832 (update miri)
 - #61866 (Remove redundant `clone()`s)
 - #61869 (Cleanup some new active feature gates)

Failed merges:

r? @ghost

5 years agoHelp LLVM better optimize slice::Iter(Mut)::len
Scott McMurray [Sun, 16 Jun 2019 03:54:04 +0000 (20:54 -0700)]
Help LLVM better optimize slice::Iter(Mut)::len

5 years agoRollup merge of #61869 - Centril:cleanup-feature-gates, r=alexreg
Mazdak Farrokhzad [Sun, 16 Jun 2019 04:05:19 +0000 (06:05 +0200)]
Rollup merge of #61869 - Centril:cleanup-feature-gates, r=alexreg

Cleanup some new active feature gates

r? @alexreg

5 years agoRollup merge of #61866 - sinkuu:redundant_clone, r=petrochenkov
Mazdak Farrokhzad [Sun, 16 Jun 2019 04:05:18 +0000 (06:05 +0200)]
Rollup merge of #61866 - sinkuu:redundant_clone, r=petrochenkov

Remove redundant `clone()`s

5 years agoRollup merge of #61832 - RalfJung:miri, r=oli-obk
Mazdak Farrokhzad [Sun, 16 Jun 2019 04:05:17 +0000 (06:05 +0200)]
Rollup merge of #61832 - RalfJung:miri, r=oli-obk

update miri

Fixes https://github.com/rust-lang/rust/issues/61830
Fixes https://github.com/rust-lang/rust/issues/61848

r? @oli-obk

5 years agoRollup merge of #61829 - Keruspe:libunwind-src, r=alexcrichton
Mazdak Farrokhzad [Sun, 16 Jun 2019 04:05:15 +0000 (06:05 +0200)]
Rollup merge of #61829 - Keruspe:libunwind-src, r=alexcrichton

rustbuild: include llvm-libunwind in dist tarball

Without this we cannot build with llvm-libunwind enabled from a release tarball.

Could it be backported in a beta rollup somehow so that this gets fixed before 1.36 is released?

5 years agoRollup merge of #61704 - petrhosek:llvm-linker-flags, r=alexcrichton
Mazdak Farrokhzad [Sun, 16 Jun 2019 04:05:14 +0000 (06:05 +0200)]
Rollup merge of #61704 - petrhosek:llvm-linker-flags, r=alexcrichton

Pass LLVM linker flags to librustc_llvm build

Some -L and -l flags may be needed even when building librustc_llvm,
for example when using static libc++ on Linux we may need to manually
specify the library search path and -ldl -lpthread as additional link
dependencies. We pass LLVM linker flags from config to librustc_llvm
build to make sure these cases are handled.

5 years agoRollup merge of #61447 - scottmcm:vec-vecdeque, r=sfackler
Mazdak Farrokhzad [Sun, 16 Jun 2019 04:05:12 +0000 (06:05 +0200)]
Rollup merge of #61447 - scottmcm:vec-vecdeque, r=sfackler

Add some Vec <-> VecDeque documentation

These are more than just `.into_iter().collect()`, so talk about some of their nuances.

For VecDeque -> Vec I'm trying to intentionally not write a guarantee for people making their own `Vec`s, since the rules are more complicated than I think we want to commit to forever.

The "Vec -> VecDeque doesn't reallocate" guarantee seems reasonable, though.  (And I'm intentionally ambiguous about when it's O(1) instead of O(n).)

5 years agolibrustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C) (#61306)
John Paul Adrian Glaubitz [Sun, 16 Jun 2019 00:53:33 +0000 (02:53 +0200)]
librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C) (#61306)

In order to make sure that Rust's bitflags types are passed the same
way in the Rust ABI as they are in the C ABI, we need to use the attribute
repr(transparent) over the repr(C) attribute for the single-field bitflags
structs in in order to prevent ABI mismatches. Thanks to Michael Karcher
for finding this bug.

5 years agoAuto merge of #61828 - RalfJung:cfg-if, r=alexcrichton
bors [Sat, 15 Jun 2019 21:15:28 +0000 (21:15 +0000)]
Auto merge of #61828 - RalfJung:cfg-if, r=alexcrichton

make sure we use cfg-if as a std dependency

xargo currently fails to build libstd because this feature is missing. My guess is that it works in rustc because the feature is enabled elsewhere, but that does not help for a libstd-only build.

Miri is currently in a state where it is shipped but broken, which makes CI fail for projects that are tested in Miri. So this is kind of urgent.

Cc @alexcrichton  https://github.com/rust-lang/rust/pull/61720