Commit Graph

166199 Commits

Author SHA1 Message Date
Oli Scherer
2e0ef701c2 Document and rename the new wrapper type 2022-04-07 13:01:48 +00:00
bors
650a0e52b8 Auto merge of #8646 - Alexendoo:option-as-deref-mut, r=giraffate
Fix `as_deref_mut` false positives in `needless_option_as_deref`

Also moves it into `methods/`

Fixes #7846
Fixes #8047

changelog: [`needless_option_as_deref`]: No longer lints for `as_deref_mut` on Options that cannot be moved

supersedes #8064
2022-04-07 13:00:15 +00:00
bors
fa72316031 Auto merge of #95715 - nnethercote:shrink-Nonterminal, r=davidtwco
Shrink `Nonterminal`

Small consistency and performance improvements.

r? `@petrochenkov`
2022-04-07 12:52:32 +00:00
Caio
5974c18efb [macro_metavar_expr] Add tests to ensure the feature requirement 2022-04-07 09:32:02 -03:00
Alex Macleod
182b7c38d7 Fix as_deref_mut false positives in needless_option_as_deref
Also moves the lint to the methods directory
2022-04-07 12:39:21 +01:00
Caio
3191d27f48 Kickstart the inner usage of macro_metavar_expr 2022-04-07 08:13:41 -03:00
bors
ed6c958ee4 Auto merge of #95760 - Dylan-DPC:rollup-uskzggh, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #95189 (Stop flagging unexpected inner attributes as outer ones in certain diagnostics)
 - #95752 (Regression test for #82866)
 - #95753 (Correct safety reasoning in `str::make_ascii_{lower,upper}case()`)
 - #95757 (Use gender neutral terms)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-07 09:50:11 +00:00
Paolo Borelli
f2bbb5fac0 conf: fix lint name in comment
The lint name is ERR_EXPECT, not EXPECT_ERR
2022-04-07 11:29:02 +02:00
Paolo Borelli
b0edbca0e6 new lint cast_abs_to_unsigned
Add a lint to detect cast to unsigned for abs() and suggest
unsigned_abs() to avoid panic when called on MIN.
2022-04-07 11:28:14 +02:00
Dylan DPC
d907ab87a0
Rollup merge of #95757 - zofrex:gender-neutral-terms, r=dtolnay
Use gender neutral terms

#95508 was not executed well, but it did find a couple of legitimate issues: some uses of unnecessarily gendered language, and some typos. This PR fixes (properly) the legitimate issues it found.
2022-04-07 11:17:17 +02:00
Dylan DPC
6639604bd6
Rollup merge of #95753 - ChayimFriedman2:patch-1, r=dtolnay
Correct safety reasoning in `str::make_ascii_{lower,upper}case()`

I don't understand why the previous comment was used (it was inserted in #66564), but it doesn't explain why these functions are safe, only why `str::as_bytes{_mut}()` are safe.

If someone thinks they make perfect sense, I'm fine with closing this PR.
2022-04-07 11:17:16 +02:00
Dylan DPC
870ab12ea7
Rollup merge of #95752 - compiler-errors:issue-82866, r=Dylan-DPC
Regression test for #82866

Saw that this issue was open when i was cleaning my old branch for #92237.
I am also not opposed to not adding an extra test and just closing #82866.

Fixes #82866
2022-04-07 11:17:14 +02:00
Dylan DPC
648d644c60
Rollup merge of #95189 - fmease:fix-issue-94340, r=estebank
Stop flagging unexpected inner attributes as outer ones in certain diagnostics

Fixes #94340.

In the issue to-be-fixed I write that the general message _an inner attribute is not permitted in this context_ should be more specific noting that the “context” is the `include` macro. This, however, cannot be achieved without touching a lot of things and passing a flag to the `parse_expr` and `parse_item` calls in `expand_include`. This seems rather hacky to me. That's why I left it as it. `Span::from_expansion` does not apply either AFAIK.

`@rustbot` label A-diagnostics T-compiler
2022-04-07 11:17:13 +02:00
James 'zofrex' Sanderson
ef59ab738e Use gender neutral terms 2022-04-07 08:51:59 +01:00
Jakub Beránek
49efa23d70
Update rustc-perf version used in CI and also the corresponding PGO benchmarks 2022-04-07 09:42:14 +02:00
bors
f565016edd Auto merge of #95678 - pietroalbini:pa-1.62.0-bootstrap, r=Mark-Simulacrum
Bump bootstrap compiler to 1.61.0 beta

