]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agofix typo in compile_fail doctest
Ralf Jung [Fri, 16 Jul 2021 08:31:56 +0000 (10:31 +0200)]
fix typo in compile_fail doctest

2 years agoAuto merge of #87177 - ehuss:update-cargo, r=ehuss
bors [Fri, 16 Jul 2021 04:03:12 +0000 (04:03 +0000)]
Auto merge of #87177 - ehuss:update-cargo, r=ehuss

Update cargo

6 commits in 66a6737a0c9f3a974af2dd032a65d3e409c77aac..27277d966b3cfa454d6dea7f724cb961c036251c
2021-07-14 20:54:28 +0000 to 2021-07-16 00:50:39 +0000
- Flag another curl error as possibly spurious (rust-lang/cargo#9695)
- Add `d` as an alias for `doc` (rust-lang/cargo#9680)
- `cargo fix --edition`: extend warning when on latest edition (rust-lang/cargo#9694)
- Update env_logger requirement from 0.8.1 to 0.9.0 (rust-lang/cargo#9688)
- Document cargo limitation w/ workspaces & configs (rust-lang/cargo#9674)
- Change some warnings to errors (rust-lang/cargo#9689)

2 years agoUpdate cargo
Eric Huss [Fri, 16 Jul 2021 02:27:11 +0000 (19:27 -0700)]
Update cargo

2 years agoAuto merge of #86993 - jackh726:project-gat-binders, r=nikomatsakis
bors [Fri, 16 Jul 2021 01:11:37 +0000 (01:11 +0000)]
Auto merge of #86993 - jackh726:project-gat-binders, r=nikomatsakis

Replace associated item bound vars with placeholders when projecting

Fixes #76407
Fixes #76826

Similar, but more limited, to #85499. This allows us to handle things like `for<'a> <T as Trait>::Assoc<'a>` but not `for<'a> <T as Trait<'a>>::Assoc`, unblocking GATs.

r? `@nikomatsakis`

2 years agoAuto merge of #83319 - tmiasko:packed-aligned, r=jackh726
bors [Thu, 15 Jul 2021 19:51:17 +0000 (19:51 +0000)]
Auto merge of #83319 - tmiasko:packed-aligned, r=jackh726

Layout error instead of an ICE for packed and aligned types

Fixes #83107.

2 years agoAuto merge of #87152 - flip1995:clippyup, r=Manishearth
bors [Thu, 15 Jul 2021 17:10:09 +0000 (17:10 +0000)]
Auto merge of #87152 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoLayout error instead of an ICE for packed and aligned types
Tomasz Miąsko [Sat, 20 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Layout error instead of an ICE for packed and aligned types

2 years agoRemove failed and review comments
jackh726 [Thu, 15 Jul 2021 14:41:35 +0000 (10:41 -0400)]
Remove failed and review comments

2 years agoAuto merge of #87156 - JohnTitor:rollup-osuhe53, r=JohnTitor
bors [Thu, 15 Jul 2021 14:29:07 +0000 (14:29 +0000)]
Auto merge of #87156 - JohnTitor:rollup-osuhe53, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #85579 (Added Arc::try_pin)
 - #86478 (Add -Zfuture-incompat-test to assist with testing future-incompat reports.)
 - #86947 (Move assert_matches to an inner module)
 - #87081 (Add tracking issue number to `wasi_ext`)
 - #87127 (Add safety comments in private core::slice::rotate::ptr_rotate function)
 - #87134 (Make SelfInTyParamDefault wording not be specific to type defaults)
 - #87147 (Update cargo)
 - #87154 (Fix misuse of rev attribute on <a> tag)

Failed merges:

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

2 years agoRollup merge of #87154 - GuillaumeGomez:rev-attr-a, r=JohnTitor
Yuki Okushi [Thu, 15 Jul 2021 12:19:22 +0000 (21:19 +0900)]
Rollup merge of #87154 - GuillaumeGomez:rev-attr-a, r=JohnTitor

Fix misuse of rev attribute on <a> tag

The `rev` attribute is supposed to talk about "ownership" as far as I could found out. This attribute seems not very well defined in the HTML spec and its usage in rustdoc is suboptimal.

It was found out in https://github.com/rust-lang/rust/pull/87149.

r? `@JohnTitor`

2 years agoRollup merge of #87147 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Thu, 15 Jul 2021 12:19:21 +0000 (21:19 +0900)]
Rollup merge of #87147 - ehuss:update-cargo, r=ehuss

Update cargo

13 commits in 3ebb5f15a940810f250b68821149387af583a79e..66a6737a0c9f3a974af2dd032a65d3e409c77aac
2021-07-02 20:35:38 +0000 to 2021-07-14 20:54:28 +0000
- Add format option to `cargo tree` to print the lib_name (rust-lang/cargo#9663)
- Prefer patched versions of dependencies (rust-lang/cargo#9639)
- When a dependency does not have a version, git or path, fails directly (rust-lang/cargo#9686)
- Spot the crate typo easily (rust-lang/cargo#9665)
- remove unnecessary 'collect' (rust-lang/cargo#9616)
- Make it easier to run testsuite with a custom toolchain. (rust-lang/cargo#9679)
- Serialize `cargo fix` (rust-lang/cargo#9677)
- Don't recommend filing issues on rust-lang/cargo for Cargo.toml errors. (rust-lang/cargo#9658)
- Update nightly failure notification. (rust-lang/cargo#9657)
- Update Windows env uppercase key check. (rust-lang/cargo#9654)
- Unignore fix_edition_2021. (rust-lang/cargo#9662)
- Warning when using features in patch (rust-lang/cargo#9666)
- Unify cargo and rustc's error reporting (rust-lang/cargo#9655)

2 years agoRollup merge of #87134 - BoxyUwU:cgd-self-ty-error, r=lcnr
Yuki Okushi [Thu, 15 Jul 2021 12:19:20 +0000 (21:19 +0900)]
Rollup merge of #87134 - BoxyUwU:cgd-self-ty-error, r=lcnr

Make SelfInTyParamDefault wording not be specific to type defaults

r? ```@lcnr```

2 years agoRollup merge of #87127 - poliorcetics:ptr-rotate-safety, r=scottmcm
Yuki Okushi [Thu, 15 Jul 2021 12:19:19 +0000 (21:19 +0900)]
Rollup merge of #87127 - poliorcetics:ptr-rotate-safety, r=scottmcm

Add safety comments in private core::slice::rotate::ptr_rotate function

Helps with #66219.

```@rustbot``` label C-cleanup T-compiler T-libs

2 years agoRollup merge of #87081 - a1phyr:add_wasi_ext_tracking_issue, r=dtolnay
Yuki Okushi [Thu, 15 Jul 2021 12:19:18 +0000 (21:19 +0900)]
Rollup merge of #87081 - a1phyr:add_wasi_ext_tracking_issue, r=dtolnay

Add tracking issue number to `wasi_ext`

Feature `wasi_ext` is tracked by #71213 but is was not in the source code.

2 years agoRollup merge of #86947 - m-ou-se:assert-matches-to-submodule, r=yaahc
Yuki Okushi [Thu, 15 Jul 2021 12:19:16 +0000 (21:19 +0900)]
Rollup merge of #86947 - m-ou-se:assert-matches-to-submodule, r=yaahc

Move assert_matches to an inner module

Fixes #82913

2 years agoRollup merge of #86478 - ehuss:future-incompat-test, r=oli-obk
Yuki Okushi [Thu, 15 Jul 2021 12:19:11 +0000 (21:19 +0900)]
Rollup merge of #86478 - ehuss:future-incompat-test, r=oli-obk

Add -Zfuture-incompat-test to assist with testing future-incompat reports.

This adds a `-Zfuture-incompat-test` cli flag to assist with testing future-incompatible reports. This flag causes all lints to be treated as a future-incompatible lint, and will emit a report for them. This is being added so that Cargo's testsuite can reliably test the reporting infrastructure.  Right now, Cargo relies on using array_into_iter as a test subject. Since the breaking "future incompatible" lints are never intended to last forever, this means Cargo's testsuite would always need to keep changing to choose different lints (for example, #86330 proposed dropping that moniker for array_into_iter). With this flag, Cargo's tests can trigger any lint and check for the report.

2 years agoRollup merge of #85579 - alex:patch-1, r=yaahc
Yuki Okushi [Thu, 15 Jul 2021 12:19:10 +0000 (21:19 +0900)]
Rollup merge of #85579 - alex:patch-1, r=yaahc

Added Arc::try_pin

This helper is in line with other other allocation helpers on Arc.

I didn't think this would require an RFC or broader discussion, let me know if that's incorrect.

2 years agoAdded Arc::try_pin
Alex Gaynor [Sat, 22 May 2021 14:24:50 +0000 (10:24 -0400)]
Added Arc::try_pin

This helper is in line with other other allocation helpers on Arc.

2 years agoFix misuse of rev attribute on <a> tag
Guillaume Gomez [Thu, 15 Jul 2021 11:05:15 +0000 (13:05 +0200)]
Fix misuse of rev attribute on <a> tag

2 years agoMerge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup
flip1995 [Thu, 15 Jul 2021 08:44:10 +0000 (10:44 +0200)]
Merge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup

2 years agoAuto merge of #7468 - flip1995:rustup, r=flip1995
bors [Thu, 15 Jul 2021 08:37:36 +0000 (08:37 +0000)]
Auto merge of #7468 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-07-15
flip1995 [Thu, 15 Jul 2021 08:32:21 +0000 (10:32 +0200)]
Bump nightly version -> 2021-07-15

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 15 Jul 2021 08:21:01 +0000 (10:21 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #7308 - lengyijun:redundant_allocation_arc, r=xFrednet,flip1995
bors [Thu, 15 Jul 2021 07:20:37 +0000 (07:20 +0000)]
Auto merge of #7308 - lengyijun:redundant_allocation_arc, r=xFrednet,flip1995

add Arc to `redundant_allocation`

 fixes #7303
changelog:  add Arc to `redundant_allocation`

2 years agoUpdate cargo
Eric Huss [Thu, 15 Jul 2021 02:56:42 +0000 (19:56 -0700)]
Update cargo

2 years agoAuto merge of #86876 - jyn514:56935-target-crate-num, r=petrochenkov
bors [Thu, 15 Jul 2021 02:39:38 +0000 (02:39 +0000)]
Auto merge of #86876 - jyn514:56935-target-crate-num, r=petrochenkov

Reuse CrateNum for proc-macro crates even when cross-compiling

Proc-macros are always compiled for the host, so this should be the same
in every way as recompiling the crate.

I am not sure why the previous code special-cased the target, since the
compiler properly gives an error when trying to load a crate for a
different host:

```
error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu
  --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2
   |
LL |     dependency::is_64();
   |     ^^^^^^^^^^
   |
   = note: the following crate versions were found:
           crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so
```

I think another possible fix is to remove the check altogether. But I'm
not sure, and this fix works, so I'm not making the larger change here.

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

r? `@petrochenkov` cc `@alexcrichton`

2 years agoReuse CrateNum for proc-macro crates even when cross-compiling
Joshua Nelson [Sun, 4 Jul 2021 03:35:24 +0000 (23:35 -0400)]
Reuse CrateNum for proc-macro crates even when cross-compiling

Proc-macros are always compiled for the host, so this should be the same
in every way as recompiling the crate.

I am not sure why the previous code special-cased the target, since the
compiler properly gives an error when trying to load a crate for a
different host:

```
error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu
  --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2
   |
LL |     dependency::is_64();
   |     ^^^^^^^^^^
   |
   = note: the following crate versions were found:
           crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so
```

I think another possible fix is to remove the check altogether. But I'm
not sure, and this fix works, so I'm not making the larger change here.

2 years agoAuto merge of #87137 - richkadel:compiler-builtins-0.1.47, r=tmandry
bors [Wed, 14 Jul 2021 23:58:43 +0000 (23:58 +0000)]
Auto merge of #87137 - richkadel:compiler-builtins-0.1.47, r=tmandry

Update compiler-builtins to 0.1.47

  Bumped to `0.1.47` to resolve missing symbols on `aarch` when linking
  `cargo`. This was due to a recent change in a `cargo` dependency on
  `curl` (upstream C library added code that uses the uncommon `long
  double` type).

r? `@tmandry`

2 years agoredundant_allocation: add Arc; some refractoring.
lyj [Wed, 2 Jun 2021 05:41:52 +0000 (13:41 +0800)]
redundant_allocation: add Arc; some refractoring.

2 years agoAuto merge of #86765 - cuviper:fuse-less-specialized, r=joshtriplett
bors [Wed, 14 Jul 2021 21:17:52 +0000 (21:17 +0000)]
Auto merge of #86765 - cuviper:fuse-less-specialized, r=joshtriplett

Make the specialized Fuse still deal with None

Fixes #85863 by removing the assumption that we'll never see a cleared iterator in the `I: FusedIterator` specialization. Now all `Fuse` methods check for the possibility that `self.iter` is `None`, and the specialization only avoids _setting_ that to `None` in `&mut self` methods.

2 years agoUpdate compiler-builtins to 0.1.47
Rich Kadel [Wed, 14 Jul 2021 20:45:16 +0000 (13:45 -0700)]
Update compiler-builtins to 0.1.47

  Bumped to `0.1.47` to resolve missing symbols on `aarch` when linking
  `cargo`. This was due to a recent change in a `cargo` dependency on
  `curl` (upstream C library added code that uses the uncommon `long
  double` type).

2 years agoAuto merge of #7462 - xFrednet:7369-branches-sharing-code-else-expr-fp, r=camsteffen
bors [Wed, 14 Jul 2021 20:29:56 +0000 (20:29 +0000)]
Auto merge of #7462 - xFrednet:7369-branches-sharing-code-else-expr-fp, r=camsteffen

FP fix and documentation for `branches_sharing_code` lint

Closes rust-lang/rust-clippy#7369

Related rust-lang/rust-clippy#7452 I'm still thinking about the best way to fix this. I could simply add another visitor to ensure that the moved expressions don't modify values being used in the condition, but I'm not totally happy with this due to the complexity. I therefore only documented it for now

changelog: [`branches_sharing_code`] fixed false positive where block expressions would sometimes be ignored.

2 years agoFixed `branches_sharing_code` FP with block expressions in else
xFrednet [Tue, 13 Jul 2021 21:27:19 +0000 (23:27 +0200)]
Fixed `branches_sharing_code` FP with block expressions in else

And added `branches_sharing_code` PF note to lint doc for `rust-clippy#7452`

2 years agoOOPS
Ellen [Wed, 14 Jul 2021 18:38:58 +0000 (19:38 +0100)]
OOPS

2 years agoAuto merge of #87133 - GuillaumeGomez:rollup-pfz9jbk, r=GuillaumeGomez
bors [Wed, 14 Jul 2021 18:36:44 +0000 (18:36 +0000)]
Auto merge of #87133 - GuillaumeGomez:rollup-pfz9jbk, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #87027 (expand: Support helper attributes for built-in derive macros)
 - #87056 (Fix codeblocks overflow)
 - #87117 (Shrink the CrateStore dynamic interface.)
 - #87120 (rustdoc: Remove unnecessary `extern crate` aliases)
 - #87125 (Fix Ayu theme `<code>` color)
 - #87130 (Update browser-ui-test package version)

Failed merges:

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

2 years agoChange type param -> generic param
Ellen [Wed, 14 Jul 2021 18:22:32 +0000 (19:22 +0100)]
Change type param -> generic param

2 years agoRollup merge of #87130 - GuillaumeGomez:update-browser-ui-test, r=Mark-Simulacrum
Guillaume Gomez [Wed, 14 Jul 2021 17:53:41 +0000 (19:53 +0200)]
Rollup merge of #87130 - GuillaumeGomez:update-browser-ui-test, r=Mark-Simulacrum

Update browser-ui-test package version

It adds a check to prevent to have empty CSS values in `assert-css` command.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #87125 - GuillaumeGomez:ayu-code-color, r=notriddle
Guillaume Gomez [Wed, 14 Jul 2021 17:53:40 +0000 (19:53 +0200)]
Rollup merge of #87125 - GuillaumeGomez:ayu-code-color, r=notriddle

Fix Ayu theme <code> color

Fixes #87072 (the second regression).

r? `@notriddle`

2 years agoRollup merge of #87120 - jyn514:rustdoc-cleanup, r=CraftSpider
Guillaume Gomez [Wed, 14 Jul 2021 17:53:38 +0000 (19:53 +0200)]
Rollup merge of #87120 - jyn514:rustdoc-cleanup, r=CraftSpider

rustdoc: Remove unnecessary `extern crate` aliases

2 years agoRollup merge of #87117 - cjgillot:cstore, r=petrochenkov
Guillaume Gomez [Wed, 14 Jul 2021 17:53:37 +0000 (19:53 +0200)]
Rollup merge of #87117 - cjgillot:cstore, r=petrochenkov

Shrink the CrateStore dynamic interface.

The information is either accessible through queries or by crates which already depend on rustc_metadata.

2 years agoRollup merge of #87056 - GuillaumeGomez:fix-codeblocks-overflow, r=notriddle
Guillaume Gomez [Wed, 14 Jul 2021 17:53:36 +0000 (19:53 +0200)]
Rollup merge of #87056 - GuillaumeGomez:fix-codeblocks-overflow, r=notriddle

Fix codeblocks overflow

Fixes #87043.

Instead of completely relying on `pulldown-cmark` (and its potential changes), I decided to move the generation of codeblocks HTML directly in rustdoc so we can unify the DOM and the CSS classes.

r? `@Nemo157`

2 years agoRollup merge of #87027 - petrochenkov:builderhelp, r=oli-obk
Guillaume Gomez [Wed, 14 Jul 2021 17:53:35 +0000 (19:53 +0200)]
Rollup merge of #87027 - petrochenkov:builderhelp, r=oli-obk

expand: Support helper attributes for built-in derive macros

This is needed for https://github.com/rust-lang/rust/pull/86735 (derive macro `Default` should have a helper attribute `default`).

With this PR we can specify helper attributes for built-in derives using syntax `#[rustc_builtin_macro(MacroName, attributes(attr1, attr2, ...))]` which mirrors equivalent syntax for proc macros `#[proc_macro_derive(MacroName, attributes(attr1, attr2, ...))]`.
Otherwise expansion infra was already ready for this.
The attribute parsing code is shared between proc macro derives and built-in macros (`fn parse_macro_name_and_helper_attrs`).

2 years agoAdd -Zfuture-incompat-test to assist with testing future-incompat reports.
Eric Huss [Sun, 20 Jun 2021 00:06:46 +0000 (17:06 -0700)]
Add -Zfuture-incompat-test to assist with testing future-incompat reports.

2 years agoAuto merge of #87082 - michaelwoerister:const-in-debuginfo-type-names-fix, r=oli...
bors [Wed, 14 Jul 2021 15:18:27 +0000 (15:18 +0000)]
Auto merge of #87082 - michaelwoerister:const-in-debuginfo-type-names-fix, r=oli-obk,wesleywiser

Handle non-integer const generic parameters in debuginfo type names.

This PR fixes an ICE introduced by https://github.com/rust-lang/rust/pull/85269 which started emitting const generic arguments for debuginfo names but did not cover the case where such an argument could not be evaluated to a flat string of bits.

The fix implemented in this PR is very basic: If `try_eval_bits()` fails for the constant in question, we fall back to generating a stable hash of the constant and emit that instead. This way we get a (virtually) unique name and side step the problem of generating a string representation of a potentially complex value.

The downside is that the generated name will be rather opaque. E.g. the regression test adds a function `const_generic_fn_non_int<()>` which is then rendered as `const_generic_fn_non_int<{CONST#fe3cfa0214ac55c7}>`. I think it's an open question how to deal with this more gracefully.

I'd be interested in ideas on how to do this better.

r? `@wesleywiser`

cc `@dpaoliello` (do you see any problems with this approach?)
cc `@Mark-Simulacrum` & `@nagisa` (who I've seen comment on debuginfo issues recently -- anyone else?)

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

2 years agoAuto merge of #7437 - ebobrow:redundant-closure-move, r=flip1995
bors [Wed, 14 Jul 2021 15:15:28 +0000 (15:15 +0000)]
Auto merge of #7437 - ebobrow:redundant-closure-move, r=flip1995

suggest `&mut` for redundant FnMut closures

fixes #6903

changelog: suggest `&mut` for redundant FnMut closures

2 years agosuggest `&mut` for redundant FnMut closures
Elliot Bobrow [Sat, 3 Jul 2021 03:25:55 +0000 (20:25 -0700)]
suggest `&mut` for redundant FnMut closures

2 years agoShrink the CrateStore dynamic interface.
Camille GILLOT [Mon, 12 Jul 2021 19:20:16 +0000 (21:20 +0200)]
Shrink the CrateStore dynamic interface.

2 years agoUpdate browser-ui-test package version
Guillaume Gomez [Wed, 14 Jul 2021 14:28:15 +0000 (16:28 +0200)]
Update browser-ui-test package version

2 years agoHandle non-integer const generic parameters in debuginfo type names.
Michael Woerister [Mon, 12 Jul 2021 13:12:49 +0000 (15:12 +0200)]
Handle non-integer const generic parameters in debuginfo type names.

2 years agoAdd safety comments in private core::slice::rotate::ptr_rotate function
Alexis Bourget [Wed, 14 Jul 2021 13:31:12 +0000 (15:31 +0200)]
Add safety comments in private core::slice::rotate::ptr_rotate function

2 years agoAdd GUI test to check ayu <code> colors
Guillaume Gomez [Wed, 14 Jul 2021 13:00:12 +0000 (15:00 +0200)]
Add GUI test to check ayu <code> colors

2 years agoAuto merge of #87118 - JohnTitor:rollup-8ltidsq, r=JohnTitor
bors [Wed, 14 Jul 2021 12:49:45 +0000 (12:49 +0000)]
Auto merge of #87118 - JohnTitor:rollup-8ltidsq, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #87085 (Search result colors)
 - #87090 (Make BTreeSet::split_off name elements like other set methods do)
 - #87098 (Unignore some pretty printing tests)
 - #87099 (Upgrade `cc` crate to 1.0.69)
 - #87101 (Suggest a path separator if a stray colon is found in a match arm)
 - #87102 (Add GUI test for "go to first" feature)

Failed merges:

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

2 years agoFix color for <code> which are not in doc blocks
Guillaume Gomez [Wed, 14 Jul 2021 12:47:54 +0000 (14:47 +0200)]
Fix color for <code> which are not in doc blocks

2 years agoAuto merge of #7346 - lengyijun:redundant_clone_5707, r=oli-obk
bors [Wed, 14 Jul 2021 10:10:14 +0000 (10:10 +0000)]
Auto merge of #7346 - lengyijun:redundant_clone_5707, r=oli-obk

fix 5707

changelog: ``[`redundant_clone`]``, fix #5707

# Root problem of #5707 :
```
&2:&mut HashMap = &mut _4;
&3:&str = & _5;
_1 = HashMap::insert(move _2,move _3, _);
```

generate PossibleBorrower(_2,_1) and PossibleBorrower(_3,_1).

However, it misses PossibleBorrower(_3,_2).

# My solution to #5707 :

When meet a function call, we should:
1. build PossibleBorrower between borrow parameters and return value (currently)
2. build PossibleBorrower between immutable borrow parameters and mutable borrow parameters (*add*)
3. build PossibleBorrower inside mutable borrow parameters (*add*)

For example:
```
_2: &mut _22;
_3: &mut _;
_4: & _;
_5: & _;
_1 = call(move _2, move _3, move _4, move _5);
```
we need to build
1. return value with parameter(current implementataion)
 PossibleBorrower(_2,_1)
 PossibleBorrower(_3,_1)
 PossibleBorrower(_4,_1)
 PossibleBorrower(_5,_1)

2. between mutable borrow and immutable borrow
PossibleBorrower(_4,_2)
PossibleBorrower(_5,_2)
PossibleBorrower(_4,_3)
PossibleBorrower(_5,_3)

3. between mutable borrow and mutable borrow
PossibleBorrower(_3,_2)
PossibleBorrower(_2,_3)

  But that's not enough.
 Modification to _2 actually apply to _22.
  So I write a `PossibleBorrowed` visitor, which tracks (borrower => possible borrowed) relation.
  For example (_2 => _22).
  However, a lot of problems exist here.

## Known Problems:
  1. not sure all `&mut`'s origin are collected.
  I'm not sure how to deal with `&mut` when meet a function call, so I didn't do it currently.
  Also, my implement is not flow sensitive, so it's not accurate.

```
foo(_2:&mut _, _3: &_)
```
This pr doesn't count _3 as origin of _2.

 2. introduce false negative
`foo(_2, _3)` will  emit PossibleBorrower(_3,_2) in this pr, but _3 and _2 may not have relation.
Clippy may feel that _3 is still in use because of _2, but actually, _3 is on longer needed and can be moved.

## Insight
  The key problem is determine where every `&mut` come from accurately.
  I think Polonius is an elegant solution to it. Polonius is flow sensitive and accurate.
  But I'm uncertain about whether we can import Polonius in rust-clippy currently.
  This pr actually is part of Polonius' functionality, I think.

# TODO
1. `cargo test` can't pass yet due to similar variable name

2 years agoAdd test for codeblocks overflow
Guillaume Gomez [Sun, 11 Jul 2021 11:06:48 +0000 (13:06 +0200)]
Add test for codeblocks overflow

2 years agoFix display for non-rust code blocks
Guillaume Gomez [Sun, 11 Jul 2021 10:40:31 +0000 (12:40 +0200)]
Fix display for non-rust code blocks

2 years agorename possible_borrowed to possible_origin; pass dogfood
lyj [Wed, 14 Jul 2021 03:29:39 +0000 (11:29 +0800)]
rename possible_borrowed to possible_origin; pass dogfood

2 years agoAuto merge of #86211 - tlyu:option-result-overviews, r=joshtriplett
bors [Wed, 14 Jul 2021 05:10:57 +0000 (05:10 +0000)]
Auto merge of #86211 - tlyu:option-result-overviews, r=joshtriplett

create method overview docs for core::option and core::result

The `Option` and `Result` types have large lists of methods. They each could use an overview page of methods grouped by category. These proposed overviews include "truth tables" for the underappreciated boolean operators/combinators of these types. The methods are already somewhat categorized in the source, but some logical groupings are broken up by the necessities of putting related methods in different `impl` blocks, for example.

This is based on #86209, but those are small changes and unlikely to conflict.

2 years agoRemove useless alias from `rustc_span` to itself
Joshua Nelson [Wed, 14 Jul 2021 01:41:05 +0000 (21:41 -0400)]
Remove useless alias from `rustc_span` to itself

2 years agoRemove renaming of `test` crate
Joshua Nelson [Wed, 14 Jul 2021 01:40:09 +0000 (21:40 -0400)]
Remove renaming of `test` crate

This is leftover from when `doctest` used to be called `test`. Remove it
now, it's unnecessary and makes the code harder to read.

2 years agofix 5707
lyj [Fri, 11 Jun 2021 12:57:11 +0000 (20:57 +0800)]
fix 5707

2 years agoAuto merge of #87106 - Mark-Simulacrum:edition-no-clone, r=petrochenkov
bors [Wed, 14 Jul 2021 01:41:12 +0000 (01:41 +0000)]
Auto merge of #87106 - Mark-Simulacrum:edition-no-clone, r=petrochenkov

Avoid cloning ExpnData to access Span edition

ExpnData is a fairly hefty structure to clone; cloning it may not be cheap. In
some cases this may get optimized out, but it's not clear that will always be
the case. Try to avoid that cost.

r? `@ghost` -- opening for a perf run to start with

2 years agoRollup merge of #87102 - GuillaumeGomez:go-to-first-feature, r=Manisheart,notriddle
Yuki Okushi [Wed, 14 Jul 2021 00:35:27 +0000 (09:35 +0900)]
Rollup merge of #87102 - GuillaumeGomez:go-to-first-feature, r=Manisheart,notriddle

Add GUI test for "go to first" feature

It adds a test for #85876 to ensure the feature is working as expected and prevent potential regression.

cc ```@jeanlucthumm```

r? ```@Manishearth```

2 years agoRollup merge of #87101 - FabianWolff:issue-87086, r=estebank
Yuki Okushi [Wed, 14 Jul 2021 00:35:26 +0000 (09:35 +0900)]
Rollup merge of #87101 - FabianWolff:issue-87086, r=estebank

Suggest a path separator if a stray colon is found in a match arm

Attempts to fix #87086.

r? `@estebank`

2 years agoRollup merge of #87099 - JohnTitor:upgrade-cc-crate, r=alexcrichton
Yuki Okushi [Wed, 14 Jul 2021 00:35:25 +0000 (09:35 +0900)]
Rollup merge of #87099 - JohnTitor:upgrade-cc-crate, r=alexcrichton

Upgrade `cc` crate to 1.0.69

This pulls another fix for #83043, i.e., alexcrichton/cc-rs#605.
r? ``@alexcrichton``

2 years agoRollup merge of #87098 - JohnTitor:unignore-some-tests, r=petrochenkov
Yuki Okushi [Wed, 14 Jul 2021 00:35:23 +0000 (09:35 +0900)]
Rollup merge of #87098 - JohnTitor:unignore-some-tests, r=petrochenkov

Unignore some pretty printing tests

Closes #37201
r? ````@petrochenkov````

2 years agoRollup merge of #87090 - ssomers:btree_comments, r=the8472
Yuki Okushi [Wed, 14 Jul 2021 00:35:22 +0000 (09:35 +0900)]
Rollup merge of #87090 - ssomers:btree_comments, r=the8472

Make BTreeSet::split_off name elements like other set methods do

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

2 years agoRollup merge of #87085 - GuillaumeGomez:search-result-colors, r=notriddle
Yuki Okushi [Wed, 14 Jul 2021 00:35:22 +0000 (09:35 +0900)]
Rollup merge of #87085 - GuillaumeGomez:search-result-colors, r=notriddle

Search result colors

Part of  #87072 (fixes the first and fourth regressions and add tests to prevent it from happening again).

cc ````@Nemo157````

r? ````@camelid````

2 years agoSuggest a path separator if a stray colon is found in a match arm
Fabian Wolff [Tue, 13 Jul 2021 11:18:03 +0000 (13:18 +0200)]
Suggest a path separator if a stray colon is found in a match arm

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2 years agoAuto merge of #87044 - cjgillot:expnhash, r=petrochenkov
bors [Tue, 13 Jul 2021 22:32:58 +0000 (22:32 +0000)]
Auto merge of #87044 - cjgillot:expnhash, r=petrochenkov

Cache expansion hash globally

... instead of computing it multiple times.

Split from #86676
r? `@petrochenkov`

2 years agoCache expansion hash.
Camille GILLOT [Tue, 22 Jun 2021 17:20:25 +0000 (19:20 +0200)]
Cache expansion hash.

2 years agoMove HashStable implementations.
Camille GILLOT [Tue, 22 Jun 2021 17:16:18 +0000 (19:16 +0200)]
Move HashStable implementations.

2 years agoConditionally call normalize_erasing_regions only if polymorhization is enabled
jackh726 [Tue, 13 Jul 2021 19:09:01 +0000 (15:09 -0400)]
Conditionally call normalize_erasing_regions only if polymorhization is enabled

2 years agoexpand: Support helper attributes for built-in derive macros
Vadim Petrochenkov [Sat, 10 Jul 2021 14:16:53 +0000 (17:16 +0300)]
expand: Support helper attributes for built-in derive macros

2 years agoAdd test for "go to first" feature
Guillaume Gomez [Tue, 13 Jul 2021 12:41:19 +0000 (14:41 +0200)]
Add test for "go to first" feature

2 years agoAuto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk
bors [Tue, 13 Jul 2021 15:06:10 +0000 (15:06 +0000)]
Auto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk

Fix internal `default_hash_types` lint to use resolved path

I run into false positives now and then (mostly in Clippy) when I want to name some util after HashMap.

2 years agoAuto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk
bors [Tue, 13 Jul 2021 15:06:10 +0000 (15:06 +0000)]
Auto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk

Fix internal `default_hash_types` lint to use resolved path

I run into false positives now and then (mostly in Clippy) when I want to name some util after HashMap.

2 years agoAvoid cloning ExpnData to access Span edition
Mark Rousskov [Tue, 13 Jul 2021 14:57:10 +0000 (10:57 -0400)]
Avoid cloning ExpnData to access Span edition

ExpnData is a fairly hefty structure to clone; cloning it may not be cheap. In
some cases this may get optimized out, but it's not clear that will always be
the case. Try to avoid that cost.

2 years agoWIP partial apply fix
jackh726 [Tue, 13 Jul 2021 14:50:40 +0000 (10:50 -0400)]
WIP partial apply fix

2 years agoAuto merge of #7446 - Y-Nak:fix-7445, r=xFrednet,flip1995
bors [Tue, 13 Jul 2021 14:31:02 +0000 (14:31 +0000)]
Auto merge of #7446 - Y-Nak:fix-7445, r=xFrednet,flip1995

`default_numeric_fallback`: Fix FP with floating literal

Fix #7445

changelog: `default_numeric_fallback`: Fix FP with floating literal

2 years ago`default_numeric_fallback`: Add rustfix tests
Yoshitomo Nakanishi [Tue, 13 Jul 2021 13:57:47 +0000 (22:57 +0900)]
`default_numeric_fallback`: Add rustfix tests

2 years agoAuto merge of #7442 - camsteffen:format-args, r=xFrednet
bors [Tue, 13 Jul 2021 13:58:38 +0000 (13:58 +0000)]
Auto merge of #7442 - camsteffen:format-args, r=xFrednet

Refactor `format_args!` expansion parsing

Introduces `FormatExpn::parse` and `FormatArgsExpn::parse`. Motivated by rust-lang/rust#83302, so I only have to change Clippy in one place. Fixed an FP along the way.

I also allowed `needless_bool` in macros because I often want to do `if_chain! { .. then { true } else { false } }`.

changelog: Fix false positive in `useless_format` when some text is appended or prepended to a single string with some useless formatting params
changelog: Allow `needless_bool` in macros

2 years agoSplit a lint message into help
Cameron Steffen [Mon, 12 Jul 2021 01:30:19 +0000 (20:30 -0500)]
Split a lint message into help

2 years agoReduce redundant code
Cameron Steffen [Mon, 12 Jul 2021 01:21:21 +0000 (20:21 -0500)]
Reduce redundant code

2 years agoRefactor format macro parsing
Cameron Steffen [Tue, 6 Jul 2021 16:51:15 +0000 (11:51 -0500)]
Refactor format macro parsing

2 years agoFix useless_format false positive
Cameron Steffen [Sun, 4 Jul 2021 21:34:22 +0000 (16:34 -0500)]
Fix useless_format false positive

2 years agoAllow needless_bool in macro
Cameron Steffen [Wed, 9 Jun 2021 19:44:42 +0000 (14:44 -0500)]
Allow needless_bool in macro

2 years agoFix `NumericLiteral::format` that may produce a invalid literal
Yoshitomo Nakanishi [Tue, 13 Jul 2021 13:56:41 +0000 (22:56 +0900)]
Fix `NumericLiteral::format` that may produce a invalid literal

2 years agoAuto merge of #7458 - flip1995:unused_unit-doc, r=giraffate
bors [Tue, 13 Jul 2021 13:43:12 +0000 (13:43 +0000)]
Auto merge of #7458 - flip1995:unused_unit-doc, r=giraffate

Add fixed example to unused_unit documentation

changelog: none

(don't think this is worth a changelog mention)

2 years agoAuto merge of #86922 - joshtriplett:target-abi, r=oli-obk
bors [Tue, 13 Jul 2021 12:25:10 +0000 (12:25 +0000)]
Auto merge of #86922 - joshtriplett:target-abi, r=oli-obk

target abi

Implement cfg(target_abi) (RFC 2992)

Add an `abi` field to `TargetOptions`, defaulting to "". Support using
`cfg(target_abi = "...")` for conditional compilation on that field.

Gated by `feature(cfg_target_abi)`.

Add a test for `target_abi`, and a test for the feature gate.

Add `target_abi` to tidy as a platform-specific cfg.

Update targets to use `target_abi`

All eabi targets have `target_abi = "eabi".`
All eabihf targets have `target_abi = "eabihf"`.
`armv6_unknown_freebsd` and `armv7_unknown_freebsd` have `target_abi = "eabihf"`.
All abi64 targets have `target_abi = "abi64"`.
All ilp32 targets have `target_abi = "ilp32"`.
All softfloat targets have `target_abi = "softfloat"`.
All *-uwp-windows-* targets have `target_abi = "uwp"`.
All spe targets have `target_abi = "spe"`.
All macabi targets have `target_abi = "macabi"`.
aarch64-apple-ios-sim has `target_abi = "sim"`.
`x86_64-fortanix-unknown-sgx` has `target_abi = "fortanix"`.
`x86_64-unknown-linux-gnux32` has `target_abi = "x32"`.

Add FIXME entries for targets for which existing values need to change
once `cfg_target_abi` becomes stable. (All of them are tier 3 targets.)

Add a test for `target_abi` in `--print cfg`.

2 years agoAuto merge of #87019 - nikic:clang-12.0.1, r=Mark-Simulacrum
bors [Tue, 13 Jul 2021 09:40:28 +0000 (09:40 +0000)]
Auto merge of #87019 - nikic:clang-12.0.1, r=Mark-Simulacrum

Use clang 12.0.1 on dist-x86_64/i686-linux

The LLD + ThinLTO __morestack bug has been fixed in 12.0.1, so
we can now update our clang version. This also means that we no
longer need to build Python 2.

2 years agoUpgrade `cc` crate to 1.0.69
Yuki Okushi [Tue, 13 Jul 2021 08:58:50 +0000 (17:58 +0900)]
Upgrade `cc` crate to 1.0.69

2 years agoAdd fixed example to unused_unit documentation
flip1995 [Tue, 13 Jul 2021 08:54:29 +0000 (10:54 +0200)]
Add fixed example to unused_unit documentation

2 years agoAdd test for keyword/primitive text color
Guillaume Gomez [Mon, 12 Jul 2021 15:42:59 +0000 (17:42 +0200)]
Add test for keyword/primitive text color

2 years agoFix color for keyword/primitive search result
Guillaume Gomez [Mon, 12 Jul 2021 15:42:53 +0000 (17:42 +0200)]
Fix color for keyword/primitive search result

2 years agoAdd test for search results colors
Guillaume Gomez [Mon, 12 Jul 2021 14:48:25 +0000 (16:48 +0200)]
Add test for search results colors

2 years agoFix search result description text color for ayu theme
Guillaume Gomez [Mon, 12 Jul 2021 14:32:26 +0000 (16:32 +0200)]
Fix search result description text color for ayu theme

2 years agoUnignore some pretty printing tests
Yuki Okushi [Tue, 13 Jul 2021 07:55:40 +0000 (16:55 +0900)]
Unignore some pretty printing tests

2 years agoAuto merge of #86857 - fee1-dead:add-attr, r=oli-obk
bors [Tue, 13 Jul 2021 06:59:34 +0000 (06:59 +0000)]
Auto merge of #86857 - fee1-dead:add-attr, r=oli-obk

Add #[default_method_body_is_const]

`@rustbot` label F-const_trait_impl

2 years agoAuto merge of #86665 - FabianWolff:layout-field-thir-unsafeck, r=oli-obk
bors [Tue, 13 Jul 2021 04:38:39 +0000 (04:38 +0000)]
Auto merge of #86665 - FabianWolff:layout-field-thir-unsafeck, r=oli-obk

Implement Mutation- and BorrowOfLayoutConstrainedField in thir-unsafeck

Since nobody has so far claimed Mutation- and BorrowOfLayoutConstrainedField in rust-lang/project-thir-unsafeck#7, I have taken the liberty of implementing them in thir-unsafeck.

r? `@LeSeulArtichaut`