]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdd Arc::new_cyclic
DPC [Thu, 13 Aug 2020 01:07:54 +0000 (03:07 +0200)]
Add Arc::new_cyclic

3 years agoAuto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrum
bors [Sun, 9 Aug 2020 20:08:50 +0000 (20:08 +0000)]
Auto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrum

Upgrade indexmap and use it more

First this upgrades `indexmap` to 1.5.1, which is now based on `hashbrown::raw::RawTable`. This means it shares a lot of the same performance characteristics for insert, lookup, etc., while keeping items in insertion order.

Then across various rustc crates, this replaces a lot of `Vec`+`HashMap` pairs with a single `IndexMap` or `IndexSet`.

Closes #60608.
r? @eddyb

3 years agorustc_span: note the perf loss seen from IndexSet in symbol::Interner
Josh Stone [Sun, 9 Aug 2020 19:41:09 +0000 (12:41 -0700)]
rustc_span: note the perf loss seen from IndexSet in symbol::Interner

3 years agorustc_typeck: use IndexSet in InteriorVisitor
Josh Stone [Sat, 8 Aug 2020 03:55:01 +0000 (20:55 -0700)]
rustc_typeck: use IndexSet in InteriorVisitor

3 years agorustc_typeck: use IndexSet in UniquePredicates
Josh Stone [Sat, 8 Aug 2020 03:54:09 +0000 (20:54 -0700)]
rustc_typeck: use IndexSet in UniquePredicates

3 years agorustc_span: use IndexSet in SpanInterner
Josh Stone [Sat, 8 Aug 2020 03:50:53 +0000 (20:50 -0700)]
rustc_span: use IndexSet in SpanInterner

3 years agorustc_mir_build: use IndexMap in TestKind::SwitchInt
Josh Stone [Sat, 8 Aug 2020 03:49:51 +0000 (20:49 -0700)]
rustc_mir_build: use IndexMap in TestKind::SwitchInt

3 years agorustc_mir: use IndexSet in PlaceholderIndices
Josh Stone [Sat, 8 Aug 2020 03:48:00 +0000 (20:48 -0700)]
rustc_mir: use IndexSet in PlaceholderIndices

3 years agorustc_mir: use IndexMap in BorrowSet
Josh Stone [Sat, 8 Aug 2020 03:47:33 +0000 (20:47 -0700)]
rustc_mir: use IndexMap in BorrowSet

3 years agorustc_middle: use IndexSet in OnDiskCache
Josh Stone [Sat, 8 Aug 2020 03:44:47 +0000 (20:44 -0700)]
rustc_middle: use IndexSet in OnDiskCache

3 years agorustc_metadata: use IndexSet in EncodeContext
Josh Stone [Sat, 8 Aug 2020 03:44:12 +0000 (20:44 -0700)]
rustc_metadata: use IndexSet in EncodeContext

3 years agorustc_data_structures: use IndexSet in TransitiveRelation
Josh Stone [Sat, 8 Aug 2020 03:43:18 +0000 (20:43 -0700)]
rustc_data_structures: use IndexSet in TransitiveRelation

3 years agorustc_codegen_llvm: use IndexSet in CoverageMapGenerator
Josh Stone [Sat, 8 Aug 2020 03:42:29 +0000 (20:42 -0700)]
rustc_codegen_llvm: use IndexSet in CoverageMapGenerator

3 years agoUpgrade indexmap to 1.5.1, now using hashbrown!
Josh Stone [Sat, 8 Aug 2020 00:03:47 +0000 (17:03 -0700)]
Upgrade indexmap to 1.5.1, now using hashbrown!

3 years agoAuto merge of #75137 - Aaron1011:fix/hygiene-skip-expndata, r=petrochenkov
bors [Sun, 9 Aug 2020 18:19:34 +0000 (18:19 +0000)]
Auto merge of #75137 - Aaron1011:fix/hygiene-skip-expndata, r=petrochenkov

Don't serialize ExpnData for foreign crates

When we encode an ExpnId into the crate metadata, we write out the
CrateNum of the crate that 'owns' the corresponding `ExpnData`, which
is later used to decode the `ExpnData` from its owning crate.

However, we current serialize the `ExpnData` for all `ExpnIds` that we
serialize, even if the `ExpnData` was already serialized into a foreign
crate. This commit skips encoding this kind of `ExpnData`, which should
hopefully speed up metadata encoding and reduce the total metadata size.

