Commit Graph

95673 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
b41a62ef69
Rollup merge of #62158 - christianpoveda:ecx-memory-extra, r=RalfJung
Add MemoryExtra in InterpretCx constructor params

This is to avoid modifying `MemoryExtra` inside `InterpretCx` after initialization. Related miri PR: https://github.com/rust-lang/miri/pull/792

r? @RalfJung
2019-07-05 20:26:55 +02:00
Mazdak Farrokhzad
0224532493
Rollup merge of #62133 - petrochenkov:norustc, r=eddyb
Feature gate `rustc` attributes harder

Fixes https://github.com/rust-lang/rust/issues/62116
2019-07-05 20:26:54 +02:00
Mazdak Farrokhzad
40841e049a
Rollup merge of #62110 - nnethercote:improve-Ztime-passes, r=Zoxc
Improve -Ztime-passes

Two improvements that make `-Ztime-passes` more useful.

r? @Zoxc
2019-07-05 20:26:52 +02:00
Mazdak Farrokhzad
485a084b45
Rollup merge of #61545 - flip1995:internal_lints, r=oli-obk
Implement another internal lints

cc #49509

This adds ~~two~~ one internal lint~~s~~:
1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669
2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~

~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~

TODO (not directly relevant for review):
- [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) 🤔 cc @eddyb)
- [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870
- [x] Check explicitly for the `{declare,impl}_lint_pass!` macros

r? @oli-obk
2019-07-05 20:26:51 +02:00
bors
853f30052d Auto merge of #62407 - Centril:rollup-g0zmff7, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #62123 ( Remove needless lifetimes (std))
 - #62150 (Implement mem::{zeroed,uninitialized} in terms of MaybeUninit.)
 - #62169 (Derive which queries to save using the proc macro)
 - #62238 (Fix code block information icon position)
 - #62292 (Move `async || ...` closures into `#![feature(async_closure)]`)
 - #62323 (Clarify unaligned fields in ptr::{read,write}_unaligned)
 - #62324 (Reduce reliance on `await!(...)` macro)
 - #62371 (Add tracking issue for Box::into_pin)
 - #62383 (Improve error span for async type inference error)
 - #62388 (Break out of the correct number of scopes in loops)

Failed merges:

r? @ghost
2019-07-05 11:53:52 +00:00
Mazdak Farrokhzad
18081890ea
Rollup merge of #62388 - rust-lang:fix-loop-break-mir-generation, r=eddyb
Break out of the correct number of scopes in loops

We were incorrectly breaking out of one too many drop scopes when
generating MIR for loops and breakable blocks, resulting in use after
free and associated borrow checker warnings.

This wasn't noticed because the scope that we're breaking out of twice
is only used for temporaries that are created for adjustments applied to
the loop. Since loops generally propagate coercions to the `break`
expressions, the only case we see this is when the type of the loop is a
smart pointer to a trait object.

Closes #62312
2019-07-05 13:53:13 +02:00
Mazdak Farrokhzad
cc696b957b
Rollup merge of #62383 - Aaron1011:fix/async-error-span, r=varkor
Improve error span for async type inference error

Fixes #62382

Previously, we would point at the spawn of the 'await' expression,
instead of the actual expression with an unknown type.
2019-07-05 13:53:11 +02:00
Mazdak Farrokhzad
ccd925bc7d
Rollup merge of #62371 - Nemo157:fix-62288, r=Centril
Add tracking issue for Box::into_pin

Fixes #62288
2019-07-05 13:53:10 +02:00
Mazdak Farrokhzad
7d6e43177c
Rollup merge of #62324 - Centril:reduce-await-macro-reliance, r=cramertj
Reduce reliance on `await!(...)` macro

Only the last commit is new.

r? @cramertj
2019-07-05 13:53:09 +02:00
Mazdak Farrokhzad
d3569ddf32
Rollup merge of #62323 - Centril:clarify-read-unaligned, r=RalfJung
Clarify unaligned fields in ptr::{read,write}_unaligned

r? @RalfJung
2019-07-05 13:53:07 +02:00
Mazdak Farrokhzad
84527e4676
Rollup merge of #62292 - Centril:split-async-closures, r=cramertj
Move `async || ...` closures into `#![feature(async_closure)]`

The `async || expr` syntax is moved out from `#![feature(async_await)]` into its own gate `#![feature(async_closure)]`.

New tracking issue: https://github.com/rust-lang/rust/issues/62290

Closes https://github.com/rust-lang/rust/issues/62214.

cc https://github.com/rust-lang/rust/issues/62149

r? @varkor
2019-07-05 13:53:06 +02:00
Mazdak Farrokhzad
61256a8164
Rollup merge of #62238 - GuillaumeGomez:fix-code-block-information-icon-pos, r=QuietMisdreavus
Fix code block information icon position

Fixes #62118.

A screenshot of the fix:

<img width="720" alt="Screenshot 2019-06-29 at 18 28 59" src="https://user-images.githubusercontent.com/3050060/60386900-edb23b80-9a9b-11e9-9f4f-0f343674348c.png">

r? @rust-lang/rustdoc
2019-07-05 13:53:04 +02:00
Mazdak Farrokhzad
4b21e20f8e
Rollup merge of #62169 - Zoxc:store-query-results, r=eddyb
Derive which queries to save using the proc macro

Based on https://github.com/rust-lang/rust/pull/62166.

r? @eddyb
2019-07-05 13:53:02 +02:00
Mazdak Farrokhzad
1d45156866
Rollup merge of #62150 - alex:mem-uninit-refactor, r=RalfJung
Implement mem::{zeroed,uninitialized} in terms of MaybeUninit.

Refs #62061

r? @oli-obk
2019-07-05 13:53:00 +02:00
Mazdak Farrokhzad
0f92eb8a4a
Rollup merge of #62123 - jeremystucki:needless_lifetimes_std, r=alexcrichton
Remove needless lifetimes (std)

Split from #62039
2019-07-05 13:52:58 +02:00
bors
f119bf2761 Auto merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddyb
Remove io::Result from syntax::print

Since we're now writing directly to the vector, there's no need to
thread results through the whole printing infrastructure
2019-07-05 06:55:48 +00:00
bors
baab1914ec Auto merge of #62376 - Mark-Simulacrum:1.38-nightly, r=alexcrichton
Switch master to 1.38
2019-07-05 03:33:03 +00:00
Mark Rousskov
007d87f171 Permit use of mem::uninitialized via allow(deprecated) 2019-07-04 21:01:35 -04:00
Nicholas Nethercote
87b103d4a9 Add a "total" measurement to -Ztime-passes.
This is useful for getting the total compilation time at the end.
To do this, the patch changes `print_time_passes_entry` to not increment
the depth, which means that `print_time_passes_entry_internal` is no
longer needed.
2019-07-05 08:19:48 +10:00
Nicholas Nethercote
90419d36bd Remove solve_nll_region_constraints measurements from -Ztime-passes output.
Because it pollutes the output with hundreds or thousands of
uninteresting lines for which the time duration is always(?) 0.000s.
2019-07-05 08:19:43 +10:00
bors
4ca7a349da Auto merge of #62153 - alexcrichton:parallel-compress, r=Mark-Simulacrum
Update the `rust-installer` submodule

This pulls in a commit which uses parallel xz encoding which should
hopefully help shave some time off the dist builders which spend an
inordinate amount of time compressing this data.
2019-07-04 22:14:08 +00:00
Matthew Jasper
1b7ffe5300 Break out of the correct number of scopes in loops
We were incorrectly breaking out of one too many drop scopes when
generating MIR for loops and breakable blocks, resulting in use after
free and associated borrow checker warnings.

This wasn't noticed because the scope that we're breaking out of twice
is only used for temporaries that are created for adjustments applied to
the loop. Since loops generally propagate coercions to the `break`
expressions, the only case we see this is when the type of the loop is a
smart pointer to a trait object.
2019-07-04 21:53:46 +01:00
Alex Crichton
2fb2e00f20 Update the rust-installer submodule
This pulls in a commit which uses parallel xz encoding which should
hopefully help shave some time off the dist builders which spend an
inordinate amount of time compressing this data.
2019-07-04 11:59:09 -07:00
bors
24a9bcbb7c Auto merge of #61392 - Zoxc:single-interner, r=eddyb
Use a single CtxtInterners

Builds on https://github.com/rust-lang/rust/pull/57214

r? @eddyb
2019-07-04 18:44:49 +00:00
Aaron Hill
779308a5e1
Improve error span for async type inference error
Fixes #62382

Previously, we would point at the spawn of the 'await' expression,
instead of the actual expression with an unknown type.
2019-07-04 14:22:47 -04:00
Mark Rousskov
8a7dded1a2 Switch master to 1.38 2019-07-04 11:26:57 -04:00
Alex Gaynor
e4f250e405 Implement mem::{zeroed,uninitialized} in terms of MaybeUninit.
Refs #62061
2019-07-04 09:33:15 -04:00
Wim Looman
55bd2140a2 Add tracking issue for Box::into_pin 2019-07-04 12:57:34 +02:00
Jeremy Stucki
fc67e5774d
Add missing lifetime specifier
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-04 10:42:24 +02:00
Mazdak Farrokhzad
54527db7b0
ptr::{read,write}_unaligned: use no_run and reword slightly. 2019-07-04 09:54:37 +02:00
Christian Poveda
e45bbaf48c Fix merge conflicts 2019-07-04 01:45:29 -05:00
Mazdak Farrokhzad
bee964c502 Clarify unaligned fields in ptr::read_unaligned. 2019-07-04 05:32:38 +02:00
bors
b43eb4235a Auto merge of #62355 - Centril:rollup-xnxtcgm, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #62039 (Remove needless lifetimes (rustc))
 - #62173 (rename InterpretCx -> InterpCx)
 - #62240 (wfcheck: resolve the type-vars in `AdtField` types)
 - #62249 (Use mem::take instead of mem::replace with default)
 - #62252 (Update mem::replace example to not be identical to mem::take)
 - #62258 (syntax: Unsupport `foo! bar { ... }` macros in the parser)
 - #62268 (Clean up inherent_impls)
 - #62287 (Use link attributes on extern "C" blocks with llvm-libuwind)
 - #62295 (miri realloc: do not require giving old size+align)
 - #62297 (refactor check_for_substitution)
 - #62316 (When possible without changing semantics, implement Iterator::last in terms of DoubleEndedIterator::next_back for types in liballoc and libcore.)
 - #62317 (Migrate `compile-pass` annotations to `build-pass`)
 - #62337 (Fix bucket in CPU usage script)
 - #62344 (simplify Option::get_or_insert)
 - #62346 (enable a few more tests in Miri and update the comment for others)
 - #62351 (remove bogus example from drop_in_place)

Failed merges:

r? @ghost
2019-07-03 23:39:36 +00:00
Mazdak Farrokhzad
6363a58e9a
Rollup merge of #62351 - RalfJung:drop-in-place, r=cramertj
remove bogus example from drop_in_place

Fixes https://github.com/rust-lang/rust/issues/62313
2019-07-04 01:39:04 +02:00
Mazdak Farrokhzad
144ed029c5
Rollup merge of #62346 - RalfJung:miri-tests, r=Centril
enable a few more tests in Miri and update the comment for others
2019-07-04 01:39:02 +02:00
Mazdak Farrokhzad
839e89c3d1
Rollup merge of #62344 - matklad:simplify-option, r=sfackler
simplify Option::get_or_insert

I am pretty sure that the optimized result will be the same, and it's one `unsafe` less in the stdlib!
2019-07-04 01:39:01 +02:00
Mazdak Farrokhzad
cd1fa00446
Rollup merge of #62337 - Mark-Simulacrum:fix-cpu-usage-script, r=alexcrichton
Fix bucket in CPU usage script

r? @alexcrichton
2019-07-04 01:38:59 +02:00
Mazdak Farrokhzad
919349701a
Rollup merge of #62317 - JohnTitor:move-tests-to-build-pass, r=Centril
Migrate `compile-pass` annotations to `build-pass`

This is a part of #62277.

As a first step, the `compile-pass` tests are migrated to `build-pass`.

r? @cramertj
cc @Centril
2019-07-04 01:38:58 +02:00
Mazdak Farrokhzad
4049a3cf1b
Rollup merge of #62316 - khuey:efficient_last, r=sfackler
When possible without changing semantics, implement Iterator::last in terms of DoubleEndedIterator::next_back for types in liballoc and libcore.

Provided that the iterator has finite length and does not trigger user-provided code, this is safe.

What follows is a full list of the DoubleEndedIterators in liballoc/libcore and whether this optimization is safe, and if not, why not.

src/liballoc/boxed.rs
Box: Pass through to avoid defeating optimization of the underlying DoubleIterator implementation. This has no correctness impact.

src/liballoc/collections/binary_heap.rs
Iter: Pass through to avoid defeating optimizations on slice::Iter
IntoIter: Not safe, changes Drop order
Drain: Not safe, changes Drop order

src/liballoc/collections/btree/map.rs
Iter: Safe to call next_back, invokes no user defined code.
IterMut: ditto
IntoIter: Not safe, changes Drop order
Keys: Safe to call next_back, invokes no user defined code.
Values: ditto
ValuesMut: ditto
Range: ditto
RangeMut: ditto

src/liballoc/collections/btree/set.rs
Iter: Safe to call next_back, invokes no user defined code.
IntoIter: Not safe, changes Drop order
Range: Safe to call next_back, invokes no user defined code.

src/liballoc/collections/linked_list.rs
Iter: Safe to call next_back, invokes no user defined code.
IterMut: ditto
IntoIter: Not safe, changes Drop order

src/liballoc/collections/vec_deque.rs
Iter: Safe to call next_back, invokes no user defined code.
IterMut: ditto
IntoIter: Not safe, changes Drop order
Drain: ditto

src/liballoc/string.rs
Drain: Safe because return type is a primitive (char)

src/liballoc/vec.rs
IntoIter: Not safe, changes Drop order
Drain: ditto
Splice: ditto

src/libcore/ascii.rs
EscapeDefault: Safe because return type is a primitive (u8)

src/libcore/iter/adapters/chain.rs
Chain: Not safe, invokes user defined code (Iterator impl)

src/libcore/iter/adapters/flatten.rs
FlatMap: Not safe, invokes user defined code (Iterator impl)
Flatten: ditto
FlattenCompat: ditto

src/libcore/iter/adapters/mod.rs
Rev: Not safe, invokes user defined code (Iterator impl)
Copied: ditto
Cloned: Not safe, invokes user defined code (Iterator impl and T::clone)
Map: Not safe, invokes user defined code (Iterator impl + closure)
Filter: ditto
FilterMap: ditto
Enumerate: Not safe, invokes user defined code (Iterator impl)
Skip: ditto
Fuse: ditto
Inspect: ditto

src/libcore/iter/adapters/zip.rs
Zip: Not safe, invokes user defined code (Iterator impl)

src/libcore/iter/range.rs
ops::Range: Not safe, changes Drop order, but ALREADY HAS SPECIALIZATION
ops::RangeInclusive: ditto

src/libcore/iter/sources.rs
Repeat: Not safe, calling last should iloop.
Empty: No point, iterator is at most one item long.
Once: ditto
OnceWith: ditto

src/libcore/option.rs
Item: No point, iterator is at most one item long.
Iter: ditto
IterMut: ditto
IntoIter: ditto

src/libcore/result.rs
Iter: No point, iterator is at most one item long
IterMut: ditto
IntoIter: ditto

src/libcore/slice/mod.rs
Split: Not safe, invokes user defined closure
SplitMut: ditto
RSplit: ditto
RSplitMut: ditto
Windows: Safe, already has specialization
Chunks: ditto
ChunksMut: ditto
ChunksExact: ditto
ChunksExactMut: ditto
RChunks: ditto
RChunksMut: ditto
RChunksExact: ditto
RChunksExactMut: ditto

src/libcore/str/mod.rs
Chars: Safe, already has specialization
CharIndices: ditto
Bytes: ditto
Lines: Safe to call next_back, invokes no user defined code.
LinesAny: Deprecated
Everything that is generic over P: Pattern: Not safe because Pattern invokes user defined code.
SplitWhitespace: Safe to call next_back, invokes no user defined code.
SplitAsciiWhitespace: ditto

This is attempt 2 of #60130.

r? @sfackler
2019-07-04 01:38:56 +02:00
Mazdak Farrokhzad
c0ec567214
Rollup merge of #62297 - matklad:peek-delimited, r=petrochenkov
refactor check_for_substitution

No behavior change, just flatter and simpler code.

r? @petrochenkov
2019-07-04 01:38:55 +02:00
Mazdak Farrokhzad
44f22e694c
Rollup merge of #62295 - RalfJung:miri-realloc, r=cramertj
miri realloc: do not require giving old size+align
2019-07-04 01:38:53 +02:00
Mazdak Farrokhzad
d93b52fd18
Rollup merge of #62287 - petrhosek:libunwind-link-attribute, r=tmandry
Use link attributes on extern "C" blocks with llvm-libuwind

When llvm-libunwind feature is enabled, we need to use link attribute on
extern "C" blocks to make sure that symbols provided by LLVM's libunwind
that's built as part of Rust's libunwind crate are re-exported.

This addresses issue #62088.
2019-07-04 01:38:52 +02:00
Mazdak Farrokhzad
d7e42cc61c
Rollup merge of #62268 - Zoxc:inherent_impls, r=eddyb
Clean up inherent_impls

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

r? @eddyb
2019-07-04 01:38:50 +02:00
Mazdak Farrokhzad
8867ba19de
Rollup merge of #62258 - petrochenkov:idclean, r=Centril
syntax: Unsupport `foo! bar { ... }` macros in the parser

Their support in expansion was removed in https://github.com/rust-lang/rust/pull/61606.

Also un-reserve `macro_rules` as a macro name, there's no ambiguity between `macro_rules` definitions and macro calls (it also wasn't reserved correctly).

