Commit Graph

171421 Commits

Author SHA1 Message Date
Dylan DPC
3f2ba25159
Rollup merge of #98479 - leocth:atomic-bool-fetch-not, r=joshtriplett
Add `fetch_not` method on `AtomicBool`

This PR adds a `fetch_not` method on `AtomicBool` performs the NOT operation on the inner value.
Internally, this just calls the `fetch_xor` method with the value `true`.

[See this IRLO discussion](https://internals.rust-lang.org/t/could-we-have-fetch-not-for-atomicbool-s/16881)
2022-06-29 17:59:32 +05:30
Dylan DPC
d10497bba2
Rollup merge of #98415 - compiler-errors:rustc-borrowck-session-diagnostic-1, r=davidtwco
Migrate some `rustc_borrowck` diagnostics to `SessionDiagnostic`

Self-explanatory

r? ```@davidtwco```
2022-06-29 17:59:31 +05:30
Takayuki Maeda
6212e6b339 avoid many &str to String conversions with MultiSpan::push_span_label 2022-06-29 21:16:43 +09:00
bors
66c83ffca1 Auto merge of #98558 - nnethercote:smallvec-1.8.1, r=lqd
Update `smallvec` to 1.8.1.

This pulls in https://github.com/servo/rust-smallvec/pull/282, which
gives some small wins for rustc.

r? `@lqd`
2022-06-29 09:11:29 +00:00
Oli Scherer
c33b127d7c The only reason we had to replace opaque types in closures was due to async fn desugaring, make that explicit 2022-06-29 08:58:36 +00:00
Oli Scherer
77e88a7c7a Add more tests 2022-06-29 08:58:36 +00:00
Oli Scherer
524d2b3178 Make RPIT and TAIT work exactly the same 2022-06-29 08:58:36 +00:00
Chris Denton
3cbf864d43
Use verbose help for deprecation suggestion 2022-06-29 09:53:15 +01:00
Dominik Stolz
d048b15216 Improve doc comment of destructure_const 2022-06-29 10:30:47 +02:00
Eduard-Mihai Burtescu
a84e19d444 Unbreak stage1 tests via ignore-stage1 in proc-macro/invalid-punct-ident-1.rs. 2022-06-29 07:32:20 +00:00
bors
493c960a3e Auto merge of #98656 - Dylan-DPC:rollup-hhytn0c, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #97423 (Simplify memory ordering intrinsics)
 - #97542 (Use typed indices in argument mismatch algorithm)
 - #97786 (Account for `-Z simulate-remapped-rust-src-base` when resolving remapped paths)
 - #98277 (Fix trait object reborrow suggestion)
 - #98525 (Add regression test for #79224)
 - #98549 (interpret: do not prune requires_caller_location stack frames quite so early)
 - #98603 (Some borrowck diagnostic fixes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-29 05:47:42 +00:00
Dylan DPC
25fb2b47a5
Rollup merge of #98603 - compiler-errors:minor-borrowck-diagnostic-fixes, r=davidtwco
Some borrowck diagnostic fixes

1. Remove some redundant `.as_ref` suggestion logic from borrowck, this has the consequence of also not suggesting `.as_ref` after `Option` methods, but (correctly) before.
2. Fix a bug where we were replacing a binding's name with a type. Instead, make it a note.

This is somewhat incomplete. See `src/test/ui/borrowck/suggest-as-ref-on-mut-closure.rs` for more improvements.
2022-06-29 10:28:24 +05:30
Dylan DPC
021d21c888
Rollup merge of #98549 - RalfJung:interpret-stacktraces, r=oli-obk
interpret: do not prune requires_caller_location stack frames quite so early

https://github.com/rust-lang/rust/pull/87000 made the interpreter skip `caller_location` frames for its stacktraces and `cur_span`. However, those functions are used for much more than just panic reporting, and e.g. when Miri reports UB somewhere, it probably wants to point inside `caller_location` frames. (And if it did not, it would want to have its own logic to decide that, not be forced into it by the core interpreter engine.) This fixes some rare ICEs in Miri that say "we should never pop more than one frame at once".

So let's remove all `caller_location` logic from the core interpreter, and instead move it to CTFE error reporting. This does not change user-visible behavior. That's the first commit.

We might additionally want to change CTFE error reporting to treat panics differently from other errors: only prune `caller_location` frames for panics. The second commit does that. But honestly I am not sure if this is an improvement.

r? ``@oli-obk``
2022-06-29 10:28:23 +05:30
Dylan DPC
b8bb6f9a4b
Rollup merge of #98525 - JohnTitor:issue-79224, r=compiler-errors
Add regression test for #79224

Closes #79224
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-29 10:28:22 +05:30
Dylan DPC
57c3cee8c3
Rollup merge of #98277 - compiler-errors:issue-93596, r=estebank
Fix trait object reborrow suggestion

Fixes #93596

Slightly generalizes the logic we use to suggest fix first implemented in #95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
2022-06-29 10:28:21 +05:30
Dylan DPC
c23add778c
Rollup merge of #97786 - ferrocene:pa-fix-simulate-remap-prefix, r=Mark-Simulacrum
Account for `-Z simulate-remapped-rust-src-base` when resolving remapped paths

Discovered in #97682, `-Z simulate-remapped-rust-src-base` only partially simulated the behavior of `remap-debuginfo = true`. While the flag successfully simulates the remapping when stdlib's `rmeta` file is loaded, the simulated prefix was not accounted for when the remapped path's local path was being discovered. This caused the flag to not fully simulate the behavior of `remap-debuginfo = true`, leading to inconsistent behaviors.

This PR fixes https://github.com/rust-lang/rust/issues/97682 by also accounting for the simulated path.
2022-06-29 10:28:20 +05:30
Dylan DPC
dee9aed07d
Rollup merge of #97542 - compiler-errors:arg-mismatch, r=jackh726
Use typed indices in argument mismatch algorithm

I kinda went overboard with the renames, but in general, "arg" is renamed to "expected", and "input" is renamed to "provided", and we use new typed indices to make sure we're indexing into the right sized array.

Other drive-by changes:
1. Factor this logic into a new function, so we don't need to `break 'label` to escape it.
1. Factored out dependence on `final_arg_types`, which is never populated for arguments greater than the number of expected args. Instead, we just grab the final coerced expression type from `in_progress_typeck_results`.
1. Adjust the criteria we use to print (provided) type names, before we didn't suggest anything that had infer vars, but now we suggest thing that have infer vars but aren't `_`.

~Also, sorry in advance, I kinda want to backport this but I know I have folded in a lot of unnecessary drive-by changes that might discourage that. I would be open to brainstorming how to get some of these changes on beta at least.~ edit: Minimized the ICE-fixing changes to #97557

cc `@jackh726` as author of #92364, and `@estebank` as reviewer of the PR.
fixes #97484
2022-06-29 10:28:19 +05:30
Dylan DPC
45740acd34
Rollup merge of #97423 - m-ou-se:memory-ordering-intrinsics, r=tmiasko
Simplify memory ordering intrinsics

This changes the names of the atomic intrinsics to always fully include their memory ordering arguments.

```diff
- atomic_cxchg
+ atomic_cxchg_seqcst_seqcst

- atomic_cxchg_acqrel
+ atomic_cxchg_acqrel_release

- atomic_cxchg_acqrel_failrelaxed
+ atomic_cxchg_acqrel_relaxed

// And so on.
```

- `seqcst` is no longer implied
- The failure ordering on chxchg is no longer implied in some cases, but now always explicitly part of the name.
- `release` is no longer shortened to just `rel`. That was especially confusing, since `relaxed` also starts with `rel`.
- `acquire` is no longer shortened to just `acq`, such that the names now all match the `std::sync::atomic::Ordering` variants exactly.
- This now allows for more combinations on the compare exchange operations, such as `atomic_cxchg_acquire_release`, which is necessary for #68464.
- This PR only exposes the new possibilities through unstable intrinsics, but not yet through the stable API. That's for [a separate PR](https://github.com/rust-lang/rust/pull/98383) that requires an FCP.

Suffixes for operations with a single memory order:

| Order   | Before       | After      |
|---------|--------------|------------|
| Relaxed | `_relaxed`   | `_relaxed` |
| Acquire | `_acq`       | `_acquire` |
| Release | `_rel`       | `_release` |
| AcqRel  | `_acqrel`    | `_acqrel`  |
| SeqCst  | (none)       | `_seqcst`  |

Suffixes for compare-and-exchange operations with two memory orderings:

| Success | Failure | Before                   | After              |
|---------|---------|--------------------------|--------------------|
| Relaxed | Relaxed | `_relaxed`               | `_relaxed_relaxed` |
| Relaxed | Acquire |                       | `_relaxed_acquire` |
| Relaxed | SeqCst  |                       | `_relaxed_seqcst`  |
| Acquire | Relaxed | `_acq_failrelaxed`       | `_acquire_relaxed` |
| Acquire | Acquire | `_acq`                   | `_acquire_acquire` |
| Acquire | SeqCst  |                       | `_acquire_seqcst`  |
| Release | Relaxed | `_rel`                   | `_release_relaxed` |
| Release | Acquire |                       | `_release_acquire` |
| Release | SeqCst  |                       | `_release_seqcst`  |
| AcqRel  | Relaxed | `_acqrel_failrelaxed`    | `_acqrel_relaxed`  |
| AcqRel  | Acquire | `_acqrel`                | `_acqrel_acquire`  |
| AcqRel  | SeqCst  |                       | `_acqrel_seqcst`   |
| SeqCst  | Relaxed | `_failrelaxed`           | `_seqcst_relaxed`  |
| SeqCst  | Acquire | `_failacq`               | `_seqcst_acquire`  |
| SeqCst  | SeqCst  | (none)                   | `_seqcst_seqcst`   |
2022-06-29 10:28:18 +05:30
kadmin
1e40200b35 Erase regions in new abstract consts 2022-06-29 03:44:11 +00:00
bors
116edb6800 Auto merge of #98542 - jackh726:coinductive-wf, r=oli-obk
Make empty bounds lower to `WellFormed` and make `WellFormed` coinductive

r? rust-lang/types
2022-06-29 03:22:47 +00:00
Miguel Ojeda
60dc54e29e alloc: ensure no_global_oom_handling builds are warning-free
Rust 1.62.0 introduced a couple new `unused_imports` warnings
in `no_global_oom_handling` builds, making a total of 5 warnings.

To avoid accumulating more over time, let's keep the builds
warning-free. This ensures projects compiling `alloc` without
infallible allocations do not see the warnings in the future
and that they can keep enabling `-Dwarnings`.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-06-29 04:44:23 +02:00
Miguel Ojeda
83addf2540 alloc: fix no_global_oom_handling warnings
Rust 1.62.0 introduced a couple new `unused_imports` warnings
in `no_global_oom_handling` builds, making a total of 5 warnings:

```txt
warning: unused import: `Unsize`
 --> library/alloc/src/boxed/thin.rs:6:33
  |
6 | use core::marker::{PhantomData, Unsize};
  |                                 ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `from_fn`
  --> library/alloc/src/string.rs:51:18
   |
51 | use core::iter::{from_fn, FusedIterator};
   |                  ^^^^^^^

warning: unused import: `core::ops::Deref`
  --> library/alloc/src/vec/into_iter.rs:12:5
   |
12 | use core::ops::Deref;
   |     ^^^^^^^^^^^^^^^^

warning: associated function `shrink` is never used
   --> library/alloc/src/raw_vec.rs:424:8
    |
424 |     fn shrink(&mut self, cap: usize) -> Result<(), TryReserveError> {
    |        ^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: associated function `forget_remaining_elements` is never used
   --> library/alloc/src/vec/into_iter.rs:126:19
    |
126 |     pub(crate) fn forget_remaining_elements(&mut self) {
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^
```

This patch cleans them so that projects compiling `alloc` without
infallible allocations do not see the warnings. It also enables
the use of `-Dwarnings`.

The couple `dead_code` ones may be reverted when some fallible
allocation support starts using them.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-06-29 04:44:23 +02:00
Michael Goulet
23f3b0dfd0 Don't point at another arg if we're already pointing at one 2022-06-28 19:42:41 -07:00
Michael Howell
ccea908c17 rustdoc: add assertion for missing popover div 2022-06-28 18:20:19 -07:00
Michael Howell
f5f42a8cba rustdoc: make keyboard commands work when checkboxes are selected 2022-06-28 17:29:55 -07:00
Michael Howell
cb8a7388fa rustdoc: fix keyboard shortcuts bug in settings menu
This commit fixes the keyboard shorts code to call localStorage every time a
key is pressed. This matters because you're supposed to be able to change a
setting and have it immediately take effect.
2022-06-28 17:29:37 -07:00
bors
126e3df406 Auto merge of #98376 - nnethercote:improve-derive-PartialEq, r=petrochenkov
Improve some deriving code and add a test

The `.stdout` test is particularly useful.

r? `@petrochenkov`
2022-06-29 00:20:57 +00:00
Michael Howell
cec6988a07 rustdoc: fix help menu popover toggling 2022-06-28 16:02:44 -07:00
Michael Goulet
98af1bfecc Migrate some rustc_borrowck diagnostics to SessionDiagnostic 2022-06-28 22:41:56 +00:00
Michael Goulet
8fd73560b3 Do not use a suggestion to change a binding's name to a type 2022-06-28 22:34:13 +00:00
Michael Goulet
f4fdcc7e24 Remove redundant logic to suggest as_ref 2022-06-28 22:34:13 +00:00
Eric Huss
78c9790e2a Update cargo 2022-06-28 15:31:42 -07:00
Yan Chen
f97326de45 Fix #98260, added the test case 2022-06-28 15:20:30 -07:00
Michael Goulet
862873d20b Note concrete type being coerced into object 2022-06-28 21:56:18 +00:00
Michael Goulet
6c0a591dee Fix trait object reborrow suggestion 2022-06-28 21:42:52 +00:00
bors
2953edc7b7 Auto merge of #98475 - notriddle:notriddle/index-fn-signatures, r=GuillaumeGomez
rustdoc: reference function signature types from the `p` array

This reduces the size of the function signature index, because it's common to have many functions that operate on the same types.

    $ wc -c search-index-old.js search-index-new.js
    5224374 search-index-old.js
    3932314 search-index-new.js

By my math, this reduces the uncompressed size of the search index by 32%.
On compressed signatures, the wins are less drastic, a mere 8%:

    $ wc -c search-index-old.js.gz search-index-new.js.gz
    404532 search-index-old.js.gz
    371635 search-index-new.js.gz
2022-06-28 21:40:10 +00:00
Dominik Stolz
053f48d91f Address code review comments 2022-06-28 23:26:54 +02:00
DrMeepster
9039265c30 fix silly mistake
you should always run x.py check before pushing
2022-06-28 13:48:13 -07:00
Dominik Stolz
080525229b Make consts mod private 2022-06-28 22:45:05 +02:00
Dominik Stolz
cd88bb332c Improve pretty printing of valtrees for references 2022-06-28 22:38:32 +02:00
Josh Stone
c6f362a7c5 Let rust-analyzer ship on stable, non-preview 2022-06-28 12:28:01 -07:00
Eric Huss
b292d94a9a Triagebot: Fix mentions word wrapping. 2022-06-28 11:38:07 -07:00
bors
8308806403 Auto merge of #98632 - matthiaskrgr:rollup-peg868d, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #98548 (rustdoc-json: Allow Typedef to be different in sanity assert)
 - #98560 (Add regression test for #85907)
 - #98564 (Remove references to `./tmp` in-tree)
 - #98602 (Add regression test for #80074)
 - #98606 (⬆️ rust-analyzer)
 - #98609 (Fix ICE for associated constant generics)
 - #98611 (Fix glob import ICE in rustdoc JSON format)
 - #98617 (Remove feature `const_option` from std)
 - #98619 (Fix mir-opt wg name)
 - #98621 (llvm-wrapper: adapt for removal of the ASanGlobalsMetadataAnalysis LLVM API)
 - #98623 (fix typo in comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-28 18:36:42 +00:00
bors
4995b4e584 Auto merge of #9046 - xFrednet:rust-97660-expection-something-something, r=Jarcho
Fix `#[expect]` for most clippy lints

This PR fixes most `#[expect]` - lint interactions listed in rust-lang/rust#97660. [My comment in the issue](https://github.com/rust-lang/rust/issues/97660#issuecomment-1147269504) shows the current progress (Once this is merged). I plan to work on `duplicate_mod` and `multiple_inherent_impl` and leave the rest for later. I feel like stabilizing the feature is more important than fixing the last few nits, which currently also don't work with `#[allow]`.

---

changelog: none

r? `@Jarcho`

cc: rust-lang/rust#97660
2022-06-28 18:28:38 +00:00
bors
a4130e1612 Auto merge of #8355 - Jarcho:explicit_auto_deref_2, r=flip1995
Add lint `explicit_auto_deref` take 2

fixes: #234
fixes: #8367
fixes: #8380

Still things to do:

* ~~This currently only lints `&*<expr>` when it doesn't trigger `needless_borrow`.~~
* ~~This requires a borrow after a deref to trigger. So `*<expr>` changing `&&T` to `&T` won't be caught.~~
* The `deref` and `deref_mut` trait methods aren't linted.
* Neither ~~field accesses~~, nor method receivers are linted.
* ~~This probably shouldn't lint reborrowing.~~
* Full slicing to deref should probably be handled here as well. e.g. `&vec[..]` when just `&vec` would do

changelog: new lint `explicit_auto_deref`
2022-06-28 18:09:26 +00:00
bors
23c6765276 Auto merge of #8921 - Jarcho:merge_passes, r=llogiq
Add `Operators` lint pass

changelog: None
2022-06-28 17:24:06 +00:00
Jason Newcomb
ffbba8550a Move SelfAssignment into Operators lint pass 2022-06-28 13:03:08 -04:00
Jason Newcomb
5e2a2d3ac9 Fix dogfood 2022-06-28 13:02:08 -04:00
Jason Newcomb
92891a01a1 Move PtrEq into Operators lin pass 2022-06-28 12:51:30 -04:00
Jason Newcomb
fc5eac5894 Move NeedlessBitwiseBool into Operators lint pass 2022-06-28 12:51:30 -04:00