Commit Graph

93305 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
10f5a36664
Rollup merge of #60521 - rasendubi:tidy-2018-edition, r=Centril
Migrate tidy to rust 2018 edition

cc @Centril
2019-05-04 09:21:32 +02:00
Mazdak Farrokhzad
68dcca8e09
Rollup merge of #60520 - matklad:rustfmt-all-the-new-things, r=Centril
Add rustfmt toml

This commit adds an rustfmt.toml for using for **new** code.
Old code should continut to use old style, until we put automated
style checks in place.

See
https://internals.rust-lang.org/t/running-rustfmt-on-rust-lang-rust-and-other-rust-lang-repositories/8732/81
for the reason why we deviate from the default formatting. The TL;DR
is that currently compiler uses a pretty condensed style of code, and
default settings both create a huge diff and inflate the number of
lines. use_small_heuristics=Max fixes that.

version=Two is required for bug-fixes, which technically can't be made
to the stable first version

cc @Centril: I guess adding config file with agreed-upon formatting doesn't hurt :-)

EDIT: Zullip discussion: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/x.2Epy.20fmt
2019-05-04 09:21:31 +02:00
Mazdak Farrokhzad
099c06465b
Rollup merge of #60517 - estebank:wording, r=davidtwco
Reword casting message

r? @davidtwco
2019-05-04 09:21:29 +02:00
Mazdak Farrokhzad
3cfd39bb2e
Rollup merge of #60516 - JohnTitor:remove-typeck, r=matthewjasper
Remove TypeckMir

Fixes #60422

r? @matthewjasper
2019-05-04 09:21:27 +02:00
Mazdak Farrokhzad
ffc33b3733
Rollup merge of #60513 - chrisvittal:remove-borrowck-compare, r=matthewjasper
Remove -Z borrowck=compare flag

This is the start of the work that needs to be done on #59193. It just removes the flag and updates
the tests.

r? @matthewjasper
2019-05-04 09:21:26 +02:00
Mazdak Farrokhzad
0399d1349e
Rollup merge of #60486 - spastorino:place-related-refactors, r=oli-obk
Place related refactors

Meanwhile I was working on Place 2 I'm finding some little things that I had on my branch but preferred to land a separate PR for things that are simpler to merge.

r? @oli-obk
2019-05-04 09:21:24 +02:00
Mazdak Farrokhzad
b4c620dc05
Rollup merge of #60449 - matthewjasper:impl-trait-outlives, r=pnkfelix
Constrain all regions in the concrete type for an opaque type

`push_outlives_components` skips some regions in a type, notably the signature
of a closure is ignored. Most of the time this is OK, but for opaque types the
concrete type is used when checking auto-trait bounds in other functions.

cc @nikomatsakis @pnkfelix

Closes #57464
Closes #60127
2019-05-04 09:21:23 +02:00
Mazdak Farrokhzad
6a86be9fca
Rollup merge of #60429 - estebank:pub-path, r=michaelwoerister
Account for paths in incorrect pub qualifier help

Handle case where incorrect pub qualifier with a mod path is used and provide the same help given for all other incorrect qualifiers by making the `pub(crate)` parse check more specific.
2019-05-04 09:21:21 +02:00
Dan Gohman
c07b52e29a Bump libc dependency to 0.2.54. 2019-05-03 23:01:24 -07:00
Dan Gohman
33ea556cb5 Categorize WASI as an "OS" rather than as an "environment".
This distinction is fairly abstract, but in practice, the main advantage
here is that LLVM's triple code considers WASI to be an OS, so this
makes rustc agree with that.
2019-05-03 23:01:24 -07:00
Gianluca Recchia
99b98068e8
Correct code points to match their textual description 2019-05-04 07:44:30 +02:00
bors
e232636693 Auto merge of #59897 - tmandry:variantful-generators, r=eddyb
Multi-variant layouts for generators

This allows generators to overlap fields using variants, but doesn't do any such overlapping yet. It creates one variant for every state of the generator (unresumed, returned, panicked, plus one for every yield), and puts every stored local in each of the yield-point variants.

