]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRespond to review feedback
Wesley Wiser [Thu, 14 Nov 2019 11:17:41 +0000 (06:17 -0500)]
Respond to review feedback

4 years ago[ConstProp] Avoid OOM crashes by not evaluating large Places
Wesley Wiser [Thu, 14 Nov 2019 01:37:33 +0000 (20:37 -0500)]
[ConstProp] Avoid OOM crashes by not evaluating large Places

Fixes #66397

4 years agoFix spurious CI filures due to OOM
Wesley Wiser [Thu, 14 Nov 2019 00:19:25 +0000 (19:19 -0500)]
Fix spurious CI filures due to OOM

Fixes #66342

4 years agoUpdate src/llvm-project to include rust-lang/llvm-project#27.
Eduard-Mihai Burtescu [Fri, 15 Nov 2019 20:56:40 +0000 (22:56 +0200)]
Update src/llvm-project to include rust-lang/llvm-project#27.

4 years agoChange makefile back to python27.
Steven Malis [Fri, 15 Nov 2019 19:19:13 +0000 (11:19 -0800)]
Change makefile back to python27.

4 years agoRemove newtype for qualifs in `rustc_metadata`
Dylan MacKenzie [Thu, 14 Nov 2019 20:07:35 +0000 (12:07 -0800)]
Remove newtype for qualifs in `rustc_metadata`

We have a proper type for these now, so the wrapper is no longer
necessary.

4 years agoFix nits from review
Dylan MacKenzie [Thu, 14 Nov 2019 19:58:50 +0000 (11:58 -0800)]
Fix nits from review

4 years agoUse `mir::QualifSet` to store qualifs
Dylan MacKenzie [Thu, 14 Nov 2019 17:16:08 +0000 (09:16 -0800)]
Use `mir::QualifSet` to store qualifs

4 years agoUse a bespoke type for the result of `mir_const_qualif`
Dylan MacKenzie [Thu, 14 Nov 2019 17:15:23 +0000 (09:15 -0800)]
Use a bespoke type for the result of `mir_const_qualif`

4 years agoA `Downcast` is now reached when const-checking a `for` loop
Dylan MacKenzie [Wed, 13 Nov 2019 22:48:59 +0000 (14:48 -0800)]
A `Downcast` is now reached when const-checking a `for` loop

I believe this occurs because the old checker stopped processing basic
blocks after a `SwitchInt`.

4 years agoRemove -Z flag for suppressing validation mismatch ICE
Dylan MacKenzie [Wed, 13 Nov 2019 20:57:58 +0000 (12:57 -0800)]
Remove -Z flag for suppressing validation mismatch ICE

4 years agoAdd explanation of test for validation mismatch
Dylan MacKenzie [Wed, 13 Nov 2019 20:51:16 +0000 (12:51 -0800)]
Add explanation of test for validation mismatch

4 years agoSilence miri unleashed warnings in test
Dylan MacKenzie [Wed, 13 Nov 2019 20:50:41 +0000 (12:50 -0800)]
Silence miri unleashed warnings in test

4 years agoRemove unnecessary `fmt::Debug` bound
Dylan MacKenzie [Sun, 10 Nov 2019 18:42:30 +0000 (10:42 -0800)]
Remove unnecessary `fmt::Debug` bound

4 years agoRemove remaining validator mismatch code
Dylan MacKenzie [Sun, 10 Nov 2019 18:41:42 +0000 (10:41 -0800)]
Remove remaining validator mismatch code

4 years agoMove `delay_span_bug` into `emit_error` for if/loop
Dylan MacKenzie [Sun, 10 Nov 2019 18:39:27 +0000 (10:39 -0800)]
Move `delay_span_bug` into `emit_error` for if/loop

4 years agoRemove `qualify_consts` completely
Dylan MacKenzie [Tue, 29 Oct 2019 04:25:51 +0000 (21:25 -0700)]
Remove `qualify_consts` completely