This PR bumps the bootstrap compiler to the 1.61.0 beta. The first commit changes the stage0 compiler, the second commit applies the "mechanical" changes and the third and fourth commits apply changes explained in the relevant comments.

r? `@Mark-Simulacrum`
2022-04-07 07:34:04 +00:00
bors
8cd6080f6c Auto merge of #95748 - Dylan-DPC:rollup-t208j51, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95352 ([bootstrap] Print the full relative path to failed tests)
 - #95646 (Mention `std::env::var` in `env!`)
 - #95708 (Update documentation for `trim*` and `is_whitespace` to include newlines)
 - #95714 (Add test for issue #83474)
 - #95725 (Message: Chunks cannot have a size of zero.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-07 05:12:08 +00:00
Chayim Refael Friedman
b399e7ea7c
Correct safety reasoning in str::make_ascii_{lower,upper}case() 2022-04-07 07:52:07 +03:00
Michael Goulet
c7c80577c2 regression test for #82866 2022-04-06 21:43:34 -07:00
Michael Goulet
39bff4bf9c don't report int/float ambiguity when we have previous errors 2022-04-06 21:27:46 -07:00
Dylan DPC
939f84ab00
Rollup merge of #95725 - hkBst:patch-1, r=Dylan-DPC
Message: Chunks cannot have a size of zero.

Add a message to the assertion that chunks cannot have a size of zero.
2022-04-07 06:04:54 +02:00
Dylan DPC
2e4964ed3d
Rollup merge of #95714 - KSBilodeau:master, r=Dylan-DPC
Add test for issue #83474

Adds test for https://github.com/rust-lang/rust/issues/83474 - second attempt at PR https://github.com/rust-lang/rust/pull/91821 which was abandoned.
2022-04-07 06:04:54 +02:00
Dylan DPC
eeabdec14c
Rollup merge of #95708 - fee1-dead:doc_whitespace_trim, r=Dylan-DPC
Update documentation for `trim*` and `is_whitespace` to include newlines
2022-04-07 06:04:52 +02:00
Dylan DPC
a2df05d4d5
Rollup merge of #95646 - mgeisler:mention-std-env-var, r=Dylan-DPC
Mention `std::env::var` in `env!`

When searching for how to read an environment variable, I first encountered the `env!` macro. It would have been useful to me if the documentation had included a link to `std::env::var`, which is what I was actually looking for.
2022-04-07 06:04:52 +02:00
Dylan DPC
f7499a892e
Rollup merge of #95352 - jyn514:full-relative-path, r=Mark-Simulacrum
[bootstrap] Print the full relative path to failed tests

Before:
```
failures:
    [ui] rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s
```

After:
```
failures:
    [ui] src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s
```

This allows copy pasting the path or using Ctrl+Click in IDEs to go directly to the file, instead of having to edit the filename first.
2022-04-07 06:04:51 +02:00
Nicholas Nethercote
d9592c2d9f Shrink Nonterminal.
By heap allocating the argument within `NtPath`, `NtVis`, and `NtStmt`.
This slightly reduces cumulative and peak allocation amounts, most
notably on `deep-vector`.
2022-04-07 12:51:50 +10:00
Dylan DPC
c331a9293a
Update library/core/src/slice/mod.rs
Co-authored-by: Janusz Marcinkiewicz <virrages@gmail.com>
2022-04-07 04:44:30 +02:00
Dylan DPC
7660b2fd74
remove exclamation mark
Co-authored-by: Janusz Marcinkiewicz <virrages@gmail.com>
2022-04-07 04:44:11 +02:00
bors
846993ec43 Auto merge of #95688 - pfmooney:libc-update, r=Mark-Simulacrum
Update libc to 0.2.121

With the updated libc, UNIX stack overflow handling in libstd can now
use the common `si_addr` accessor function, rather than attempting to
use a field from that name in `siginfo_t`.  This simplifies the
collection of the fault address, particularly on platforms where that
data resides within a union in `siginfo_t`.
2022-04-07 02:41:28 +00:00
bors
2310da432c Auto merge of #95745 - Dylan-DPC:rollup-485ajqi, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95185 (Stabilize Stdin::lines.)
 - #95626 (Don't cast thread name to an integer for prctl)
 - #95709 (Improve terse test output.)
 - #95735 (Revert "Mark Location::caller() as #[inline]")
 - #95738 (Switch item-info from div to span)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-07 00:15:18 +00:00
