Commit graph

152466 commits

Author SHA1 Message Date
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
Frank Steffahn
9ff421da99 Remove redundant bounds on get_unchecked for vec_deque iterators, and run fmt 2021-07-28 14:33:36 +02:00
Frank Steffahn
f9c982c8fd Add back TrustedRandomAccess-specialization for Vec, but only without coercions 2021-07-28 14:33:36 +02:00
Frank Steffahn
bbc6b2691e Change __iterator_get_unchecked to work with TrustedRandomAccessNoCoerce 2021-07-28 14:33:35 +02:00
Frank Steffahn
69dd992f95 Add TrustedRandomAccessNoCoerce supertrait without requirements or guarantees about subtype coercions
Update all the TrustedRandomAccess impls to also implement the new supertrait
2021-07-28 14:33:35 +02:00
Frank Steffahn
1c7f27f792 Improve documentation of TrustedRandomAccess
Include new details regarding coercions to a subtype.
These conditions also explain why the previously removed implementations
for {array, vec, vec_deque}::IntoIter<T> were unsound, because they introduced
an extra `T: Clone` for the TrustedRandomAccess impl, even though their parameter T
is covariant.
2021-07-28 14:33:35 +02:00
Frank Steffahn
a0d8a324eb Remove unsound TrustedRandomAccess implementations
Removes the implementations that depend on the user-definable trait `Copy`.
2021-07-28 14:33:28 +02:00
flip1995
9bc5803195
Fix last occurence of **What it does:** 2021-07-28 14:32:02 +02:00
xFrednet
12c61612f7
Update lint documentation to use markdown headlines 2021-07-28 14:31:59 +02:00
Hans Kratz
aa465a5983 Bail on any found recursion when expanding opaque types
Fixes #87450. More of a bandaid because it does not fix the exponential complexity of the type folding used for opaque type expansion.
2021-07-28 14:21:59 +02:00
flip1995
fe25282aaa
Remove old python lint doc generation scripts 2021-07-28 14:18:40 +02:00
flip1995
6c5d199d57
Update deploy CI
This updates all the deploy scripts and the deploy workflow.

The deploy workflow now runs the metadata collector to collect the lint
documentation. It also changes the files that are checked out in the
deploy workflow from master and adds an explanation why we have to do
this.
2021-07-28 14:16:31 +02:00
Yuki Okushi
7985e4c7c3
Rollup merge of #87524 - FabianWolff:issue-87495, r=Aaron1011
Fix ICE in `diagnostic_hir_wf_check`

Fixes #87495. The [documentation for `ObligationCauseCode::WellFormed`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/traits/enum.ObligationCauseCode.html#variant.WellFormed) says that

> it is always correct [...] to specify `WellFormed(None)`

instead of `WellFormed(Some(...))`, which seems to have caused the issue here, as `diagnostic_hir_wf_check` does not expect to be called with an associated constant and will ICE:

fd853c00e2/compiler/rustc_typeck/src/hir_wf_check.rs (L131-L134)

Therefore, I have changed `check_associated_item()` to pass a `WellFormed(None)` for associated constants.

r? ``@Aaron1011``
2021-07-28 18:28:23 +09:00
Yuki Okushi
4ae529688a
Rollup merge of #87523 - frogtd:patch-2, r=dtolnay
Stop creating a reference then immediately dereferencing it.

Stop creating a reference then immediately dereferencing it.
2021-07-28 18:28:22 +09:00
Yuki Okushi
168238246f
Rollup merge of #87513 - hudson-ayers:bootstrap-py-fix, r=jyn514
bootstrap.py: change `git log` option to indicate desired behavior

When determining which LLVM artifacts to download, bootstrap.py calls: `git log --author=bors --format=%H -n1 -m --first-parent --
src/llvm-project src/bootstrap/download-ci-llvm-stamp src/version`. However, the `-m` option has no effect, per the `git log` help:

> -m
> This option makes diff output for merge commits to be shown in the
> default format. -m will produce the output only if -p is given as
> well. The default format could be changed using log.diffMerges
> configuration parameter, which default value is separate.

Accordingly, this commit removes use of the -m option in favor of ~~`--diff-merges=off`~~ `--no-patch`, since no diff information is needed, and in fact the presence of a diff breaks the command. Tested using git 2.32, this does not change the output of the command.

