]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRemove last use of mem::uninitialized in SGX
Jethro Beekman [Fri, 5 Jul 2019 16:03:49 +0000 (09:03 -0700)]
Remove last use of mem::uninitialized in SGX

5 years agoAuto merge of #62407 - Centril:rollup-g0zmff7, r=Centril
bors [Fri, 5 Jul 2019 11:53:52 +0000 (11:53 +0000)]
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

5 years agoRollup merge of #62388 - rust-lang:fix-loop-break-mir-generation, r=eddyb
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:13 +0000 (13:53 +0200)]
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

5 years agoRollup merge of #62383 - Aaron1011:fix/async-error-span, r=varkor
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:11 +0000 (13:53 +0200)]
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.

5 years agoRollup merge of #62371 - Nemo157:fix-62288, r=Centril
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:10 +0000 (13:53 +0200)]
Rollup merge of #62371 - Nemo157:fix-62288, r=Centril

Add tracking issue for Box::into_pin

Fixes #62288

5 years agoRollup merge of #62324 - Centril:reduce-await-macro-reliance, r=cramertj
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:09 +0000 (13:53 +0200)]
Rollup merge of #62324 - Centril:reduce-await-macro-reliance, r=cramertj

Reduce reliance on `await!(...)` macro

Only the last commit is new.

r? @cramertj

5 years agoRollup merge of #62323 - Centril:clarify-read-unaligned, r=RalfJung
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:07 +0000 (13:53 +0200)]
Rollup merge of #62323 - Centril:clarify-read-unaligned, r=RalfJung

Clarify unaligned fields in ptr::{read,write}_unaligned

r? @RalfJung

5 years agoRollup merge of #62292 - Centril:split-async-closures, r=cramertj
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:06 +0000 (13:53 +0200)]
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

5 years agoRollup merge of #62238 - GuillaumeGomez:fix-code-block-information-icon-pos, r=QuietM...
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:04 +0000 (13:53 +0200)]
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

5 years agoRollup merge of #62169 - Zoxc:store-query-results, r=eddyb
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:02 +0000 (13:53 +0200)]
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

5 years agoRollup merge of #62150 - alex:mem-uninit-refactor, r=RalfJung
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:53:00 +0000 (13:53 +0200)]
Rollup merge of #62150 - alex:mem-uninit-refactor, r=RalfJung

Implement mem::{zeroed,uninitialized} in terms of MaybeUninit.

Refs #62061

r? @oli-obk

5 years agoRollup merge of #62123 - jeremystucki:needless_lifetimes_std, r=alexcrichton
Mazdak Farrokhzad [Fri, 5 Jul 2019 11:52:58 +0000 (13:52 +0200)]
Rollup merge of #62123 - jeremystucki:needless_lifetimes_std, r=alexcrichton

 Remove needless lifetimes (std)

Split from #62039

5 years agoAuto merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddyb
bors [Fri, 5 Jul 2019 06:55:48 +0000 (06:55 +0000)]
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

5 years agoAuto merge of #62376 - Mark-Simulacrum:1.38-nightly, r=alexcrichton
bors [Fri, 5 Jul 2019 03:33:03 +0000 (03:33 +0000)]
Auto merge of #62376 - Mark-Simulacrum:1.38-nightly, r=alexcrichton

Switch master to 1.38

5 years agoPermit use of mem::uninitialized via allow(deprecated)
Mark Rousskov [Thu, 4 Jul 2019 15:24:56 +0000 (11:24 -0400)]
Permit use of mem::uninitialized via allow(deprecated)

5 years agoAuto merge of #62153 - alexcrichton:parallel-compress, r=Mark-Simulacrum
bors [Thu, 4 Jul 2019 22:14:08 +0000 (22:14 +0000)]
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.

5 years agoBreak out of the correct number of scopes in loops
Matthew Jasper [Thu, 4 Jul 2019 20:53:46 +0000 (21:53 +0100)]
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.

5 years agoUpdate the `rust-installer` submodule
Alex Crichton [Wed, 26 Jun 2019 15:24:43 +0000 (08:24 -0700)]
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.

5 years agoAuto merge of #61392 - Zoxc:single-interner, r=eddyb
bors [Thu, 4 Jul 2019 18:44:49 +0000 (18:44 +0000)]
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

