]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoFix typo in libcore/intrinsics.rs
Taiki Endo [Wed, 10 Jul 2019 07:27:39 +0000 (16:27 +0900)]
Fix typo in libcore/intrinsics.rs

5 years agoAuto merge of #62555 - Centril:rollup-ti46adx, r=Centril
bors [Wed, 10 Jul 2019 05:21:43 +0000 (05:21 +0000)]
Auto merge of #62555 - Centril:rollup-ti46adx, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #61853 (Emit warning when trying to use PGO in conjunction with unwinding on …)
 - #62278 (Add Iterator::partition_in_place() and is_partitioned())
 - #62283 (Target::arch can take more than listed options)
 - #62393 (Fix pretty-printing of `$crate` (take 4))
 - #62474 (Prepare for LLVM 9 update)

Failed merges:

r? @ghost

5 years agoUse fold in Iterator::last
Chris Gregory [Sun, 7 Jul 2019 23:54:48 +0000 (16:54 -0700)]
Use fold in Iterator::last

Replace last impl with fold

5 years agoRollup merge of #62474 - nikic:update-llvm, r=alexcrichton
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:10 +0000 (05:14 +0200)]
Rollup merge of #62474 - nikic:update-llvm, r=alexcrichton

Prepare for LLVM 9 update

Main changes:

 * In preparation for opaque pointer types, the `byval` attribute now takes a type. As such, the argument type needs to be threaded through to the function/callsite attribute application logic.
 * On ARM the `+fp-only-sp` and `+d16` features have become `-fp64` and `-d32`. I've switched the target definitions to use the new names, but also added bidirectional emulation so either can be used on any LLVM version for backwards compatibility.
 * The datalayout can now specify function pointer alignment. In particular on ARM `Fi8` is specified, which means that function pointer alignment is independent of function alignment. I've added this to our datalayouts to match LLVM (which is something we check) and strip the fnptr alignment for older LLVM versions.
 * The fmul/fadd reductions now always respect the accumulator (including for unordered reductions), so we should pass the identity instead of undef.

Open issues:

 * https://reviews.llvm.org/D62106 causes linker errors with ld.bdf due to https://sourceware.org/bugzilla/show_bug.cgi?id=24784. To avoid this I've enabled `RelaxELFRelocations`, which results in a GOTPCRELX relocation for `__tls_get_addr` and avoids the issue. However, this is likely not acceptable because relax relocations are not supported by older linker versions. We may need an LLVM option to keep using PLT for `__tls_get_addr` despite `RtLibUseGOT`.

The corresponding llvm-project PR is https://github.com/rust-lang/llvm-project/pull/19.

r? @ghost

5 years agoRollup merge of #62393 - petrochenkov:notto-disu, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:09 +0000 (05:14 +0200)]
Rollup merge of #62393 - petrochenkov:notto-disu, r=Mark-Simulacrum

Fix pretty-printing of `$crate` (take 4)

Pretty-print `$crate` as `crate` or `crate_name` in unstructured tokens like `a $crate c` in `foo!(a $crate c)`, but only if those tokens are printed as a part of AST pretty-printing, rather than as a standalone token stream.

Fixes https://github.com/rust-lang/rust/issues/62325
Previous iterations - https://github.com/rust-lang/rust/pull/56647, https://github.com/rust-lang/rust/pull/57155, https://github.com/rust-lang/rust/pull/57915.

5 years agoRollup merge of #62283 - fintelia:patch-5, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:07 +0000 (05:14 +0200)]
Rollup merge of #62283 - fintelia:patch-5, r=Mark-Simulacrum

Target::arch can take more than listed options

A list of options in a comment like this is almost guaranteed to become out of date: right now it is missing "riscv32" and "riscv64" and perhaps other architectures as well.

5 years agoRollup merge of #62278 - cuviper:iter-partition, r=alexcrichton
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:06 +0000 (05:14 +0200)]
Rollup merge of #62278 - cuviper:iter-partition, r=alexcrichton

Add Iterator::partition_in_place() and is_partitioned()

`partition_in_place()` swaps `&mut T` items in-place to satisfy the
predicate, so all `true` items precede all `false` items. This requires
a `DoubleEndedIterator` so we can search from front and back for items
that need swapping.

`is_partitioned()` checks whether the predicate is already satisfied.

5 years agoRollup merge of #61853 - EricRahm:use_warning, r=varkor
Mazdak Farrokhzad [Wed, 10 Jul 2019 03:14:04 +0000 (05:14 +0200)]
Rollup merge of #61853 - EricRahm:use_warning, r=varkor

Emit warning when trying to use PGO in conjunction with unwinding on …

…Windows.

This reduces the error introduced for #61002 to just a warning.