The motivation for this change is that some patched versions of git change the behavior of the `-m` flag to imply `-p`, rather than to do nothing unless `-p` is passed. These patched versions of git lead to this script not working. Google's corp-provided git is one such example.
2021-07-28 18:28:21 +09:00
Yuki Okushi
8bc7ec1316
Rollup merge of #87507 - jethrogb:jb/sgx-unmoveable-mutex, r=dtolnay
SGX mutex is *not* moveable

Reverts the erroneous change in #85029.
2021-07-28 18:28:20 +09:00
Yuki Okushi
23479f716a
Rollup merge of #87501 - spastorino:remove-min-tait, r=oli-obk
Remove min_type_alias_impl_trait in favor of type_alias_impl_trait

r? ``@oli-obk``
2021-07-28 18:28:19 +09:00
Yuki Okushi
35dddd3dea
Rollup merge of #87500 - Smittyvb:min-max-docs, r=kennytm
Document math behind MIN/MAX consts on integers

Currently the documentation for `[integer]::{MIN, MAX}` doesn't explain where the constants come from. This documents how the values of those constants are related to powers of 2.
2021-07-28 18:28:18 +09:00
Yuki Okushi
954137ea0e
Rollup merge of #87453 - ibraheemdev:i-68697, r=wesleywiser
Suggest removing unnecessary &mut as help message

Closes #68697
2021-07-28 18:28:17 +09:00
Yuki Okushi
287a252c0b
Rollup merge of #87443 - jyn514:submodules-take-n, r=jyn514
Don't treat git repos as non-existent when `ignore_git` is set

The new submodule handling depends on `is_git()` to be accurate to
decide whether it should handle submodules at all or not. Unfortunately,
`is_git()` treated "this directory does not have a git repository" and
"this repository should not be used for SHA/version/commit date info"
the same. This changes it to distinguish the two.

To clarify: ignore_get is set by default whenever channel == "dev", which it is by default whenever you're compiling locally. So basically everyone would hit this, not just people who had explicitly configured ignore_git.

Here's an example of an error this fixes:

```
$ x build
Updating only changed submodules
Submodules updated in 0.01 seconds
    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
warning: x.py has made several changes recently you may want to look at
help: consider looking at the changes in `src/bootstrap/CHANGELOG.md`
note: to silence this warning, add `changelog-seen = 2` at the top of `config.toml`
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.16s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building LLVM for x86_64-unknown-linux-gnu
detected home dir change, cleaning out entire build directory
running: "cmake" "/home/joshua/rustc3/src/llvm-project/llvm" "-G" "Ninja" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_DOCS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_ENABLE_BINDINGS=OFF" "-DLLVM_ENABLE_Z3_SOLVER=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=48" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" "-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_LIBXML2=OFF" "-DLLVM_VERSION_SUFFIX=-rust-dev" "-DCMAKE_INSTALL_MESSAGE=LAZY" "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" "-DCMAKE_ASM_COMPILER=gcc" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX=/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_BUILD_TYPE=Release"
CMake Error: The source directory "/home/joshua/rustc3/src/llvm-project/llvm" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
thread 'main' panicked at '
command did not execute successfully, got: exit status: 1

build script failed, must exit now', /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
	finished in 0.783 seconds
Build completed unsuccessfully in 0:00:01
```

I *believe* this regression was only introduced in https://github.com/rust-lang/rust/pull/87380, not https://github.com/rust-lang/rust/pull/82653. ``@petrochenkov`` can you check that this fixes the issue you encountered in https://github.com/rust-lang/rust/pull/82653#issuecomment-886113679 ?

r? ``@Mark-Simulacrum``
2021-07-28 18:28:15 +09:00
Yuki Okushi
98f7a009fa
Rollup merge of #87330 - inquisitivecrystal:extend-reserve, r=JohnTitor
Use hashbrown's `extend_reserve()` in `HashMap`

