]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #81012 - VillSnow:stabilize_partition_point, r=matklad
Dylan DPC [Fri, 12 Feb 2021 21:53:28 +0000 (22:53 +0100)]
Rollup merge of #81012 - VillSnow:stabilize_partition_point, r=matklad

Stabilize the partition_point feature

Stabilize the partition_point feature.
Tracking Issue: #73831
First PR: #73577

3 years agoRollup merge of #79775 - jyn514:doctest, r=GuillaumeGomez
Dylan DPC [Fri, 12 Feb 2021 21:53:21 +0000 (22:53 +0100)]
Rollup merge of #79775 - jyn514:doctest, r=GuillaumeGomez

Fix injected errors when running doctests on a crate named after a keyword

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

3 years agoAuto merge of #81744 - rylev:overlapping-early-exit2, r=lcnr
bors [Fri, 12 Feb 2021 17:38:15 +0000 (17:38 +0000)]
Auto merge of #81744 - rylev:overlapping-early-exit2, r=lcnr

Try fast_reject::simplify_type in coherence before doing full check

This is a reattempt at landing #69010 (by `@jonas-schievink).` The change adds a fast path for coherence checking to see if there's no way for types to unify since full coherence checking can be somewhat expensive.

This has big effects on code generated by the [`windows`](https://github.com/microsoft/windows-rs) which in some cases spends as much as 20% of compilation time in the `specialization_graph_of` query. In local benchmarks this took a compilation that previously took ~500 seconds down to ~380 seconds.

This is surely not going to make a difference on much smaller crates, so the question is whether it will have a negative impact. #69010 was closed because some of the perf suite crates did show small regressions.

Additional discussion of this issue is happening [here](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf).

3 years agoDon't check self type twice
Ryan Levick [Fri, 12 Feb 2021 16:30:39 +0000 (17:30 +0100)]
Don't check self type twice

3 years agoSwitch boolean checks
Ryan Levick [Fri, 12 Feb 2021 16:22:19 +0000 (17:22 +0100)]
Switch boolean checks

3 years agoAuto merge of #82025 - JohnTitor:rollup-cohp0gy, r=JohnTitor
bors [Fri, 12 Feb 2021 14:40:27 +0000 (14:40 +0000)]
Auto merge of #82025 - JohnTitor:rollup-cohp0gy, r=JohnTitor

Rollup of 16 pull requests

Successful merges:

 - #79983 (fix indefinite article in cell.rs)
 - #81831 (Don't display `mut` in arguments for functions documentation)
 - #81947 (Relax ItemCtxt::to_ty lifetime)
 - #81954 (RELEASES.md 1.50: Group platform support notes together)
 - #81955 (bootstrap: Locate llvm-dwp based on llvm-config bindir)
 - #81959 (Fix assosiated typo)
 - #81964 (Fix documentation not showing on localStorage error)
 - #81968 (bootstrap: fix wrong docs installation path)
 - #81990 (Make suggestion of changing mutability of arguments broader)
 - #81994 (Improve long explanation for E0542 and E0546)
 - #81997 (dist: include src/build_helper as part of the crate graph for rustc-dev)
 - #82003 (Stack probes: fix error message)
 - #82004 (clean up clean::Static struct)
 - #82011 (Fix private intra-doc warnings on associated items)
 - #82013 (Tell user how to fix CI file being not up to date)
 - #82017 (Fix typo in mod.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoShort circuit full corherence check when dealing with types with different reference...
Ryan Levick [Fri, 12 Feb 2021 13:04:09 +0000 (14:04 +0100)]
Short circuit full corherence check when dealing with types with different reference mutability

3 years agostabilize partition_point
VillSnow [Thu, 14 Jan 2021 14:36:33 +0000 (23:36 +0900)]
stabilize partition_point

3 years agoupdate documents
VillSnow [Sun, 31 Jan 2021 00:31:17 +0000 (09:31 +0900)]
update documents

3 years agoRollup merge of #82017 - eltociear:patch-8, r=jyn514
Yuki Okushi [Fri, 12 Feb 2021 10:32:22 +0000 (19:32 +0900)]
Rollup merge of #82017 - eltociear:patch-8, r=jyn514

Fix typo in mod.rs

insted -> instead

3 years agoRollup merge of #82013 - Mark-Simulacrum:better-ci-error, r=jyn514
Yuki Okushi [Fri, 12 Feb 2021 10:32:21 +0000 (19:32 +0900)]
Rollup merge of #82013 - Mark-Simulacrum:better-ci-error, r=jyn514

Tell user how to fix CI file being not up to date

This hopefully should avoid future questions like in https://github.com/rust-lang/rust/pull/79979#issuecomment-776241356.

3 years agoRollup merge of #82011 - jyn514:warn-private-assoc-item, r=max-heller
Yuki Okushi [Fri, 12 Feb 2021 10:32:20 +0000 (19:32 +0900)]
Rollup merge of #82011 - jyn514:warn-private-assoc-item, r=max-heller

Fix private intra-doc warnings on associated items

The issue was that the `kind, id` override was previously only being
considered for the disambiguator check, not the privacy check. This uses
the same ID for both.

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

r? ``@max-heller``

3 years agoRollup merge of #82004 - GuillaumeGomez:clean-static-struct, r=jyn514
Yuki Okushi [Fri, 12 Feb 2021 10:32:18 +0000 (19:32 +0900)]
Rollup merge of #82004 - GuillaumeGomez:clean-static-struct, r=jyn514

clean up clean::Static struct

Having a `String` for the expression didn't make much sense, and even less when it's actually not used (except in json so I kept it).

r? ``@jyn514``

3 years agoRollup merge of #82003 - ojeda:stack-probe-msg, r=estebank
Yuki Okushi [Fri, 12 Feb 2021 10:32:17 +0000 (19:32 +0900)]
Rollup merge of #82003 - ojeda:stack-probe-msg, r=estebank

Stack probes: fix error message

3 years agoRollup merge of #81997 - bnjbvr:dist-include-build-helper, r=Mark-Simulacrum
Yuki Okushi [Fri, 12 Feb 2021 10:32:16 +0000 (19:32 +0900)]
Rollup merge of #81997 - bnjbvr:dist-include-build-helper, r=Mark-Simulacrum

dist: include src/build_helper as part of the crate graph for rustc-dev

The build_helper dependency is used to build the compiler/rustc_llvm build script.

Since it was missing, it wasn't possible to really use rustc-dev to
build, see for instance: https://github.com/rust-analyzer/rust-analyzer/issues/7589.

3 years agoRollup merge of #81994 - jesusprubio:improve-long-explanation-e0542-e0546, r=Guillaum...
Yuki Okushi [Fri, 12 Feb 2021 10:32:15 +0000 (19:32 +0900)]
Rollup merge of #81994 - jesusprubio:improve-long-explanation-e0542-e0546, r=GuillaumeGomez

Improve long explanation for E0542 and E0546

Helps with #61137

To keep the consistency with: https://github.com/rust-lang/rust/pull/81925

3 years agoRollup merge of #81990 - matsujika:suggest-mut-reference, r=estebank
Yuki Okushi [Fri, 12 Feb 2021 10:32:14 +0000 (19:32 +0900)]
Rollup merge of #81990 - matsujika:suggest-mut-reference, r=estebank

Make suggestion of changing mutability of arguments broader

Fix #81421

Previously rustc tries to emit the suggestion of changing mutablity unless `!trait_ref.has_infer_types_or_consts() && self.predicate_can_apply(obligation.param_env, trait_ref)` and this led to some false negatives to occur.

3 years agoRollup merge of #81968 - pietroalbini:fix-doc-install-path, r=Mark-Simulacrum
Yuki Okushi [Fri, 12 Feb 2021 10:32:13 +0000 (19:32 +0900)]
Rollup merge of #81968 - pietroalbini:fix-doc-install-path, r=Mark-Simulacrum

bootstrap: fix wrong docs installation path

This PR fixes https://github.com/rust-lang/rust/issues/81967, a regression introduced by https://github.com/rust-lang/rust/pull/80797. The commit has already been backported to stable 1.50.0.

r? ``````@Mark-Simulacrum``````

3 years agoRollup merge of #81964 - lovasoa:patch-1, r=GuillaumeGomez
Yuki Okushi [Fri, 12 Feb 2021 10:32:13 +0000 (19:32 +0900)]
Rollup merge of #81964 - lovasoa:patch-1, r=GuillaumeGomez

Fix documentation not showing on localStorage error

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

The [documentation for setItem](https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem) specifies:

> developers should make sure to always catch possible exceptions from setItem()

3 years agoRollup merge of #81959 - therealprof:fix-typo, r=oli-obk
Yuki Okushi [Fri, 12 Feb 2021 10:32:12 +0000 (19:32 +0900)]
Rollup merge of #81959 - therealprof:fix-typo, r=oli-obk

Fix assosiated typo

Introduced in d3c4dbd85d63c8bdfa362d7cac8b3e8cbca51272, noticed only
after the fact, sorry. 😅

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
3 years agoRollup merge of #81955 - dtolnay:dwp, r=Mark-Simulacrum
Yuki Okushi [Fri, 12 Feb 2021 10:32:11 +0000 (19:32 +0900)]
Rollup merge of #81955 - dtolnay:dwp, r=Mark-Simulacrum

bootstrap: Locate llvm-dwp based on llvm-config bindir

Fixes #81949.

Tested by successfully building 1.50.0 pre-release, which is where I originally hit the issue (https://internals.rust-lang.org/t/rust-1-50-0-pre-release-testing/14012/4?u=dtolnay). Tested both with and without prebuilt LLVM. The check for dry_run is necessary in the non-prebuilt case because the llvm-config built by bootstrap won't exist yet.

3 years agoRollup merge of #81954 - joshtriplett:release-notes-group-platform-notes, r=XAMPPRocky
Yuki Okushi [Fri, 12 Feb 2021 10:32:09 +0000 (19:32 +0900)]
Rollup merge of #81954 - joshtriplett:release-notes-group-platform-notes, r=XAMPPRocky

RELEASES.md 1.50: Group platform support notes together

Move the note about dropping cloudabi next to the other platform support
changes.

3 years agoRollup merge of #81947 - camsteffen:to-ty, r=jyn514
Yuki Okushi [Fri, 12 Feb 2021 10:32:08 +0000 (19:32 +0900)]
Rollup merge of #81947 - camsteffen:to-ty, r=jyn514

Relax ItemCtxt::to_ty lifetime

Tiny simplification by relaxing a lifetime.

3 years agoRollup merge of #81831 - LeSeulArtichaut:81289-mut-arg, r=camelid
Yuki Okushi [Fri, 12 Feb 2021 10:32:07 +0000 (19:32 +0900)]
Rollup merge of #81831 - LeSeulArtichaut:81289-mut-arg, r=camelid

Don't display `mut` in arguments for functions documentation

Fixes #81289 by reverting #80799, as requested in https://github.com/rust-lang/rust/pull/81328#issuecomment-766364413.
Supersedes #81328.
r? ``@camelid`` cc ``@jyn514``

3 years agoRollup merge of #79983 - petar-dambovaliev:master, r=Dylan-DPC
Yuki Okushi [Fri, 12 Feb 2021 10:32:06 +0000 (19:32 +0900)]
Rollup merge of #79983 - petar-dambovaliev:master, r=Dylan-DPC

fix indefinite article in cell.rs

3 years agoAuto merge of #81486 - ssomers:btree_separate_drop, r=Mark-Simulacrum
bors [Fri, 12 Feb 2021 06:34:21 +0000 (06:34 +0000)]
Auto merge of #81486 - ssomers:btree_separate_drop, r=Mark-Simulacrum

BTreeMap: disentangle Drop implementation from IntoIter

No longer require every `BTreeMap` to dig up its last leaf edge before dying. This speeds up the `clone_` benchmarks by 25% for normal keys and values (far less for huge values).

r? `@Mark-Simulacrum`

3 years agoFix typo in mod.rs
Ikko Ashimine [Fri, 12 Feb 2021 04:47:21 +0000 (13:47 +0900)]
Fix typo in mod.rs

insted -> instead

3 years agoTell user how to fix CI file being not up to date
Mark Rousskov [Fri, 12 Feb 2021 00:57:59 +0000 (19:57 -0500)]
Tell user how to fix CI file being not up to date

3 years agoFix private intra-doc warnings on associated items
Joshua Nelson [Fri, 12 Feb 2021 00:15:16 +0000 (19:15 -0500)]
Fix private intra-doc warnings on associated items

The issue was that the `kind, id` override was previously only being
considered for the disambiguator check, not the privacy check. This uses
the same ID for both.

3 years agoFix injected errors when running doctests on a crate named after a keyword
Joshua Nelson [Sun, 6 Dec 2020 22:56:01 +0000 (17:56 -0500)]
Fix injected errors when running doctests on a crate named after a keyword

Unfortunately, this can't currently be tested. The problem is that we
need the file to be compiled first to then be used as dependency, which
cannot be done currently unfortunately in the rustdoc test suites.
Example:

```rust
// name this file "foo.rs"

/// ```
/// let x = foo::foo();
/// ```
pub fn foo() {}
```

If you run `rustdoc --test foo.rs`, you'll get:

```
running 1 test
test foo.rs - foo (line 1) ... FAILED

failures:

---- foo.rs - foo (line 1) stdout ----
error[E0463]: can't find crate for `foo`
 --> foo.rs:0:1
  |
2 | extern crate foo;
  | ^^^^^^^^^^^^^^^^^ can't find crate
```

If a test were possible, it would look something like

 ````rust
 #![crate_name = "mod"]
 #![crate_type = "lib"]
 //! ```
 //! // NOTE: requires that the literal string 'mod' appears in the doctest for
 //! // the bug to appear
 //! assert_eq!(1, 1);
 //! ```
 ````

3 years agoclean up clean::Static struct
Guillaume Gomez [Thu, 11 Feb 2021 19:37:36 +0000 (20:37 +0100)]
clean up clean::Static struct

3 years agoStack probes: fix error message
Miguel Ojeda [Thu, 11 Feb 2021 19:33:16 +0000 (20:33 +0100)]
Stack probes: fix error message

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
3 years agoAuto merge of #81760 - tmiasko:debug-borrow, r=pnkfelix
bors [Thu, 11 Feb 2021 16:46:08 +0000 (16:46 +0000)]
Auto merge of #81760 - tmiasko:debug-borrow, r=pnkfelix

Borrow builder only once in debug derive

3 years agodist: include src/build_helper as part of the crate graph for rustc-dev.
Benjamin Bouvier [Thu, 11 Feb 2021 16:45:54 +0000 (17:45 +0100)]
dist: include src/build_helper as part of the crate graph for rustc-dev.

Since it was missing, it wasn't possible to really use rustc-dev to
build, see for instance: https://github.com/rust-analyzer/rust-analyzer/issues/7589.

3 years agoImprove long explanation for E0542 and E0546
Jesus Rubio [Thu, 11 Feb 2021 15:26:07 +0000 (16:26 +0100)]
Improve long explanation for E0542 and E0546

3 years agoAuto merge of #81350 - tmiasko:instrument-debug, r=lcnr
bors [Thu, 11 Feb 2021 13:44:00 +0000 (13:44 +0000)]
Auto merge of #81350 - tmiasko:instrument-debug, r=lcnr

Reduce log level used by tracing instrumentation from info to debug

Restore log level to debug to avoid make info log level overly verbose (the uses of instrument attribute modified there, were for the most part a replacement for `debug!`;  one use was novel).

3 years agoMake suggestion of changing mutability of arguments broader
Hirochika Matsumoto [Thu, 11 Feb 2021 06:13:06 +0000 (15:13 +0900)]
Make suggestion of changing mutability of arguments broader

3 years agoAuto merge of #81129 - bugadani:lighter-move-errors, r=petrochenkov
bors [Thu, 11 Feb 2021 07:50:02 +0000 (07:50 +0000)]
Auto merge of #81129 - bugadani:lighter-move-errors, r=petrochenkov

Borrowck: don't calculate unused info when reporting move errors

3 years agoAuto merge of #81126 - oxalica:retain-early-drop, r=m-ou-se
bors [Thu, 11 Feb 2021 04:40:57 +0000 (04:40 +0000)]
Auto merge of #81126 - oxalica:retain-early-drop, r=m-ou-se

Optimize Vec::retain

Use `copy_non_overlapping` instead of `swap` to reduce memory writes, like what we've done in #44355 and `String::retain`.
#48065 already tried to do this optimization but it is reverted in #67300 due to bad codegen of `DrainFilter::drop`.

This PR re-implement the drop-then-move approach. I did a [benchmark](https://gist.github.com/oxalica/3360eec9376f22533fcecff02798b698) on small-no-drop, small-need-drop, large-no-drop elements with different predicate functions. It turns out that the new implementation is >20% faster in average for almost all cases. Only 2/24 cases are slower by 3% and 5%. See the link above for more detail.

I think regression in may-panic cases is due to drop-guard preventing some optimization. If it's permitted to leak elements when predicate function of element's `drop` panic, the new implementation should be almost always faster than current one.
I'm not sure if we should leak on panic, since there is indeed an issue (#52267) complains about it before.

3 years agoAuto merge of #80860 - camelid:nodeid-docs, r=sanxiyn
bors [Thu, 11 Feb 2021 00:51:45 +0000 (00:51 +0000)]
Auto merge of #80860 - camelid:nodeid-docs, r=sanxiyn

Document `NodeId`

3 years agoAuto merge of #80762 - petrochenkov:visclean, r=varkor
bors [Wed, 10 Feb 2021 21:48:07 +0000 (21:48 +0000)]
Auto merge of #80762 - petrochenkov:visclean, r=varkor

resolve: Cleanup visibility resolution for enum variants and trait items

by always delegating it to `fn resolve_visibility`.

Also remove some special treatment of visibility on enum variants and trait items remaining from pre-`pub(restricted)` times.

3 years agoresolve: Remove visibility hacks for enum variants and trait items
Vadim Petrochenkov [Wed, 6 Jan 2021 15:07:47 +0000 (18:07 +0300)]
resolve: Remove visibility hacks for enum variants and trait items

Special treatment like this was necessary before `pub(restricted)` had been implemented and only two visibilities existed - `pub` and non-`pub`.
Now it's no longer necessary and the desired behavior follows from `pub(restricted)`-style visibilities naturally assigned to enum variants and trait items.

3 years agoresolve: Cleanup visibility resolution in enums and traits
Vadim Petrochenkov [Wed, 6 Jan 2021 14:19:47 +0000 (17:19 +0300)]
resolve: Cleanup visibility resolution in enums and traits

3 years agobootstrap: fix wrong docs installation path
Pietro Albini [Wed, 10 Feb 2021 17:33:43 +0000 (18:33 +0100)]
bootstrap: fix wrong docs installation path

3 years agoDo not ICE on range patterns in function arguments
LeSeulArtichaut [Mon, 8 Feb 2021 23:20:44 +0000 (00:20 +0100)]
Do not ICE on range patterns in function arguments

3 years agoAdd regression test for #81289
LeSeulArtichaut [Sat, 6 Feb 2021 15:40:30 +0000 (16:40 +0100)]
Add regression test for #81289

3 years agoFix getCurrentValue
Ophir LOJKINE [Wed, 10 Feb 2021 13:55:53 +0000 (14:55 +0100)]
Fix getCurrentValue

3 years agoCatch errors on localStorage setting failure
Ophir LOJKINE [Wed, 10 Feb 2021 13:53:22 +0000 (14:53 +0100)]
Catch errors on localStorage setting failure

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

“Ask forgiveness not permission”  : this makes the code both simpler and more robust

3 years agoAuto merge of #79804 - tmiasko:improper-ctypes-no-niche, r=pnkfelix
bors [Wed, 10 Feb 2021 12:56:09 +0000 (12:56 +0000)]
Auto merge of #79804 - tmiasko:improper-ctypes-no-niche, r=pnkfelix

Types with a hidden niche are not known to be non-null

Fixes #79787.

3 years agoAuto merge of #81768 - calebcartwright:bump-rls-rustfmt, r=Xanewok
bors [Wed, 10 Feb 2021 10:00:01 +0000 (10:00 +0000)]
Auto merge of #81768 - calebcartwright:bump-rls-rustfmt, r=Xanewok

update RLS and rustfmt

Fixes #81582 and fixes #81583

r? `@Xanewok`

I was originally surprised by the size of lockfile diff, though after looking at the RLS changes it makes a bit more sense to me now

3 years agoFix assosiated typo
Daniel Egger [Wed, 10 Feb 2021 08:36:26 +0000 (09:36 +0100)]
Fix assosiated typo

Introduced in d3c4dbd85d63c8bdfa362d7cac8b3e8cbca51272, noticed only
after the fact, sorry. 😅

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
3 years agoOnly initialize what is used
Dániel Buga [Sun, 17 Jan 2021 19:20:16 +0000 (20:20 +0100)]
Only initialize what is used

3 years agoAuto merge of #81929 - pietroalbini:pgo-bootstrap, r=Mark-Simulacrum
bors [Wed, 10 Feb 2021 07:10:43 +0000 (07:10 +0000)]
Auto merge of #81929 - pietroalbini:pgo-bootstrap, r=Mark-Simulacrum

Allow unstable features in some PGO benchmarks

Some of the benchmarks we're using for PGO require unstable features (such as compiling the standard library and some rustc-perf benchmarks), breaking CI on the beta and stable branches. For the past two releases we cherry-picked a commit directly onto the beta branch that unconditionally sets `RUSTC_BOOTSTRAP=1`, and this PR backports a similar change to the master branch.

The difference between this commit and the one we backported previously (483c1a83ca7cf53fd8f3432edb32cbe70ba39d45) is that this is more scoped in which benchmarks we allow unstable features, to prevent unintentionally enabling unstable features.

r? `@Mark-Simulacrum`

3 years agobootstrap: Locate llvm-dwp based on llvm-config bindir
David Tolnay [Wed, 10 Feb 2021 03:04:29 +0000 (19:04 -0800)]
bootstrap: Locate llvm-dwp based on llvm-config bindir

3 years agoRELEASES.md 1.50: Group platform support notes together
Josh Triplett [Wed, 10 Feb 2021 03:45:32 +0000 (19:45 -0800)]
RELEASES.md 1.50: Group platform support notes together

Move the note about dropping cloudabi next to the other platform support
changes.

3 years agoAuto merge of #81952 - JohnTitor:rollup-i28kgfb, r=JohnTitor
bors [Wed, 10 Feb 2021 03:30:17 +0000 (03:30 +0000)]
Auto merge of #81952 - JohnTitor:rollup-i28kgfb, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #79849 (Clarify docs regarding sleep of zero duration)
 - #80438 (Add `Box::into_inner`.)
 - #81466 (Add suggest mut method for loop)
 - #81687 (Make Vec::split_at_spare_mut public)
 - #81904 (Bump stabilization version for const int methods)
 - #81909 ([compiler/rustc_typeck/src/check/expr.rs] Remove unnecessary refs in pattern matching)
 - #81910 (Use format string in bootstrap panic instead of a string directly)
 - #81913 (Rename HIR UnOp variants)
 - #81925 (Add long explanation for E0547)
 - #81926 (add suggestion to use the `async_recursion` crate)
 - #81951 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #81951 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Wed, 10 Feb 2021 03:24:32 +0000 (12:24 +0900)]
Rollup merge of #81951 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 34170fcd6e0947808a1ac63ac85ffc0da7dace2f..ab64d1393b5b77c66b6534ef5023a1b89ee7bf64
2021-02-04 15:52:52 +0000 to 2021-02-10 00:19:10 +0000
- Allow `true` and `false` as options for `strip` option (rust-lang/cargo#9153)
- Change git dependencies to use `HEAD` by default (rust-lang/cargo#9133)
- appendix auth gcm link to new repo (which is xplat) (rust-lang/cargo#9152)
- Fix warnings of the new non_fmt_panic lint (rust-lang/cargo#9148)
- Fix panic with doc collision orphan. (rust-lang/cargo#9142)

3 years agoRollup merge of #81926 - henryboisdequin:fix-81907, r=estebank
Yuki Okushi [Wed, 10 Feb 2021 03:24:30 +0000 (12:24 +0900)]
Rollup merge of #81926 - henryboisdequin:fix-81907, r=estebank

add suggestion to use the `async_recursion` crate

Closes #81907

CC `@estebank`

3 years agoRollup merge of #81925 - jesusprubio:add-long-explanation-e0547, r=GuillaumeGomez
Yuki Okushi [Wed, 10 Feb 2021 03:24:29 +0000 (12:24 +0900)]
Rollup merge of #81925 - jesusprubio:add-long-explanation-e0547, r=GuillaumeGomez

Add long explanation for E0547

Helps with #61137

3 years agoRollup merge of #81913 - osa1:rename_unop_variants, r=matthewjasper
Yuki Okushi [Wed, 10 Feb 2021 03:24:28 +0000 (12:24 +0900)]
Rollup merge of #81913 - osa1:rename_unop_variants, r=matthewjasper

Rename HIR UnOp variants

This renames the variants in HIR UnOp from

    enum UnOp {
        UnDeref,
        UnNot,
        UnNeg,
    }

to

    enum UnOp {
        Deref,
        Not,
        Neg,
    }

Motivations:

- This is more consistent with the rest of the code base where most enum
  variants don't have a prefix.

- These variants are never used without the `UnOp` prefix so the extra
  `Un` prefix doesn't help with readability. E.g. we don't have any
  `UnDeref`s in the code, we only have `UnOp::UnDeref`.

- MIR `UnOp` type variants don't have a prefix so this is more
  consistent with MIR types.

- "un" prefix reads like "inverse" or "reverse", so as a beginner in
  rustc code base when I see "UnDeref" what comes to my mind is
  something like `&*` instead of just `*`.

3 years agoRollup merge of #81910 - jyn514:bootstrap-1.52, r=jackh726
Yuki Okushi [Wed, 10 Feb 2021 03:24:26 +0000 (12:24 +0900)]
Rollup merge of #81910 - jyn514:bootstrap-1.52, r=jackh726

Use format string in bootstrap panic instead of a string directly

This fixes the following warning when compiling with nightly:

```
warning: panic message is not a string literal
    --> src/bootstrap/builder.rs:1515:24
     |
1515 |                 panic!(out);
     |                        ^^^
     |
     = note: `#[warn(non_fmt_panic)]` on by default
     = note: this is no longer accepted in Rust 2021
help: add a "{}" format string to Display the message
     |
1515 |                 panic!("{}", out);
     |                        ^^^^^
help: or use std::panic::panic_any instead
     |
1515 |                 std::panic::panic_any(out);
     |                 ^^^^^^^^^^^^^^^^^^^^^^
```

Found while working on https://github.com/rust-lang/rust/pull/79540. cc https://github.com/rust-lang/rust/pull/81645, which landed in 1.51.

3 years agoRollup merge of #81909 - wcampbell0x2a:remove-unnecessary-refs, r=estebank
Yuki Okushi [Wed, 10 Feb 2021 03:24:25 +0000 (12:24 +0900)]
Rollup merge of #81909 - wcampbell0x2a:remove-unnecessary-refs, r=estebank

[compiler/rustc_typeck/src/check/expr.rs] Remove unnecessary refs in pattern matching

3 years agoRollup merge of #81904 - jhpratt:const_int_fn-stabilization, r=jyn514
Yuki Okushi [Wed, 10 Feb 2021 03:24:23 +0000 (12:24 +0900)]
Rollup merge of #81904 - jhpratt:const_int_fn-stabilization, r=jyn514

Bump stabilization version for const int methods

These methods missed the beta cutoff. See #80962 for details.

`@rustbot` modify labels to +A-const-fn, +A-intrinsics

r? `@m-ou-se`

3 years agoRollup merge of #81687 - WaffleLapkin:split_at_spare, r=KodrAus
Yuki Okushi [Wed, 10 Feb 2021 03:24:22 +0000 (12:24 +0900)]
Rollup merge of #81687 - WaffleLapkin:split_at_spare, r=KodrAus

Make Vec::split_at_spare_mut public

This PR introduces a new method to the public API, under
`vec_split_at_spare` feature gate:

```rust
impl<T, A: Allocator> impl Vec<T, A> {
    pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]);
}
```

The method returns 2 slices, one slice references the content of the vector,
and the other references the remaining spare capacity.

The method was previously implemented while adding `Vec::extend_from_within` in #79015,
and used to implement `Vec::spare_capacity_mut` (as the later is just a
subset of former one).

See also previous [discussion in `Vec::spare_capacity_mut` tracking issue](https://github.com/rust-lang/rust/issues/75017#issuecomment-770381335).

## Unresolved questions

- [ ] Should we consider changing the name? `split_at_spare_mut` doesn't seem like an intuitive name
- [ ] Should we deprecate `Vec::spare_capacity_mut`? Any usecase of `Vec::spare_capacity_mut` can be replaced with `Vec::split_at_spare_mut` (but not vise-versa)

r? `@KodrAus`

3 years agoRollup merge of #81466 - sasurau4:fix/enhance-sugget-mut-method-for-loop, r=oli-obk
Yuki Okushi [Wed, 10 Feb 2021 03:24:21 +0000 (12:24 +0900)]
Rollup merge of #81466 - sasurau4:fix/enhance-sugget-mut-method-for-loop, r=oli-obk

Add suggest mut method for loop

Part of #49839

This PR focus on [the comment case](https://github.com/rust-lang/rust/issues/49839#issuecomment-761930746)

3 years agoRollup merge of #80438 - crlf0710:box_into_inner, r=m-ou-se
Yuki Okushi [Wed, 10 Feb 2021 03:24:19 +0000 (12:24 +0900)]
Rollup merge of #80438 - crlf0710:box_into_inner, r=m-ou-se

Add `Box::into_inner`.

This adds a `Box::into_inner` method to the `Box` type. <del>I actually suggest deprecating the compiler magic of `*b` if this gets stablized in the future.</del>

r? `@m-ou-se`

3 years agoRollup merge of #79849 - Digital-Chaos:sleep-zero, r=m-ou-se
Yuki Okushi [Wed, 10 Feb 2021 03:24:18 +0000 (12:24 +0900)]
Rollup merge of #79849 - Digital-Chaos:sleep-zero, r=m-ou-se

Clarify docs regarding sleep of zero duration

Clarify that the behaviour of sleep() when given a duration of zero is actually platform specific.

3 years agoUpdate cargo
Eric Huss [Wed, 10 Feb 2021 02:59:47 +0000 (18:59 -0800)]
Update cargo

3 years agoremove unused backtrace refs
Caleb Cartwright [Wed, 10 Feb 2021 01:56:18 +0000 (19:56 -0600)]
remove unused backtrace refs

3 years agoupdate RLS and rustfmt
Caleb Cartwright [Wed, 10 Feb 2021 01:52:54 +0000 (19:52 -0600)]
update RLS and rustfmt

3 years agoUse ItemCtxt::to_ty
Cameron Steffen [Wed, 10 Feb 2021 01:05:18 +0000 (19:05 -0600)]
Use ItemCtxt::to_ty

3 years agoAuto merge of #81411 - Skgland:deprecate_expr_method_call, r=varkor
bors [Wed, 10 Feb 2021 00:25:11 +0000 (00:25 +0000)]
Auto merge of #81411 - Skgland:deprecate_expr_method_call, r=varkor

Remove usages of `expr_method_call` in derive(Ord,PartialOrd,RustcEncode,RustcDecode)

Preparing for deprecation of `expr_method_call`  (#81295), by removing the remaining usages not covered by (#81294).

I am not sure about the changes to `derive(RustcEncode,RustcDecode)`

3 years agoBorrow builder only once in debug derive
Tomasz Miąsko [Wed, 10 Feb 2021 00:00:00 +0000 (00:00 +0000)]
Borrow builder only once in debug derive

3 years agoupdate tracking issue for vec_split_at_spare
Ashley Mannix [Tue, 9 Feb 2021 23:50:59 +0000 (09:50 +1000)]
update tracking issue for vec_split_at_spare

3 years agoAuto merge of #81132 - bugadani:map-prealloc, r=matthewjasper
bors [Tue, 9 Feb 2021 21:28:58 +0000 (21:28 +0000)]
Auto merge of #81132 - bugadani:map-prealloc, r=matthewjasper

Borrowck: refactor visited map to a bitset

This PR refactors `Borrows`  and the `precompute_borrows_out_of_scope` function so that this initial phase has a much reduced memory pressure. This is achieved by reducing what is stored on the heap, and also reusing heap memory as much as possible.

3 years agoAuto merge of #81892 - jyn514:no-inline, r=cjgillot
bors [Tue, 9 Feb 2021 18:37:33 +0000 (18:37 +0000)]
Auto merge of #81892 - jyn514:no-inline, r=cjgillot

[experiment] remove `#[inline]` from rustc_query_system::plumbing

These functions have a ton of generic parameters and are instantiated
over and over again. Hopefully this will reduce binary bloat and speed
up bootstrapping times.

r? `@cjgillot`

3 years agoAuto merge of #79540 - jyn514:no-xpy, r=Mark-Simulacrum
bors [Tue, 9 Feb 2021 15:28:28 +0000 (15:28 +0000)]
Auto merge of #79540 - jyn514:no-xpy, r=Mark-Simulacrum

Allow building rustdoc without first building rustc (MVP)

 ## Motivation

The compile times for rustc are extremely long and a major issue for
recruiting new contributors to rustdoc. People interested in joining
often give up after running into issues with submodules or python
versions. stage1 rustdoc fundamentally doesn't care about bootstrapping
or stages, it just needs `rustc_private` available.

## Summary of Changes

- Add an opt-in `[rust] download_rustc` option
- Determine the version of the compiler to download using `log --author=bors`
- Do no work for any component other than `Rustdoc` for any stage. Instead, copy the CI artifacts from the downloaded sysroot stage0/ to stage0-sysroot/ or stage1/ in `Sysroot`. This is done with an `ENABLE_DOWNLOAD_STAGE1` constant which is off by default.
- Don't download different versions of rustfmt or cargo - those should still use the beta version (rustfmt especially).

The vast majority of work is done in bootstrap.py, which downloads the artifacts and extracts them to stage0/ in place of the beta compiler. Rustbuild just takes care of copying the artifacts to stage1 if necessary.

## Future work

- I turned off verification for the commit tarballs because the .sha256 URLs gave a 404. This seems not ideal, it would be nice to start signing them.
- This will break if you rebase an old enough branch (I think commits are kept at most 160 days?). This doesn't need to be supported, but it would be nice to give a reasonable error. https://github.com/rust-lang/rust/pull/79540#issuecomment-751481291
- Right now, every time you rebase, stage0 tools (bootstrap, tidy, ...) will have to be recompiled. Additionally running `x.py setup tools` will compile rustbuild twice. Instead, this should download a separate beta compiler for stage0 and only use CI artifacts for stage1 onward. https://github.com/rust-lang/rust/pull/79540#issuecomment-757047321
- Add `x.py setup tools` to enable this conveniently (it doesn't make sense to use this for compiler developers). https://github.com/jyn514/rust/commit/cb5d8c85226c501bf9deb39082a08af0ebfae850
- Compile a new version of tracing so that rustdoc still gets debug logging (since CI artifacts always disable `debug` and `trace` logging). https://github.com/rust-lang/rust/pull/79540#issuecomment-742756411, https://github.com/jyn514/rust/commit/6a5d5124209bec7652e745725a995bd77bb3f881
- Right now only rustdoc is ever rebuilt. This is not ideal and should probably at least compile compiler tools (rustfmt, clippy, miri). https://github.com/rust-lang/rust/pull/79540#issuecomment-775634693
- Using `git log --author=bors` sometimes breaks. This should use `git merge-base` instead. https://github.com/rust-lang/rust/pull/79540#discussion_r572572280
- It would be nice to support cross-compiling the standard library. Right now this gives an assertion failure I think.

Some of this work has already been done in (the history for) https://github.com/jyn514/rust/commit/673476c785bc1fbff175cb7f49ad487c7a2b0337.

3 years agoci: allow unstable features in some PGO benchmarks
Pietro Albini [Tue, 29 Dec 2020 20:18:40 +0000 (15:18 -0500)]
ci: allow unstable features in some PGO benchmarks

3 years agoUpdate compiler/rustc_error_codes/src/error_codes/E0547.md
Jesús Rubio [Tue, 9 Feb 2021 13:13:40 +0000 (14:13 +0100)]
Update compiler/rustc_error_codes/src/error_codes/E0547.md

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
3 years agoadd suggestion to use the `async_recursion` crate
Henry Boisdequin [Tue, 9 Feb 2021 13:13:39 +0000 (18:43 +0530)]
add suggestion to use the `async_recursion` crate

3 years agoLost text re-added
Jesus Rubio [Tue, 9 Feb 2021 13:09:19 +0000 (14:09 +0100)]
Lost text re-added

3 years agoBTreeMap: disentangle Drop implementation from IntoIter
Stein Somers [Fri, 22 Jan 2021 16:03:52 +0000 (17:03 +0100)]
BTreeMap: disentangle Drop implementation from IntoIter

3 years agofix derive(RustcEncodable, RustcDecodable)
Skgland [Thu, 4 Feb 2021 21:49:50 +0000 (22:49 +0100)]
fix derive(RustcEncodable, RustcDecodable)

3 years agouse ufcs in derive(RustDecodable)
Skgland [Tue, 26 Jan 2021 14:06:01 +0000 (15:06 +0100)]
use ufcs in derive(RustDecodable)

3 years agouse ufcs in derive(RustEncodable)
Skgland [Tue, 26 Jan 2021 14:05:11 +0000 (15:05 +0100)]
use ufcs in derive(RustEncodable)

3 years agoadd method to construct def site path as a vec of idents
Skgland [Tue, 26 Jan 2021 14:04:09 +0000 (15:04 +0100)]
add method to construct def site path as a vec of idents

like std_path but used dummy span for all path elements and does not perpend kw:DollarCrate

3 years agouse ufcs in derive(Ord) and derive(PartialOrd)
Skgland [Tue, 9 Feb 2021 12:41:34 +0000 (13:41 +0100)]
use ufcs in derive(Ord) and derive(PartialOrd)

3 years agoAuto merge of #81916 - RalfJung:miri, r=RalfJung
bors [Tue, 9 Feb 2021 11:38:47 +0000 (11:38 +0000)]
Auto merge of #81916 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/81868
Cc `@rust-lang/miri` r? `@ghost`

3 years agoupdate Miri
Ralf Jung [Tue, 9 Feb 2021 10:05:42 +0000 (11:05 +0100)]
update Miri

3 years agoAuto merge of #81384 - tmiasko:partial-ord, r=petrochenkov
bors [Tue, 9 Feb 2021 08:47:38 +0000 (08:47 +0000)]
Auto merge of #81384 - tmiasko:partial-ord, r=petrochenkov

Fix derived PartialOrd operators

The derived implementation of `partial_cmp` compares matching fields one
by one, stopping the computation when the result of a comparison is not
equal to `Some(Equal)`.

On the other hand the derived implementation for `lt`, `le`, `gt` and
`ge` continues the computation when the result of a field comparison is
`None`, consequently those operators are not transitive and inconsistent
with `partial_cmp`.

Fix the inconsistency by using the default implementation that fall-backs
to the `partial_cmp`. This also avoids creating very deeply nested
closures that were quite costly to compile.

Fixes #81373.
Helps with #81278, #80118.

3 years agoRename HIR UnOp variants
Ömer Sinan Ağacan [Tue, 9 Feb 2021 08:15:53 +0000 (11:15 +0300)]
Rename HIR UnOp variants

This renames the variants in HIR UnOp from

    enum UnOp {
        UnDeref,
        UnNot,
        UnNeg,
    }

to

    enum UnOp {
        Deref,
        Not,
        Neg,
    }

Motivations:

- This is more consistent with the rest of the code base where most enum
  variants don't have a prefix.

- These variants are never used without the `UnOp` prefix so the extra
  `Un` prefix doesn't help with readability. E.g. we don't have any
  `UnDeref`s in the code, we only have `UnOp::UnDeref`.

- MIR `UnOp` type variants don't have a prefix so this is more
  consistent with MIR types.

- "un" prefix reads like "inverse" or "reverse", so as a beginner in
  rustc code base when I see "UnDeref" what comes to my mind is
  something like "&*" instead of just "*".

3 years agoAuto merge of #81905 - Dylan-DPC:rollup-mxpz1j7, r=Dylan-DPC
bors [Tue, 9 Feb 2021 05:57:18 +0000 (05:57 +0000)]
Auto merge of #81905 - Dylan-DPC:rollup-mxpz1j7, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #72209 (Add checking for no_mangle to unsafe_code lint)
 - #80732 (Allow Trait inheritance with cycles on associated types take 2)
 - #81697 (Add "every" as a doc alias for "all".)
 - #81826 (Prefer match over combinators to make some Box methods inlineable)
 - #81834 (Resolve typedef in HashMap lldb pretty-printer only if possible)
 - #81841 ([rustbuild] Output rustdoc-json-types docs )
 - #81849 (Expand the docs for ops::ControlFlow a bit)
 - #81876 (parser: Fix panic in 'const impl' recovery)
 - #81882 (:arrow_up: rust-analyzer)
 - #81888 (Fix pretty printer macro_rules with semicolon.)
 - #81896 (Remove outdated comment in windows' mutex.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoUse `log --author=bors` instead of `merge-base`
Joshua Nelson [Fri, 22 Jan 2021 06:00:51 +0000 (01:00 -0500)]
Use `log --author=bors` instead of `merge-base`

3 years agoAbsolute bare minimum for downloading rustc from CI
Joshua Nelson [Fri, 22 Jan 2021 05:31:17 +0000 (00:31 -0500)]
Absolute bare minimum for downloading rustc from CI

- Use the same compiler for stage0 and stage1. This should be fixed at
  some point (so bootstrap isn't constantly rebuilt).
- Make sure `x.py build` and `x.py check` work.
- Use `git merge-base` to determine the most recent commit to download.
- Copy stage0 to the various sysroots in `Sysroot`, and delegate to
  Sysroot in Assemble. Leave all other code unchanged.
- Rename date -> key

  This can also be a commit hash, so 'date' is no longer a good name.

- Add the commented-out option to config.toml.example
- Disable all steps by default when `download-rustc` is enabled

  Most steps don't make sense when downloading a compiler, because they'll
  be pre-built in the sysroot. Only enable the ones that might be useful,
  in particular Rustdoc and all `check` steps.

  At some point, this should probably enable other tools, but rustdoc is
  enough to test out `download-rustc`.

- Don't print 'Skipping' twice in a row

  Bootstrap forcibly enables a dry run if it isn't already set, so
  previously it would print the message twice:

  ```
  Skipping bootstrap::compile::Std because it is not enabled for `download-rustc`
  Skipping bootstrap::compile::Std because it is not enabled for `download-rustc`
  ```

  Now it correctly only prints once.

 ## Future work

- Add FIXME about supporting beta commits
- Debug logging will never work. This should be fixed.

3 years agoUse format string in bootstrap panic instead of a string directly
Joshua Nelson [Tue, 9 Feb 2021 03:51:21 +0000 (22:51 -0500)]
Use format string in bootstrap panic instead of a string directly

This fixes the following warning when compiling with nightly:

```
warning: panic message is not a string literal
    --> src/bootstrap/builder.rs:1515:24
     |
1515 |                 panic!(out);
     |                        ^^^
     |
     = note: `#[warn(non_fmt_panic)]` on by default
     = note: this is no longer accepted in Rust 2021
help: add a "{}" format string to Display the message
     |
1515 |                 panic!("{}", out);
     |                        ^^^^^
help: or use std::panic::panic_any instead
     |
1515 |                 std::panic::panic_any(out);
     |                 ^^^^^^^^^^^^^^^^^^^^^^
```

3 years agoAuto merge of #81901 - Mark-Simulacrum:use-string-not-cow, r=jackh726
bors [Tue, 9 Feb 2021 03:06:42 +0000 (03:06 +0000)]
Auto merge of #81901 - Mark-Simulacrum:use-string-not-cow, r=jackh726

Switch query descriptions to just String

In practice we never used the borrowed variant anyway.

3 years agoRemove unnecessary refs in pattern matching
wcampbell [Tue, 9 Feb 2021 03:02:35 +0000 (22:02 -0500)]
Remove unnecessary refs in pattern matching

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
3 years agoAdd `Box::into_inner`.
Charles Lew [Mon, 28 Dec 2020 12:47:19 +0000 (20:47 +0800)]
Add `Box::into_inner`.

3 years agoRollup merge of #81896 - m-ou-se:oudated-comment, r=Mark-Simulacrum
Dylan DPC [Tue, 9 Feb 2021 01:40:06 +0000 (02:40 +0100)]
Rollup merge of #81896 - m-ou-se:oudated-comment, r=Mark-Simulacrum

Remove outdated comment in windows' mutex.rs

After https://github.com/rust-lang/rust/pull/81250, this `Mutex` no longer falls back to the `ReentrantMutex` implementation, so this comment is no longer relevant.

3 years agoRollup merge of #81888 - ehuss:macro_rules-pp, r=petrochenkov
Dylan DPC [Tue, 9 Feb 2021 01:40:05 +0000 (02:40 +0100)]
Rollup merge of #81888 - ehuss:macro_rules-pp, r=petrochenkov

Fix pretty printer macro_rules with semicolon.

The pretty printer was not including the trailing semicolon for a macro_rules definition that used parenthesis or brackets, which results in invalid code. This adds the semicolon in those two cases.