5 years agoImprove error span for async type inference error
Aaron Hill [Thu, 4 Jul 2019 18:20:04 +0000 (14:20 -0400)]
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.

5 years agoSwitch master to 1.38
Mark Rousskov [Thu, 4 Jul 2019 14:05:50 +0000 (10:05 -0400)]
Switch master to 1.38

5 years agoImplement mem::{zeroed,uninitialized} in terms of MaybeUninit.
Alex Gaynor [Wed, 26 Jun 2019 11:50:30 +0000 (07:50 -0400)]
Implement mem::{zeroed,uninitialized} in terms of MaybeUninit.

Refs #62061

5 years agoAdd tracking issue for Box::into_pin
Wim Looman [Thu, 4 Jul 2019 10:55:23 +0000 (12:55 +0200)]
Add tracking issue for Box::into_pin

5 years agoAdd missing lifetime specifier
Jeremy Stucki [Thu, 4 Jul 2019 08:42:24 +0000 (10:42 +0200)]
Add missing lifetime specifier

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
5 years agoptr::{read,write}_unaligned: use no_run and reword slightly.
Mazdak Farrokhzad [Thu, 4 Jul 2019 07:54:37 +0000 (09:54 +0200)]
ptr::{read,write}_unaligned: use no_run and reword slightly.

5 years agoClarify unaligned fields in ptr::read_unaligned.
Mazdak Farrokhzad [Wed, 3 Jul 2019 02:05:05 +0000 (04:05 +0200)]
Clarify unaligned fields in ptr::read_unaligned.

5 years agoAuto merge of #62355 - Centril:rollup-xnxtcgm, r=Centril
bors [Wed, 3 Jul 2019 23:39:36 +0000 (23:39 +0000)]
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

5 years agoRollup merge of #62351 - RalfJung:drop-in-place, r=cramertj
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:39:04 +0000 (01:39 +0200)]
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

5 years agoRollup merge of #62346 - RalfJung:miri-tests, r=Centril
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:39:02 +0000 (01:39 +0200)]
Rollup merge of #62346 - RalfJung:miri-tests, r=Centril

enable a few more tests in Miri and update the comment for others

5 years agoRollup merge of #62344 - matklad:simplify-option, r=sfackler
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:39:01 +0000 (01:39 +0200)]
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!

5 years agoRollup merge of #62337 - Mark-Simulacrum:fix-cpu-usage-script, r=alexcrichton
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:59 +0000 (01:38 +0200)]
Rollup merge of #62337 - Mark-Simulacrum:fix-cpu-usage-script, r=alexcrichton

Fix bucket in CPU usage script

r? @alexcrichton

5 years agoRollup merge of #62317 - JohnTitor:move-tests-to-build-pass, r=Centril
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:58 +0000 (01:38 +0200)]
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

5 years agoRollup merge of #62316 - khuey:efficient_last, r=sfackler
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:56 +0000 (01:38 +0200)]
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

5 years agoRollup merge of #62297 - matklad:peek-delimited, r=petrochenkov
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:55 +0000 (01:38 +0200)]
Rollup merge of #62297 - matklad:peek-delimited, r=petrochenkov

refactor check_for_substitution

No behavior change, just flatter and simpler code.

r? @petrochenkov

5 years agoRollup merge of #62295 - RalfJung:miri-realloc, r=cramertj
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:53 +0000 (01:38 +0200)]
Rollup merge of #62295 - RalfJung:miri-realloc, r=cramertj

miri realloc: do not require giving old size+align

5 years agoRollup merge of #62287 - petrhosek:libunwind-link-attribute, r=tmandry
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:52 +0000 (01:38 +0200)]
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.

5 years agoRollup merge of #62268 - Zoxc:inherent_impls, r=eddyb
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:50 +0000 (01:38 +0200)]
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

5 years agoRollup merge of #62258 - petrochenkov:idclean, r=Centril
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:49 +0000 (01:38 +0200)]
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

5 years agoRollup merge of #62252 - czipperz:change-mem-replace-doc-example, r=dtolnay
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:47 +0000 (01:38 +0200)]
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.

5 years agoRollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay...
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:46 +0000 (01:38 +0200)]
Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril

Use mem::take instead of mem::replace with default

5 years agoRollup merge of #62240 - arielb1:resolve-wf-fields, r=pnkfelix
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:44 +0000 (01:38 +0200)]
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.

5 years agoRollup merge of #62173 - RalfJung:miri-interp, r=oli-obk
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:42 +0000 (01:38 +0200)]
Rollup merge of #62173 - RalfJung:miri-interp, r=oli-obk

rename InterpretCx -> InterpCx

That's more consistent with InterpResult and InterpError.

r? @oli-obk

5 years agoRollup merge of #62039 - jeremystucki:needless_lifetimes, r=eddyb
Mazdak Farrokhzad [Wed, 3 Jul 2019 23:38:41 +0000 (01:38 +0200)]
Rollup merge of #62039 - jeremystucki:needless_lifetimes, r=eddyb

Remove needless lifetimes (rustc)

5 years agoReduce reliance on feature(await_macro).
Mazdak Farrokhzad [Wed, 3 Jul 2019 22:25:14 +0000 (00:25 +0200)]
Reduce reliance on feature(await_macro).

5 years agoAdjust tests wrt. 'async_closure' feature gate.
Mazdak Farrokhzad [Tue, 2 Jul 2019 02:12:29 +0000 (04:12 +0200)]
Adjust tests wrt. 'async_closure' feature gate.

5 years agoAdd separate 'async_closure' feature gate.
Mazdak Farrokhzad [Tue, 2 Jul 2019 02:10:19 +0000 (04:10 +0200)]
Add separate 'async_closure' feature gate.

5 years agoremove bogus example from drop_in_place
Ralf Jung [Wed, 3 Jul 2019 18:13:42 +0000 (20:13 +0200)]
remove bogus example from drop_in_place

5 years agoenable a few more tests in Miri and update the comment for others
Ralf Jung [Wed, 3 Jul 2019 17:41:16 +0000 (19:41 +0200)]
enable a few more tests in Miri and update the comment for others

5 years agosimplify Option::get_or_insert
Aleksey Kladov [Wed, 3 Jul 2019 17:17:05 +0000 (20:17 +0300)]
simplify Option::get_or_insert

5 years agoAuto merge of #62335 - Mark-Simulacrum:rollup-0pcaz5a, r=Mark-Simulacrum
bors [Wed, 3 Jul 2019 14:29:08 +0000 (14:29 +0000)]
Auto merge of #62335 - Mark-Simulacrum:rollup-0pcaz5a, r=Mark-Simulacrum

Rollup of 15 pull requests

Successful merges:

 - #62021 (MSVC link output improve)
 - #62064 (nth_back for chunks_exact)
 - #62128 (Adjust warning of -C extra-filename with -o.)
 - #62161 (Add missing links for TryFrom docs)
 - #62183 (std: Move a process test out of libstd)
 - #62186 (Add missing type urls in Into trait)
 - #62196 (Add Vec::leak)
 - #62199 (import gdb for explicit access to gdb.current_objfile())
 - #62229 (Enable intptrcast for explicit casts)
 - #62250 (Improve box clone doctests to ensure the documentation is valid)
 - #62255 (Switch tracking issue for `#![feature(slice_patterns)]`)
 - #62285 (Fix michaelwoerister's mailmap)
 - #62304 (HashMap is UnwindSafe)
 - #62319 (Fix mismatching Kleene operators)
 - #62327 (Fixed document bug, those replaced each other)

Failed merges:

r? @ghost

5 years agoFix bucket in CPU usage script
Mark Rousskov [Wed, 3 Jul 2019 14:19:59 +0000 (10:19 -0400)]
Fix bucket in CPU usage script

5 years agoRollup merge of #62327 - Flast:patch-1, r=Mark-Simulacrum
Mark Rousskov [Wed, 3 Jul 2019 13:59:31 +0000 (09:59 -0400)]
Rollup merge of #62327 - Flast:patch-1, r=Mark-Simulacrum

Fixed document bug, those replaced each other

Originally reported by #57686, introduced by #58005

5 years agoRollup merge of #62319 - ia0:fix_kleene, r=petrochenkov
Mark Rousskov [Wed, 3 Jul 2019 13:59:30 +0000 (09:59 -0400)]
Rollup merge of #62319 - ia0:fix_kleene, r=petrochenkov