Dylan DPC
fe6d69f410
Rollup merge of #95738 - GuillaumeGomez:item-info-switch-to-span, r=jsha
Switch item-info from div to span

Following discussion in #95684.

cc `@jsha`
r? `@notriddle`
2022-04-07 01:59:24 +02:00
Dylan DPC
b22df08bb0
Rollup merge of #95735 - bjorn3:revert_inline_location_caller, r=compiler-errors
Revert "Mark Location::caller() as #[inline]"

This reverts https://github.com/rust-lang/rust/pull/95619. As noted in https://github.com/rust-lang/rust/pull/95619#issuecomment-1088548140 this seems to break several tests with cg_clif.
2022-04-07 01:59:24 +02:00
Dylan DPC
687e40a959
Rollup merge of #95709 - nnethercote:improve-terse-test-output, r=Dylan-DPC
Improve terse test output.

The current terse output gives 112 chars per line, which causes
wraparound for people using 100 char wide terminals, which is very
common.

This commit changes it to be exactly 100 wide, which makes the output
look much nicer.
2022-04-07 01:59:23 +02:00
Dylan DPC
64e7bf9fae
Rollup merge of #95626 - saethlin:pass-pointer-to-prctl, r=cuviper
Don't cast thread name to an integer for prctl

`libc::prctl` and the `prctl` definitions in glibc, musl, and the kernel headers are C variadic functions. Therefore, all the arguments (except for the first) are untyped. It is only the Linux man page which says that `prctl` takes 4 `unsigned long` arguments. I have no idea why it says this.

In any case, the upshot is that we don't need to cast the pointer to an integer and confuse Miri.

But in light of this... what are we doing with those three `0`s? We're passing 3 `i32`s to `prctl`, which doesn't fill me with confidence. The man page says `unsigned long` and all the constants in the linux kernel are macros for expressions of the form `1UL << N`. I'm mostly commenting on this because looks a whole lot like some UB that was found in SQLite a few years ago: <https://youtu.be/LbzbHWdLAI0?t=1925> that was related to accidentally passing a 32-bit value from a literal `0` instead of a pointer-sized value. This happens to work on x86 due to the size of pointers and happens to work on x86_64 due to the calling convention. But also, there is no good reason for an implementation to be looking at those arguments. Some other calls to `prctl` require that other arguments be zeroed, but not `PR_SET_NAME`... so why are we even passing them?

I would prefer to end such questions by either passing 3 `libc::c_ulong`, or not passing those at all, but I'm not sure which is better.
2022-04-07 01:59:22 +02:00
Dylan DPC
d2f1a0b88c
Rollup merge of #95185 - m-ou-se:stabilize-stdin-lines, r=Mark-Simulacrum
Stabilize Stdin::lines.

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

Fcp completed here: https://github.com/rust-lang/rust/issues/87096#issuecomment-1028792980
2022-04-07 01:59:21 +02:00
bors
0d66404941 Auto merge of #8630 - Jarcho:forget_non_drop, r=Manishearth
Add lints `drop_non_drop` and `forget_non_drop`

fixes #1897

changelog: Add lints `drop_non_drop` and `forget_non_drop`
2022-04-06 23:04:20 +00:00
Vadim Petrochenkov
69d6c3b2e6 rustdoc: Early doc link resolution fixes and refactorings 2022-04-07 00:19:48 +03:00
bors
8f36334ca9 Auto merge of #95742 - Dylan-DPC:rollup-8n7o87y, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #95342 (Ignore "format the world" commit in git blame)
 - #95353 ([bootstrap] Give a hard error when filtering tests for a file that does not exist)
 - #95649 (New mir-opt deref_separator)
 - #95721 (Fix typo in bootstrap/setup.rs)
 - #95730 (Rename RWLock to RwLock in std::sys.)
 - #95731 (Check that all hidden types are the same and then deduplicate them.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-06 21:15:16 +00:00
Ben Kimock
e8a6f53af8 Change trailing prctl arguments to c_ulong 2022-04-06 17:11:50 -04:00
Dylan DPC
ebba894f19
Rollup merge of #95731 - oli-obk:lazy_tait_regression, r=compiler-errors
Check that all hidden types are the same and then deduplicate them.

