Commit Graph

167871 Commits

Author SHA1 Message Date
bors
0dd7e10282 Auto merge of #96877 - matthiaskrgr:rollup-evlh6ot, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #95483 (Improve floating point documentation)
 - #96008 (Warn on unused `#[doc(hidden)]` attributes on trait impl items)
 - #96841 (Revert "Implement [OsStr]::join", which was merged without FCP.)
 - #96844 (Actually fix ICE from #96583)
 - #96854 (Some subst cleanup)
 - #96858 (Remove unused param from search.js::checkPath)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-09 17:23:34 +00:00
Matthias Krüger
59722228b9
Rollup merge of #96858 - notriddle:notriddle/cleanup-search-js, r=GuillaumeGomez
Remove unused param from search.js::checkPath
2022-05-09 18:45:40 +02:00
Matthias Krüger
0e00ed5f48
Rollup merge of #96854 - jackh726:subst-cleanup, r=compiler-errors
Some subst cleanup

Two separate things here. Both changes are useful for some refactoring I'm doing to add an "EarlyBinder" newtype. (Part of chalkification).

1) Remove `subst_spanned` and just use `subst`. It wasn't used much anyways. In practice, I think we can probably get most of the info just from the actual error message. If not, outputting logs should do the trick. (The specific line probably wouldn't help much anyways).

2) Call `.subst()` before `replace_bound_vars_with_fresh_vars` and `erase_late_bound_regions` in three places that do the opposite. I think there might have been some time in the past that the order here matter for something, but this shouldn't be the case anymore. Conceptually, it makes more sense to the of the *early bound* vars on `fn`s as "outside" the late bound vars.
2022-05-09 18:45:39 +02:00
Matthias Krüger
84a8f8dedf
Rollup merge of #96844 - Badel2:actually-fix-96583, r=compiler-errors
Actually fix ICE from #96583

PR #96746 fixed a very similar bug, so the same logic is used in a different place.