cc https://github.com/rust-lang-nursery/wg-grammar/issues/51
2019-07-04 01:38:49 +02:00
Mazdak Farrokhzad
944bda9abb
Rollup merge of #62252 - czipperz:change-mem-replace-doc-example, r=dtolnay
Update mem::replace example to not be identical to mem::take

This also adds assertions that the operations work as expected.
2019-07-04 01:38:47 +02:00
Mazdak Farrokhzad
88c007cd04
Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
2019-07-04 01:38:46 +02:00
Mazdak Farrokhzad
6cfd474e33
Rollup merge of #62240 - arielb1:resolve-wf-fields, r=pnkfelix
wfcheck: resolve the type-vars in `AdtField` types

Normalization can leave some type-vars unresolved in its return type.
Make sure to resolve them so we have an infcx-independent type that can
be used with `needs_drop`.

Fixes #61402.

Closes #62212 - this PR fixes the root cause.
2019-07-04 01:38:44 +02:00
Mazdak Farrokhzad
740d5bd157
Rollup merge of #62173 - RalfJung:miri-interp, r=oli-obk
rename InterpretCx -> InterpCx

That's more consistent with InterpResult and InterpError.

r? @oli-obk
2019-07-04 01:38:42 +02:00
Mazdak Farrokhzad
e8a88f7d43
Rollup merge of #62039 - jeremystucki:needless_lifetimes, r=eddyb
Remove needless lifetimes (rustc)
2019-07-04 01:38:41 +02:00
Mazdak Farrokhzad
3eef0cbfe2 Reduce reliance on feature(await_macro). 2019-07-04 00:25:14 +02:00