fixes #95538

This used to trigger a sanity check. Now we accept that there may be multiple places where a hidden type is constrained and we merge all of these at the end.

Ideally we'd merge eagerly, but that is a larger refactoring that I don't want to put into a backport
2022-04-06 23:06:10 +02:00
Dylan DPC
d2697e3128
Rollup merge of #95730 - m-ou-se:rwlock-case, r=Dylan-DPC
Rename RWLock to RwLock in std::sys.

std::sync::RwLock is spelled with two capital letters, but std::sys's RWLock was spelled with three capital letters. This cleans that up and uses `RwLock` everywhere.
2022-04-06 23:06:08 +02:00
Dylan DPC
bd92c7c6d7
Rollup merge of #95721 - xu-cheng:typo, r=compiler-errors
Fix typo in bootstrap/setup.rs
2022-04-06 23:06:07 +02:00
Dylan DPC
9fa941c23e
Rollup merge of #95649 - ouz-a:mir-opt, r=oli-obk
New mir-opt deref_separator

This adds a new mir-opt that split certain derefs into this form:
`let x = (*a.b).c;` to => `tmp = a.b; let x = (*tmp).c;`

Huge thanks to ``@oli-obk`` for his patient mentoring.
2022-04-06 23:06:06 +02:00
Dylan DPC
76cd8f8bf0
Rollup merge of #95353 - jyn514:invalid-filter-hard-error, r=Mark-Simulacrum
[bootstrap] Give a hard error when filtering tests for a file that does not exist

A common issue people run into when running compiletest is that filtering for files that don't exist is only a warning and not an error; running the whole test suite instead.
See for example https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Question.20about.20compiletest.
This is especially bad when using `--bless`, which will modify all `.stderr` files.

Change bootstrap to require valid filters instead of discarding invalid filters and continuing.

Before:

```
Warning: Skipping "/home/jnelson/rust-lang/rust/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.r": not a regular file or directory
Check compiletest suite=rustdoc-ui mode=ui (x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) -> x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu))

running 163 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii.......................... 100/163
...............................................................
test result: ok. 89 passed; 0 failed; 74 ignored; 0 measured; 0 filtered out; finished in 7.20s

        finished in 7.248 seconds
Build completed successfully in 0:00:08
```

After:
```
thread 'main' panicked at 'Invalid test suite filter "/home/jnelson/rust-lang/rust/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.r": file or directory does not exist', src/bootstrap/util.rs:311:
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:08
```
2022-04-06 23:06:05 +02:00
Dylan DPC
86ddbf236e
Rollup merge of #95342 - jyn514:ignore-revs, r=Mark-Simulacrum
Ignore "format the world" commit in git blame

This tells github to hide it in its blame view: https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
It can also be used locally by running `git config blame.ignorerevsfile .git-blame-ignore-revs` (although it's advised to avoid `--global` since git gives a hard error when the file doesn't exist).

We may want to add more commits in later PRs, but this should be a good start.

Before: ![image](https://user-images.githubusercontent.com/23638587/160255130-d7283cc4-4d33-4a7d-bc70-f9ce6820293c.png)
After: ![image](https://user-images.githubusercontent.com/23638587/160255138-90d0325a-e063-4e0e-8cfb-732724bf6c60.png)
cc https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Hide.20some.20commits.20in.20GitHub.20blame
2022-04-06 23:06:04 +02:00
Pietro Albini
b500a78ac1
fix regression caused by rust-lang/cargo#10448 2022-04-06 23:04:03 +02:00
Guillaume Gomez
56d0f9484b Update rustdoc test following DOM change 2022-04-06 20:41:57 +02:00
Guillaume Gomez
d48a39a5e2 Switch item-info div to span to generate valid HTML 2022-04-06 20:41:44 +02:00
bors
409a936f3b Auto merge of #8606 - InfRandomness:err()-expect()-lint, r=xFrednet
Add [`err_expect`] lint

[`expect_err`] lint

- \[ ] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

Fixes https://github.com/rust-lang/rust-clippy/issues/1435

changelog: Added a lint to detect usage of .err().expect()
2022-04-06 18:07:56 +00:00
León Orell Valerian Liehr
5ab0548500 Stop flagging certain inner attrs as outer ones 2022-04-06 19:54:05 +02:00