Fix mismatching Kleene operators

5 years agoRollup merge of #62304 - SimonSapin:safe, r=eddyb
Mark Rousskov [Wed, 3 Jul 2019 13:59:28 +0000 (09:59 -0400)]
Rollup merge of #62304 - SimonSapin:safe, r=eddyb

HashMap is UnwindSafe

Fixes https://github.com/rust-lang/rust/issues/62301, a regression in 1.36.0-pre which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.

5 years agoRollup merge of #62285 - Mark-Simulacrum:mailmap-mw, r=Centril
Mark Rousskov [Wed, 3 Jul 2019 13:59:27 +0000 (09:59 -0400)]
Rollup merge of #62285 - Mark-Simulacrum:mailmap-mw, r=Centril

Fix michaelwoerister's mailmap

Noticed while going through some changes to thanks.

cc @michaelwoerister
r? @Centril

5 years agoRollup merge of #62255 - Centril:slice-patterns-change-issue, r=varkor
Mark Rousskov [Wed, 3 Jul 2019 13:59:25 +0000 (09:59 -0400)]
Rollup merge of #62255 - Centril:slice-patterns-change-issue, r=varkor

Switch tracking issue for `#![feature(slice_patterns)]`

Switches the tracking issue for `#![feature(slice_patterns)]` to a fresh one in https://github.com/rust-lang/rust/issues/62254 due to new RFCs.

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

r? @varkor

5 years agoRollup merge of #62250 - czipperz:improve-box-clone-doctests, r=GuillaumeGomez
Mark Rousskov [Wed, 3 Jul 2019 13:59:24 +0000 (09:59 -0400)]
Rollup merge of #62250 - czipperz:improve-box-clone-doctests, r=GuillaumeGomez

Improve box clone doctests to ensure the documentation is valid

5 years agoRollup merge of #62229 - christianpoveda:intptrcast-explicit-casts, r=RalfJung
Mark Rousskov [Wed, 3 Jul 2019 13:59:22 +0000 (09:59 -0400)]
Rollup merge of #62229 - christianpoveda:intptrcast-explicit-casts, r=RalfJung

Enable intptrcast for explicit casts

I checked locally that this does not break miri on master. r? @RalfJung

5 years agoRollup merge of #62199 - cclauss:patch-1, r=nikomatsakis
Mark Rousskov [Wed, 3 Jul 2019 13:59:21 +0000 (09:59 -0400)]
Rollup merge of #62199 - cclauss:patch-1, r=nikomatsakis

import gdb for explicit access to gdb.current_objfile()

5 years agoRollup merge of #62196 - cramertj:vec-leak, r=centril,withoutboats
Mark Rousskov [Wed, 3 Jul 2019 13:59:20 +0000 (09:59 -0400)]
Rollup merge of #62196 - cramertj:vec-leak, r=centril,withoutboats

Add Vec::leak

5 years agoRollup merge of #62186 - GuillaumeGomez:add-missing-type-links-into, r=docs
Mark Rousskov [Wed, 3 Jul 2019 13:59:18 +0000 (09:59 -0400)]
Rollup merge of #62186 - GuillaumeGomez:add-missing-type-links-into, r=docs

Add missing type urls in Into trait

r? @rust-lang/docs

5 years agoRollup merge of #62183 - alexcrichton:fix-tests, r=nikomatsakis
Mark Rousskov [Wed, 3 Jul 2019 13:59:16 +0000 (09:59 -0400)]
Rollup merge of #62183 - alexcrichton:fix-tests, r=nikomatsakis

std: Move a process test out of libstd

This commit moves a test out of libstd which is causing deadlocks on
musl on CI. Looks like the recent update in musl versions brings in some
internal updates to musl which makes `setgid` and `setuid` invalid to
call after a `fork` in a multithreaded program. The issue seen here is
that the child thread was attempting to grab a lock held by a
nonexistent thread, meaning that the child process simply deadlocked
causing the whole test to deadlock.

This commit moves the test to its own file with no threads which should
work.

5 years agoRollup merge of #62161 - GuillaumeGomez:add-missing-tryfrom-links, r=docs
Mark Rousskov [Wed, 3 Jul 2019 13:59:15 +0000 (09:59 -0400)]
Rollup merge of #62161 - GuillaumeGomez:add-missing-tryfrom-links, r=docs

