Commit Graph

79643 Commits

Author SHA1 Message Date
bors
61d88318aa Auto merge of #51068 - Crazycolorz5:pluseqsplitting, r=petrochenkov
parser: Split `+=` into `+` and `=` where `+` is explicitly requested (such as generics)

Added functions in tokens to check whether a token leads with `+`. Used them when parsing to allow for token splitting of `+=` into `+` and `=`.
Fixes https://github.com/rust-lang/rust/issues/47856
2018-06-09 17:46:36 +00:00
bors
0b491a17b9 Auto merge of #51441 - bstrie:sizeof128, r=dtolnay
Document size_of for 128-bit integers

We might want to consider separately documenting the alignment of
primitives, rather than just their size, since 128-bit integers, unlike
all other primitives, have an alignment that is not identical to their
size (size_of is 16, align_of is 8)
2018-06-09 15:41:44 +00:00
Niko Matsakis
908c1f2f0c use DUMMY_NODE_ID as the body_id during NLL type-checking
The choice is arbitrary since there is only one involved.
2018-06-09 11:06:41 -04:00
Niko Matsakis
6a5a4874a0 convert type-check constraints into NLL constraints on the fly
We used to accumulate a vector of type-check constraints, but now we
generate them as we go, and just store the NLL-style
`OutlivesConstraint` and `TypeTest` information.
2018-06-09 11:02:14 -04:00
Niko Matsakis
ba6a7f7500 rename Constraint to OutlivesConstraint 2018-06-09 11:02:14 -04:00
Niko Matsakis
9980415fbd key drop-data computation by ty, not var 2018-06-09 11:02:14 -04:00
Niko Matsakis
a40e629a33 update some tests affected by some of the prior tweaks 2018-06-09 11:02:14 -04:00
Niko Matsakis
d476147629 cache the dropck_outlives computation per variable 2018-06-09 11:02:14 -04:00
Niko Matsakis
780f6c52cc extract out fully_perform_op_and_get_region_constraints 2018-06-09 11:02:13 -04:00
Niko Matsakis
7ff89805fe put the RegionConstraintData into an Rc 2018-06-09 11:02:13 -04:00
Niko Matsakis
8825f42a07 librustc_mir/borrow_check/nll/type_check/mod.rs: rustfmt 2018-06-09 11:02:13 -04:00
Niko Matsakis
55c6357daf micro-optimize empty predicate and normalize lists 2018-06-09 11:02:13 -04:00
Niko Matsakis
73a09f35b1 skip eq_types and sub_types when the two types are equal 2018-06-09 11:02:13 -04:00
Niko Matsakis
956e2f8348 add some instrumentation 2018-06-09 11:02:13 -04:00
bors
a561ea7083 Auto merge of #51439 - Voultapher:feature/fix-contributing-spelling-error, r=kennytm
Fix spelling error in CONTRIBUTING.md

Thought I'd start with something small.
2018-06-09 12:35:21 +00:00
Guillaume Gomez
b000cf0726 Add lint for intra link resolution failure 2018-06-09 14:07:25 +02:00
bors
0fb32a9f62 Auto merge of #51400 - xfix:patch-6, r=kennytm
Increase number of usages of `u8` in weird expressions u8 test
2018-06-09 10:22:59 +00:00
Ralf Jung
426f06f8fe Be more precise about why references need to be non-null and aligned 2018-06-09 10:40:51 +02:00
tinaun
fb507cadf3 add inherent methods to Poll 2018-06-09 00:38:11 -04:00
bors
40f20b5327 Auto merge of #51359 - cramertj:fdio_spawn, r=sfackler
[fuchsia] Migrate from launchpad to fdio_spawn_etc

fdio_spawn_etc is the preferred way of creating processes on Fuchsia
now.

cc @abarth
2018-06-09 03:41:31 +00:00
tinaun
49eb754cc0 addressed nits 2018-06-08 23:16:51 -04:00
bors
1c5626f551 Auto merge of #51042 - matthewjasper:reenable-trivial-bounds, r=nikomatsakis
Re-enable trivial bounds

cc #50825

Remove implementations from global bounds in winnowing when there is ambiguity.

This results in the reverse of #24066 happening sometimes. I'm not sure if anything can be done about that though.

cc #48214

r? @nikomatsakis
2018-06-09 01:32:48 +00:00
bors
cf91e9b9ba Auto merge of #51448 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 13 pull requests

Successful merges:

 - #50143 (Add deprecation lint for duplicated `macro_export`s)
 - #51099 (Fix Issue 38777)
 - #51276 (Dedup auto traits in trait objects.)
 - #51298 (Stabilize unit tests with non-`()` return type)
 - #51360 (Suggest parentheses when a struct literal needs them)
 - #51391 (Use spans pointing at the inside of a rustdoc attribute)
 - #51394 (Use scope tree depths to speed up `nearest_common_ancestor`.)
 - #51396 (Make the size of Option<NonZero*> a documented guarantee.)
 - #51401 (Warn on `repr` without hints)
 - #51412 (Avoid useless Vec clones in pending_obligations().)
 - #51427 (compiletest: autoremove duplicate .nll.* files (#51204))
 - #51436 (Do not require stage 2 compiler for rustdoc)
 - #51437 (rustbuild: generate full list of dependencies for metadata)