4 years agoUse new const-checker for `mir_const_qualif`
Dylan MacKenzie [Mon, 28 Oct 2019 17:26:16 +0000 (10:26 -0700)]
Use new const-checker for `mir_const_qualif`

Now `mir_const_qualif` must be called for `static`s and `const fn`s as
well as `const`s since it is responsible for const-checking. We return
the qualifs in the return place for everything, even though they will
only be used for `const`s.

4 years agoEnable standalone const-checking with `Validator`
Dylan MacKenzie [Wed, 30 Oct 2019 00:19:58 +0000 (17:19 -0700)]
Enable standalone const-checking with `Validator`

Unlike the original pass, we check *every* non-cleanup basic block
instead of stopping at `SwitchInt`. We use the `is_cfg_cyclic` function
to check for loops unlike the original checker which could not differentiate
between true cycles and basic blocks with more than two predecessors.

The last three functions are all copied verbatim from `qualify_consts`.

4 years agoAllow `Validator` to get qualifs for the return place
Dylan MacKenzie [Mon, 28 Oct 2019 17:24:29 +0000 (10:24 -0700)]
Allow `Validator` to get qualifs for the return place

4 years agoRemove `requires_sync`
Dylan MacKenzie [Wed, 30 Oct 2019 00:17:30 +0000 (17:17 -0700)]
Remove `requires_sync`

4 years agoRemove `QUALIF_ERROR_BIT` checking
Dylan MacKenzie [Thu, 14 Nov 2019 00:56:08 +0000 (16:56 -0800)]
Remove `QUALIF_ERROR_BIT` checking

4 years agoRollup merge of #66441 - RalfJung:seh, r=oli-obk
Mazdak Farrokhzad [Fri, 15 Nov 2019 17:02:04 +0000 (18:02 +0100)]
Rollup merge of #66441 - RalfJung:seh, r=oli-obk

libpanic_unwind for Miri: make sure we have the SEH lang items when needed