I originally concluded that the two issues (#96583 and #96738) were identical by comparing the backtrace, but I didn't look close enough.
2022-05-09 18:45:38 +02:00
Matthias Krüger
f4bef2e41c
Rollup merge of #96841 - thomcc:revert-osstr-join, r=m-ou-se
Revert "Implement [OsStr]::join", which was merged without FCP.

This reverts commit 4fcbc53820, see https://github.com/rust-lang/rust/pull/96744. (I'm terribly sorry, and truly don't remember r+ing it, or even having seen it before yesterday, which is... genuinely very worrisome for me).

r? `@m-ou-se`
2022-05-09 18:45:37 +02:00
Matthias Krüger
6c8001b85c
Rollup merge of #96008 - fmease:warn-on-useless-doc-hidden-on-assoc-impl-items, r=lcnr
Warn on unused `#[doc(hidden)]` attributes on trait impl items

[Zulip conversation](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.E2.9C.94.20Validy.20checks.20for.20.60.23.5Bdoc.28hidden.29.5D.60).

Whether an associated item in a trait impl is shown or hidden in the documentation entirely depends on the corresponding item in the trait declaration. Rustdoc completely ignores `#[doc(hidden)]` attributes on impl items. No error or warning is emitted:

```rust
pub trait Tr { fn f(); }
pub struct Ty;
impl Tr for Ty { #[doc(hidden)] fn f() {} }
//               ^^^^^^^^^^^^^^ ignored by rustdoc and currently
//                              no error or warning issued
```

This may lead users to the wrong belief that the attribute has an effect. In fact, several such cases are found in the standard library (I've removed all of them in this PR).
There does not seem to exist any incentive to allow this in the future either: Impl'ing a trait for a type means the type *fully* conforms to its API. Users can add `#[doc(hidden)]` to the whole impl if they want to hide the implementation or add the attribute to the corresponding associated item in the trait declaration to hide the specific item. Hiding an implementation of an associated item does not make much sense: The associated item can still be found on the trait page.

This PR emits the warn-by-default lint `unused_attribute` for this case with a future-incompat warning.

`@rustbot` label T-compiler T-rustdoc A-lint
2022-05-09 18:45:36 +02:00
Matthias Krüger
28d800ce1c
Rollup merge of #95483 - golddranks:improve_float_docs, r=joshtriplett
Improve floating point documentation

This is my attempt to improve/solve https://github.com/rust-lang/rust/issues/95468 and https://github.com/rust-lang/rust/issues/73328 .

Added/refined explanations:
- Refine the "NaN as a special value" top level explanation of f32
- Refine `const NAN` docstring: add an explanation about there being multitude of NaN bitpatterns and disclaimer about the portability/stability guarantees.
- Refine `fn is_sign_positive` and `fn is_sign_negative` docstrings: add disclaimer about the sign bit of NaNs.
- Refine `fn min` and `fn max` docstrings: explain the semantics and their relationship to the standard and libm better.
- Refine `fn trunc` docstrings: explain the semantics slightly more.
- Refine `fn powi` docstrings: add disclaimer that the rounding behaviour might be different from `powf`.
- Refine `fn copysign` docstrings: add disclaimer about payloads of NaNs.
- Refine `minimum` and `maximum`: add disclaimer that "propagating NaN" doesn't mean that propagating the NaN bit patterns is guaranteed.
- Refine `max` and `min` docstrings: add "ignoring NaN" to bring the one-row explanation to parity with `minimum` and `maximum`.

Cosmetic changes:
- Reword `NaN` and `NAN` as plain "NaN", unless they refer to the specific `const NAN`.
- Reword "a number" to `self` in function docstrings to clarify.
- Remove "Returns NAN if the number is NAN" from `abs`, as this is told to be the default behavior in the top explanation.
2022-05-09 18:45:35 +02:00
bors
0e345b76a5 Auto merge of #96845 - Patryk27:upgrade-llvm, r=nikic
Upgrade llvm-project (rustc + avr = lovelove back again!)

See:
https://github.com/rust-lang/llvm-project/pull/139

tl;dr:
- closes https://github.com/rust-lang/rust/issues/83633,
- closes https://github.com/rust-lang/rust/issues/82104,
- closes https://github.com/rust-lang/rust/issues/79889,
- closes https://github.com/rust-lang/compiler-builtins/issues/400.

🙂
2022-05-09 14:58:22 +00:00
bors
e013f9e0ca Auto merge of #96815 - SparrowLii:promote_const, r=oli-obk
optimize `promote_consts` by caching the results of `validate_local`

From the FIXME in the impl of `promote_consts`. Early return the `validate_local` should save some compile time.

`qualif_local` is similar to this, but requires futher changing because there are different types of qualif checks. If this PR is effective, I will do it as well.
2022-05-09 11:49:09 +00:00
SparrowLii
b890037af3 use Result<(),()> instead of Validity enum 2022-05-09 17:13:30 +08:00
Patryk Wychowaniec
694962718f
chore: Upgrade llvm-project
See: https://github.com/rust-lang/llvm-project/pull/139
2022-05-09 09:39:29 +02:00
Michael Howell
521d2c3d3c Remove unused param from search.js::checkPath 2022-05-08 22:19:40 -07:00
bors
8a2fe75d0e Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errors
Remove `#[rustc_deprecated]`

This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`.

I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-05-09 04:47:30 +00:00
bors
db5b365fb0 Auto merge of #96802 - gimbles:windows_slice, r=thomcc
[feat] Make sys::windows::os_str::Slice repr(transparent)

Fixes #96577
2022-05-09 02:25:32 +00:00
Jack Huey
657499df64 Reorder erasing/replacing late bound vars and substs 2022-05-08 22:02:54 -04:00
Jack Huey
e14eae6226 Remove subst_spanned 2022-05-08 21:53:25 -04:00
bors
a57117982a Auto merge of #95542 - xFrednet:rfc-2383-expect-query, r=wesleywiser
Support tool lints with the `#[expect]` attribute (RFC 2383)

This PR fixes the ICE https://github.com/rust-lang/rust/issues/94953 by making the assert for converted expectation IDs conditional.

Additionally, it moves the lint expectation check into a separate query to support rustdoc and other tools. On the way, I've also added some tests to ensure that the attribute works for Clippy and rustdoc lints.

The number of changes comes from the long test file. This may look like a monster PR, this may smell like a monster PR and this may be a monster PR, but it's a harmless monster. 🦕

---

Closes: https://github.com/rust-lang/rust/issues/94953

cc: https://github.com/rust-lang/rust/issues/85549

r? `@wesleywiser`

cc: `@rust-lang/rustdoc`
2022-05-09 00:02:55 +00:00
bors
cb12198715 Auto merge of #96846 - matthiaskrgr:rollup-yxu9ot9, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #96617 (Fix incorrect syntax suggestion with `pub async fn`)
 - #96828 (Further elaborate the lack of guarantees from `Hasher`)
 - #96829 (Fix the `x.py clippy` command)
 - #96830 (Add and tweak const-generics tests)
 - #96835 (Add more eslint rules)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-08 21:37:26 +00:00
León Orell Valerian Liehr
9d157ada35 Warn on unused doc(hidden) on trait impl items 2022-05-08 22:53:14 +02:00
Matthias Krüger
43b3a491f5
Rollup merge of #96835 - GuillaumeGomez:eslint-rules, r=notriddle
Add more eslint rules

Slowly continuing to enforce more rules with eslint.

Part of https://github.com/rust-lang/rust/issues/93058.

r? `@notriddle`
2022-05-08 21:31:20 +02:00
Matthias Krüger
4c162a1cc6
Rollup merge of #96830 - JohnTitor:issue-96654, r=compiler-errors
Add and tweak const-generics tests

Closes #96654
Also correct the src/test/ui/const-generics/issues/issue-77357.rs test's issue number.
2022-05-08 21:31:19 +02:00
Matthias Krüger
e8257154a9
Rollup merge of #96829 - JohnTitor:fix-xpy-clippy, r=jyn514
Fix the `x.py clippy` command

Fixes #96826, confirmed clippy runs correctly on local
r? `@Mark-Simulacrum`
2022-05-08 21:31:18 +02:00
Matthias Krüger
2c4d7a5463
Rollup merge of #96828 - scottmcm:clarify-hasher-write, r=Amanieu
Further elaborate the lack of guarantees from `Hasher`

I realized that I got too excited in #94598 by adding new methods, and forgot to do the documentation to really answer the core question in #94026.

This PR just has that doc update.

r? `@Amanieu`
2022-05-08 21:31:17 +02:00
Matthias Krüger
cdaa5c03c9
Rollup merge of #96617 - ken-matsui:fix-incorrect-syntax-suggestion-with-pub-async-fn, r=cjgillot
Fix incorrect syntax suggestion with `pub async fn`

This PR closes: https://github.com/rust-lang/rust/issues/96555
2022-05-08 21:31:16 +02:00
bors
68461648bf Auto merge of #96302 - Serial-ATA:more-diagnostic-items, r=manishearth
Add more diagnostic items

This just adds a handful diagnostic items I noticed were missing.

Would it be worth doing this for all of the remaining types? I'm willing to do it if it'd be helpful.
2022-05-08 19:08:34 +00:00
Badel2
84adf0d8dd Actually fix ICE from #96583
PR #96746 fixed a very similar bug, so the same logic is used in a
different place.
2022-05-08 19:57:47 +02:00
bors
83322c557f Auto merge of #93675 - name1e5s:fix/strip_prefix_panic, r=Mark-Simulacrum
fix panic in Path::strip_prefix

close #93586
2022-05-08 16:51:00 +00:00
Thom Chiovoloni
df446cb2af
Revert "Implement [OsStr]::join", which was merged without FCP
This reverts commit 4fcbc53820.
2022-05-08 09:37:36 -07:00
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