Add missing links for TryFrom docs

r? @rust-lang/docs

5 years agoRollup merge of #62128 - ehuss:extra-filename-warning, r=matthewjasper
Mark Rousskov [Wed, 3 Jul 2019 13:59:13 +0000 (09:59 -0400)]
Rollup merge of #62128 - ehuss:extra-filename-warning, r=matthewjasper

Adjust warning of -C extra-filename with -o.

If `--emit` includes multiple unnamed outputs, and `-o` was specified, and `-C extra-filename` was specified, the compiler would warn that `-C extra-filename` was ignored, but this is not true.  The "adapting" of the filenames includes the extra-filename info.

Since this is a little convoluted and hard to follow, here is a little chart to summarize when running with `rustc foo.rs -o xyz -C extra-filename=asdf`

`--emit` | Result
---------|--------
`link` | `xyz` (extra-filename ignored)
`link,dep-info` | `xyzasdf`, `xyzasdf.d` (this PR removes the incorrect warning)

As to whether or not this behavior is the best choice is another question.

5 years agoRollup merge of #62064 - wizAmit:feature/chunks_exact_nth_back, r=scottmcm
Mark Rousskov [Wed, 3 Jul 2019 13:59:12 +0000 (09:59 -0400)]
Rollup merge of #62064 - wizAmit:feature/chunks_exact_nth_back, r=scottmcm

nth_back for chunks_exact

wip nth_back for chunks_exact

working nth_back for chunks exact

Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
r? @timvermeulen
r? @scottmcm

5 years agoRollup merge of #62021 - crlf0710:msvc_link_output_improve, r=alexcrichton
Mark Rousskov [Wed, 3 Jul 2019 13:59:10 +0000 (09:59 -0400)]
Rollup merge of #62021 - crlf0710:msvc_link_output_improve, r=alexcrichton

MSVC link output improve

Resolves #35785.

However i haven't come up with a idea to add test case for this :(

r? @retep998

5 years agoAuto merge of #61995 - eddyb:hir-sep-ptr, r=petrochenkov
bors [Wed, 3 Jul 2019 10:57:39 +0000 (10:57 +0000)]
Auto merge of #61995 - eddyb:hir-sep-ptr, r=petrochenkov

rustc: use a separate copy of P for HIR than for AST.

Note: this currently includes/is based on top of #61987.

Like #61968, but goes one step further and uses a separate `P<...>` for the HIR, with no `Clone`, or the ability to mutate after allocation.
There is still `into_inner`/`into_iter`, but they're only exposed for `hir::lowering`, and they would take more work to untangle.

r? @petrochenkov cc @rust-lang/compiler

5 years agoRevert changes to the standard library
Jeremy Stucki [Tue, 25 Jun 2019 17:36:30 +0000 (19:36 +0200)]
Revert changes to the standard library

Moved to its own PR

5 years agoAdd missing lifetime specifier
Jeremy Stucki [Mon, 24 Jun 2019 18:10:05 +0000 (20:10 +0200)]
Add missing lifetime specifier

5 years agoAdd missing lifetime specifier
Jeremy Stucki [Sun, 23 Jun 2019 20:32:23 +0000 (22:32 +0200)]
Add missing lifetime specifier

5 years agoAdd missing lifetime specifier
Jeremy Stucki [Sun, 23 Jun 2019 18:05:36 +0000 (20:05 +0200)]
Add missing lifetime specifier

5 years agoAdd missing lifetime specifier
Jeremy Stucki [Sun, 23 Jun 2019 14:11:52 +0000 (16:11 +0200)]
Add missing lifetime specifier

5 years agoRemove needless lifetimes
Jeremy Stucki [Fri, 21 Jun 2019 21:49:03 +0000 (23:49 +0200)]
Remove needless lifetimes

5 years agoRemove needless lifetimes
Jeremy Stucki [Fri, 21 Jun 2019 18:27:44 +0000 (20:27 +0200)]
Remove needless lifetimes

5 years agoRemove needless lifetimes
Jeremy Stucki [Fri, 21 Jun 2019 18:05:14 +0000 (20:05 +0200)]
Remove needless lifetimes

