Commit Graph

96145 Commits

Author SHA1 Message Date
Josh Stone
60f1449b61 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.
2019-07-09 12:39:25 -07:00
Vadim Petrochenkov
3997507786 Resolve $crate in all hygienic contexts for pretty-pringing
Stop visiting AST to discover those contexts, just iterate through hygiene data instead
2019-07-09 22:17:44 +03:00
Vadim Petrochenkov
4344a90308 Pretty-print $crate as crate/::my_crate in tokens
...but only if those tokens are printed from inside of AST pretty-printing.
2019-07-09 22:17:44 +03:00
Vadim Petrochenkov
7aaf0de700 Add a test for $crate inside macro invocation 2019-07-09 22:17:44 +03:00
Mazdak Farrokhzad
e8cf6146a8
Rollup merge of #62541 - mark-i-m:patch-1, r=Centril
Add spastorino for rustc-guide toolstate

cc @spastorino

r? @Centril
2019-07-09 21:01:59 +02:00
Mazdak Farrokhzad
9243c28d50
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`.
2019-07-09 21:01:58 +02:00
Mazdak Farrokhzad
8d0243a01e
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.
2019-07-09 21:01:56 +02:00
Mazdak Farrokhzad
c57a223f15
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
2019-07-09 21:01:55 +02:00
Mazdak Farrokhzad
e6f68a93b3
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.
2019-07-09 21:01:53 +02:00
Mazdak Farrokhzad
8e793439a4
Rollup merge of #62515 - tshepang:consistent, r=Centril
cli: make help output for -l and -L consistent
2019-07-09 21:01:52 +02:00
Mazdak Farrokhzad
5915517c6b
Rollup merge of #62470 - dima74:patch-1, r=GuillaumeGomez
Prevent shrinking of "crate select" element on Firefox

This fixes #60368
2019-07-09 21:01:51 +02:00
Mazdak Farrokhzad
9c144335bf
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
2019-07-09 21:01:49 +02:00
Mazdak Farrokhzad
2c2062e83b
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
2019-07-09 21:01:48 +02:00
Who? Me?!
4eb492db54
Add spastorino for rustc-guide toolstate 2019-07-09 13:58:32 -05:00
bors
0b680cfce5 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.
2019-07-09 18:35:12 +00:00
Aleksey Kladov
b052fbb54b
Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-09 19:10:22 +03:00
Alex Crichton
0efc7e3898 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`.
2019-07-09 09:09:13 -07:00
Ohad Ravid
194814065c Added a test for coherence when a generic type param has a default value from an associated type 2019-07-09 17:35:30 +02:00
Freyskeyd
bc322af444
doc(ptr): add example for {read,write}_unaligned
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2019-07-09 16:55:00 +02:00
Felix S. Klock II
b0b64ddcd1 Added comment explaining purpose of search_for_adt_without_structural_match. 2019-07-09 16:54:19 +02:00
bors
b8ec4c4d11 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
2019-07-09 13:10:31 +00:00
Aleksey Kladov
8175a1f905 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.
2019-07-09 15:26:18 +03:00
Samy Kacimi
41e71b0c93
normalize use of backticks in compiler messages for libsyntax/feature_gate
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
Niko Matsakis
66e026666d rewrite the test to workaround #51525 2019-07-09 06:57:52 -04:00
Felix S. Klock II
4becbf3a79 Regression test for issue 42574. 2019-07-09 11:56:01 +02:00
bors
5d8ffb5b8b 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.
2019-07-09 09:50:51 +00:00
bors
88953840ac 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.
2019-07-09 06:20:44 +00:00
bors
909f5a0494 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
2019-07-09 02:53:20 +00:00
Mazdak Farrokhzad
4e5bccc46d
Rollup merge of #62494 - sinkuu:unused_deps, r=alexcrichton
Remove unused dependencies
2019-07-09 04:52:40 +02:00
Mazdak Farrokhzad
bc18981f21
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.
2019-07-09 04:52:38 +02:00
Mazdak Farrokhzad
3bbc421142
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
2019-07-09 04:52:37 +02:00
Mazdak Farrokhzad
fb9ca03e0b
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`.
2019-07-09 04:52:35 +02:00
Ashley Mannix
70d630fd5a add feature to docs 2019-07-09 08:30:20 +10:00
bors
09ab31bc64 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
2019-07-08 22:03:26 +00:00
Felix S. Klock II
4c58b29285 regression test. 2019-07-08 22:27:02 +02:00
Felix S. Klock II
81cc482265 Avoid infinite looping in print_def_path. 2019-07-08 22:27:02 +02:00
Shotaro Yamada
b06ed52cfd Remove unused dependencies 2019-07-09 00:17:42 +09:00
bors
78ca1bda35 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.
2019-07-08 12:03:06 +00:00
Felix S. Klock II
02af3ca5c4 Added test explicitly testing that this PR continues to handle empty arrays in same manner as before. 2019-07-08 13:40:08 +02:00
Felix S. Klock II
02714b8ba3 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())`
2019-07-08 12:12:03 +02:00
Felix S. Klock II
b56080162b 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.
2019-07-08 11:51:39 +02:00
Felix S. Klock II
36777f157b future-compat lint for newly handled cases of #[structural_match]. 2019-07-08 11:50:52 +02:00
Felix S. Klock II
507ee7242a Note that eq_trait denotes trait PartialEq, not Eq, so you don't have to go to trait def to double-check. 2019-07-08 11:50:52 +02:00
bors
10840b8ae2 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
2019-07-08 08:39:56 +00:00
Lzu Tao
df53a3fd55 Add documentation to float conversion methods 2019-07-08 07:34:25 +00:00
Tobias Bucher
ad47f0874a Add float conversions to and from bytes
Use the same API as for integers.

Fixes #57492.
2019-07-08 07:34:25 +00:00
bors
db592f4627 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
2019-07-08 01:32:50 +00:00
Mazdak Farrokhzad
ada2684c80
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
2019-07-08 02:40:58 +02:00
Mazdak Farrokhzad
b0062cadab
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.
2019-07-08 02:40:57 +02:00
Mazdak Farrokhzad
264884db3b
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
2019-07-08 02:40:56 +02:00