3 years agoAuto merge of #75134 - Aaron1011:feature/expn-data-parent-hash, r=petrochenkov
bors [Sun, 9 Aug 2020 14:29:42 +0000 (14:29 +0000)]
Auto merge of #75134 - Aaron1011:feature/expn-data-parent-hash, r=petrochenkov

Hash parent ExpnData

cc https://github.com/rust-lang/rust/pull/72121#discussion_r460528326

3 years agoAdd comment about the lack of `ExpnData` serialization for proc-macro crates
Aaron Hill [Sun, 9 Aug 2020 12:42:41 +0000 (08:42 -0400)]
Add comment about the lack of `ExpnData` serialization for proc-macro crates

3 years agoAuto merge of #75293 - poliorcetics:intra-doc-links-std-path, r=jyn514
bors [Sun, 9 Aug 2020 12:31:03 +0000 (12:31 +0000)]
Auto merge of #75293 - poliorcetics:intra-doc-links-std-path, r=jyn514

Move to intra-doc links in library/std/src/path.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issue: The following links are broken (they are inside trait impls, undocumented in this file, inheriting from the original doc):

- [`Hasher`]
- [`Self`] (referencing `../primitive.slice.html`)
- [`Ordering`]

3 years agoAuto merge of #75310 - petrochenkov:needwasm, r=Mark-Simulacrum
bors [Sun, 9 Aug 2020 08:52:53 +0000 (08:52 +0000)]
Auto merge of #75310 - petrochenkov:needwasm, r=Mark-Simulacrum

tests: Mark `ui/asm/bad-arch.rs` as requiring wasm llvm backend

So it doesn't fail when not all LLVM backends are built.

3 years agotests: Mark `ui/asm/bad-arch.rs` as requiring wasm llvm backend
Vadim Petrochenkov [Sat, 8 Aug 2020 22:09:23 +0000 (01:09 +0300)]
tests: Mark `ui/asm/bad-arch.rs` as requiring wasm llvm backend

3 years agoAuto merge of #75280 - overdrivenpotato:psp-unwind, r=dtolnay
bors [Sun, 9 Aug 2020 03:07:00 +0000 (03:07 +0000)]
Auto merge of #75280 - overdrivenpotato:psp-unwind, r=dtolnay

Add back unwinding support for Sony PSP

This PR adds back unwinding support for the Sony PSP. The `mipsel-sony-psp` target works well with unwinding. In [rust-psp], we use the `panic_unwind` crate along with LLVM's libunwind to catch panics, run destructors, and print them to the debug screen without aborting all threads.

[rust-psp]: https://github.com/overdrivenpotato/rust-psp

3 years agoAuto merge of #75306 - Amanieu:hashbrown8, r=Mark-Simulacrum
bors [Sun, 9 Aug 2020 01:05:56 +0000 (01:05 +0000)]
Auto merge of #75306 - Amanieu:hashbrown8, r=Mark-Simulacrum

Update hashbrown to 0.8.2