5 years agoRemove needless lifetimes
Jeremy Stucki [Fri, 21 Jun 2019 16:51:27 +0000 (18:51 +0200)]
Remove needless lifetimes

5 years agoRemove needless lifetimes
Jeremy Stucki [Fri, 21 Jun 2019 16:12:39 +0000 (18:12 +0200)]
Remove needless lifetimes

5 years agoRemove needless lifetimes
Jeremy Stucki [Fri, 21 Jun 2019 15:46:41 +0000 (17:46 +0200)]
Remove needless lifetimes

5 years agoFixed document bug, those replaced each other
Kohei Takahashi [Wed, 3 Jul 2019 06:59:40 +0000 (15:59 +0900)]
Fixed document bug, those replaced each other

Introduced by #58005

5 years agoAuto merge of #61775 - nikomatsakis:issue-56238-multiple-lifetimes-async-fn-region...
bors [Wed, 3 Jul 2019 03:47:47 +0000 (03:47 +0000)]
Auto merge of #61775 - nikomatsakis:issue-56238-multiple-lifetimes-async-fn-region-solver, r=MatthewJasper

generalize impl trait to permit multiple lifetime bounds

Generalizes the region solver to support "pick constraints". These have the form:

```
pick R0 from [R1..Rn]
```

where `R1..Rn` are called the "option regions". The idea is that `R0` must be equal to *some* region in the set `R1..Rn`. These constraints are then used to handle cases like this:

```rust
fn foo<'a, 'b>(...) -> impl Trait<'a, 'b> { .. }
```

The problem here is that every region R in the hidden type must be equal to *either* `'a` *or* `'b` (or `'static`) -- in the past, the only kinds of constraints we had were outlives constraints, and since `'a` and `'b` are unrelated, there was no outlives constraint we could issue that would enforce that (`R: 'a` and `R: 'b` are both too strict, for example). But now we can issue a pick constraint: `pick R from ['a, 'b]`.

In general, solving pick constraints is tricky. We integrate them into the solver as follows. In general, during the propagation phase, we are monotonically growing a set of inference regions. To handle a case like `pick R from [O...]`, where `O...` represents the option regions, we do the following:

- Look for all the *lower bounds* of the region R -- that is, every region LB such that `R: LB` must hold.
- Look for all the *upper bounds* of the region R -- that is, every region UB such that `UB: R` must hold.
- Let the *viable options* be each option region O such that `UB: O` and `O: LB` for each UB, LB bound.
- Find the *minimal viable option* M, where `O: M` holds for every option region O.

If there is such a *minimal viable option*, then we make `R: M`. (This may in turn influence other bits of inference.) If there is no minimal viable option, either because all options were eliminated or because none of the remaining options are minimal, we do nothing. Ultimately, if the pick constraint is not satisfied, an error is reported.

For this logic, we currently require that the option regions O are always lifetime parameters. To determine the bounds, we walk the various outlives edges that were otherwise introduced.

r? @matthewjasper
cc @cramertj

Fixes #56238

TODO:

- [ ] Error messages include region variable info sometimes, how to fix?
- [ ] Tests for bare `existential type`  and other impl Trait usage

5 years agoUse link attributes on extern "C" blocks with llvm-libuwind
Petr Hosek [Tue, 2 Jul 2019 00:32:43 +0000 (17:32 -0700)]
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.

5 years agoFix mismatching Kleene operators
Julien Cretin [Tue, 2 Jul 2019 22:37:25 +0000 (00:37 +0200)]
Fix mismatching Kleene operators

5 years agoMigrate compile-pass annotations to build-pass
Yuki Okushi [Tue, 2 Jul 2019 21:30:28 +0000 (06:30 +0900)]
Migrate compile-pass annotations to build-pass

5 years agoWhen possible without changing semantics, implement Iterator::last in terms of Double...
Kyle Huey [Tue, 2 Jul 2019 20:45:29 +0000 (13:45 -0700)]
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

5 years agoAuto merge of #61268 - michaelwoerister:stabilize-pgo, r=alexcrichton
bors [Tue, 2 Jul 2019 20:00:29 +0000 (20:00 +0000)]
Auto merge of #61268 - michaelwoerister:stabilize-pgo, r=alexcrichton

