Commit graph

138222 commits

Author SHA1 Message Date
Guillaume Gomez
583563d86d clean up clean::Static struct 2021-02-11 20:37:36 +01:00
Miguel Ojeda
0df8ddee53 Stack probes: fix error message
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-11 20:33:16 +01:00
bors
e9920ef774 Auto merge of #81760 - tmiasko:debug-borrow, r=pnkfelix
Borrow builder only once in debug derive
2021-02-11 16:46:08 +00:00
Benjamin Bouvier
f492b257e7 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.
2021-02-11 17:45:54 +01:00
0yoyoyo
788e4bb4e5 Fix suggestion to introduce explicit lifetime 2021-02-12 00:48:44 +09:00
Jesus Rubio
a99d869e6c Improve long explanation for E0542 and E0546 2021-02-11 16:26:07 +01:00
bors
26e5bcd220 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).
2021-02-11 13:44:00 +00:00
Hirochika Matsumoto
e03f09730f Make suggestion of changing mutability of arguments broader 2021-02-11 17:03:03 +09:00
bors
2918062d1d Auto merge of #81129 - bugadani:lighter-move-errors, r=petrochenkov
Borrowck: don't calculate unused info when reporting move errors
2021-02-11 07:50:02 +00:00
bors
1efd804983 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.
2021-02-11 04:40:57 +00:00
bors
9ce7268bcf Auto merge of #80860 - camelid:nodeid-docs, r=sanxiyn
Document `NodeId`
2021-02-11 00:51:45 +00:00
bors
178108bf81 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.
2021-02-10 21:48:07 +00:00
Amanieu d'Antras
bfd1ccfb27 Seal the CommandExt, OsStrExt and OsStringExt traits 2021-02-10 21:30:30 +00:00
Vadim Petrochenkov
8e74842089 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.
2021-02-10 22:46:44 +03:00
Vadim Petrochenkov
b4b6b62e70 resolve: Cleanup visibility resolution in enums and traits 2021-02-10 22:46:44 +03:00
Pietro Albini
5034b504b4
bootstrap: fix wrong docs installation path 2021-02-10 18:46:40 +01:00
LeSeulArtichaut
089ee27dd0 Do not ICE on range patterns in function arguments 2021-02-10 16:41:48 +01:00
LeSeulArtichaut
793e88ad16 Add regression test for #81289 2021-02-10 16:41:09 +01:00
Ophir LOJKINE
16f0ccda86
Fix getCurrentValue 2021-02-10 14:55:53 +01:00
Ophir LOJKINE
f13bbea124
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
2021-02-10 14:53:22 +01:00
Ellen
7ca96ed2af rewrite the comments 2021-02-10 13:11:22 +00:00
bors
07194ffcd2 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.
2021-02-10 12:56:09 +00:00
Ömer Sinan Ağacan
d64b749f2c Allow casting mut array ref to mut ptr
We now allow two new casts:

- mut array reference to mut ptr. Example:

      let mut x: [usize; 2] = [0, 0];
      let p = &mut x as *mut usize;

  We allow casting const array references to const pointers so not
  allowing mut references to mut pointers was inconsistent.

- mut array reference to const ptr. Example:

      let mut x: [usize; 2] = [0, 0];
      let p = &mut x as *const usize;

  This was similarly inconsistent as we allow casting mut references to
  const pointers.

Existing test 'vector-cast-weirdness' updated to test both cases.

Fixes #24151
2021-02-10 15:44:41 +03:00
bors
218bf8d765 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
2021-02-10 10:00:01 +00:00
Daniel Egger
a6d413715c Fix assosiated typo
Introduced in d3c4dbd85d, noticed only
after the fact, sorry. 😅

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2021-02-10 09:36:26 +01:00
Dániel Buga
3c1d792f49 Only initialize what is used 2021-02-10 09:20:41 +01:00
bors
6523b721c3 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`
2021-02-10 07:10:43 +00:00
Stein Somers
f81358d578 BTree: remove outdated traces of coercions 2021-02-10 07:48:13 +01:00
Ellen
0ffa2da186 comma... 2021-02-10 05:29:45 +00:00
Ellen
0422745585 Fix comment smol mistakes 2021-02-10 05:23:16 +00:00
Ellen
2c4337a70a Comments :3 2021-02-10 05:15:43 +00:00
David Tolnay
d3fea13ae0
bootstrap: Locate llvm-dwp based on llvm-config bindir 2021-02-09 20:39:54 -08:00
Josh Triplett
883988b350 RELEASES.md 1.50: Group platform support notes together
Move the note about dropping cloudabi next to the other platform support
changes.
2021-02-09 19:45:32 -08:00
bors
f7534b566c 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
2021-02-10 03:30:17 +00:00
Yuki Okushi
77114af9ca
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)
2021-02-10 12:24:32 +09:00
Yuki Okushi
2e8e591a16
Rollup merge of #81926 - henryboisdequin:fix-81907, r=estebank
add suggestion to use the `async_recursion` crate

Closes #81907

CC `@estebank`
2021-02-10 12:24:30 +09:00
Yuki Okushi
40fa6fc43f
Rollup merge of #81925 - jesusprubio:add-long-explanation-e0547, r=GuillaumeGomez
Add long explanation for E0547

Helps with #61137
2021-02-10 12:24:29 +09:00
Yuki Okushi
a58feb9282
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 `*`.
2021-02-10 12:24:28 +09:00
Yuki Okushi
812910898a
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.
2021-02-10 12:24:26 +09:00
Yuki Okushi
fff36f199a
Rollup merge of #81909 - wcampbell0x2a:remove-unnecessary-refs, r=estebank
[compiler/rustc_typeck/src/check/expr.rs] Remove unnecessary refs in pattern matching
2021-02-10 12:24:25 +09:00
Yuki Okushi
bf0c2d5382
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`
2021-02-10 12:24:23 +09:00
Yuki Okushi
e2765f8cbd
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`
2021-02-10 12:24:22 +09:00
Yuki Okushi
3f09418cbe
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)
2021-02-10 12:24:21 +09:00
Yuki Okushi
a28f2afbeb
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`
2021-02-10 12:24:19 +09:00
Yuki Okushi
bb06b13131
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.
2021-02-10 12:24:18 +09:00
Eric Huss
b53b79cc76 Update cargo 2021-02-09 18:59:47 -08:00
Caleb Cartwright
0a47a38fd0 remove unused backtrace refs 2021-02-09 19:56:18 -06:00
Caleb Cartwright
6391318158 update RLS and rustfmt 2021-02-09 19:52:54 -06:00
Cameron Steffen
471ed5f80f Use ItemCtxt::to_ty 2021-02-09 19:27:33 -06:00
bors
ca98712ff9 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)`
2021-02-10 00:25:11 +00:00