Commit graph

152235 commits

Author SHA1 Message Date
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
bors a985d8e6c7 Auto merge of #87579 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2021-07-29 15:36:52 +00:00
flip1995 8570a367e0
Update Cargo.lock (Clippy version bump) 2021-07-29 12:17:29 +02:00
flip1995 72d655b5b6
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup 2021-07-29 12:16:06 +02:00
bors 0cce3f643b Auto merge of #7504 - flip1995:rename-lints, r=flip1995
Rename two lints to comply with our lint naming convention

self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain

We don't need to `register_renamed` those lints, since I'll backport them to beta, so the old names won't hit stable.

changelog: none
(I'll adapt the changelog before merging #7498)
2021-07-29 10:14:31 +00:00
flip1995 54e539121d
Rename two lints to comply with our lint naming convention
self_named_constructor -> self_named_constructors
append_instead_of_extend -> extend_with_drain
2021-07-29 12:10:18 +02:00
bors 5fb3394cbd Auto merge of #86664 - m-ou-se:uninit-track-caller, r=JohnTitor
Add #[track_caller] for some function in core::mem.

These functions can panic for some types. This makes the panic point to the code that calls e.g. mem::uninitialized(), instead of inside the definition of mem::uninitialized.
2021-07-29 09:35:23 +00:00
bors 766f09f5c1 Auto merge of #7503 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2021-07-29 09:35:13 +00:00
flip1995 80116f9009
Bump Clippy Version -> 0.1.56 2021-07-29 11:15:11 +02:00
flip1995 7ed7b29d73
Bump nightly version -> 2021-07-29 2021-07-29 11:14:53 +02:00
flip1995 490beda6be
Merge remote-tracking branch 'upstream/master' into rustup 2021-07-29 11:14:25 +02:00
bors 6e0a8bf790 Auto merge of #86998 - m-ou-se:const-panic-fmt-as-str, r=oli-obk
Make const panic!("..") work in Rust 2021.

During const eval, this replaces calls to core::panicking::panic_fmt and std::panicking::being_panic_fmt with a call to a new const fn: core::panicking::const_panic_fmt. That function uses fmt::Arguments::as_str() to get the str and calls panic_str with that instead.

panic!() invocations with formatting arguments are still not accepted, as the creation of such a fmt::Arguments cannot be done in constant functions right now.

r? `@RalfJung`
2021-07-29 07:12:07 +00:00
bors 581b1664c9 Auto merge of #87416 - Aaron1011:query-side-effect, r=cjgillot
Create `QuerySideEffects` and use it for diagnostics

The code for saving and loading diagnostics during execution is generalized to handle a new `QuerySideEffects` struct. Currently, this struct just holds diagnostics - in a follow-up PR, I plan to add support for storing attriutes marked as used during query execution.

This is a pure refactor, with no intended behavior changes.
2021-07-29 02:51:19 +00:00
bors 85237886df Auto merge of #85874 - steffahn:fix_unsound_zip_optimization, r=yaahc
Remove unsound TrustedRandomAccess implementations

Removes the implementations that depend on the user-definable trait `Copy`.

Fixes #85873 in the most straightforward way.

<hr>

_Edit:_ This PR now contains additional trait infrastructure to avoid performance regressions around in-place collect, see the discussion in this thread starting from the codegen test failure at https://github.com/rust-lang/rust/pull/85874#issuecomment-872327577.

With this PR, `TrustedRandomAccess` gains additional documentation that specifically allows for and specifies the safety conditions around subtype coercions – those coercions can happen in safe Rust code with the `Zip` API’s usage of `TrustedRandomAccess`. This PR introduces a new supertrait of `TrustedRandomAccess`(currently named `TrustedRandomAccessNoCoerce`) that _doesn’t allow_ such coercions, which means it can be still be useful for optimizing cases such as in-place collect where no iterator is handed out to a user (who could do coercions) after a `get_unchecked` call; the benefit of the supertrait is that it doesn’t come with the additional safety conditions around supertraits either, so it can be implemented for more types than `TrustedRandomAccess`.

The `TrustedRandomAccess` implementations for `vec::IntoIter`, `vec_deque::IntoIter`, and `array::IntoIter` are removed as they don’t conform with the newly documented safety conditions, this way unsoundness is removed. But this PR in turn (re-)adds a `TrustedRandomAccessNoCoerce` implementation for `vec::IntoIter` to avoid performance regressions from stable in a case of in-place collecting of `Vec`s [the above-mentioned codegen test failure]. Re-introducing the (currently nightly+beta-only) impls for `VecDeque`’s and `[T; N]`’s iterators is technically possible, but goes beyond the scope of this PR (i.e. it can happen in a future PR).
2021-07-29 00:31:07 +00:00
bors 4533be947b Auto merge of #87569 - JohnTitor:rollup-7ydfetw, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #81050 (Stabilize core::task::ready!)
 - #81363 (Remove P: Unpin bound on impl Future for Pin)
 - #86839 (Add doc aliases to fs.rs)
 - #87435 (fix example code for E0617)
 - #87451 (Add support for tuple struct field documentation)
 - #87491 (Integrate context into the memorial to Anna)
 - #87521 (Add long explanation for E0498)
 - #87527 (Don't run MIR unsafeck at all when using `-Zthir-unsafeck`)
 - #87550 (Add `CI_ONLY_WHEN_CHANNEL` and run `x86_64-gnu-stable` only on nightly)
 - #87565 (Use backticks when referring to `core::future::Ready` in panic message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-28 22:06:51 +00:00
Yuki Okushi 6c4888a74e
Rollup merge of #87565 - ibraheemdev:patch-7, r=scottmcm
Use backticks when referring to `core::future::Ready` in panic message
2021-07-29 06:11:50 +09:00
Yuki Okushi 65003c6189
Rollup merge of #87550 - pietroalbini:ci-only-when-channel, r=Mark-Simulacrum
Add `CI_ONLY_WHEN_CHANNEL` and run `x86_64-gnu-stable` only on nightly

Backporting a commit made on #87508. cc ``@Mark-Simulacrum``
2021-07-29 06:11:49 +09:00
Yuki Okushi 9e94d7bbe6
Rollup merge of #87527 - LeSeulArtichaut:no-mir-unsafeck, r=oli-obk
Don't run MIR unsafeck at all when using `-Zthir-unsafeck`

I don't know how I missed this :D
r? ``@oli-obk``
2021-07-29 06:11:48 +09:00
Yuki Okushi 1d5f15f9fb
Rollup merge of #87521 - midgleyc:long-E0498, r=GuillaumeGomez
Add long explanation for E0498

Helps with #61137
2021-07-29 06:11:47 +09:00
Yuki Okushi aa301a0660
Rollup merge of #87491 - jamesmunns:integrate-memorial, r=Mark-Simulacrum
Integrate context into the memorial to Anna

This came up after I reviewed https://github.com/rust-lang/rust/pull/87298, but I didn't propose this in time before that PR was merged.

If y'all feel this is too much churn on the file, no worries, feel free to close, but I felt this was a more fitting integration of the memorial into the test suite.

CC ``@boringcactus.``
2021-07-29 06:11:46 +09:00
Yuki Okushi 014e22c836
Rollup merge of #87451 - GuillaumeGomez:tuple-struct-field-doc, r=jyn514
Add support for tuple struct field documentation

Fixes  #42615.
This is #80320 updated to new codebase and with added tests.
Part of https://github.com/rust-lang/rust/issues/83255.

cc ```@camelid``` (since you were involved on the original PR).
r? ```@jyn514```
2021-07-29 06:11:45 +09:00
Yuki Okushi 9222984636
Rollup merge of #87435 - ibraheemdev:patch-4, r=JohnTitor
fix example code for E0617

Closes #86908
2021-07-29 06:11:44 +09:00
Yuki Okushi 87c9f32dc4
Rollup merge of #86839 - D1mon:patch-1, r=JohnTitor
Add doc aliases to fs.rs

Add aliases for create_dir, create_dir_all, remove_dir, remove_dir_all
2021-07-29 06:11:43 +09:00
Yuki Okushi 7c1283a068
Rollup merge of #81363 - jonhoo:no-unpin-in-pin-future-impl, r=m-ou-se
Remove P: Unpin bound on impl Future for Pin

We can safely produce a `Pin<&mut P::Target>` without moving out of the `Pin` by using `Pin::as_mut` directly.

The `Unpin` bound was originally added in #56939 following the recommendation of ``@withoutboats`` in https://github.com/rust-lang/rust/issues/55766#issue-378417538

That comment does not give explicit justification for why the bound should be added. The relevant context was:

> [ ] Remove `impl<P> Unpin for Pin<P>`
>
> This impl is not justified by our standard justification for unpin impls: there is no pointer direction between `Pin<P>` and `P`. Its usefulness is covered by the impls for pointers themselves.
>
> This futures impl (link to the impl changed in this PR) will need to change to add a `P: Unpin` bound.

The decision to remove the unconditional impl of `Unpin for Pin` is sound (these days there is just an auto-impl for when `P: Unpin`). But, I think the decision to also add the `Unpin` bound for `impl Future` may have been unnecessary. Or if that's not the case, I'd be very interested to have the argument for why written down somewhere. The bound _appears_ to not be needed, as demonstrated by the change requiring no unsafe code and by the existence of `Pin::as_mut`.
2021-07-29 06:11:42 +09:00
Yuki Okushi fef1725c0f
Rollup merge of #81050 - yoshuawuyts:stabilize-task-ready, r=m-ou-se
Stabilize core::task::ready!

_Tracking issue: https://github.com/rust-lang/rust/issues/70922_

This PR stabilizes the `task::ready!` macro. Similar to https://github.com/rust-lang/rust/pull/80886, this PR was waiting on https://github.com/rust-lang/rust/issues/74355 to be fixed.

The `task::ready!` API has existed in the futures ecosystem for several years, and was added on nightly last year in https://github.com/rust-lang/rust/pull/70817. The motivation for this macro is the same as it was back then: virtually every single manual future implementation makes use of this; so much so that it's one of the few things included in the [futures-core](https://docs.rs/futures-core/0.3.12/futures_core) library.

r? ``@tmandry``

cc/ ``@rust-lang/wg-async-foundations`` ``@rust-lang/libs``

## Example
```rust
use core::task::{Context, Poll};
use core::future::Future;
use core::pin::Pin;

async fn get_num() -> usize {
    42
}

pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
    let mut f = get_num();
    let f = unsafe { Pin::new_unchecked(&mut f) };

    let num = ready!(f.poll(cx));
    // ... use num

    Poll::Ready(())
}
```
2021-07-29 06:11:41 +09:00
Ibraheem Ahmed 00198dd902 fix example code for E0617 2021-07-28 16:33:02 -04:00
Ibraheem Ahmed 2d8b6e3476
Use backticks when referring to core::future::Ready in panic message 2021-07-28 16:22:34 -04:00
bors b70888601a Auto merge of #87538 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/87518
Cc `@rust-lang/miri` r? `@ghost`
2021-07-28 19:25:59 +00:00
D1mon 387cd6dbf6
Add some doc aliases
Add `mkdir` to `create_dir`, `rmdir` to `remove_dir`.
2021-07-29 04:23:01 +09:00
bors a28109a767 Auto merge of #87540 - JohnTitor:rollup-8xc6bl5, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #87315 (Add docs for raw-dylib to unstable book)
 - #87330 (Use hashbrown's `extend_reserve()` in `HashMap`)
 - #87443 (Don't treat git repos as non-existent when `ignore_git` is set)
 - #87453 (Suggest removing unnecessary &mut as help message)
 - #87500 (Document math behind MIN/MAX consts on integers)
 - #87501 (Remove min_type_alias_impl_trait in favor of type_alias_impl_trait)
 - #87507 (SGX mutex is *not* moveable)
 - #87513 (bootstrap.py: change `git log` option to indicate desired behavior)
 - #87523 (Stop creating a reference then immediately dereferencing it.)
 - #87524 (Fix ICE in `diagnostic_hir_wf_check`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-28 16:59:00 +00:00
Mara Bos 18cc06c848 Update stable version of ready!() macro. 2021-07-28 16:56:12 +02:00
Mara Bos 312bf8e0b8 Extend documentation of const_format_args!(). 2021-07-28 16:18:38 +02:00
Mara Bos 0b8033ad8d Improve comments about const panic handling
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-07-28 16:18:38 +02:00
Mara Bos 4e6356188f Check that const_panic_fmt is const too. 2021-07-28 16:18:38 +02:00
Mara Bos 38bf5b0412 Make const_fmt_args!() work during bootstrap. 2021-07-28 16:12:31 +02:00
Mara Bos b48274fd98 Use unreachable_unchecked in const_panic_fmt. 2021-07-28 16:12:30 +02:00
Mara Bos b64c4f9560 Add new const_format_args!() macro and use it in panics. 2021-07-28 16:12:25 +02:00
Mara Bos 76cf1b8bd0 Add test for const panic in Rust 2021. 2021-07-28 16:10:43 +02:00
Mara Bos 91d0823dff Update test output for const fmt::Arguments constructor. 2021-07-28 16:10:43 +02:00
Mara Bos f827d3e285 Make const panic!("..") work in Rust 2021.
During const eval, this replaces calls to core::panicking::panic_fmt and
std::panicking::being_panic_fmt with a call to a new const fn:
core::panicking::const_panic_fmt. That function uses
fmt::Arguments::as_str() to get the str and calls panic_str with that
instead.

panic!() invocations with formatting arguments are still not accepted,
as the creation of such a fmt::Arguments cannot be done in constant
functions right now.
2021-07-28 16:10:41 +02:00
Pietro Albini 4b5ac09e32
add CI_ONLY_WHEN_CHANNEL and run x86_64-gnu-stable only on nightly 2021-07-28 15:32:23 +02:00
bors 92ca25b3ec Auto merge of #7502 - flip1995:rollup-y3ho3w0, r=flip1995
Rollup of 3 pull requests

Successful merges:

 - #7279 (Adapting the lint list to Clippy's new metadata format)
 - #7298 (Switch CI to new metadata collection)
 - #7420 (Update lint documentation to use markdown headlines)

Failed merges:

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

changelog: rollup
2021-07-28 13:15:43 +00:00
Philipp Krones 464c85c8c1
Rollup merge of #7420 - xFrednet:7172-update-lint-documentation, r=flip1995
Update lint documentation to use markdown headlines

This PR updates all lint documentation to use markdown headlines. It additionally removed the *Known problems* section for lints without any problems. I've double-checked all automatic replacements, but a second pair of eyes is definitely appreciated!

I wasn't sure when you wanted to switch to the new metadata collection tomorrow, I therefore prepared this PR today. And that's it this is a standalone PR to keep the other related PRs reviewable.

changelog:  none

r? `@flip1995`

cc: #7172

Note: This should be merged with the other metadata collection related PRs.
2021-07-28 15:06:27 +02:00
Philipp Krones bcdf147aaf
Rollup merge of #7298 - flip1995:ci-switch-to-monster, r=xFrednet,flip1995
Switch CI to new metadata collection

r? `@xFrednet`

Things we have to keep in mind:

- This removes the template files and the scripts used for deployment from the checkout. This was added in #5517. I don't think we ever needed those there. Not sure though.
- ~~As a result, we can't remove the python scripts yet. We have to wait until this hits a stable Clippy release.~~ I'll just break the next stable deploy and do it by hand once.
- This should be merged together with #7279. Me and `@xFrednet` will coordinate the switch
- ...?

I still have to try out some things:

- [x] Is it worth caching? Yes
- [x] ~~Is it worth to do a release build?~~ Nope
- [x] Does it actually work? With a few changes, yes
- [ ] ...?

changelog: Clippy now uses a lint to generate its documentation 🎉
2021-07-28 15:06:26 +02:00
Philipp Krones ce465995d8
Rollup merge of #7279 - xFrednet:7172-adapt-website-to-new-format, r=flip1995
Adapting the lint list to Clippy's new metadata format

This is close to the end of a long living project to rewrite the lint metadata collection for Clippy. Progress on this has been tracked in #7172. This PR adds one of the last missing puzzle pieces, the actual display of all the changes that have been done in the background. A preview can be seen here: [Clippy's lint list](https://xfrednet.github.io/rust-clippy/master/index.html)

The styling has been discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Styling.20feedback.20for.20Clippy's.20lint.20list/near/239601067) but is still open to suggestion.

Side note: It has been fun working on the website where we don't have unit tests and everything is just tested by playing around. However, it's good that this chaos is contained into this one part of Clippy. 🐛

---

Closes: #1303
Closes: #4310

This actually closes fewer things than I thought it would...

changelog: Reworked Clippy's [website](https://rust-lang.github.io/rust-clippy/master/index.html):
changelog: * Added applicability information about lints
changelog: * Added a link to jump to the specific lint implementation
changelog: * Adapted some styling and improved loading time

r? `@flip1995`
2021-07-28 15:06:26 +02:00
flip1995 c951a3c68d
Run cargo collect-metadata in cargo dev serve 2021-07-28 15:05:11 +02:00
xFrednet 322a768c77
Adapting the lint list to Clippy's new metadata format
Changes included:
    - Minimum adaption to the new `lints.json` format
    - Fixing filtering for the new `lints.json` format; hardcoding the
      lint groups in the index
    - Recreating the original doc styling for the new format
    - Fixed sytax highlighting for rust,ignore code blocks
    - Fixed markdown table extraction in the metadata collector and
      fixed lint level output
    - Adding the additional information row for lints
    - Changed the website title to Clippy's lint list
    - Flexing the website for mobile users
    - Added (?) references for lint levels and groups
    - Making deprecated lints look dead
    - Removed JS code block language extraction in favor of a rust
      implementation `rust-clippy#7352`
    - Added the suspicious lint group to the lint list
    - Remove trailing whitespaces from index.html
    - Fix code highlighting
    - Use default value if the docVersion is empty

Co-authored-by: Philipp Krones <hello@philkrones.com>
2021-07-28 15:03:55 +02:00
Mara Bos 3f6dc9a8ab Add #[track_caller] for some function in core::mem.
These functions can panic for some types. This makes the panic point to
the code that calls e.g. mem::uninitialized(), instead of inside the
definition of mem::uninitialized.
2021-07-28 14:34:36 +02:00
Frank Steffahn 6d9c0a16d9 Documentation improvements 2021-07-28 14:33:37 +02:00
Frank Steffahn 89583e98e8 Make SpecInPlaceCollect use TrustedRandomAccessNoCoerce 2021-07-28 14:33:36 +02:00