Failed merges:
2018-06-08 23:22:33 +00:00
Mark Rousskov
8c5002d1e0
Rollup merge of #51437 - est31:rustbuild_metadata, r=Mark-Simulacrum
rustbuild: generate full list of dependencies for metadata

Previously, we didn't send --features to our cargo metadata invocations,
and thus missed some dependencies that we enable through the --features
mechanism.
2018-06-08 17:21:10 -06:00
Mark Rousskov
efb30d7695
Rollup merge of #51436 - Mark-Simulacrum:doc-stage1, r=QuietMisdreavus
Do not require stage 2 compiler for rustdoc

r? @QuietMisdreavus

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

I *think* this is correct; though I'm not certain. If it passes CI though I expect that to be good enough...
2018-06-08 17:21:09 -06:00
Mark Rousskov
4a2c1c294f
Rollup merge of #51427 - FelixMcFelix:nll-stderr-remover, r=oli-obk
compiletest: autoremove duplicate .nll.* files (#51204)

UI tests in bless mode should now check to see if `.nll.*` files have a
matching `.*` file. If a match is found, it will be deleted.
This should be extensible to other modes (i.e., Polonius).
On running with `--bless`, the two files removed in #51186 are, in turn,
removed automatically.

fixes #51204
2018-06-08 17:21:08 -06:00
Mark Rousskov
8ac351c209
Rollup merge of #51412 - nnethercote:pending_obligations, r=estebank
Avoid useless Vec clones in pending_obligations().

The only instance of `ObligationForest` in use has an obligation type of
`PendingPredicateObligation`, which contains a `PredicateObligation` and a
`Vec<Ty>`.

`FulfillmentContext::pending_obligations()` calls
`ObligationForest::pending_obligations()`, which clones all the
`PendingPredicateObligation`s. But the `Vec<Ty>` field of those cloned
obligations is never touched.

This patch changes `ObligationForest::pending_obligations()` to
`map_pending_obligations` -- which gives callers control about which part
of the obligation to clone -- and takes advantage of the change to avoid
cloning the `Vec<Ty>`. The change speeds up runs of a few rustc-perf
benchmarks, the best by 1%.
2018-06-08 17:21:07 -06:00
Mark Rousskov
898bb78024
Rollup merge of #51401 - estebank:warn-repr, r=cramertj
Warn on `repr` without hints

Fix #51376.
2018-06-08 17:21:05 -06:00
Mark Rousskov
b1a6db2833
Rollup merge of #51396 - SimonSapin:option-nonzero-layout, r=SimonSapin
Make the size of Option<NonZero*> a documented guarantee.

Closes #49137, the tracking issue for `NonZero*`, as this was the last remaining open question.

Note that `ptr::NonNull<T>` already documents a similar guarantee.
2018-06-08 17:21:04 -06:00
Mark Rousskov
6abaf4e703
Rollup merge of #51394 - nnethercote:NCA-depths, r=nikomatsakis
Use scope tree depths to speed up `nearest_common_ancestor`.

This patch adds depth markings to all entries in the `ScopeTree`'s
`parent_map`. This change increases memory usage somewhat, but permits a
much faster algorithm to be used:

- If one scope has a greater depth than the other, the deeper scope is
  moved upward until they are at equal depths.

- Then we move the two scopes upward in lockstep until they match.

This avoids the need to keep track of which scopes have already been
seen, which was the major part of the cost of the old algorithm. It also
reduces the number of child-to-parent moves (which are hash table
lookups) when the scopes start at different levels, because it never
goes past the nearest common ancestor the way the old algorithm did.

Finally, the case where one of the scopes is the root is now handled in
advance, because that is moderately common and lets us skip everything.

This change speeds up runs of several rust-perf benchmarks, the best by
6%.

A selection of the bigger improvements:
```
clap-rs-check
        avg: -2.6%      min: -6.6%      max: 0.0%
syn-check
        avg: -2.2%      min: -5.0%      max: 0.0%
style-servo-check
        avg: -2.9%?     min: -4.8%?     max: 0.0%?
cargo-check
        avg: -1.3%      min: -2.8%      max: 0.0%
sentry-cli-check
        avg: -1.0%      min: -2.1%      max: 0.0%
webrender-check
        avg: -0.9%      min: -2.0%      max: 0.0%
style-servo
        avg: -0.9%?     min: -1.8%?     max: -0.0%?
ripgrep-check
        avg: -0.7%      min: -1.8%      max: 0.1%
clap-rs
        avg: -0.9%      min: -1.6%      max: -0.2%
regex-check
        avg: -0.2%      min: -1.3%      max: 0.1%
syn
        avg: -0.6%      min: -1.3%      max: 0.1%
hyper-check
        avg: -0.5%      min: -1.1%      max: 0.0%
```
The idea came from multiple commenters on my blog and on Reddit. Thank you!

r? @nikomatsakis
2018-06-08 17:21:03 -06:00
Mark Rousskov
32ed5acf98
Rollup merge of #51391 - estebank:docspan, r=GuillaumeGomez
Use spans pointing at the inside of a rustdoc attribute

Follow up to #51111.

Point to the link in a rustdoc attribute where intralink resolution failed, instead of the full rustdoc attribute's span.

r? @GuillaumeGomez cc @kennytm
2018-06-08 17:21:02 -06:00
Mark Rousskov
4b176b2ce2
Rollup merge of #51360 - estebank:braces-around-literal-structs, r=nikomatsakis
Suggest parentheses when a struct literal needs them

When writing a struct literal in an expression that expects a block to
be started afterwards (like an `if` statement), do not suggest using the
same struct literal:

```
did you mean `S { /* fields * /}`?
```

Instead, suggest surrounding the expression with parentheses:

```
did you mean `(S { /* fields * /})`?
```

Fix #47360, #50090. Leaving #42982 open to come back to this problem with a better solution.
2018-06-08 17:21:00 -06:00
Mark Rousskov
d68098a43e
Rollup merge of #51298 - Dylan-DPC:stabilise/termination-test, r=nikomatsakis
Stabilize unit tests with non-`()` return type

References #48854
2018-06-08 17:20:59 -06:00
Mark Rousskov
b370f0e646
Rollup merge of #51276 - Havvy:dyn-trait-send-send, r=nikomatsakis
Dedup auto traits in trait objects.

Fixes #47010

Note that the test file `run-pass/trait-object-auto-dedup.rs` passes before and after this change. It's the `ui` test that changed from compiling to not compiling. Which does make this a breaking change, but I cannot imagine anybody actually being broken by it.
2018-06-08 17:20:58 -06:00
Mark Rousskov
71865fb947
Rollup merge of #51099 - Crazycolorz5:expectedcloseparen, r=estebank
Fix Issue 38777

When looking through for a closing bracket in the loop condition, adds them to expecteds.
https://github.com/rust-lang/rust/issues/38777
2018-06-08 17:20:57 -06:00
Mark Rousskov
91b6842dc9
Rollup merge of #50143 - petrochenkov:mexuniq, r=nikomatsakis
Add deprecation lint for duplicated `macro_export`s

cc https://github.com/rust-lang/rust/issues/35896#issuecomment-381370556
2018-06-08 17:20:55 -06:00
David Cao
313d6c53df provide error message when using more than 65535 hash symbols for raw strings 2018-06-08 15:32:28 -07:00
tinaun
6e5c18e8dc add a few blanket future impls to std 2018-06-08 17:56:59 -04:00
Crazycolorz5
df0c6a97b4 Built, corrected, and run tests. Added expected stderr files. 2018-06-08 17:25:53 -04:00
bors
8afb894931 Auto merge of #51247 - pnkfelix:issue-51190-report-type-moved-from-behind-borrow, r=nikomatsakis
NLL: report type moved from behind borrow of array/slice

When NLL has illegal move due to borrowed content in an array or slice, provide feedback about why the move wasn't a copy.

Drive by: While comparing the resulting `.nll.stderr` files to their old borrowck variants, I noticed that the test for borrowck-vec-pattern-nesting.rs was not signaling some errors under NLL due to the test assuming lexical lifetimes. So I fixed that too.

Fix #51190
2018-06-08 20:41:20 +00:00
bstrie
9a8fa2cf92 Document size_of for 128-bit integers
We might want to consider separately documenting the alignment of
primitives, rather than just their size, since 128-bit integers, unlike
all other primitives, have an alignment that is not identical to their
size (size_of is 16, align_of is 8)
2018-06-08 19:20:28 +00:00
Lukas Bergdoll
0bc8d4ef2c Fix spelling error in CONTRIBUTING.md 2018-06-08 19:44:04 +02:00
bors
c40275b34f Auto merge of #51410 - oli-obk:cargo_bump, r=nikomatsakis
Update the cargo submodule

This allows the next nightly to publish crates that are on the 2018 edition (in an unstable way)
2018-06-08 17:04:14 +00:00
Matthew Jasper
a1bddcfe7b Normalize associated types when checking global bounds 2018-06-08 17:00:56 +01:00
Matthew Jasper
9d7613abee Fix a typo 2018-06-08 17:00:49 +01:00
Matthew Jasper
0476a875d1 Test that object bounds are preferred over global where clause bounds 2018-06-08 17:00:36 +01:00
Matthew Jasper
87f63ca258 Add tests for associated types and inconsistent bounds 2018-06-08 17:00:26 +01:00
Matthew Jasper
ba35e80534 Reenable trivial bounds
Removes extra global bounds at the winnowing stage rather than when
normalizing the param_env. This avoids breaking inference when there is
a global bound.
2018-06-08 17:00:03 +01:00
Niko Matsakis
92d4ae2be2 rename irrefutable_let_pattern to irrefutable_let_patterns 2018-06-08 11:37:35 -04:00
Evgenii Pashkin
cb5e9731bb Add test for libsyntax with canonicalized base path 2018-06-08 18:05:01 +03:00