r? @oli-obk  @alexcrichton This is required to fix the Miri toolstate. Turns out rustc complains when doing codegen for MSVC and these lang items do not exist. For now `cfg(miri)` needs to still be able to codegen (we [plan to change that](https://github.com/rust-lang/miri/pull/1048#issuecomment-554108470) but that's a larger project requiring improvements to xargo and maybe also cargo; that should not block fixing the toolstate). Yes, this is a hack, but it is inside `cfg(miri)` so I hope this is okay.

Cc @Aaron1011

4 years agoRollup merge of #66427 - Mark-Simulacrum:errors-json, r=Centril
Mazdak Farrokhzad [Fri, 15 Nov 2019 17:02:02 +0000 (18:02 +0100)]
Rollup merge of #66427 - Mark-Simulacrum:errors-json, r=Centril

Move the JSON error emitter to librustc_errors

This is done both as a cleanup (it makes little sense for this emitter to be in libsyntax), but also as part of broader work to decouple Session from librustc itself.

Along the way, this also moves SourceMap to syntax_pos, which is also nice for the above reasons, as well as allowing dropping the SourceMapper trait from code. This had the unfortunate side-effect of moving `FatalError` to rustc_data_structures (it's needed in syntax_pos, due to SourceMap, but putting it there feels somehow worse).

4 years agoRollup merge of #66415 - tmandry:force-test-in-process, r=alexcrichton
Mazdak Farrokhzad [Fri, 15 Nov 2019 17:02:01 +0000 (18:02 +0100)]
Rollup merge of #66415 - tmandry:force-test-in-process, r=alexcrichton

Add --force-run-in-process unstable option to libtest

When running tests with `-Zpanic_abort_tests`, it's sometimes desirable to fall back to the old behavior of only running tests in-process. This comes in handy if the system process launcher is unavailable, or the test code somehow expects all tests to be run in the same process.

For example, in Fuchsia we have unit tests that actually test the process launcher itself, in which case we can't use the process launcher to run the tests :).

r? @alexcrichton
cc @cramertj,@petrhosek

4 years agoRollup merge of #66407 - JohnTitor:add-ice-tests, r=Centril
Mazdak Farrokhzad [Fri, 15 Nov 2019 17:01:59 +0000 (18:01 +0100)]
Rollup merge of #66407 - JohnTitor:add-ice-tests, r=Centril

Add more tests for fixed ICEs

Closes #36122 (fixed in 1.20.0)
Closes #58094 (fixed in #66054)
Also, fix mistaken test case, from #30904 to #30906 (cc @eddyb)

r? @Centril

4 years agoRollup merge of #66350 - hermitcore:hermit, r=rkruppe
Mazdak Farrokhzad [Fri, 15 Nov 2019 17:01:58 +0000 (18:01 +0100)]
Rollup merge of #66350 - hermitcore:hermit, r=rkruppe

protect creation of destructors by a mutex

- add on HermitCore an additional lock to protect static data

4 years agoApply suggestions from code review
Nadrieril [Fri, 15 Nov 2019 17:00:38 +0000 (17:00 +0000)]
Apply suggestions from code review

4 years agoAdd regression test
Nadrieril [Tue, 12 Nov 2019 13:24:04 +0000 (13:24 +0000)]
Add regression test

4 years agoApply suggestions from code review
Nadrieril [Tue, 12 Nov 2019 13:23:27 +0000 (13:23 +0000)]
Apply suggestions from code review

4 years agoFactor out IntRange::is_subrange
Nadrieril [Tue, 12 Nov 2019 13:03:05 +0000 (13:03 +0000)]
Factor out IntRange::is_subrange

4 years agoApply suggestions from code review
Nadrieril Feneanar [Tue, 12 Nov 2019 11:47:34 +0000 (12:47 +0100)]
Apply suggestions from code review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoAdd test for failing `try_eval_bits`
Nadrieril [Tue, 12 Nov 2019 09:42:31 +0000 (09:42 +0000)]
Add test for failing `try_eval_bits`

4 years agoRemove fishy condition
Nadrieril [Sat, 9 Nov 2019 21:46:46 +0000 (21:46 +0000)]
Remove fishy condition

That condition was leftover from a refactor, and was probably not
intended. In fact it can't trigger: it would require a ConstantValue of
an integral type for which `try_eval_bits` fails. But since we only
apply `subtract_ctors` to the output of `all_ctors`, this won't happen.

4 years agoMalformed range patterns can't happen thanks to E0030
Nadrieril [Sat, 9 Nov 2019 21:42:02 +0000 (21:42 +0000)]
Malformed range patterns can't happen thanks to E0030

4 years agoRemove unnecessary data from ConstantValue/ConstantRange
Nadrieril [Sat, 9 Nov 2019 21:11:59 +0000 (21:11 +0000)]
Remove unnecessary data from ConstantValue/ConstantRange

4 years agoStore Const directly in ConstantRange
Nadrieril [Sat, 9 Nov 2019 21:09:12 +0000 (21:09 +0000)]
Store Const directly in ConstantRange

4 years agoMake should_treat_range_exhaustively a method
Nadrieril [Sat, 9 Nov 2019 21:06:41 +0000 (21:06 +0000)]
Make should_treat_range_exhaustively a method

4 years agoInline now-trivial IntRange::from_ctor
Nadrieril [Sat, 9 Nov 2019 21:01:26 +0000 (21:01 +0000)]
Inline now-trivial IntRange::from_ctor

4 years agoFactor out getting the boundaries of an `IntRange`
Nadrieril [Sat, 9 Nov 2019 20:59:10 +0000 (20:59 +0000)]
Factor out getting the boundaries of an `IntRange`

4 years agoEagerly convert ranges to IntRange
Nadrieril [Sat, 9 Nov 2019 13:35:04 +0000 (13:35 +0000)]
Eagerly convert ranges to IntRange

That way no `ConstantRange` or `ConstantValue` ever needs to be
converted to `IntRange`.

4 years agoAdd `IntRange::to_pat` and use it instead of custom `display()`
Nadrieril [Sat, 9 Nov 2019 12:01:47 +0000 (12:01 +0000)]
Add `IntRange::to_pat` and use it instead of custom `display()`

4 years agoFix nll test
Yuki Okushi [Fri, 15 Nov 2019 16:40:59 +0000 (01:40 +0900)]
Fix nll test

4 years agoformatting
Nadrieril [Fri, 15 Nov 2019 16:39:56 +0000 (16:39 +0000)]
formatting

4 years agoIntroduce IntRange constructor
Nadrieril [Fri, 15 Nov 2019 16:39:31 +0000 (16:39 +0000)]
Introduce IntRange constructor

4 years ago`Constructor::display` was only needed for displaying `IntRange`
Nadrieril [Sat, 9 Nov 2019 10:31:53 +0000 (10:31 +0000)]
`Constructor::display` was only needed for displaying `IntRange`

I'm planning to stop using `ConstantRange`/`ConstantValue` for integral
types, so going through `Constructor` will soon not be relevant.

4 years agoAvoid converting through Constructor when subtracting ranges
Nadrieril [Sat, 9 Nov 2019 10:03:18 +0000 (10:03 +0000)]
Avoid converting through Constructor when subtracting ranges

4 years agoSpecial-case subtracting from a range if that range is not an IntRange
Nadrieril [Sat, 9 Nov 2019 09:43:15 +0000 (09:43 +0000)]
Special-case subtracting from a range if that range is not an IntRange

4 years agoPrefer IntRange::into_ctor to range_to_ctor
Nadrieril [Thu, 7 Nov 2019 20:03:50 +0000 (20:03 +0000)]
Prefer IntRange::into_ctor to range_to_ctor

4 years agoMove range exhaustiveness check to IntRange::intersection
Nadrieril [Thu, 7 Nov 2019 19:46:14 +0000 (19:46 +0000)]
Move range exhaustiveness check to IntRange::intersection

Only IntRange should need to worry about range exhaustiveness really.

4 years agoSpecial-case range inclusion when the range is integral but non-exhaustive
Nadrieril [Thu, 7 Nov 2019 18:52:13 +0000 (18:52 +0000)]
Special-case range inclusion when the range is integral but non-exhaustive

4 years agoCleanup `constructor_covered_by_range`
Nadrieril [Thu, 7 Nov 2019 19:15:59 +0000 (19:15 +0000)]
Cleanup `constructor_covered_by_range`

4 years agoIntRange::from_pat is redundant with pat_constructors
Nadrieril [Thu, 7 Nov 2019 18:37:10 +0000 (18:37 +0000)]
IntRange::from_pat is redundant with pat_constructors

4 years ago`pat_constructor` does not need `pcx` anymore
Nadrieril [Thu, 7 Nov 2019 18:27:50 +0000 (18:27 +0000)]
`pat_constructor` does not need `pcx` anymore

4 years agoFactor out range construction in `all_constructors`
Nadrieril [Thu, 7 Nov 2019 18:06:48 +0000 (18:06 +0000)]
Factor out range construction in `all_constructors`

4 years agoClarify conditions for exhaustive integer range matching
Nadrieril [Thu, 7 Nov 2019 17:29:56 +0000 (17:29 +0000)]
Clarify conditions for exhaustive integer range matching

4 years agoNote link between apply/specialize/arity functions
Nadrieril [Thu, 7 Nov 2019 12:09:05 +0000 (12:09 +0000)]
Note link between apply/specialize/arity functions

4 years agomore comment
Ralf Jung [Fri, 15 Nov 2019 14:57:01 +0000 (15:57 +0100)]
more comment

4 years agoApply suggestion from Centril
Yuki Okushi [Thu, 14 Nov 2019 09:14:45 +0000 (18:14 +0900)]
Apply suggestion from Centril

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoFix test case and issue number
Yuki Okushi [Thu, 14 Nov 2019 08:56:36 +0000 (17:56 +0900)]
Fix test case and issue number

4 years agoAdd test for issue-58094
Yuki Okushi [Thu, 14 Nov 2019 07:51:11 +0000 (16:51 +0900)]
Add test for issue-58094

4 years agoAdd test for issue-36122
Yuki Okushi [Thu, 14 Nov 2019 07:50:32 +0000 (16:50 +0900)]
Add test for issue-36122

4 years agoImprove error message for tests with panic=abort
Tyler Mandry [Thu, 14 Nov 2019 15:26:41 +0000 (07:26 -0800)]
Improve error message for tests with panic=abort

4 years agoAdd --force-run-in-process unstable libtest option
Tyler Mandry [Thu, 14 Nov 2019 15:26:22 +0000 (07:26 -0800)]
Add --force-run-in-process unstable libtest option

4 years agoMove JSON emitter to rustc_errors
Mark Rousskov [Thu, 14 Nov 2019 22:24:44 +0000 (17:24 -0500)]
Move JSON emitter to rustc_errors

4 years agoRemove SourceMapper trait
Mark Rousskov [Fri, 15 Nov 2019 13:32:31 +0000 (08:32 -0500)]
Remove SourceMapper trait

SourceMap is now in the root of all rustc-specific crates, syntax_pos,
so there's no need for the trait object to decouple the dependencies
between librustc_errors and libsyntax as was needed previously.

4 years agoAuto merge of #66449 - tmandry:rollup-3p1t0sb, r=tmandry
bors [Fri, 15 Nov 2019 13:45:25 +0000 (13:45 +0000)]
Auto merge of #66449 - tmandry:rollup-3p1t0sb, r=tmandry

Rollup of 4 pull requests

Successful merges:

 - #66197 (Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering)
 - #66429 (Add a regression test for #62524)
 - #66435 (Correct `const_in_array_repeat_expressions` feature name)
 - #66443 (Port erased cleanup)

Failed merges:

r? @ghost

4 years agoRollup merge of #66443 - GuillaumeGomez:port-erased-cleanup, r=Mark-Simulacrum
Tyler Mandry [Fri, 15 Nov 2019 13:44:52 +0000 (14:44 +0100)]
Rollup merge of #66443 - GuillaumeGomez:port-erased-cleanup, r=Mark-Simulacrum

Port erased cleanup

Just realised that the changes I made in #65965 were removed after the move of all error codes so here it is. I made them into separate commits to make the history look better this time.

r? @Mark-Simulacrum

4 years agoRollup merge of #66435 - JohnTitor:fix-spelling, r=Centril
Tyler Mandry [Fri, 15 Nov 2019 13:44:50 +0000 (14:44 +0100)]
Rollup merge of #66435 - JohnTitor:fix-spelling, r=Centril

Correct `const_in_array_repeat_expressions` feature name

Fixes #66433

r? @estebank

4 years agoRollup merge of #66429 - guanqun:add-unit-test, r=Centril
Tyler Mandry [Fri, 15 Nov 2019 13:44:48 +0000 (14:44 +0100)]
Rollup merge of #66429 - guanqun:add-unit-test, r=Centril

Add a regression test for #62524

Closes #62524

4 years agoRollup merge of #66197 - Centril:transparent-ast, r=varkor
Tyler Mandry [Fri, 15 Nov 2019 13:44:47 +0000 (14:44 +0100)]
Rollup merge of #66197 - Centril:transparent-ast, r=varkor

Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering

We currently have a hack in the form of `ast::{ItemKind, ImplItemKind}::OpaqueTy` which is constructed literally when you write `type Alias = impl Trait;` but not e.g. `type Alias = Vec<impl Trait>;`. Per https://github.com/rust-lang/rfcs/pull/2515, this needs to change to allow `impl Trait` in nested positions.  This PR achieves this change for the syntactic aspect but not the semantic one, which will require changes in lowering and def collection. In the interim, `TyKind::opaque_top_hack` is introduced to avoid knock-on changes in lowering, collection, and resolve. These hacks can then be removed and fixed one by one until the desired semantics are supported.

r? @varkor

4 years agoMove SourceMap to syntax_pos
Mark Rousskov [Fri, 15 Nov 2019 13:27:09 +0000 (08:27 -0500)]
Move SourceMap to syntax_pos

This does not update the use sites or delete the now unnecessary
SourceMapper trait, to allow git to interpret the file move as a rename
rather than a new file.

4 years agoMove FatalError to syntax_pos
Mark Rousskov [Thu, 14 Nov 2019 19:01:03 +0000 (14:01 -0500)]
Move FatalError to syntax_pos

This is a bit unfortunate, but code needs to be able to fatally error
early on (in particular, syntax_pos after we move SourceMap there). It's
also a tiny bit of code, which means it's ultimately not that bad.

4 years agoClean up E0025, E0034, E0044, E0046 and E0053
Guillaume Gomez [Fri, 15 Nov 2019 12:05:21 +0000 (13:05 +0100)]
Clean up E0025, E0034, E0044, E0046 and E0053

4 years agoClean up E0054
Guillaume Gomez [Fri, 15 Nov 2019 12:21:50 +0000 (13:21 +0100)]
Clean up E0054

4 years agoClean up E0050
Guillaume Gomez [Fri, 15 Nov 2019 12:20:17 +0000 (13:20 +0100)]
Clean up E0050

4 years agoClean up E0049
Guillaume Gomez [Fri, 15 Nov 2019 12:19:34 +0000 (13:19 +0100)]
Clean up E0049

4 years agoClean up E0045
Guillaume Gomez [Fri, 15 Nov 2019 12:18:05 +0000 (13:18 +0100)]
Clean up E0045

4 years agoClean up E0040
Guillaume Gomez [Fri, 15 Nov 2019 12:16:47 +0000 (13:16 +0100)]
Clean up E0040

4 years agoClean up E0033
Guillaume Gomez [Fri, 15 Nov 2019 12:15:05 +0000 (13:15 +0100)]
Clean up E0033

4 years agoClean up E0029
Guillaume Gomez [Fri, 15 Nov 2019 12:14:10 +0000 (13:14 +0100)]
Clean up E0029

4 years agoClean up E0027
Guillaume Gomez [Fri, 15 Nov 2019 12:13:18 +0000 (13:13 +0100)]
Clean up E0027

4 years agoClean up E0026
Guillaume Gomez [Fri, 15 Nov 2019 12:09:46 +0000 (13:09 +0100)]
Clean up E0026

4 years agoAdd link to error code explanation RFC
Guillaume Gomez [Fri, 15 Nov 2019 12:07:37 +0000 (13:07 +0100)]
Add link to error code explanation RFC

4 years agofind_deprecation: deprecation attr may be ill-formed meta.
Mazdak Farrokhzad [Wed, 13 Nov 2019 18:32:12 +0000 (19:32 +0100)]
find_deprecation: deprecation attr may be ill-formed meta.

4 years agoClean up E0023
Guillaume Gomez [Fri, 15 Nov 2019 12:04:52 +0000 (13:04 +0100)]
Clean up E0023

4 years agolibpanic_unwind for Miri: make sure we have the SEH lang items when needed
Ralf Jung [Fri, 15 Nov 2019 10:52:46 +0000 (11:52 +0100)]
libpanic_unwind for Miri: make sure we have the SEH lang items when needed

4 years agoAuto merge of #66438 - JohnTitor:rollup-qpv3wia, r=JohnTitor
bors [Fri, 15 Nov 2019 09:37:24 +0000 (09:37 +0000)]
Auto merge of #66438 - JohnTitor:rollup-qpv3wia, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #65557 (rename Error::iter_chain() and remove Error::iter_sources())
 - #66013 (Avoid hashing the key twice in `get_query()`.)
 - #66306 (Remove cannot mutate statics in initializer of another static error)
 - #66338 (Update mdbook.)
 - #66388 (Do not ICE on recovery from unmet associated type bound obligation)
 - #66390 (Fix ICE when trying to suggest `Type<>` instead of `Type()`)
 - #66391 (Do not ICE in `if` without `else` in `async fn`)
 - #66398 (Remove some stack frames from `.async` calls)
 - #66410 (miri: helper methods for max values of machine's usize/isize)
 - #66418 (Link to tracking issue in HIR const-check error code description)
 - #66419 (Don't warn labels beginning with `_` on unused_labels lint)
 - #66428 (Cleanup unused function)

Failed merges:

r? @ghost

4 years agoRollup merge of #66428 - dns2utf8:cleanup_unused_function, r=GuillaumeGomez
Yuki Okushi [Fri, 15 Nov 2019 09:36:35 +0000 (18:36 +0900)]
Rollup merge of #66428 - dns2utf8:cleanup_unused_function, r=GuillaumeGomez

Cleanup unused function

The argument was not used.

r? @GuillaumeGomez

4 years agoRollup merge of #66419 - JohnTitor:ignore-underscore, r=varkor
Yuki Okushi [Fri, 15 Nov 2019 09:36:34 +0000 (18:36 +0900)]
Rollup merge of #66419 - JohnTitor:ignore-underscore, r=varkor

Don't warn labels beginning with `_` on unused_labels lint

Fixes #66382

r? @varkor

4 years agoRollup merge of #66418 - ecstatic-morse:hir-const-check-err-msg, r=estebank
Yuki Okushi [Fri, 15 Nov 2019 09:36:32 +0000 (18:36 +0900)]
Rollup merge of #66418 - ecstatic-morse:hir-const-check-err-msg, r=estebank

Link to tracking issue in HIR const-check error code description

This is a follow up to #66170 that addresses [this comment](https://github.com/rust-lang/rust/pull/66170#discussion_r344021268).

As an aside, the only other error code whose description uses the phrase "tracking issue" is `E0202`. We may want to come up with standards around this, especially since error codes are now centralized and easier to keep track of (thanks @GuillaumeGomez).

r? @estebank (since they +1'ed the comment)

4 years agoRollup merge of #66410 - RalfJung:miri-machine-max, r=oli-obk
Yuki Okushi [Fri, 15 Nov 2019 09:36:31 +0000 (18:36 +0900)]
Rollup merge of #66410 - RalfJung:miri-machine-max, r=oli-obk

miri: helper methods for max values of machine's usize/isize

We recently wanted this in Miri.

r? @oli-obk

4 years agoRollup merge of #66398 - sfackler:no-async-nesting, r=Centril
Yuki Okushi [Fri, 15 Nov 2019 09:36:29 +0000 (18:36 +0900)]
Rollup merge of #66398 - sfackler:no-async-nesting, r=Centril

Remove some stack frames from `.async` calls

The `Context` argument is currently smuggled through TLS for
async-generated futures. The current infrastructure is closure-based,
and results in an extra 6 stack frames when .awaiting an async-generated
future!

```
  12: foo::async_b::{{closure}}
             at src/main.rs:10
  13: <std::future::GenFuture<T> as core::future::future::Future>::poll::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  14: std::future::set_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:79
  15: <std::future::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  16: std::future::poll_with_tls_context::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  17: std::future::get_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:111
  18: std::future::poll_with_tls_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  19: foo::async_a::{{closure}}
             at src/main.rs:6
```

While the long (medium?) term solution is to remove the use of TLS
entirely, we can improve things a bit in the meantime. In particular,
this commit does 2 things:

1. `get_task_context` has been inlined into `poll_with_tls_context`,
    removing 2 frames (16 and 17 above).
2. `set_task_context` now returns a guard type that resets the TLS
    rather than taking a closure, removing 2 frames (13 and 14 above).

We can also remove frame 18 by removing `poll_with_tls_context` in favor
of a `get_task_context` function which returns a guard, but that
requires adjusting the code generated for .await, so I've left that off
for now.

4 years agoRollup merge of #66391 - estebank:if-else-async-ice, r=Centril
Yuki Okushi [Fri, 15 Nov 2019 09:36:28 +0000 (18:36 +0900)]
Rollup merge of #66391 - estebank:if-else-async-ice, r=Centril

Do not ICE in `if` without `else` in `async fn`

Fix #66387.

4 years agoRollup merge of #66390 - estebank:parenice, r=Centril
Yuki Okushi [Fri, 15 Nov 2019 09:36:26 +0000 (18:36 +0900)]
Rollup merge of #66390 - estebank:parenice, r=Centril

Fix ICE when trying to suggest `Type<>` instead of `Type()`

Fixes #66286, but the output has no span:

```
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait

error: aborting due to previous error

For more information about this error, try `rustc --explain E0214`.
```

4 years agoRollup merge of #66388 - estebank:melt-ice, r=Centril
Yuki Okushi [Fri, 15 Nov 2019 09:36:25 +0000 (18:36 +0900)]
Rollup merge of #66388 - estebank:melt-ice, r=Centril

Do not ICE on recovery from unmet associated type bound obligation

Fix #66353.

r? @Centril

4 years agoRollup merge of #66338 - ehuss:update-mdbook, r=alexcrichton
Yuki Okushi [Fri, 15 Nov 2019 09:36:23 +0000 (18:36 +0900)]
Rollup merge of #66338 - ehuss:update-mdbook, r=alexcrichton

Update mdbook.

This brings in some important updates to fix some rendering issues in the books. In particular fixing hidden lines in code blocks, and some escaping issues.  More details at https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md

This also requires updating mdbook-linkcheck.

4 years agoRollup merge of #66306 - spastorino:remove-error-handled-by-miri, r=oli-obk
Yuki Okushi [Fri, 15 Nov 2019 09:36:22 +0000 (18:36 +0900)]
Rollup merge of #66306 - spastorino:remove-error-handled-by-miri, r=oli-obk

Remove cannot mutate statics in initializer of another static error

r? @oli-obk

This is just a refactoring. As the removed code itself said, it only a heuristic catching a few cases early instead of leaving it all to const eval. It's easy to work around the static check and then run into the miri-engine check.

4 years agoRollup merge of #66013 - nnethercote:avoid-hashing-twice-in-get_query, r=Zoxc
Yuki Okushi [Fri, 15 Nov 2019 09:36:20 +0000 (18:36 +0900)]
Rollup merge of #66013 - nnethercote:avoid-hashing-twice-in-get_query, r=Zoxc

Avoid hashing the key twice in `get_query()`.

For a single-threaded parallel compiler, this reduces instruction counts
across several benchmarks, by up to 2.8%.

The commit also adds documentation about `Sharded`'s use of `FxHasher`.

r? @Zoxc

4 years agoRollup merge of #65557 - haraldh:error_iter_rename, r=sfackler
Yuki Okushi [Fri, 15 Nov 2019 09:36:18 +0000 (18:36 +0900)]
Rollup merge of #65557 - haraldh:error_iter_rename, r=sfackler

rename Error::iter_chain() and remove Error::iter_sources()

~~Rename~~
* ~~Error::iter_chain() -> Error::chained()~~
* ~~Error::iter_sources() -> Error::ancestors()~~
* ~~ErrorIter -> Chained and Ancestors~~

according to
https://github.com/rust-lang/rust/issues/58520#issuecomment-527704110

Tracker:
https://github.com/rust-lang/rust/issues/58520

Edit:

Rename
* Error::iter_chain() -> Error::chained()
* ErrorIter -> Chain

So, it seems, that even Path::ancestors() includes itself. So, to avoid confusion and simplify it more, I reduced PR  #65557 to only have `chained` and `Chain`.

Rationale:

   1. Such iterators are helpful. They should better be stabilized sooner than later.
   1. self should be included. It is easy to .skip(1) it.  Not including self is harmful because it is harder to add self to the iterator than to remove it.
   1. The chosen name should be telling and reflect the fact that self is included. `.chained()` was chosen in honor of error-chain and because the iterator iterates over the chain of errors that is somehow included in self.
   1. The resulting iterator is named `Chain` because the `error::Chain` is what we want to have.