Commit Graph

96117 Commits

Author SHA1 Message Date
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
Mazdak Farrokhzad
60f300ab30
Rollup merge of #62462 - JohnTitor:document-while, r=Centril
Document `while` keyword

This is a rework of #60761.
Closes #60736

r? @dtolnay
2019-07-08 02:40:54 +02:00
Mazdak Farrokhzad
6da30983d6
Rollup merge of #62356 - soc:topic/contains, r=Centril
Implement Option::contains and Result::contains

This increases consistency with other common data structures.
2019-07-08 02:40:53 +02:00
Ashley Mannix
e98ea52762 add key and value methods to DebugMap 2019-07-08 09:56:02 +10:00
Samy Kacimi
8aa9f18eb5
normalize use of backticks for compiler messages in librustc_codegen
https://github.com/rust-lang/rust/issues/60532
2019-07-08 00:54:38 +02:00
Petr Hosek
1dcee4cc63 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-07 15:45:04 -07:00
bors
a8247238e3 Auto merge of #62026 - mati865:deps, r=alexcrichton
Final nail in `rand 0.4` coffin

Closes https://github.com/rust-lang/rust/issues/57724
2019-07-07 22:03:54 +00:00
Aaron Loucks
df5b32ee9b Clarify double-drop comment 2019-07-07 16:36:19 -04:00
Mateusz Mikuła
2ac20e2be6 Update phf to get rid of rand 0.4 2019-07-07 21:08:49 +02:00
Tim Vermeulen
98b54fbd7a Only call the closure parameter of Iterator::is_sorted_by_key once per item 2019-07-07 20:46:38 +02:00
bors
6e310f2aba 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 🙃
2019-07-07 18:37:08 +00:00
Scott McMurray
d6a9793722 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
2019-07-07 11:31:38 -07:00
Aaron Loucks
a4a6a67a01 Remove while loop in DrainFilter::drop and add additional docs 2019-07-07 13:44:21 -04:00
Tshepang Lekhonkhobe
8353007e56 cli: make help output for -l and -L consistent 2019-07-07 18:32:39 +02:00
Samy Kacimi
60a49384f5
normalize use of backticks in compiler messages for librustc_typecheck
https://github.com/rust-lang/rust/issues/60532
2019-07-07 18:27:21 +02:00
Dmitry Murzin
11a4d6ed9c
Prevent shrinking of "crate select" element on Firefox 2019-07-07 18:46:24 +03:00
bors
9210359b18 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
2019-07-07 15:00:47 +00:00
Mazdak Farrokhzad
a2500db858
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.
2019-07-07 17:00:20 +02:00
Mazdak Farrokhzad
fe807fcf3e
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
2019-07-07 17:00:18 +02:00
Mazdak Farrokhzad
3250b8ee59
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
2019-07-07 17:00:17 +02:00
Mazdak Farrokhzad
9cd75fb35f
Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
`non_ascii_idents` lint (part of RFC 2457)

RFC 2457 [declares](121bbeff50/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
2019-07-07 17:00:15 +02:00
Simon Ochsenreither
6f76da494b Implement Option::contains, Result::contains and Result::contains_err
This increases consistency with other common data structures.
2019-07-07 16:50:44 +02:00
Matthew Jasper
38306adf16 Add help message for mutation though overloaded place operators 2019-07-07 15:24:19 +01:00
Matthew Jasper
5b86c604f9 Move BorrowedContentSource from move_errors to error_reporting 2019-07-07 15:23:07 +01:00
Matthew Jasper
163c059354 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.
2019-07-07 15:04:43 +01:00
Matthew Jasper
89188815ed Give index temporaries a drop scope 2019-07-07 15:03:07 +01:00
Yuki Okushi
559c3ec562 Document while keyword 2019-07-07 22:17:26 +09:00
Vadim Kaushan
f90d6d5144
Update LLVM: apply patch necessary for ThinLTO on RISC-V 2019-07-07 15:32:09 +03:00