When we added `extend_reserve()` to our implementation of `Extend` for `HashMap`, hashbrown didn't have a version we could use. Now that hashbrown has added it, we should use its version instead of implementing it ourself.
2021-07-28 18:28:14 +09:00
Yuki Okushi
911e22b57d
Rollup merge of #87315 - ricobbe:raw-dylib-unstable-book, r=wesleywiser
Add docs for raw-dylib to unstable book
2021-07-28 18:28:13 +09:00
bors
eba3228b2a Auto merge of #86251 - Smittyvb:thir-tree-again, r=oli-obk
Support -Z unpretty=thir-tree again

Currently `-Z unpretty=thir-tree` is broken after some THIR refactorings. This re-implements it, making it easier to debug THIR-related issues.

We have to do analyzes before getting the THIR, since trying to create THIR from invalid HIR can ICE. But doing those analyzes requires the THIR to be built and stolen. We work around this by creating a separate query to construct the THIR tree string representation.

Closes https://github.com/rust-lang/project-thir-unsafeck/issues/8, fixes #85552.
2021-07-28 09:01:11 +00:00
Ralf Jung
2acc83ed4f update Miri 2021-07-28 10:39:38 +02:00
bors
aea2e446f0 Auto merge of #86735 - jhpratt:rfc-3107, r=petrochenkov
Implement RFC 3107: `#[derive(Default)]` on enums with a `#[default]` attribute

This PR implements RFC 3107, which permits `#[derive(Default)]` on enums where a unit variant has a `#[default]` attribute. See comments for current status.
2021-07-28 05:59:30 +00:00
bors
8b50cc9a2c Auto merge of #85769 - jhpratt:stabilize-const-transmute-union, r=RalfJung
Stabilize `const_fn_transmute`, `const_fn_union`

This PR stabilizes the `const_fn_transmute` and `const_fn_union` features. It _does not_ stabilize any methods (obviously aside from `transmute`) that are blocked on only these features.

Closes #53605. Closes #51909.
2021-07-28 00:53:17 +00:00
Fabian Wolff
dbd0fd2c2a Fix ICE in diagnostic_hir_wf_check 2021-07-28 01:41:52 +02:00
Aaron Hill
6954f9d4f2
Update stderr 2021-07-27 18:21:25 -05:00
Santiago Pastorino
f16ae7ee26
Remove min_tait and full_tait stderr dangling files 2021-07-27 19:50:14 -03:00
Santiago Pastorino
d395fe8653
Bless nll tests 2021-07-27 19:48:54 -03:00
LeSeulArtichaut
40b57be547 Don't run MIR unsafeck at all when using -Zthir-unsafeck 2021-07-27 23:26:55 +02:00
Smitty
0e017496eb remove unneeded stringify 2021-07-27 16:37:18 -04:00
Jacob Pratt
5331fea875 Update tests 2021-07-27 16:26:50 -04:00
Jacob Pratt
37af399573
Update tests 2021-07-27 16:26:50 -04:00
frogtd
47414aa1bd
Update range.rs
Stop creating a reference then immediately dereferencing it.
2021-07-27 16:14:48 -04:00
Jacob Pratt
7bf791d162
Stabilize const_fn_union 2021-07-27 16:03:33 -04:00
Jacob Pratt
36f02f3523
Stabilize const_fn_transmute 2021-07-27 16:03:09 -04:00
frogtd
b8eb1f167c
Fix assert in diy_float
The shifting should have gone the other way, the current incarnation is always true.
2021-07-27 16:02:35 -04:00
bors
2faabf5793 Auto merge of #80367 - camelid:check_match-combine-loop, r=Nadrieril
Combine two loops in `check_match`

Suggested by Nadrieril in
https://github.com/rust-lang/rust/pull/79051#discussion_r548778186.

Opening to get a perf run. Hopefully this code doesn't require everything in the
first loop to be done before running the second! (It shouldn't though.)

cc `@Nadrieril`
2021-07-27 19:56:18 +00:00
Jacob Pratt
72465b0a32
Prohibit #[default] in invalid places 2021-07-27 15:47:49 -04:00
Jacob Pratt
5ae2371ceb
Indicate E0665 is no longer emitted 2021-07-27 15:47:49 -04:00
Jacob Pratt
eef2856eaf
Add machine-applicable suggestions
This avoids the need for tools like rust-analyzer to implement these
suggestions themselves.
2021-07-27 15:47:49 -04:00