5 years agoAuto merge of #62548 - ehuss:update-cargo, r=alexcrichton
bors [Wed, 10 Jul 2019 01:53:04 +0000 (01:53 +0000)]
Auto merge of #62548 - ehuss:update-cargo, r=alexcrichton

Update cargo

Update cargo

12 commits in 4c1fa54d10f58d69ac9ff55be68e1b1c25ecb816..677a180f4c8ca1dcef594f68dd0e63e4f08621f5
2019-06-24 11:24:18 +0000 to 2019-07-08 13:43:02 +0000
- Update dependencies (rust-lang/cargo#7106)
- Fix overwriting .d file for binary with dSYM on apple targets. (rust-lang/cargo#7057)
- Update changelog. (rust-lang/cargo#7102)
- Revert "Fix 'getting started' internal links" (rust-lang/cargo#7099)
- Bump to 0.39.0 (rust-lang/cargo#7100)
- Update dependency.rs (rust-lang/cargo#7098)
- Typo (rust-lang/cargo#7097)
- Fix 'getting started' internal links (rust-lang/cargo#7093)
- Fix misleading comment in testsuite (rust-lang/cargo#7090)
- improve uncommitted changes cargo-package message (rust-lang/cargo#7083)
- Clean environment when git-fetch-with-cli is used. (rust-lang/cargo#7082)
- Fix exponentiality in depend_on_deps_of_deps. (rust-lang/cargo#7062)

5 years agoUpdate cargo
Eric Huss [Tue, 9 Jul 2019 23:47:45 +0000 (16:47 -0700)]
Update cargo

5 years agoUpdate cargo-vendor usage
Eric Huss [Tue, 9 Jul 2019 23:12:41 +0000 (16:12 -0700)]
Update cargo-vendor usage

5 years agoTracking issue 62544 for iter_is_partitioned
Josh Stone [Tue, 9 Jul 2019 22:18:33 +0000 (15:18 -0700)]
Tracking issue 62544 for iter_is_partitioned

5 years agoTracking issue 62543 for iter_partition_in_place
Josh Stone [Tue, 9 Jul 2019 22:17:47 +0000 (15:17 -0700)]
Tracking issue 62543 for iter_partition_in_place

5 years agoAuto merge of #62542 - Centril:rollup-5mpb8tu, r=Centril
bors [Tue, 9 Jul 2019 22:02:58 +0000 (22:02 +0000)]
Auto merge of #62542 - Centril:rollup-5mpb8tu, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #62417 (Fix ICEs when `Self` is used in type aliases)
 - #62450 (Raise the default recursion limit to 128)
 - #62470 (Prevent shrinking of "crate select" element on Firefox)
 - #62515 (cli: make help output for -l and -L consistent)
 - #62520 (Regression test for issue 42574.)
 - #62526 (normalize use of backticks in compiler messages for libsyntax/feature_gate.rs)
 - #62527 (clarify that debug_assert does not completely omits the code)
 - #62535 (ci: Configure $CI_JOB_NAME correctly)
 - #62541 (Add spastorino for rustc-guide toolstate)

Failed merges:

r? @ghost

5 years agoEmit warning when trying to use PGO in conjunction with unwinding on Windows.
Eric Rahm [Fri, 14 Jun 2019 17:58:39 +0000 (10:58 -0700)]
Emit warning when trying to use PGO in conjunction with unwinding on Windows.

5 years agoAdjust codegen tests for DISPFlagMainSubprogram
Nikita Popov [Sun, 7 Jul 2019 18:22:56 +0000 (20:22 +0200)]
Adjust codegen tests for DISPFlagMainSubprogram

5 years agoFix float add/mul reduction codegen
Nikita Popov [Sun, 7 Jul 2019 17:08:40 +0000 (19:08 +0200)]
Fix float add/mul reduction codegen

The accumulator is now respected for unordered reductions.

5 years agoStrip function pointer alignment for older LLVM versions
Nikita Popov [Sun, 7 Jul 2019 16:41:28 +0000 (18:41 +0200)]
Strip function pointer alignment for older LLVM versions

5 years agoAdd function pointer alignment to ARM/Thumb data layout
Nikita Popov [Sun, 7 Jul 2019 16:18:02 +0000 (18:18 +0200)]
Add function pointer alignment to ARM/Thumb data layout

5 years agoUse new feature names in target feature lists
Nikita Popov [Sun, 7 Jul 2019 16:10:12 +0000 (18:10 +0200)]
Use new feature names in target feature lists

5 years agoTranslate target features for LLVM 9
Nikita Popov [Sun, 7 Jul 2019 15:44:00 +0000 (17:44 +0200)]
Translate target features for LLVM 9

5 years agoPass type to byval attributes
Nikita Popov [Sat, 6 Jul 2019 19:52:25 +0000 (21:52 +0200)]
Pass type to byval attributes

5 years agoPass GUIDPreservedSymbols to thinLTOResolvePrevailingInIndex()
Nikita Popov [Sat, 6 Jul 2019 17:02:48 +0000 (19:02 +0200)]
Pass GUIDPreservedSymbols to thinLTOResolvePrevailingInIndex()

5 years agoAdd a test case with `$crate` from other crate
Vadim Petrochenkov [Tue, 9 Jul 2019 19:21:55 +0000 (22:21 +0300)]
Add a test case with `$crate` from other crate

5 years agoUnit test Iterator::partition_in_place and is_partitioned
Josh Stone [Tue, 9 Jul 2019 19:39:19 +0000 (12:39 -0700)]
Unit test Iterator::partition_in_place and is_partitioned

5 years agoReturn the true count from partition_in_place
Josh Stone [Tue, 9 Jul 2019 01:25:19 +0000 (18:25 -0700)]
Return the true count from partition_in_place

5 years agoRename partition_mut to partition_in_place
Josh Stone [Mon, 1 Jul 2019 22:34:53 +0000 (15:34 -0700)]
Rename partition_mut to partition_in_place

5 years agoCapitalize example comment
Josh Stone [Mon, 1 Jul 2019 22:17:39 +0000 (15:17 -0700)]
Capitalize example comment

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
5 years agoAdd Iterator::partition_mut() and is_partitioned()
Josh Stone [Mon, 1 Jul 2019 18:49:44 +0000 (11:49 -0700)]
Add Iterator::partition_mut() and is_partitioned()

`partition_mut()` swaps `&mut T` items in-place to satisfy the
predicate, so all `true` items precede all `false` items. This requires
a `DoubleEndedIterator` so we can search from front and back for items
that need swapping.

`is_partitioned()` checks whether the predicate is already satisfied.

5 years agoResolve `$crate` in all hygienic contexts for pretty-pringing
Vadim Petrochenkov [Fri, 5 Jul 2019 00:09:24 +0000 (03:09 +0300)]
Resolve `$crate` in all hygienic contexts for pretty-pringing

Stop visiting AST to discover those contexts, just iterate through hygiene data instead

5 years agoPretty-print `$crate` as `crate`/`::my_crate` in tokens
Vadim Petrochenkov [Wed, 3 Jul 2019 23:37:34 +0000 (02:37 +0300)]
Pretty-print `$crate` as `crate`/`::my_crate` in tokens

...but only if those tokens are printed from inside of AST pretty-printing.

5 years agoAdd a test for `$crate` inside macro invocation
Vadim Petrochenkov [Wed, 3 Jul 2019 22:28:24 +0000 (01:28 +0300)]
Add a test for `$crate` inside macro invocation

5 years agoRollup merge of #62541 - mark-i-m:patch-1, r=Centril
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:59 +0000 (21:01 +0200)]
Rollup merge of #62541 - mark-i-m:patch-1, r=Centril

Add spastorino for rustc-guide toolstate

cc @spastorino

r? @Centril

5 years agoRollup merge of #62535 - alexcrichton:ci-job-name, r=pietroalbini
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:58 +0000 (21:01 +0200)]
Rollup merge of #62535 - alexcrichton:ci-job-name, r=pietroalbini

ci: Configure $CI_JOB_NAME correctly

Looks like some env vars were tweaked on Azure's side of things, so
update how we configure `CI_JOB_NAME`.

5 years agoRollup merge of #62527 - matklad:debug-assert, r=Centril
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:56 +0000 (21:01 +0200)]
Rollup merge of #62527 - matklad:debug-assert, r=Centril

clarify that debug_assert does not completely omits the code

TIL that debug_assert is implemented using `if cfg!(debug_assertions)`
rather than `#[cfg(debug_assertions)]`. This means one can not use API
gated with `#[cfg(debug_assertions)]` in `debug_assert` family of
macros.

5 years agoRollup merge of #62526 - fakenine:normalize_use_of_backticks_compiler_messages_p4...
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:55 +0000 (21:01 +0200)]
Rollup merge of #62526 - fakenine:normalize_use_of_backticks_compiler_messages_p4, r=Centril

normalize use of backticks in compiler messages for libsyntax/feature_gate.rs

https://github.com/rust-lang/rust/issues/60532

5 years agoRollup merge of #62520 - pnkfelix:add-test-for-42574, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:53 +0000 (21:01 +0200)]
Rollup merge of #62520 - pnkfelix:add-test-for-42574, r=alexcrichton

Regression test for issue 42574.

Cc #42574.

I'm not going to say this *closes* that issue yet, for two reasons:

 1. I am still confused about some aspects of the behavior we are observing that bug

 2. The "fix" to the diagnostic relies on full NLL (`#![feature(nll)]`); migration mode still has a subpar diagnostic.

5 years agoRollup merge of #62515 - tshepang:consistent, r=Centril
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:52 +0000 (21:01 +0200)]
Rollup merge of #62515 - tshepang:consistent, r=Centril

cli: make help output for -l and -L consistent

5 years agoRollup merge of #62470 - dima74:patch-1, r=GuillaumeGomez
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:51 +0000 (21:01 +0200)]
Rollup merge of #62470 - dima74:patch-1, r=GuillaumeGomez

Prevent shrinking of "crate select" element on Firefox

This fixes #60368

5 years agoRollup merge of #62450 - nagisa:reclimit, r=pnkfelix
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:49 +0000 (21:01 +0200)]
Rollup merge of #62450 - nagisa:reclimit, r=pnkfelix

Raise the default recursion limit to 128

The previous limit of 64 is being (just) barely hit by genuine code out there, which is causing issues like https://github.com/rust-lang/rust/issues/62059 to rear their end.

Ideally, we wouldn’t have such arbitrary limits at all, but while we do, it makes a lot of sense to just raise this limit whenever genuine use-cases end up hitting it.

r? @pnkfelix

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

5 years agoRollup merge of #62417 - alexreg:fix-self-in-type-alias, r=pnkfelix
Mazdak Farrokhzad [Tue, 9 Jul 2019 19:01:48 +0000 (21:01 +0200)]
Rollup merge of #62417 - alexreg:fix-self-in-type-alias, r=pnkfelix

Fix ICEs when `Self` is used in type aliases

I think it is right just to disallow this at resolution stage rather than let typeck produce a cyclic error. This is in line with previous behaviour. There was probably no need at all for the change that introduced this bug in #57428, so I've simply reversed it.

Fixes #62263, #62364, #62305.

r? @eddyb

5 years agoAdd spastorino for rustc-guide toolstate
Who? Me?! [Tue, 9 Jul 2019 18:58:32 +0000 (13:58 -0500)]
Add spastorino for rustc-guide toolstate

5 years agoAuto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakis
bors [Tue, 9 Jul 2019 18:35:12 +0000 (18:35 +0000)]
Auto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakis

Normalize projections appearing in `impl Trait`

Fixes #60414

This does not try to do the same for `existential type`s (which have the same bug), since that always seems to lead to cycle errors.

5 years agoApply suggestions from code review
Aleksey Kladov [Tue, 9 Jul 2019 16:10:22 +0000 (19:10 +0300)]
Apply suggestions from code review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
5 years agoci: Configure $CI_JOB_NAME correctly
Alex Crichton [Tue, 9 Jul 2019 16:09:13 +0000 (09:09 -0700)]
ci: Configure $CI_JOB_NAME correctly

Looks like some env vars were tweaked on Azure's side of things, so
update how we configure `CI_JOB_NAME`.

5 years agoAdded a test for coherence when a generic type param has a default value from an...
Ohad Ravid [Tue, 4 Jun 2019 15:22:03 +0000 (17:22 +0200)]
Added a test for coherence when a generic type param has a default value from an associated type

5 years agodoc(ptr): add example for {read,write}_unaligned
Freyskeyd [Mon, 8 Jul 2019 14:03:29 +0000 (16:03 +0200)]
doc(ptr): add example for {read,write}_unaligned

Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
5 years agoAdded comment explaining purpose of `search_for_adt_without_structural_match`.
Felix S. Klock II [Tue, 9 Jul 2019 14:54:19 +0000 (16:54 +0200)]
Added comment explaining purpose of `search_for_adt_without_structural_match`.

5 years agoAuto merge of #62233 - matthewjasper:exit-arm-scopes, r=pnkfelix
bors [Tue, 9 Jul 2019 13:10:31 +0000 (13:10 +0000)]
Auto merge of #62233 - matthewjasper:exit-arm-scopes, r=pnkfelix

Exit arm scopes

Due to a bug in the HIR CFG construction, borrows for arm scopes were incorrectly leaking into other arms.
This PR also includes some drive-by improvements to `-Zunpretty=hir,identified` that would have been helpful while investigating this.

Closes #62107

5 years agoclarify that debug_assert does not completely omits the code
Aleksey Kladov [Tue, 9 Jul 2019 12:26:18 +0000 (15:26 +0300)]
clarify that debug_assert does not completely omits the code

TIL that debug_assert is implemented using `if cfg!(debug_assertions)`
rather than `#[cfg(debug_assertions)]`. This means one can not use API
gated with `#[cfg(debug_assertions)]` in `debug_assert` family of
macros.

5 years agonormalize use of backticks in compiler messages for libsyntax/feature_gate
Samy Kacimi [Tue, 9 Jul 2019 09:32:08 +0000 (11:32 +0200)]
normalize use of backticks in compiler messages for libsyntax/feature_gate

https://github.com/rust-lang/rust/issues/60532

5 years agorewrite the test to workaround #51525
Niko Matsakis [Tue, 9 Jul 2019 10:57:52 +0000 (06:57 -0400)]
rewrite the test to workaround #51525

5 years agoRegression test for issue 42574.
Felix S. Klock II [Tue, 9 Jul 2019 09:56:01 +0000 (11:56 +0200)]
Regression test for issue 42574.

5 years agoAuto merge of #62463 - Disasm:riscv-lto, r=alexcrichton
bors [Tue, 9 Jul 2019 09:50:51 +0000 (09:50 +0000)]
Auto merge of #62463 - Disasm:riscv-lto, r=alexcrichton

Update LLVM: apply patch necessary for ThinLTO on RISC-V

This patch allows [using inlined assembly operations](https://github.com/rust-embedded/cortex-m/issues/139) on stable Rust with the help of ThinLTO.

5 years agoAuto merge of #62460 - RalfJung:llvm-null, r=eddyb
bors [Tue, 9 Jul 2019 06:20:44 +0000 (06:20 +0000)]
Auto merge of #62460 - RalfJung:llvm-null, r=eddyb

 Handle null from LLVMRustGetSectionName

As part of https://github.com/rust-lang/rust/pull/58783 and https://github.com/rust-lang/rust/pull/62103, this incorrect use of a NULL pointer was found in the interface to LLVM. That PR is stuck with some linker issues, but there is no reason the soundness fix should have to wait for that.

5 years agoAuto merge of #62511 - Centril:rollup-ojzb35x, r=Centril
bors [Tue, 9 Jul 2019 02:53:20 +0000 (02:53 +0000)]
Auto merge of #62511 - Centril:rollup-ojzb35x, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #60458 (Add key and value methods to DebugMap)
 - #62090 (typeck: merge opaque type inference logic)
 - #62403 (Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait)
 - #62494 (Remove unused dependencies)

Failed merges:

r? @ghost

5 years agoRollup merge of #62494 - sinkuu:unused_deps, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:40 +0000 (04:52 +0200)]
Rollup merge of #62494 - sinkuu:unused_deps, r=alexcrichton

Remove unused dependencies

5 years agoRollup merge of #62403 - SimonSapin:concat, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:38 +0000 (04:52 +0200)]
Rollup merge of #62403 - SimonSapin:concat, r=alexcrichton

Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait

Before this change `SliceConcatExt` was an unstable extension trait with stable methods. It was in the libstd prelude, so that its methods could be used on the stable channel.

This replaces it with inherent methods, which can be used without any addition to the prelude. Since the methods are stable and very generic (with for example a return type that depends on the types of parameters), an helper trait is still needed. But now that trait does not need to be in scope for the methods to be used.

Removing this depedency on the libstd prelude allows the methods to be used in `#![no_std]` crate that use liballoc, which does not have its own implicitly-imported prelude.

5 years agoRollup merge of #62090 - davidtwco:ice-async-await-out-of-range-substitution, r=nikom...
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:37 +0000 (04:52 +0200)]
Rollup merge of #62090 - davidtwco:ice-async-await-out-of-range-substitution, r=nikomatsakis

typeck: merge opaque type inference logic

Fixes #55872. See [relevant Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async-foundations/topic/type.20parameter.20out.20of.20range.20.2355872).

r? @nikomatsakis

5 years agoRollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichton
Mazdak Farrokhzad [Tue, 9 Jul 2019 02:52:35 +0000 (04:52 +0200)]
Rollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichton

Add key and value methods to DebugMap

Implementation PR for an active (not approved) RFC: https://github.com/rust-lang/rfcs/pull/2696.

Add two new methods to `std::fmt::DebugMap` for writing the key and value part of a map entry separately:

```rust
impl<'a, 'b: 'a> DebugMap<'a, 'b> {
    pub fn key(&mut self, key: &dyn Debug) -> &mut Self;
    pub fn value(&mut self, value: &dyn Debug) -> &mut Self;
}
```

I want to do this so that I can write a `serde::Serializer` that forwards to our format builders, so that any `T: Serialize` can also be treated like a `T: Debug`.

5 years agoadd feature to docs
Ashley Mannix [Mon, 8 Jul 2019 22:30:20 +0000 (08:30 +1000)]
add feature to docs

5 years agoAuto merge of #61224 - aloucks:drain_filter, r=Gankro
bors [Mon, 8 Jul 2019 22:03:26 +0000 (22:03 +0000)]
Auto merge of #61224 - aloucks:drain_filter, r=Gankro

Prevent Vec::drain_filter from double dropping on panic

Fixes: #60977
The changes in this PR prevent leaking and double-panicking in addition to double-drop.

Tracking issue: #43244

5 years agoregression test.
Felix S. Klock II [Mon, 8 Jul 2019 15:04:02 +0000 (17:04 +0200)]
regression test.

5 years agoAvoid infinite looping in `print_def_path`.
Felix S. Klock II [Mon, 8 Jul 2019 20:26:15 +0000 (22:26 +0200)]
Avoid infinite looping in `print_def_path`.

5 years agoRemove unused dependencies
Shotaro Yamada [Mon, 8 Jul 2019 15:17:42 +0000 (00:17 +0900)]
Remove unused dependencies

5 years agoAuto merge of #62473 - timvermeulen:is_sorted_by_key, r=scottmcm
bors [Mon, 8 Jul 2019 12:03:06 +0000 (12:03 +0000)]
Auto merge of #62473 - timvermeulen:is_sorted_by_key, r=scottmcm

Only call the closure parameter of Iterator::is_sorted_by_key once per item

See https://github.com/rust-lang/rust/issues/53485#issuecomment-472314004.

This changes `Iterator::is_sorted_by_key` to only call the given closure once for each item, which allows us to pass the items to the closure by value instead of by reference.

**Important**: `is_sorted_by_key` for slices and slice iterators is now no longer implemented in terms of the custom `slice::Iter::is_sorted_by` implementation. It's a trade-off: we could forward `slice::Iter::is_sorted_by_key` to it directly for potential SIMD benefits, but that would mean that the closure is potentially called twice for (almost) every element of the slice.

5 years agoAdded test explicitly testing that this PR continues to handle empty arrays in same...
Felix S. Klock II [Mon, 8 Jul 2019 11:40:08 +0000 (13:40 +0200)]
Added test explicitly testing that this PR continues to handle empty arrays in same manner as before.

5 years agoRegression tests and updates to existing tests.
Felix S. Klock II [Wed, 3 Jul 2019 14:54:08 +0000 (16:54 +0200)]
Regression tests and updates to existing tests.

The regression tests explore:
  (direct | indirect | doubly-indirect | unsafe) x (embedded | param):

where:
  embedded: `struct Wrapper(... NoDerive ...);`
  param:    `struct Wrapper<X>(... X ...);`

  direct:          `const A:     Wrapper<...> = Wrapper(NoDerive);`
  indirect:        `const A: & & Wrapper<...> = Wrapper(NoDerive)`
  doubly-indirect: `const A: & & Wrapper<...> = & & Wrapper(& & NoDerive)`
  unsafe:          `const A: UnsafeWrap<...>  = UnsafeWrap(std::ptr::null())`

5 years agoRewrite with future-compat lint for indirect pattern omitting
Felix S. Klock II [Wed, 3 Jul 2019 14:53:42 +0000 (16:53 +0200)]
Rewrite with future-compat lint for indirect pattern omitting
`#[structural_match]`.

Outline of changes:

 * Recur as deeply as necessary when searching for `#[structural_match]`.

 * `#[structural_match]`: handle case of `const A: & &Wrap(NoDerive)`
   by including the fields of an ADT during traversal of input
   type. (We continue to not traverse the substs of an ADT, though, so
   that we continue to handle `PhantomData<NoDerive>` and `*NoDerive`
   properly.)

 * Refactored code to use `match` instead of `if let`. This ends up
   *with less* right-ward drift by moving the handling of the main
   *`ty::Adt` case *outside* the match.

 * Using lint (rather than hard error) mmeans we need to check that
   type is `PartialEq` to avoid ICE'ing the compiler in scneario where
   MIR codegen dispatches to `PartialEq::eq`. Added said check, and
   fatal error in that case.

5 years agofuture-compat lint for newly handled cases of `#[structural_match]`.
Felix S. Klock II [Mon, 8 Jul 2019 09:11:41 +0000 (11:11 +0200)]
future-compat lint for newly handled cases of `#[structural_match]`.

5 years agoNote that `eq_trait` denotes `trait PartialEq`, not `Eq`, so you don't have to go...
Felix S. Klock II [Mon, 8 Jul 2019 08:58:58 +0000 (10:58 +0200)]
Note that `eq_trait` denotes `trait PartialEq`, not `Eq`, so you don't have to go to trait def to double-check.

5 years agoAuto merge of #62366 - lzutao:feature/float-from-to-bytes, r=SimonSapin
bors [Mon, 8 Jul 2019 08:39:56 +0000 (08:39 +0000)]
Auto merge of #62366 - lzutao:feature/float-from-to-bytes, r=SimonSapin

Add float conversions to and from bytes

Rework of #58756. Address https://github.com/rust-lang/rust/pull/58756#issuecomment-488385889.

Fixes #57492.

r? @SimonSapin

5 years agoAdd documentation to float conversion methods
Lzu Tao [Thu, 4 Jul 2019 09:11:15 +0000 (09:11 +0000)]
Add documentation to float conversion methods

5 years agoAdd float conversions to and from bytes
Tobias Bucher [Tue, 26 Feb 2019 15:47:33 +0000 (16:47 +0100)]
Add float conversions to and from bytes

Use the same API as for integers.

Fixes #57492.

5 years agoAuto merge of #62485 - Centril:rollup-gg3it1u, r=Centril
bors [Mon, 8 Jul 2019 01:32:50 +0000 (01:32 +0000)]
Auto merge of #62485 - Centril:rollup-gg3it1u, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62356 (Implement Option::contains and Result::contains)
 - #62462 (Document `while` keyword)
 - #62472 (Normalize use of backticks in compiler messages p2)
 - #62477 (Re-add bootstrap attribute to libunwind for llvm-libunwind feature)
 - #62478 (normalize use of backticks for compiler messages in librustc_codegen)

Failed merges:

r? @ghost

5 years agoRollup merge of #62478 - fakenine:normalize_use_of_backticks_compiler_messages_p3...
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:58 +0000 (02:40 +0200)]
Rollup merge of #62478 - fakenine:normalize_use_of_backticks_compiler_messages_p3, r=Centril

normalize use of backticks for compiler messages in librustc_codegen

https://github.com/rust-lang/rust/issues/60532

5 years agoRollup merge of #62477 - petrhosek:unwind-bootstrap, r=cramertj
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:57 +0000 (02:40 +0200)]
Rollup merge of #62477 - petrhosek:unwind-bootstrap, r=cramertj

Re-add bootstrap attribute to libunwind for llvm-libunwind feature

This was removed in 8a7dded, but since #62286 hasn't yet made it into
beta, this is breaking the build with llvm-libunwind feature enabled.

Furthemore, restrict the link attribute to Fuchsia and Linux, matching
the logic in build.rs since llvm-libunwind feature isn't yet supported
on other systems.

5 years agoRollup merge of #62472 - fakenine:normalize_use_of_backticks_compiler_messages_p2...
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:56 +0000 (02:40 +0200)]
Rollup merge of #62472 - fakenine:normalize_use_of_backticks_compiler_messages_p2, r=Centril

Normalize use of backticks in compiler messages p2

normalize use of backticks in compiler messages for librustc_typecheck

https://github.com/rust-lang/rust/issues/60532

5 years agoRollup merge of #62462 - JohnTitor:document-while, r=Centril
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:54 +0000 (02:40 +0200)]
Rollup merge of #62462 - JohnTitor:document-while, r=Centril

Document `while` keyword

This is a rework of #60761.
Closes #60736

r? @dtolnay

5 years agoRollup merge of #62356 - soc:topic/contains, r=Centril
Mazdak Farrokhzad [Mon, 8 Jul 2019 00:40:53 +0000 (02:40 +0200)]
Rollup merge of #62356 - soc:topic/contains, r=Centril

Implement Option::contains and Result::contains

This increases consistency with other common data structures.

5 years agoadd key and value methods to DebugMap
Ashley Mannix [Wed, 1 May 2019 07:19:41 +0000 (17:19 +1000)]
add key and value methods to DebugMap

5 years agonormalize use of backticks for compiler messages in librustc_codegen
Samy Kacimi [Sun, 7 Jul 2019 21:14:41 +0000 (23:14 +0200)]
normalize use of backticks for compiler messages in librustc_codegen

https://github.com/rust-lang/rust/issues/60532

5 years agoRe-add bootstrap attribute to libunwind for llvm-libunwind feature
Petr Hosek [Sun, 7 Jul 2019 22:45:04 +0000 (15:45 -0700)]
Re-add bootstrap attribute to libunwind for llvm-libunwind feature

This was removed in 8a7dded, but since #62286 hasn't yet made it into
beta, this is breaking the build with llvm-libunwind feature enabled.

Furthemore, restrict the link attribute to Fuchsia and Linux, matching
the logic in build.rs since llvm-libunwind feature isn't yet supported
on other systems.

5 years agoAuto merge of #62026 - mati865:deps, r=alexcrichton
bors [Sun, 7 Jul 2019 22:03:54 +0000 (22:03 +0000)]
Auto merge of #62026 - mati865:deps, r=alexcrichton

Final nail in `rand 0.4` coffin

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

5 years agoClarify double-drop comment
Aaron Loucks [Sun, 7 Jul 2019 20:36:19 +0000 (16:36 -0400)]
Clarify double-drop comment

5 years agoUpdate phf to get rid of rand 0.4
Mateusz Mikuła [Fri, 21 Jun 2019 11:14:56 +0000 (13:14 +0200)]
Update phf to get rid of rand 0.4

5 years agoOnly call the closure parameter of Iterator::is_sorted_by_key once per item
Tim Vermeulen [Sun, 7 Jul 2019 18:46:38 +0000 (20:46 +0200)]
Only call the closure parameter of Iterator::is_sorted_by_key once per item

5 years agoAuto merge of #62435 - scottmcm:constrained-array-impls, r=centril
bors [Sun, 7 Jul 2019 18:37:08 +0000 (18:37 +0000)]
Auto merge of #62435 - scottmcm:constrained-array-impls, r=centril

Use const generics for array impls [part 1]

Part 1 of #61415, following the plan in https://github.com/rust-lang/rust/issues/61415#issuecomment-497922482

Found a way that works 🙃

5 years agoUse const generics for array impls, restricted to 0..=32
Scott McMurray [Sat, 6 Jul 2019 06:59:59 +0000 (23:59 -0700)]
Use const generics for array impls, restricted to 0..=32

- uses a never-stable core::array::LengthAtMost32 to bound the impls
- includes a custom error message to avoid mentioning LengthAtMost32 too often
- doesn't use macros for the slice implementations to avoid #62433

5 years agoRemove while loop in DrainFilter::drop and add additional docs
Aaron Loucks [Sun, 7 Jul 2019 17:26:06 +0000 (13:26 -0400)]
Remove while loop in DrainFilter::drop and add additional docs

5 years agocli: make help output for -l and -L consistent
Tshepang Lekhonkhobe [Sat, 6 Jul 2019 03:30:15 +0000 (05:30 +0200)]
cli: make help output for -l and -L consistent

5 years agonormalize use of backticks in compiler messages for librustc_typecheck
Samy Kacimi [Sun, 7 Jul 2019 09:37:34 +0000 (11:37 +0200)]
normalize use of backticks in compiler messages for librustc_typecheck

https://github.com/rust-lang/rust/issues/60532

5 years agoPrevent shrinking of "crate select" element on Firefox
Dmitry Murzin [Sun, 7 Jul 2019 15:46:24 +0000 (18:46 +0300)]
Prevent shrinking of "crate select" element on Firefox

5 years agoAuto merge of #62467 - Centril:rollup-083tn7t, r=Centril
bors [Sun, 7 Jul 2019 15:00:47 +0000 (15:00 +0000)]
Auto merge of #62467 - Centril:rollup-083tn7t, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #61883 (`non_ascii_idents` lint (part of RFC 2457))
 - #62042 (Support stability and deprecation checking for all macros)
 - #62213 (rustdoc: set cfg(doctest) when collecting doctests)
 - #62286 (Check if the archive has already been added to avoid duplicates)

Failed merges:

r? @ghost

5 years agoRollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertj
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:20 +0000 (17:00 +0200)]
Rollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertj

Check if the archive has already been added to avoid duplicates

This avoids adding archives multiple times, which results in duplicate
objects in the resulting rlib, leading to symbol collision and link
failures. This could happen when crate contains multiple link attributes
that all reference the same archive.

5 years agoRollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:18 +0000 (17:00 +0200)]
Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez

rustdoc: set cfg(doctest) when collecting doctests

Note: This PR builds on top of https://github.com/rust-lang/rust/pull/61199; only the last commit is specific to this PR.

As discussed in https://github.com/rust-lang/rust/pull/61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once https://github.com/rust-lang/rust/pull/61351 lands.)

Tracking issue: https://github.com/rust-lang/rust/issues/62210

5 years agoRollup merge of #62042 - petrochenkov:macstab, r=matthewjasper
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:17 +0000 (17:00 +0200)]
Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasper

Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes https://github.com/rust-lang/rust/issues/34079
Fixes https://github.com/rust-lang/rust/issues/49912
Unblocks https://github.com/rust-lang/rust/pull/62086
Unblocks https://github.com/rust-lang/rust/pull/61000

5 years agoRollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:15 +0000 (17:00 +0200)]
Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth

`non_ascii_idents` lint (part of RFC 2457)

RFC 2457 [declares](https://github.com/rust-lang/rfcs/blob/121bbeff500c3274cea22c7e0ca176274d592646/text/2457-non-ascii-idents.md): "A `non_ascii_idents` lint is added to the compiler. This lint is allow by default."

(Part of #55467.)

r? @Manishearth

5 years agoImplement Option::contains, Result::contains and Result::contains_err
Simon Ochsenreither [Wed, 3 Jul 2019 23:38:22 +0000 (01:38 +0200)]
Implement Option::contains, Result::contains and Result::contains_err

This increases consistency with other common data structures.

5 years agoOnly omit StorageLive/Dead for variable that are never initialized
Matthew Jasper [Sun, 7 Jul 2019 14:04:43 +0000 (15:04 +0100)]
Only omit StorageLive/Dead for variable that are never initialized

With `feature(never_type)`, it's not guaranteed that any variable with
type `!` isn't ever assigned to.