Commit graph

138257 commits

Author SHA1 Message Date
LingMan 28347ebdb3 Drop an unnecessary intermediate variable
Neither does it shorten the code nor does it provide a helpful name.
2021-02-12 14:08:14 +01:00
Ryan Levick 8ea0973725 Short circuit full corherence check when dealing with types with different reference mutability 2021-02-12 14:04:09 +01:00
LingMan fde59a8cb7 Use Iterator::all instead of open-coding it
Shorter code and by initializing to the final value directly, the variable
doesn't need to be mut.
2021-02-12 14:02:35 +01:00
VillSnow afdc8c7918 stabilize partition_point 2021-02-12 21:57:17 +09:00
VillSnow de21cdf792 update documents 2021-02-12 21:57:17 +09:00
0yoyoyo fcce998d56 Add nll test 2021-02-12 21:51:00 +09:00
Yuki Okushi ff8b7f20d9
Rollup merge of #82017 - eltociear:patch-8, r=jyn514
Fix typo in mod.rs

insted -> instead
2021-02-12 19:32:22 +09:00
Yuki Okushi 095b76c755
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.
2021-02-12 19:32:21 +09:00
Yuki Okushi 6830ea1a83
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``
2021-02-12 19:32:20 +09:00
Yuki Okushi 1a9d20b430
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``
2021-02-12 19:32:18 +09:00
Yuki Okushi 55539cbdc0
Rollup merge of #82003 - ojeda:stack-probe-msg, r=estebank
Stack probes: fix error message
2021-02-12 19:32:17 +09:00
Yuki Okushi 71fd43117b
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.
2021-02-12 19:32:16 +09:00
Yuki Okushi 44d28717da
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
2021-02-12 19:32:15 +09:00
Yuki Okushi 46aef0e375
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.
2021-02-12 19:32:14 +09:00
Yuki Okushi 459dda98eb
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``````
2021-02-12 19:32:13 +09:00
Yuki Okushi 0f47e192bd
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()
2021-02-12 19:32:13 +09:00
Yuki Okushi 0b7fc80e45
Rollup merge of #81959 - therealprof:fix-typo, r=oli-obk
Fix assosiated typo

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

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2021-02-12 19:32:12 +09:00
Yuki Okushi 67403da1eb
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.
2021-02-12 19:32:11 +09:00
Yuki Okushi 2a76add29f
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.
2021-02-12 19:32:09 +09:00
Yuki Okushi c07260d534
Rollup merge of #81947 - camsteffen:to-ty, r=jyn514
Relax ItemCtxt::to_ty lifetime

Tiny simplification by relaxing a lifetime.
2021-02-12 19:32:08 +09:00
Yuki Okushi 327762f088
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``
2021-02-12 19:32:07 +09:00
Yuki Okushi 0b6876cbe7
Rollup merge of #79983 - petar-dambovaliev:master, r=Dylan-DPC
fix indefinite article in cell.rs
2021-02-12 19:32:06 +09:00
Mikail Bagishov f546633cf8
Remove unnecessary lint allow attrs on example 2021-02-12 12:46:02 +03:00
LingMan fda71d676d Push a char instead of a str with len one into a String 2021-02-12 10:27:08 +01:00
Kevin Per 1adc6be23f Update .stderr 2021-02-12 09:19:54 +00:00
Kevin Per fba2f883f3 Implementing more sophisticated filter for fn in const or static 2021-02-12 09:18:03 +00:00
Aman Arora 96c12f90cf fixup! Implement the precise analysis pass for lint disjoint_capture_drop_reorder 2021-02-12 04:10:17 -05:00
bors a118ee2c13 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`
2021-02-12 06:34:21 +00:00
Ikko Ashimine c8eeb340bc
Fix typo in mod.rs
insted -> instead
2021-02-12 13:47:21 +09:00
Mark Rousskov a35550774b Tell user how to fix CI file being not up to date 2021-02-11 19:57:59 -05:00
Joshua Nelson 67fb96c537 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.
2021-02-11 19:26:00 -05:00
Joshua Nelson 02ffe9ef01 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);
 //! ```
 ````
2021-02-11 17:16:43 -05:00
Rich Kadel b211acf683 Re-blessed the partial_eq.rs coverage test 2021-02-11 14:11:08 -08:00
Rich Kadel 625803d77e Set SHELL = /bin/dash only if it exists 2021-02-11 11:40:30 -08:00
Rich Kadel 01f5a2a81d Ensures make tests run under /bin/dash, like CI, and fixes a Makefile
Updates `tools.mk` to explicitly require `SHELL := /bin/dash`, since CI
uses `dash` but other environments (including developer local machines)
may default to `bash`.

Replaces bash-specific shell command in one Makefile with a
dash-compatible alternative, and re-enables the affected Makefile test.

Removes apparently redundant definition of `UNAME`.
2021-02-11 11:40:29 -08:00
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