Required for optimizing generator layouts (#52924).

There was quite a lot of refactoring needed for this change. I've done my best in later commits to eliminate assumptions in the code that only certain kinds of types are multi-variant, and to centralize knowledge of the inner mechanics of generators in as few places as possible.

This change also emits debuginfo about the fields contained in each variant, as well as preserving debuginfo about stored locals while running in the generator.

Also, fixes #59972.

Future work:
- Use this change for an optimization pass that actually overlaps locals within the generator struct (#52924)
- In the type layout fields, don't include locals that are uninitialized for a particular variant, so miri and UB sanitizers can check our memory (see https://github.com/rust-lang/rust/issues/59972#issuecomment-483058172)
- Preserve debuginfo scopes across generator yield points
2019-05-04 03:18:14 +00:00
Tyler Mandry
77a6d29f48 Address review comments 2019-05-03 19:25:35 -07:00
Mazdak Farrokhzad
639e452c5f Remove unused feature(need_allocator). 2019-05-04 04:20:55 +02:00
Eduard-Mihai Burtescu
60f1944ebf rustc: rename DefPathData::{MacroDef,LifetimeParam} to {Macro,Lifetime}Ns. 2019-05-04 05:10:46 +03:00
Eduard-Mihai Burtescu
2efeb485a9 rustc: collapse relevant DefPathData variants into ValueNs. 2019-05-04 05:10:46 +03:00
Eduard-Mihai Burtescu
e5b9f54cd9 rustc: collapse relevant DefPathData variants into TypeNs. 2019-05-04 05:10:46 +03:00
Mazdak Farrokhzad
d7acf596cf Rename 'no tracking issue START' to fit better with tidy. 2019-05-04 03:34:05 +02:00
Mazdak Farrokhzad
ea178e47b9 Enforce sorting of accepted and removed features. 2019-05-04 03:26:52 +02:00
bors
13fde05b12 Auto merge of #60462 - eddyb:def-1-a-mere-resolution, r=petrochenkov
rustc: factor out most of hir::def::Def's variants into DefKind, and rename to Res.

The first two commits are about introducing `DefKind`, both to simplify/orthogonalize `hir::def::Def`, and to allow reasoning about the kind of a definition without dealing with the redundant `DefId`.
(There are likely more changes to be made, such as adding enough `DefKind` variants for `tcx.def_kind(def_id)` to return just `DefKind`, not `Option<DefKind>`, but this is pretty big as-is)

The third commit frees up the `Def` name (which we may want to use in the future for "definitions", in the sense of "entities with a `DefId`") by renaming `hir::def::Def` to `Res` ("resolution").
IMO this fits, as it represents all the possible name resolution results, not just "definitions (with a `DefId`)".

Quick examples:
```rust
// Before:
if tcx.describe_def(def_id) == Some(Def::Struct(def_id)) {...}
if let Def::Struct(def_id) = path.def {...}
```
```rust
// After:
if tcx.def_kind(def_id) == Some(DefKind::Struct) {...}
if let Res::Def(DefKind::Struct, def_id) = path.res {...}
```

r? @petrochenkov cc @rust-lang/compiler
2019-05-03 23:11:17 +00:00
Tyler Mandry
15dbe652ff Split out debuginfo from type info in MIR GeneratorLayout 2019-05-03 16:03:05 -07:00
David Wood
f346309562
Fix async fn lowering ICE with APIT.
This commit fixes an ICE where simple bindings (which aren't replaced
with replacement arguments during async fn lowering) were not being
visited in the def collector and thus caused an ICE during HIR lowering
for types that use their `DefId` at that point - such as `impl Trait`.
2019-05-03 22:36:35 +01:00
Christopher Vittal
db6f7a9d1a Update help message 2019-05-03 17:34:17 -04:00
Tyler Mandry
f7c2f2475a Make variant_fields inner an IndexVec 2019-05-03 14:25:22 -07:00
Alex Crichton
884632cc79 rustc: Always handle exported symbols on the wasm target
Currently when linking an artifact rustc will only conditionally call
the `Linker::export_symbols` function, but this causes issues on some
targets, like WebAssembly, where it means that executable outputs will
not have the same symbols exported that cdylib outputs have. This commit
sinks the conditional call to `export_symbols` inside the various
implementations of the function that still need it, and otherwise the
wasm linker is configured to always pass through symbol visibility
lists.
2019-05-03 14:09:01 -07:00
Eduard-Mihai Burtescu
ff174fe09e rustc: rename hir::def::Def to Res (short for "resolution"). 2019-05-03 22:50:19 +03:00
Eduard-Mihai Burtescu
b92b1a76e1 rustc: use DefKind instead of Def, where possible. 2019-05-03 22:50:09 +03:00
Eduard-Mihai Burtescu
a3fcab36d2 rustc: factor most DefId-containing variants out of Def and into DefKind. 2019-05-03 22:48:27 +03:00
Alexey Shmalko
bacf792f6f
tidy: Extract let mut part out of parts block in version.rs 2019-05-03 22:45:59 +03:00
bors
a3404557c5 Auto merge of #60496 - jethrogb:jb/address-integer-overflow, r=alexcrichton
Fix potential integer overflow in SGX memory range calculation.

Thanks to Eduard Marin and David Oswald at the University of Burmingham, and Jo Van Bulck at KU Leuven for discovering this issue.
2019-05-03 19:42:13 +00:00
Yuki Okushi
f734057c3c Fix test 2019-05-04 04:24:32 +09:00
Alexey Shmalko
1937bf2626
Migrate tidy to rust 2018 edition 2019-05-03 22:19:24 +03:00
Aleksey Kladov
ce39461ca7 Add rustfmt toml
This commit adds an rustfmt.toml for using for **new** code.
Old code should continut to use old style, until we put automated
style checks in place.

See
https://internals.rust-lang.org/t/running-rustfmt-on-rust-lang-rust-and-other-rust-lang-repositories/8732/81
for the reason why we deviate from the default formatting. The TL;DR
is that currently compiler uses a pretty condensed style of code, and
default settings both create a huge diff and inflate the number of
lines. use_small_heuristics=Max fixes that.

version=Two is required for bug-fixes, which technically can't be made
to the stable first version
2019-05-03 21:45:37 +03:00
Esteban Küber
1e2af7d935 Reword casting message 2019-05-03 10:41:26 -07:00
Yuki Okushi
17be6822f1 Remove TypeckMir 2019-05-04 02:24:42 +09:00
Andy Russell
8fc6e420d1
use span instead of div for since version 2019-05-03 12:55:31 -04:00
bors
3af1bdc4bc Auto merge of #60510 - Centril:rollup-gsndjbp, r=Centril
Rollup of 12 pull requests

Successful merges:

 - #59928 (Make deprecation lint `ambiguous_associated_items` deny-by-default)
 - #60220 (report fatal errors during doctest parsing)
 - #60373 (Tidy: ensure lang features are sorted by since)
 - #60388 (Disallow non-explicit elided lifetimes in async fn)
 - #60393 ( Do not suggest incorrect syntax on pattern type error due to borrow)
 - #60401 (Rename `RUST_LOG` to `RUSTC_LOG`)
 - #60409 (Require a trait in the bounds of existential types)
 - #60455 (Resolve match arm ty when arms diverge)
 - #60457 (Const prop refactoring)
 - #60467 (Avoid repeated interning of static strings.)
 - #60478 (minor compiler doc tweaks)
 - #60501 (Propagate mutability from arguments to local bindings in async fn)

Failed merges:

r? @ghost
2019-05-03 15:10:16 +00:00
Mazdak Farrokhzad
6f7a1eabdf
Rollup merge of #60501 - taiki-e:async-await-mutable-arguments, r=cramertj
Propagate mutability from arguments to local bindings in async fn

Fixes #60498

cc @nikomatsakis
r? @davidtwco
2019-05-03 16:25:09 +02:00
Mazdak Farrokhzad
d5809a8b33
Rollup merge of #60478 - euclio:doc-fixes, r=cramertj
minor compiler doc tweaks
2019-05-03 16:25:08 +02:00
Mazdak Farrokhzad
0784755127
Rollup merge of #60467 - nnethercote:less-symbol-interning, r=davidtwco
Avoid repeated interning of static strings.

`file_metadata_raw` interns the strings `"<unknown>"` and `""` very
frequently. This commit avoids that, which reduces the number of symbols
interned significantly and reduces instruction counts by up to 0.5% on
some workloads.
2019-05-03 16:25:06 +02:00
Mazdak Farrokhzad
3fe5fac96d
Rollup merge of #60457 - wesleywiser:const_prop_refactoring, r=oli-obk
Const prop refactoring

This is rebased on top of #60428 so only the top commit is new.

This is the refactoring to remove the `mir` field from `ConstPropagator` which is necessary before we can begin to actually propagate constants.

r? @oli-obk
2019-05-03 16:25:05 +02:00
Mazdak Farrokhzad
2b5e296caa
Rollup merge of #60455 - estebank:resolve-match-arm-ty, r=davidtwco
Resolve match arm ty when arms diverge

Fix #58695.
2019-05-03 16:25:04 +02:00
Mazdak Farrokhzad
f6228615bd
Rollup merge of #60409 - JohnTitor:error-for-existential-type, r=oli-obk
Require a trait in the bounds of existential types

Fixes #53090

r? @oli-obk
2019-05-03 16:25:02 +02:00
Mazdak Farrokhzad
bfa22cfbca
Rollup merge of #60401 - JohnTitor:rename-log, r=davidtwco
Rename `RUST_LOG` to `RUSTC_LOG`

cc: #57985

I think we should also change these submodules:

- rustc-guide
- Cargo (rename to `CARGO_LOG`, cc: https://github.com/rust-lang/cargo/pull/6605, https://github.com/rust-lang/cargo/issues/6189)
- miri
- rls
- rustfmt

r? @davidtwco
2019-05-03 16:25:00 +02:00
Mazdak Farrokhzad
3e536e8ac6
Rollup merge of #60393 - estebank:pat-sugg, r=oli-obk
Do not suggest incorrect syntax on pattern type error due to borrow

Fix #55174.
2019-05-03 16:24:59 +02:00
Mazdak Farrokhzad
3ca0d36538
Rollup merge of #60388 - cramertj:elided-lifetime-async, r=nikomatsakis
Disallow non-explicit elided lifetimes in async fn

Fix https://github.com/rust-lang/rust/issues/60203

r? @nikomatsakis
2019-05-03 16:24:57 +02:00
Mazdak Farrokhzad
9199bb5f81
Rollup merge of #60373 - rasendubi:lang-features-sort-since, r=Centril
Tidy: ensure lang features are sorted by since

This is the tidy side of https://github.com/rust-lang/rust/issues/60361.

What is left is actually splitting features into groups and sorting by since.

This PR also likely to produce a small (a couple of lines) merge conflict with https://github.com/rust-lang/rust/pull/60362.

r? @Centril
2019-05-03 16:24:56 +02:00
Mazdak Farrokhzad
06e1d88de6
Rollup merge of #60220 - euclio:rustdoc-test-fatal-parsing-errors, r=QuietMisdreavus
report fatal errors during doctest parsing

Fixes #59557.
2019-05-03 16:24:54 +02:00
Mazdak Farrokhzad
e9509f8847
Rollup merge of #59928 - petrochenkov:denyambass, r=varkor
Make deprecation lint `ambiguous_associated_items` deny-by-default

As requested by r? @Centril

cc https://github.com/rust-lang/rust/issues/57644
2019-05-03 16:24:52 +02:00
bors
ef9a876f82 Auto merge of #60423 - varkor:update-getopts, r=alexcrichton
Update getopts

This is a prerequisite to fixing https://github.com/rust-lang/rust/issues/32352. The rustbuild fix has been pulled out of https://github.com/rust-lang/rust/pull/59440.

r? @alexcrichton
2019-05-03 10:15:48 +00:00