Commit Graph

168071 Commits

Author SHA1 Message Date
Fridtjof Stoldt
9516a40f1e
Fixed typo in docs and correct doc links
Co-authored-by: Philipp Krones <hello@philkrones.com>
2022-05-08 17:24:15 +02:00
name1e5s
b87dd755ca fix panic in Path::strip_prefix 2022-05-08 22:15:26 +08:00
bors
ed3164baf0 Auto merge of #96770 - flip1995:fix-trait-type-in-bounds, r=cjgillot
Track if a where bound comes from a impl Trait desugar

With https://github.com/rust-lang/rust/pull/93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a `impl Trait` or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during AST->HIR lowering.

r? `@cjgillot`

cc `@estebank` (as the reviewer of #93803)
2022-05-08 14:10:12 +00:00
xFrednet
897404e1d9
Support #[expect] attributes for rustdoc lints (RFC 2383) 2022-05-08 14:37:16 +02:00
xFrednet
fb225d1303
Test expect attribute for tool lints, clippy edition (RFC 2383) 2022-05-08 14:37:16 +02:00
xFrednet
cd51c7cb73
Test expect attribute for tool lints, rustc edition (RFC 2383) 2022-05-08 14:37:15 +02:00
xFrednet
2c5e85249f
Move lint expectation checking into a separate query (RFC 2383) 2022-05-08 14:37:14 +02:00
xFrednet
7f03681cd9
Only assert for unstable expectation ids after conversion (RFC 2383)
This ICE was reported by `@matthiaskrgr`. A big THANK YOU to him. See `rust#94953`
2022-05-08 14:37:14 +02:00
Guillaume Gomez
1e93165b05 Enforce no trailing spaces with eslint 2022-05-08 14:08:33 +02:00
Guillaume Gomez
b7e5116375 Enforce linebreak style in js source code 2022-05-08 14:07:25 +02:00
bors
8fbd92d0b9 Auto merge of #96689 - gimbles:campfire, r=Mark-Simulacrum
Move check-bootstrap from a makefile rule to test::Bootstrap

Fixes #96688
2022-05-08 11:14:47 +00:00
bors
4c09a3345a Auto merge of #96659 - thatzopoulos:issue-90679-fix, r=Mark-Simulacrum
Improve error for missing cmake

This PR updates the error message for a missing `cmake` to be more in line with the error message for a missing installation of `ninja`.
The original issue, (#90679), suggests that both `ninja` and `cmake` are only needed for building LLVM, so I have included the suggestion from `ninja` to set `download-ci-llvm = true` if the user would rather download LLVM. If `cmake` actually is used in other areas, I can remove that part of the message.

Fixes: #90679
2022-05-08 08:45:20 +00:00
bors
30046ce1fe Auto merge of #96457 - yungkneez:fix-bootstrap, r=Mark-Simulacrum
Initialize rust-analyzer submodule on bootstrap

Fixes #96456
2022-05-08 06:22:21 +00:00
bors
030c886c29 Auto merge of #96155 - jackh726:param-heuristics-followup, r=estebank
Followups for method call error change

Each commit is self-contained. Fixes most of the followup reviews from that PR.

r? `@estebank`
2022-05-08 04:05:36 +00:00
Yuki Okushi
2c9074b78a
Correct the issue number of a test 2022-05-08 11:28:18 +09:00
Yuki Okushi
a911452787
Add regression test for #96654 2022-05-08 11:27:43 +09:00
Yuki Okushi
c64cf27356
Fix the x.py clippy command 2022-05-08 10:54:38 +09:00
bors
4d1076c9f9 Auto merge of #94206 - PrestonFrom:significant_drop, r=flip1995
Create clippy lint against unexpectedly late drop for temporaries in match scrutinee expressions

A new clippy lint for issue 93883 (https://github.com/rust-lang/rust/issues/93883). Relies on a new trait in `marker` (called `SignificantDrop` to enable linting), which is why this PR is for the rust-lang repo and not the clippy repo.

changelog: new lint [`significant_drop_in_scrutinee`]
2022-05-08 00:57:08 +00:00
Scott McMurray
83f785bff9 Further elaborate the lack of guarantees from Hasher 2022-05-07 17:44:30 -07:00
Ken Matsui
8b89a1280c
Fix incorrect syntax suggestion with pub async fn 2022-05-08 09:34:02 +09:00
bors
e612ce9ce5 Auto merge of #96824 - matthiaskrgr:rollup-silw3ki, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #96336 (Link to correct `as_mut` in docs for `pointer::as_ref`)
 - #96586 (Add aliases for std::fs::canonicalize)
 - #96667 (Add regression test)
 - #96671 (Remove hard links from `env::current_exe` security example)
 - #96726 (Add regression and bug tests)
 - #96756 (Enable compiler-docs by default for `compiler`, `codegen`, and `tools` profiles)
 - #96757 (Don't constantly rebuild clippy on `x test src/tools/clippy`.)
 - #96769 (Remove `adx_target_feature` feature from active features list)
 - #96777 (Make the test `check-pass` not to produce a JSON file)
 - #96822 (Enforce quote rule for JS source code)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-07 22:41:39 +00:00
Thomas Hatzopoulos
bdca7376fd updated error message for missing cmake 2022-05-07 17:10:48 -05:00
Matthias Krüger
20ade86456
Rollup merge of #96822 - GuillaumeGomez:js-quote-rule, r=notriddle
Enforce quote rule for JS source code

We mostly used double quotes but still had a weird mix. This eslint rule will now enforce it.

r? `@notriddle`
2022-05-07 22:44:44 +02:00
Matthias Krüger
d6c9254cac
Rollup merge of #96777 - JohnTitor:do-not-run-pass-save-analysis, r=Mark-Simulacrum
Make the test `check-pass` not to produce a JSON file

`run-pass` produces a JSON file when enabling save analysis.
The original ICE happened on `cargo check`, moreover **without** the `generic_const_exprs` feature, so `check-pass` should be enough.
2022-05-07 22:44:43 +02:00
Matthias Krüger
c5d6f82cb7
Rollup merge of #96769 - Undin:remove-adx_target_feature-from-active, r=joshtriplett
Remove `adx_target_feature` feature from active features list

The feature was stabilized in https://github.com/rust-lang/rust/pull/93745
2022-05-07 22:44:42 +02:00
Matthias Krüger
2dcb6fdc1d
Rollup merge of #96757 - jyn514:fewer-clippy-rebuilds, r=Mark-Simulacrum
Don't constantly rebuild clippy on `x test src/tools/clippy`.

This happened because the `SYSROOT` variable was set for `x test`, but not `x build`.
Set it consistently for both to avoid unnecessary rebuilds.

This is a very small step towards https://github.com/rust-lang/rust/issues/76495.
2022-05-07 22:44:42 +02:00
Matthias Krüger
16892cfe95
Rollup merge of #96756 - jyn514:compiler-docs-default, r=Mark-Simulacrum
Enable compiler-docs by default for `compiler`, `codegen`, and `tools` profiles

I had this overridden locally for a while and realized just now it should probably just be a default.
2022-05-07 22:44:41 +02:00
Matthias Krüger
a82e2ab120
Rollup merge of #96726 - oli-obk:no_cross_inference, r=Mark-Simulacrum
Add regression and bug tests

this tracks the behaviour from https://github.com/rust-lang/rust/issues/96572 in our test suite
2022-05-07 22:44:40 +02:00
Matthias Krüger
416d600a9a
Rollup merge of #96671 - mgeisler:current-exe-docstring, r=Mark-Simulacrum
Remove hard links from `env::current_exe` security example

The security example shows that `env::current_exe` will return the path used when the program was started. This is not really surprising considering how hard links work: after `ln foo bar`, the two files are _equivalent_. It is _not_ the case that `bar` is a “link” to `foo`, nor is `foo` a link to `bar`. They are simply two names for the same underlying data.

The security vulnerability linked to seems to be different: there an attacker would start a SUID binary from a directory under the control of the attacker. The binary would respawn itself by executing the program found at `/proc/self/exe` (which the attacker can control). This is a real problem. In my opinion, the example given here doesn’t really show the same problem, it just shows a misunderstanding of what hard links are.

I looked through the history a bit and found that the example was introduced in https://github.com/rust-lang/rust/pull/33526. That PR actually has two commits, and the first (8478d48dad) explains the race condition at the root of the linked security vulnerability. The second commit proceeds to replace the explanation with the example we have today.

This commit reverts most of the second commit from https://github.com/rust-lang/rust/pull/33526.
2022-05-07 22:44:39 +02:00
Matthias Krüger
f995b67a4c
Rollup merge of #96667 - oli-obk:collect_hidden_types, r=Mark-Simulacrum
Add regression test

fixes #69785

This issue seems to have been fixed in the meantime.
2022-05-07 22:44:38 +02:00
Matthias Krüger
eecc0469f5
Rollup merge of #96586 - ear7h:master, r=joshtriplett
Add aliases for std::fs::canonicalize

The aliases are `realpath` and `GetFinalPathNameByHandle` which are explicitly mentioned in `canonicalize`'s documentation.
2022-05-07 22:44:37 +02:00
Matthias Krüger
1386a02dc1
Rollup merge of #96336 - Nilstrieb:link-to-correct-as_mut-in-ptr-as_ref, r=JohnTitor
Link to correct `as_mut` in docs for `pointer::as_ref`

It previously linked to the unstable const-mut-cast method instead of
the `mut` counterpart for `as_ref`.

Closes #96327
2022-05-07 22:44:36 +02:00
bors
ea92b08383 Auto merge of #96670 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrum
Enable cfg checking of cargo features for everything but std

This PR enable `cfg` checking of cargo features for everything but std, it also adds a `FIXME` to myself.

> Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like
> backtrace, core_simd, std_float, ...), those dependencies have their own features
> but cargo isn't involved in the #[path] and so cannot pass the complete list of
> features, so for that reason we don't enable checking of features for std.

r? `@Mark-Simulacrum`
2022-05-07 20:17:33 +00:00
Guillaume Gomez
14897180ae Enforce quote rule for JS source code 2022-05-07 20:50:55 +02:00
bors
24a0eecf03 Auto merge of #96657 - cuviper:time64, r=joshtriplett
Use 64-bit time on 32-bit linux-gnu

The standard library suffered the [Year 2038 problem][Y2038] in two main places on targets with 32-bit `time_t`:

- In `std::time::SystemTime`, we stored a `timespec` that has `time_t` seconds. This is now changed to directly store 64-bit seconds and nanoseconds, and on 32-bit linux-gnu we try to use `__clock_gettime64` (glibc 2.34+) to get the larger timestamp.

- In `std::fs::Metadata`, we store a `stat64`, which has 64-bit `off_t` but still 32-bit `time_t`, and unfortunately that is baked in the API by the (deprecated) `MetadataExt::as_raw_stat()`. However, we can use `statx` for 64-bit `statx_timestamp` to store in addition to the `stat64`, as we already do to support creation time, and the rest of the `MetadataExt` methods can return those full values. Note that some filesystems may still be limited in their actual timestamp support, but that's not something Rust can change.

There remain a few places that need `timespec` for system call timeouts -- I leave that to future work.

[Y2038]: https://en.wikipedia.org/wiki/Year_2038_problem
2022-05-07 17:53:59 +00:00
Camille GILLOT
69e5b2fde0 Do not report overflow error. 2022-05-07 18:18:03 +02:00
flip1995
dd1ff405e3
Track if a where bound comes from a impl Trait desugar
With #93803 `impl Trait` function arguments get desugared to hidden
where bounds. However, Clippy needs to know if a bound was originally a
impl Trait or an actual bound. This adds a field to the
`WhereBoundPredicate` struct to keep track of this information during
HIR lowering.
2022-05-07 17:10:30 +02:00
bors
f9b2e3c87b Auto merge of #96816 - GuillaumeGomez:rollup-oumn95i, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #96581 (make Size and Align debug-printing a bit more compact)
 - #96636 (Fix jump to def regression)
 - #96760 (diagnostics: port more diagnostics to derive + add support for `Vec` fields)
 - #96788 (Improve validator around field projections and checked bin ops)
 - #96805 (Change eslint rules from configuration comments to configuration file)
 - #96807 (update Miri)
 - #96811 (Fix a minor typo in the description of Formatter)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-07 13:31:04 +00:00
Guillaume Gomez
c6007d6b57
Rollup merge of #96811 - createyourpersonalaccount:doc-typofix, r=JohnTitor
Fix a minor typo in the description of Formatter
2022-05-07 15:23:50 +02:00
Guillaume Gomez
af2f9447e9
Rollup merge of #96807 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/96773
r? ``@ghost``
2022-05-07 15:23:49 +02:00
Guillaume Gomez
f98f92fdaf
Rollup merge of #96805 - Folyd:eslint, r=GuillaumeGomez
Change eslint rules from configuration comments to configuration file

Repeatedly declaring eslint rules in source files is an annoying thing, we should move those rules into the eslint configuration file.

r? ``@GuillaumeGomez``
2022-05-07 15:23:48 +02:00
Guillaume Gomez
27a2bae89c
Rollup merge of #96788 - JakobDegen:checked-binop, r=oli-obk
Improve validator around field projections and checked bin ops

The two commits are unrelated. In both cases, these rules were already documented in MIR docs.
2022-05-07 15:23:47 +02:00
Guillaume Gomez
a644197391
Rollup merge of #96760 - davidtwco:diagnostic-translation-vec, r=oli-obk
diagnostics: port more diagnostics to derive + add support for `Vec` fields

- Port "unconstrained opaque type" diagnostic to using the derive.
- Allow `Vec` fields in diagnostic derive - enables support for diagnostics that have multiple primary spans, or have subdiagnostics repeated at multiple locations. `Vec<..>` fields in the diagnostic derive become loops in the generated code.
- Add `create_{err,warning}` - there wasn't a way to create a diagnostic from a struct and not emit it straight away.
- Port "explicit generic args w/ impl trait" diagnostic to using the derive.

r? `````@oli-obk`````
cc `````@pvdrz`````
2022-05-07 15:23:46 +02:00
Guillaume Gomez
3346d11f4e
Rollup merge of #96636 - GuillaumeGomez:fix-jump-to-def-regression, r=notriddle
Fix jump to def regression

https://github.com/rust-lang/rust/pull/93803 introduced a regression in the "jump to def" feature. This fixes it.

Nice side-effect: it adds a new regression test. :)

I also used this opportunity to add documentation about this unstable feature in the rustdoc book.

cc ``@cjgillot``
r? ``@notriddle``
2022-05-07 15:23:45 +02:00
Guillaume Gomez
c29f8575ac
Rollup merge of #96581 - RalfJung:debug-size-align, r=oli-obk
make Size and Align debug-printing a bit more compact

In particular in `{:#?}`-mode, these take up a lot of space, so I think this is the better alternative (even though it is a bit longer in `{:?}` mode, I think it is still more readable).

We could make it even smaller by deviating further from what the actual code looks like, e.g. via something like `Size(4 bytes)`. Not sure what people would think about that?

Cc `````@oli-obk`````
2022-05-07 15:23:44 +02:00
SparrowLii
cb7f116c04 optimize promote_consts by cache the validate check 2022-05-07 21:02:25 +08:00
Camille GILLOT
89f15bfd90 Add test. 2022-05-07 13:08:04 +02:00
Camille GILLOT
96321ed756 Do not lint on explicit outlives requirements from external macros. 2022-05-07 12:41:15 +02:00
Nikolaos Chatzikonstantinou
7c1d241f2b
Fix a minor typo in the description of Formatter 2022-05-07 19:32:54 +09:00
bors
6139205622 Auto merge of #96780 - Kobzol:ci-llvm-upgrade-osx-windows, r=Mark-Simulacrum
Update LLVM version used to build OS X and Windows artifacts to 14.0.2

Let's see what breaks.

r? `@Mark-Simulacrum`
2022-05-07 09:11:12 +00:00