Stabilize support for Profile-guided Optimization

This PR makes profile-guided optimization available via the `-C profile-generate` / `-C profile-use` pair of commandline flags and adds end-user documentation for the feature to the [rustc book](https://doc.rust-lang.org/rustc/). The PR thus ticks the last two remaining checkboxes of the [stabilization tracking issue](https://github.com/rust-lang/rust/issues/59913).

From the tracking issue:
> Profile-guided optimization (PGO) is a common optimization technique for ahead-of-time compilers. It works by collecting data about a program's typical execution (e.g. probability of branches taken, typical runtime values of variables, etc) and then uses this information during program optimization for things like inlining decisions, machine code layout, or indirect call promotion.

If you are curious about how this can be used, there is a rendered version of the documentation this PR adds available [here](
https://github.com/michaelwoerister/rust/blob/stabilize-pgo/src/doc/rustc/src/profile-guided-optimization.md).

r? @alexcrichton
cc @rust-lang/compiler

5 years agofix ICE with delay-span-bug
Niko Matsakis [Tue, 2 Jul 2019 18:23:38 +0000 (14:23 -0400)]
fix ICE with delay-span-bug

5 years agoaddress nits
Niko Matsakis [Mon, 1 Jul 2019 21:54:57 +0000 (17:54 -0400)]
address nits

5 years agoUpdate src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-no-fg.rs
Niko Matsakis [Mon, 1 Jul 2019 21:53:21 +0000 (17:53 -0400)]
Update src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-no-fg.rs

Co-Authored-By: matthewjasper <mjjasper1@gmail.com>
5 years agoUpdate src/test/ui/async-await/multiple-lifetimes/elided.rs
Niko Matsakis [Mon, 1 Jul 2019 21:53:08 +0000 (17:53 -0400)]
Update src/test/ui/async-await/multiple-lifetimes/elided.rs

Co-Authored-By: matthewjasper <mjjasper1@gmail.com>
5 years agoUpdate src/test/ui/async-await/multiple-lifetimes/fn-ptr.rs
Niko Matsakis [Sat, 29 Jun 2019 10:52:47 +0000 (06:52 -0400)]
Update src/test/ui/async-await/multiple-lifetimes/fn-ptr.rs

Co-Authored-By: matthewjasper <mjjasper1@gmail.com>
5 years agoUpdate src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs
Niko Matsakis [Sat, 29 Jun 2019 10:52:35 +0000 (06:52 -0400)]
Update src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs

Co-Authored-By: matthewjasper <mjjasper1@gmail.com>
5 years agointroduce more tests covering `async fn` surface
Niko Matsakis [Tue, 25 Jun 2019 14:55:32 +0000 (10:55 -0400)]
introduce more tests covering `async fn` surface

5 years agomore nits + typos
Niko Matsakis [Mon, 24 Jun 2019 19:55:39 +0000 (15:55 -0400)]
more nits + typos

5 years agopass a parameter to enable impl Trait instead of a vec
Niko Matsakis [Mon, 24 Jun 2019 19:52:46 +0000 (15:52 -0400)]
pass a parameter to enable impl Trait instead of a vec

5 years agomore centril nits
Niko Matsakis [Mon, 24 Jun 2019 19:34:37 +0000 (15:34 -0400)]
more centril nits

5 years agoregion_constraints: nits
Niko Matsakis [Mon, 24 Jun 2019 19:21:36 +0000 (15:21 -0400)]
region_constraints: nits

5 years agoopaque_types: more nits
Niko Matsakis [Mon, 24 Jun 2019 19:21:25 +0000 (15:21 -0400)]
opaque_types: more nits

5 years agos/abstract_type_generics/opaque_type_generics/
Niko Matsakis [Mon, 24 Jun 2019 19:17:48 +0000 (15:17 -0400)]
s/abstract_type_generics/opaque_type_generics/

5 years agoopaque_types: various nits
Niko Matsakis [Mon, 24 Jun 2019 19:16:17 +0000 (15:16 -0400)]
opaque_types: various nits

5 years agocleanup formatting of comment and add attribution
Niko Matsakis [Mon, 24 Jun 2019 19:14:09 +0000 (15:14 -0400)]
cleanup formatting of comment and add attribution