Includes:
- Avoid closures to improve compile times (https://github.com/rust-lang/hashbrown/pull/183)
- Do not iterate to drop if empty (https://github.com/rust-lang/hashbrown/pull/182)

r? @Mark-Simulacrum

3 years agoAuto merge of #75308 - JohnTitor:rollup-vnnny43, r=JohnTitor
bors [Sat, 8 Aug 2020 23:05:49 +0000 (23:05 +0000)]
Auto merge of #75308 - JohnTitor:rollup-vnnny43, r=JohnTitor

Rollup of 15 pull requests

Successful merges:

 - #74712 (Update E0271 explanation)
 - #74842 (adjust remaining targets)
 - #75151 (Consistent variable name alloc for raw_vec)
 - #75162 (Fix the documentation for move about Fn traits implementations)
 - #75248 (Add `as_mut_ptr` to `NonNull<[T]>`)
 - #75262 (Show multi extension example for Path in doctests)
 - #75266 (Add safety section to `NonNull::as_*` method docs)
 - #75284 (Show relative example for Path ancestors)
 - #75285 (Separate example for Path strip_prefix)
 - #75287 (Show Path extension example change multi extension)
 - #75288 (Use assert! for Path exists example to check bool)
 - #75289 (Remove ambiguity from PathBuf pop example)
 - #75290 (fix `min_const_generics` version)
 - #75291 (Clean up E0750)
 - #75292 (Clean up E0502)

Failed merges:

r? @ghost

3 years agoRollup merge of #75292 - slanterns:cleanup-E0502, r=GuillaumeGomez
Yuki Okushi [Sat, 8 Aug 2020 21:41:39 +0000 (06:41 +0900)]
Rollup merge of #75292 - slanterns:cleanup-E0502, r=GuillaumeGomez

Clean up E0502

`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.

3 years agoRollup merge of #75291 - GuillaumeGomez:cleanup-e0750, r=pickfire
Yuki Okushi [Sat, 8 Aug 2020 21:41:37 +0000 (06:41 +0900)]
Rollup merge of #75291 - GuillaumeGomez:cleanup-e0750, r=pickfire

Clean up E0750

r? @Dylan-DPC

3 years agoRollup merge of #75290 - rust-lang:min_const_generics-version, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:35 +0000 (06:41 +0900)]
Rollup merge of #75290 - rust-lang:min_const_generics-version, r=jonas-schievink

fix `min_const_generics` version

https://github.com/rust-lang/rust/pull/74877#discussion_r467451813

> This should be 1.47.0

3 years agoRollup merge of #75289 - pickfire:patch-12, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:33 +0000 (06:41 +0900)]
Rollup merge of #75289 - pickfire:patch-12, r=jonas-schievink

Remove ambiguity from PathBuf pop example

3 years agoRollup merge of #75288 - pickfire:patch-11, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:32 +0000 (06:41 +0900)]
Rollup merge of #75288 - pickfire:patch-11, r=jonas-schievink

Use assert! for Path exists example to check bool

3 years agoRollup merge of #75287 - pickfire:patch-10, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:30 +0000 (06:41 +0900)]
Rollup merge of #75287 - pickfire:patch-10, r=jonas-schievink

Show Path extension example change multi extension

3 years agoRollup merge of #75285 - pickfire:patch-8, r=jonas-schievink
Yuki Okushi [Sat, 8 Aug 2020 21:41:28 +0000 (06:41 +0900)]
Rollup merge of #75285 - pickfire:patch-8, r=jonas-schievink

Separate example for Path strip_prefix

3 years agoRollup merge of #75284 - pickfire:patch-7, r=LukasKalbertodt
Yuki Okushi [Sat, 8 Aug 2020 21:41:27 +0000 (06:41 +0900)]
Rollup merge of #75284 - pickfire:patch-7, r=LukasKalbertodt

Show relative example for Path ancestors

3 years agoRollup merge of #75266 - aticu:master, r=RalfJung
Yuki Okushi [Sat, 8 Aug 2020 21:41:25 +0000 (06:41 +0900)]
Rollup merge of #75266 - aticu:master, r=RalfJung

Add safety section to `NonNull::as_*` method docs

This basically adds the safety section of `*mut T::as_{ref,mut}` to the
same methods on `NonNull` with minor modifications to fit the
differences.

Part of #48929.

3 years agoRollup merge of #75262 - pickfire:patch-6, r=jyn514
Yuki Okushi [Sat, 8 Aug 2020 21:41:23 +0000 (06:41 +0900)]
Rollup merge of #75262 - pickfire:patch-6, r=jyn514

Show multi extension example for Path in doctests

3 years agoRollup merge of #75248 - TimDiekmann:NonNull-as_mut_ptr, r=RalfJung
Yuki Okushi [Sat, 8 Aug 2020 21:41:22 +0000 (06:41 +0900)]
Rollup merge of #75248 - TimDiekmann:NonNull-as_mut_ptr, r=RalfJung

Add `as_mut_ptr` to `NonNull<[T]>`

Adds `as_mut_ptr` to shortcut converting a `NonNull<[T]>` to `*mut T` as proposed in https://github.com/rust-lang/rust/issues/74265#issuecomment-669702969.

r? @RalfJung

3 years agoRollup merge of #75162 - poliorcetics:move-documentation-fix, r=jyn514
Yuki Okushi [Sat, 8 Aug 2020 21:41:20 +0000 (06:41 +0900)]
Rollup merge of #75162 - poliorcetics:move-documentation-fix, r=jyn514

Fix the documentation for move about Fn traits implementations

Fixes #74997.

This uses the note from the [reference](https://doc.rust-lang.org/reference/types/closure.html#call-traits-and-coercions) but I can also just put a link to it or do both.

@rusbot modify labels: C-bug T-doc T-libs

3 years agoRollup merge of #75151 - pickfire:patch-4, r=LukasKalbertodt
Yuki Okushi [Sat, 8 Aug 2020 21:41:18 +0000 (06:41 +0900)]
Rollup merge of #75151 - pickfire:patch-4, r=LukasKalbertodt

Consistent variable name alloc for raw_vec

3 years agoRollup merge of #74842 - hermitcore:thread_local, r=Mark-Simulacrum
Yuki Okushi [Sat, 8 Aug 2020 21:41:16 +0000 (06:41 +0900)]
Rollup merge of #74842 - hermitcore:thread_local, r=Mark-Simulacrum

adjust remaining targets

- fix commit 7dc3886
- previous commit doesn't adjust all targets

3 years agoRollup merge of #74712 - strom-und-spiele:E0271-cleanup, r=Mark-Simulacrum
Yuki Okushi [Sat, 8 Aug 2020 21:41:14 +0000 (06:41 +0900)]
Rollup merge of #74712 - strom-und-spiele:E0271-cleanup, r=Mark-Simulacrum

Update E0271 explanation

When reading the explanation, I got confused by it. I hope the wording is clearer now.

3 years agoAuto merge of #75271 - cuviper:array-iter, r=LukasKalbertodt
bors [Sat, 8 Aug 2020 20:43:21 +0000 (20:43 +0000)]
Auto merge of #75271 - cuviper:array-iter, r=LukasKalbertodt

Simplify array::IntoIter

- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
  and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
  new range to get partial drops if `T::clone` panics.

r? @LukasKalbertodt

3 years agoRemove E0750 from unchecked error codes
Guillaume Gomez [Sat, 8 Aug 2020 12:00:36 +0000 (14:00 +0200)]
Remove E0750 from unchecked error codes

3 years agoClean up E0750 explanation
Guillaume Gomez [Sat, 8 Aug 2020 11:59:54 +0000 (13:59 +0200)]
Clean up E0750 explanation

3 years agoAuto merge of #75163 - canova:map_into_keys_values, r=dtolnay
bors [Sat, 8 Aug 2020 18:15:50 +0000 (18:15 +0000)]
Auto merge of #75163 - canova:map_into_keys_values, r=dtolnay

Implement `into_keys` and `into_values` for associative maps

This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature.
Fixes #55214.
r? @dtolnay

3 years agoAuto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnr
bors [Sat, 8 Aug 2020 15:57:12 +0000 (15:57 +0000)]
Auto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnr

polymorphize: unevaluated constants

This PR makes polymorphization visit the promoted MIR of unevaluated constants with available promoted MIR instead of visiting the substitutions of that constant - which will mark all of the generic parameters as used; in addition polymorphization will now visit non-promoted unevaluated constants rather than visit their substs.

r? @lcnr

3 years agoUpdate the tracking issue number of map_into_keys_values
Nazım Can Altınova [Sat, 8 Aug 2020 14:34:42 +0000 (16:34 +0200)]
Update the tracking issue number of map_into_keys_values

3 years agoUpdate hashbrown to 0.8.2
Amanieu d'Antras [Sat, 8 Aug 2020 14:03:47 +0000 (15:03 +0100)]
Update hashbrown to 0.8.2

3 years agoAdd an example about the behaviour of move and Fn* traits
Alexis Bourget [Sat, 8 Aug 2020 13:57:17 +0000 (15:57 +0200)]
Add an example about the behaviour of move and Fn* traits

3 years agoRemove min/max values from IntoValues Iterator implementation
Nazım Can Altınova [Sat, 8 Aug 2020 13:39:26 +0000 (15:39 +0200)]
Remove min/max values from IntoValues Iterator implementation

3 years agoAuto merge of #74533 - nikic:issue-74425, r=eddyb
bors [Sat, 8 Aug 2020 13:33:53 +0000 (13:33 +0000)]
Auto merge of #74533 - nikic:issue-74425, r=eddyb

Emit == null instead of <= null for niche check

When the niche maximum is zero, emit a "== zero" check instead of a "<= zero" check. In particular, this avoids the awkward case of "<= null". While LLVM does canonicalize this to "== null", this apparently doesn't happen for constant expressions, leading to the issue in #74425. While that can be addressed on the LLVM side, it still seems prudent to emit sensible IR here, because this will allow null checks to be optimized earlier in the pipeline.

Fixes #74425.

3 years agoUse `&` instead of `let ref` in E0502
Slanterns [Sat, 8 Aug 2020 12:26:56 +0000 (20:26 +0800)]
Use `&` instead of `let ref` in E0502

`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.

3 years agoMove to intra-doc links in library/std/src/path.rs
Alexis Bourget [Sat, 8 Aug 2020 12:21:27 +0000 (14:21 +0200)]
Move to intra-doc links in library/std/src/path.rs

3 years agoAdd safety section to `NonNull::as_*` method docs
aticu [Fri, 7 Aug 2020 18:58:34 +0000 (20:58 +0200)]
Add safety section to `NonNull::as_*` method docs

This basically adds the safety section of `*mut T::as_{ref,mut}` to the
same methods on `NonNull` with minor modifications to fit the
differences.

Part of #48929.

3 years agofix `min_const_generics` version
Bastian Kauschke [Sat, 8 Aug 2020 11:35:42 +0000 (13:35 +0200)]
fix `min_const_generics` version

3 years agoAuto merge of #74289 - lzutao:unroll, r=LukasKalbertodt
bors [Sat, 8 Aug 2020 11:34:18 +0000 (11:34 +0000)]
Auto merge of #74289 - lzutao:unroll, r=LukasKalbertodt

Remove some redundant parts from `unrolled_find_u16s`

See each commit message for details.

r? @wesleywiser from old PR #67705 .

3 years agoRemove abmiguity from PathBuf pop example
Ivan Tham [Sat, 8 Aug 2020 10:28:55 +0000 (18:28 +0800)]
Remove abmiguity from PathBuf pop example

3 years agoUse assert! for Path exists example to check bool
Ivan Tham [Sat, 8 Aug 2020 10:23:18 +0000 (18:23 +0800)]
Use assert! for Path exists example to check bool

3 years agoShow Path extension example change multi extension
Ivan Tham [Sat, 8 Aug 2020 10:14:29 +0000 (18:14 +0800)]
Show Path extension example change multi extension

3 years agoSeparate example for Path strip_prefix
Ivan Tham [Sat, 8 Aug 2020 10:01:34 +0000 (18:01 +0800)]
Separate example for Path strip_prefix

3 years agoShow relative example for Path ancestors
Ivan Tham [Sat, 8 Aug 2020 09:53:16 +0000 (17:53 +0800)]
Show relative example for Path ancestors

3 years agoAuto merge of #75282 - RalfJung:miri-black-box, r=oli-obk
bors [Sat, 8 Aug 2020 09:46:16 +0000 (09:46 +0000)]
Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk

do not call black_box on Miri

Helps with https://github.com/rust-lang/rust/issues/75274 (but https://github.com/rust-lang/rust/pull/74932 introduced unrelated breakage that will need a separate fix)
Cc @eggyal r? @Mark-Simulacrum

3 years agoUpdate E0271.md
strom-und-spiele [Fri, 24 Jul 2020 12:15:21 +0000 (14:15 +0200)]
Update E0271.md

remove references to non existing code,
expand solution suggestions
remove unneeded code in solution

3 years agomake black_box a NOP in Miri
Ralf Jung [Sat, 8 Aug 2020 08:36:16 +0000 (10:36 +0200)]
make black_box a NOP in Miri

3 years agoEmit == null instead of <= null
Nikita Popov [Sun, 19 Jul 2020 18:57:49 +0000 (20:57 +0200)]
Emit == null instead of <= null

When the niche maximum is zero, emit a "== zero" check instead of
a "<= zero" check. In particular, this avoid the awkward case of
"<= null". While LLVM does canonicalize this to "!= null", this
appently doesn't happen for constant expressions, leading to the
issue in #74425. While that can be addressed on the LLVM side, it
still seems prudent to emit sensible IR here, because this will
allow null checks to be optimized earlier in the pipeline.

Fixes #74425.

3 years agoAuto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum
bors [Sat, 8 Aug 2020 07:46:04 +0000 (07:46 +0000)]
Auto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum

BTreeMap: better way to postpone root access in DrainFilter

A slightly more elegant (in my opinion) adaptation of #74762. Benchmarks seem irrationally pleased to:
```
benchcmp old new --threshold 5
 name                                           old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
 btree::map::clone_fat_100_and_remove_all       215,182      185,052           -30,130  -14.00%   x 1.16
 btree::map::clone_fat_100_and_remove_half      139,667      127,945           -11,722   -8.39%   x 1.09
 btree::map::clone_fat_val_100_and_remove_all   96,755       81,279            -15,476  -16.00%   x 1.19
 btree::map::clone_fat_val_100_and_remove_half  64,678       56,911             -7,767  -12.01%   x 1.14
 btree::map::find_rand_100                      18           17                     -1   -5.56%   x 1.06
 btree::map::first_and_last_0                   33           35                      2    6.06%   x 0.94
 btree::map::first_and_last_100                 40           54                     14   35.00%   x 0.74
 btree::map::insert_rand_100                    45           42                     -3   -6.67%   x 1.07
 btree::map::insert_rand_10_000                 45           41                     -4   -8.89%   x 1.10
 btree::map::iter_0                             2,010        1,759                -251  -12.49%   x 1.14
 btree::map::iter_100                           3,514        2,764                -750  -21.34%   x 1.27
 btree::map::iter_10k                           4,018        3,768                -250   -6.22%   x 1.07
 btree::map::range_unbounded_unbounded          37,269       28,929             -8,340  -22.38%   x 1.29
 btree::map::range_unbounded_vs_iter            31,518       28,814             -2,704   -8.58%   x 1.09
```

r? @Mark-Simulacrum

3 years agoAdd back unwinding support for Sony PSP
Marko Mijalkovic [Sat, 8 Aug 2020 06:14:40 +0000 (02:14 -0400)]
Add back unwinding support for Sony PSP

3 years agoAuto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkov
bors [Sat, 8 Aug 2020 05:58:57 +0000 (05:58 +0000)]
Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkov

Remove `librustc_ast` session globals

By moving the data onto `Session`.

r? @petrochenkov

3 years agoAuto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor
bors [Sat, 8 Aug 2020 03:54:33 +0000 (03:54 +0000)]
Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #75224 (Don't call a function in function-arguments-naked.rs)
 - #75237 (Display elided lifetime for non-reference type in doc)
 - #75250 (make MaybeUninit::as_(mut_)ptr const)
 - #75253 (clean up const-hacks in int endianess conversion functions)
 - #75259 (Add missing backtick)
 - #75267 (Small cleanup)
 - #75270 (fix a couple of clippy findings)

Failed merges:

r? @ghost

3 years agoRollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPC
Yuki Okushi [Sat, 8 Aug 2020 02:36:12 +0000 (11:36 +0900)]
Rollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPC

fix a couple of clippy findings

3 years agoRollup merge of #75267 - estebank:cleanup, r=Dylan-DPC
Yuki Okushi [Sat, 8 Aug 2020 02:36:10 +0000 (11:36 +0900)]
Rollup merge of #75267 - estebank:cleanup, r=Dylan-DPC

Small cleanup

* Add docstring to `Parser` field
* Remove unnecessary `unwrap`
* Remove unnecessary borrow
* Fix indentation of some `teach`text output

3 years agoRollup merge of #75259 - giraffate:add_missing_backtick, r=lcnr
Yuki Okushi [Sat, 8 Aug 2020 02:36:09 +0000 (11:36 +0900)]
Rollup merge of #75259 - giraffate:add_missing_backtick, r=lcnr

Add missing backtick

3 years agoRollup merge of #75253 - RalfJung:cleanup-const-hack, r=oli-obk
Yuki Okushi [Sat, 8 Aug 2020 02:36:07 +0000 (11:36 +0900)]
Rollup merge of #75253 - RalfJung:cleanup-const-hack, r=oli-obk

clean up const-hacks in int endianess conversion functions

Cleans up the const hacks added in https://github.com/rust-lang/rust/pull/69373.

r? @oli-obk

3 years agoRollup merge of #75250 - RalfJung:uninit-const-ptr, r=oli-obk
Yuki Okushi [Sat, 8 Aug 2020 02:36:05 +0000 (11:36 +0900)]
Rollup merge of #75250 - RalfJung:uninit-const-ptr, r=oli-obk

make MaybeUninit::as_(mut_)ptr const

I think it was just an oversight that they are not const yet.

I also changed their implementation as the old one created references to uninitialized memory.^^

3 years agoRollup merge of #75237 - nbdd0121:rustdoc, r=jyn514
Yuki Okushi [Sat, 8 Aug 2020 02:36:03 +0000 (11:36 +0900)]
Rollup merge of #75237 - nbdd0121:rustdoc, r=jyn514

Display elided lifetime for non-reference type in doc

In edition 2018 we encourage writing `<'_>` explicitly, so rustdoc should display like such as well.

Fixes #75225

~~Somehow when I run the compiled rustdoc using `cargo +stage2 doc` on other crates, it correctly produces `<'_>`, but I couldn't get the std doc to do the same with `./x.py doc --stage 2`. Might this be related to the recent change to x.py about how the doc is built?~~

3 years agoRollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu
Yuki Okushi [Sat, 8 Aug 2020 02:36:02 +0000 (11:36 +0900)]
Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu

Don't call a function in function-arguments-naked.rs

Fixes #75096

It's U.B. to use anything other than inline assmebling in a naked
function. Fortunately, the `#break` directive works fine without
anything in the function body.

3 years agoIncrease `recursion_limit` in `librustc_plugin_impl`.
Nicholas Nethercote [Sat, 8 Aug 2020 02:05:10 +0000 (12:05 +1000)]
Increase `recursion_limit` in `librustc_plugin_impl`.

To avoid rustdoc problems.

3 years agoEliminate `librustc_hir`'s dependency on `librustc_session`.
Nicholas Nethercote [Fri, 7 Aug 2020 01:11:44 +0000 (11:11 +1000)]
Eliminate `librustc_hir`'s dependency on `librustc_session`.

3 years agoEliminate the `SessionGlobals` from `librustc_ast`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:27:50 +0000 (11:27 +1000)]
Eliminate the `SessionGlobals` from `librustc_ast`.

By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.

All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.

`contains_feature_attr()` was dead, and is removed.

Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`

3 years agoRemove some unnecessary uses of `Option`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:15:51 +0000 (11:15 +1000)]
Remove some unnecessary uses of `Option`.

These arguments are never `None`.

3 years agoAuto merge of #74877 - lcnr:min_const_generics, r=oli-obk
bors [Sat, 8 Aug 2020 01:48:35 +0000 (01:48 +0000)]
Auto merge of #74877 - lcnr:min_const_generics, r=oli-obk

Implement the `min_const_generics` feature gate

Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332.

Adds the new feature gate `#![feature(min_const_generics)]`.
This feature gate adds the following limitations to using const generics:
- generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`)
- generic parameters must be either integers, `bool` or `char`.

We do allow arbitrary expressions in associated consts though, meaning that the following is allowed,
even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable.
```rust
trait Foo {
    const ASSOC: usize;
}

impl<const N: usize> Foo for [u8; N] {
    const ASSOC: usize = 64 / N;
}
```

r? @varkor cc @eddyb @withoutboats

3 years agoCross-crate doc inlining test case for elided lifetime
Gary Guo [Sat, 8 Aug 2020 00:07:43 +0000 (01:07 +0100)]
Cross-crate doc inlining test case for elided lifetime

3 years agoAuto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum
bors [Sat, 8 Aug 2020 00:00:52 +0000 (00:00 +0000)]
Auto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum

Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away

I've stumbled across some situations where there (unexpectedly) was no `__rust_begin_short_backtrace` frame on the stack during unwinding.

On closer examination, it appeared that the calls to that function had been tail-call optimised away.

This PR follows [@bjorn3's suggestion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Disabling.20tail.20call.20optimisation.3F/near/205699133), by adding calls to `black_box` that hint to rustc not to perform TCO.

Fixes #47429

3 years agofix clippy::needless_return: remove unneeded return statements
Matthias Krüger [Fri, 7 Aug 2020 22:39:38 +0000 (00:39 +0200)]
fix clippy::needless_return: remove unneeded return statements

3 years agofix clippy::clone_on_copy: don't clone types that are copy
Matthias Krüger [Fri, 7 Aug 2020 22:27:46 +0000 (00:27 +0200)]
fix clippy::clone_on_copy: don't clone types that are copy

3 years agofix clippy::map_clone: use .cloned() instead of .map(|x| x.clone())
Matthias Krüger [Fri, 7 Aug 2020 22:14:28 +0000 (00:14 +0200)]
fix clippy::map_clone: use .cloned() instead of .map(|x| x.clone())

3 years agofix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references.
Matthias Krüger [Fri, 7 Aug 2020 22:07:01 +0000 (00:07 +0200)]
fix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references.

3 years agofix clippy::while_let_loop: use while let{} instead of loop { if ... break; }
Matthias Krüger [Fri, 7 Aug 2020 21:59:59 +0000 (23:59 +0200)]
fix clippy::while_let_loop: use while let{} instead of loop { if ... break; }

3 years agofix clippy::redundant_closure: remove redundant closures and call functions directly
Matthias Krüger [Fri, 7 Aug 2020 21:45:19 +0000 (23:45 +0200)]
fix clippy::redundant_closure: remove redundant closures and call functions directly

3 years agoDisplay elided lifetime for external paths
Gary Guo [Fri, 7 Aug 2020 22:34:44 +0000 (23:34 +0100)]
Display elided lifetime for external paths

3 years agoDisplay elided lifetime for non-reference type in doc
Gary Guo [Thu, 6 Aug 2020 23:48:24 +0000 (00:48 +0100)]
Display elided lifetime for non-reference type in doc

3 years agoAuto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
bors [Fri, 7 Aug 2020 21:48:32 +0000 (21:48 +0000)]
Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum

BTreeMap: enforce the panic rule imposed by `replace`

Also, reveal the unsafe parts in the closures fed to it.

r? @Mark-Simulacrum

3 years agoSimplify array::IntoIter
Josh Stone [Fri, 7 Aug 2020 20:51:46 +0000 (13:51 -0700)]
Simplify array::IntoIter

- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
  and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
  new range to get partial drops if `T::clone` panics.

3 years agofix clippy::len_zero: use is_empty() instead of comparing .len() to zero
Matthias Krüger [Sat, 1 Aug 2020 17:20:44 +0000 (19:20 +0200)]
fix clippy::len_zero: use is_empty() instead of comparing .len() to zero

3 years agofix clippy::unneeded_wildcard_pattern: remove redundant wildcard pattern
Matthias Krüger [Sat, 1 Aug 2020 16:20:39 +0000 (18:20 +0200)]
fix clippy::unneeded_wildcard_pattern: remove redundant wildcard pattern

3 years agofix clippy::unnecessary_mut_passed: function arg is not required to be mutable
Matthias Krüger [Sat, 1 Aug 2020 16:01:19 +0000 (18:01 +0200)]
fix clippy::unnecessary_mut_passed: function arg is not required to be mutable

3 years agofix clippy::unit_arg: make it explicit that Ok(()) is being returned
Matthias Krüger [Sat, 1 Aug 2020 15:57:51 +0000 (17:57 +0200)]
fix clippy::unit_arg: make it explicit that Ok(()) is being returned

3 years agofix clippy::single_char_pattern: use char instead of string single-char pattern
Matthias Krüger [Sat, 1 Aug 2020 15:53:16 +0000 (17:53 +0200)]
fix clippy::single_char_pattern: use char instead of string single-char pattern

3 years agofix clippy::redundant_pattern_matching: use .is_some() instead of if let Some(_)...
Matthias Krüger [Sat, 1 Aug 2020 15:52:20 +0000 (17:52 +0200)]
fix clippy::redundant_pattern_matching: use .is_some() instead of if let Some(_) = ..

3 years agofix clippy::redundant_clone: remove redundant clones
Matthias Krüger [Sat, 1 Aug 2020 15:50:31 +0000 (17:50 +0200)]
fix clippy::redundant_clone: remove redundant clones

3 years agofix clippy::map_identity: remove redundant .map(|x| x) call
Matthias Krüger [Sat, 1 Aug 2020 15:46:59 +0000 (17:46 +0200)]
fix clippy::map_identity: remove redundant .map(|x| x) call

3 years agofix clippy::iter_next_slice: use .get(0) instead of .iter().next()
Matthias Krüger [Sat, 1 Aug 2020 15:45:08 +0000 (17:45 +0200)]
fix clippy::iter_next_slice: use .get(0) instead of .iter().next()

3 years agofix clippy::filter_next: use .find(..) instead of .filter(..).next()
Matthias Krüger [Sat, 1 Aug 2020 15:40:26 +0000 (17:40 +0200)]
fix clippy::filter_next: use .find(..) instead of .filter(..).next()