Commit Graph

169597 Commits

Author SHA1 Message Date
Matthias Krüger
01453219de
Rollup merge of #97707 - Nilstrieb:data-structures-ub, r=cjgillot
Improve soundness of rustc_data_structures

Make it runnable in miri by adding some ignores and changing N in miri. Also fix a stacked borrows issue in sip128.
2022-06-04 23:42:02 +02:00
Matthias Krüger
36a16be35a
Rollup merge of #97688 - RalfJung:test-const-cpy, r=Mark-Simulacrum
test const_copy to make sure bytewise pointer copies are working

This is non-trivial; for `swap_nonoverlapping`, this is [not working](https://github.com/rust-lang/rust/issues/83163#issuecomment-1145917372).
2022-06-04 23:42:01 +02:00
Matthias Krüger
326315bf54
Rollup merge of #97609 - Elliot-Roberts:unused-trait-refactor, r=cjgillot
Iterate over `maybe_unused_trait_imports` when checking dead trait imports

Closes #96873
r? `@cjgillot`

Some questions, if you have time:

- Is there a way to shorten the `rustc_data_structures::fx::FxIndexSet` path in the query declaration? I wasn't sure where to put a `use`.
- Was returning by reference from the query the right choice here?
- How would I go about evaluating the importance of the `is_dummy()` call in `check_crate`? I don't see failing tests when I comment it out. Should I just try to determine whether dummy spans can ever be put into `maybe_unused_trait_imports`?
- Am I doing anything silly with the various ID types?
- Is that `let-else` with `unreachable!()` bad? (i.e is there a better idiom? Would `panic!("<explanation>")` be better?)
- If I want to evaluate the perf of using a `Vec` as mentioned in #96873, is the best way to use the CI or is it feasible locally?

Thanks :)
2022-06-04 23:42:00 +02:00
Jack Huey
dd38fecb78 Fix pretty printing named bound regions under -Zverbose 2022-06-04 17:32:27 -04:00
bors
4e725bad73 Auto merge of #97191 - wesleywiser:main_thread_name, r=ChrisDenton
Call the OS function to set the main thread's name on program init

Normally, `Thread::spawn` takes care of setting the thread's name, if
one was provided, but since the main thread wasn't created by calling
`Thread::spawn`, we need to call that function in `std::rt::init`.

This is mainly useful for system tools like debuggers and profilers
which might show the thread name to a user. Prior to these changes, gdb
and WinDbg would show all thread names except the main thread's name to
a user. I've validated that this patch resolves the issue for both
debuggers.
2022-06-04 20:27:53 +00:00
Elliot Roberts
76c6845a85 Iterate over maybe_unused_trait_imports when checking dead trait imports 2022-06-04 12:38:55 -07:00
Jacob Hoffman-Andrews
784eebcc60 Don't generate "Impls on Foreign Types" for std
Hack: many traits and types in std are re-exported from core or alloc. In
general, rustdoc is capable of recognizing these implementations as being
on local types. However, in at least one case, rustdoc gets confused and
labels an implementation as being on a foreign type. To make sure that
confusion doesn't pass on to the reader, consider all implementations in
std, core, and alloc to be on local types.
2022-06-04 11:10:51 -07:00
bors
3a8e713859 Auto merge of #97529 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrum
Use new cargo argument in bootstrap for cfg checking

This PR use new cargo argument in bootstrap for doing cfg checking.

Follow-up to https://github.com/rust-lang/rust/pull/97044 and https://github.com/rust-lang/rust/pull/97214.

r? `@Mark-Simulacrum`
2022-06-04 17:47:14 +00:00
Pietro Albini
8ea95988df
update tests 2022-06-04 19:38:51 +02:00
Pietro Albini
e257f38160
address review comments 2022-06-04 19:24:41 +02:00
Pietro Albini
70cdd7efc3
bump sysinfo version 2022-06-04 18:59:07 +02:00
Nilstrieb
7e3bee6d8e Fix stacked borrows invalidation in rustc_data_structures sip128
It creates the src pointer first, which is then invalidated by a
unique borrow of the destination pointer. Swap the borrows around
to fix this. Found with miri.
2022-06-04 17:46:36 +02:00
Nilstrieb
fc8b13cb96 Adapt rustc_data_structures tests to run in strict miri
Some tests took too long and owning_ref is fundamentally flawed,
so don't run these tests or run them with a shorter N. This makes
miri with `-Zmiri-strict-provenance` usable to find UB.
2022-06-04 17:46:29 +02:00
bors
6364179540 Auto merge of #97137 - Kobzol:ci-llvm-pgo-pid, r=Mark-Simulacrum
Add PID to LLVM PGO profile path

This is a continuation of https://github.com/rust-lang/rust/pull/97110, which adds PID to the filename pattern of LLVM profiles. It also adds some metrics to the pgo.sh script, so that we can observe how many profiles there are and how large are they.

r? `@lqd`
2022-06-04 14:30:36 +00:00
Wesley Wiser
cb87ce2285 Update src/test/debuginfo/thread-names.rs
Co-authored-by: Chris Denton <ChrisDenton@users.noreply.github.com>
2022-06-04 09:57:10 -04:00
Camille GILLOT
af8739b96e Completely remove LifetimeScopeForPath. 2022-06-04 15:33:27 +02:00
Camille GILLOT
a07290047e Compute lifetimes in scope at diagnostic time. 2022-06-04 15:28:15 +02:00
Yuki Okushi
7026845706
Add regresion test for #87142 2022-06-04 21:19:15 +09:00
Philipp Krones
586cbd0229
Update Cargo.lock
This updates the Cargo.lock file for Clippy:

- parking_lot 0.11.2 -> 0.12 (now 2 versions in parking lot)
- rustfix 0.6.0 -> 0.6.1 (now only one version left)
- compiletest_rs 0.7.1 -> 0.8
- clap 2.34.0 -> 3.1.1
2022-06-04 14:07:44 +02:00
Philipp Krones
c22d4e6b34
Remove unnecessary clap_derive dependency added in 9ee211af
The fixed issue in this commit can be tested without depending on
clap/clap_derive. This updates the test case to do so.
2022-06-04 14:04:35 +02:00
Philipp Krones
d55c373ddd
Merge commit 'd9ddce8a223cb9916389c039777b6966ea448dc8' into clippyup 2022-06-04 13:34:07 +02:00
bors
c7b0452ece Auto merge of #97729 - Dylan-DPC:rollup-dv43xo9, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #96642 (Avoid zero-sized allocs in ThinBox if T and H are both ZSTs.)
 - #97647 (Lazily allocate and initialize pthread locks.)
 - #97715 (Support the `#[expect]` attribute on fn parameters (RFC-2383))
 - #97716 (Fix reachability analysis for const methods)
 - #97722 (Tighten spans for bad fields in struct deriving `Copy`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-04 11:29:29 +00:00
bors
d9ddce8a22 Auto merge of #8942 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2022-06-04 10:55:48 +00:00
Philipp Krones
36b18924a7
Bump nightly version -> 2022-06-04 2022-06-04 12:54:20 +02:00
Philipp Krones
7f402b15c7
Merge remote-tracking branch 'upstream/master' into rustup 2022-06-04 12:53:27 +02:00
Sean Cross
dc789701a0 test: add xous to well-known-values.stderr
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-04 18:47:27 +08:00
Sean Cross
796d7d2824 platform-support: add riscv32imac-unknown-xous-elf
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-04 18:47:27 +08:00
Sean Cross
9f6e6872c2 riscv32imac-unknown-xous-elf: add target
Xous is a microkernel operating system designed to run on small systems.
The kernel contains a wide range of userspace processes that provide
common services such as console output, networking, and time access.

The kernel and its services are completely written in Rust using a
custom build of libstd. This adds support for this target to upstream
Rust so that we can drop support for our out-of-tree `target.json` file.

Add a Tier 3 target for Xous running on RISC-V.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-04 18:47:27 +08:00
bors
8ef490871c Auto merge of #8843 - Serial-ATA:collect-renamed, r=xFrednet
Collect renamed lints

changelog: Display past names of renamed lints on Clippy's lint list

cc #7172

r? `@xFrednet`
2022-06-04 09:49:27 +00:00
Dylan DPC
8c4c698efb
Rollup merge of #97722 - compiler-errors:tighten-copy-type-error-spans, r=Dylan-DPC
Tighten spans for bad fields in struct deriving `Copy`

r? `@estebank`

Closes #89137 for good, I think

Not sure if this is what you were looking for in https://github.com/rust-lang/rust/issues/89137#issuecomment-1146201791
2022-06-04 11:06:42 +02:00
Dylan DPC
9917f3816a
Rollup merge of #97716 - compiler-errors:issue-97708, r=wesleywiser
Fix reachability analysis for const methods

Use `method_might_be_inlined` directly for `ImplItemKind::Fn` instead of duplicating the logic in `def_id_represents_local_inlined_item`.

This is parallel to how we use `item_might_be_inlined` for `ItemKind::Fn` in that same body.

Fixes #97708
2022-06-04 11:06:42 +02:00
Dylan DPC
9c794b46cf
Rollup merge of #97715 - xFrednet:97650-expect-in-fuction-arg, r=wesleywiser
Support the `#[expect]` attribute on fn parameters (RFC-2383)

A small PR to allow the `#[expect]` attribute on function parameters.

Nothing more to say, I hope everyone reading this has a lovely day.

---

r? ``@wesleywiser``

closes: https://github.com/rust-lang/rust/issues/97650

cc: https://github.com/rust-lang/rust/issues/85549
2022-06-04 11:06:41 +02:00
Dylan DPC
e9ec02267a
Rollup merge of #97647 - m-ou-se:lazy-box-locks, r=Amanieu
Lazily allocate and initialize pthread locks.

Lazily allocate and initialize pthread locks.

This allows {Mutex, Condvar, RwLock}::new() to be const, while still using the platform's native locks for features like priority inheritance and debug tooling. E.g. on macOS, we cannot directly use the (private) APIs that pthread's locks are implemented with, making it impossible for us to use anything other than pthread while still preserving priority inheritance, etc.

This PR doesn't yet make the public APIs const. That's for a separate PR with an FCP.

Tracking issue: https://github.com/rust-lang/rust/issues/93740
2022-06-04 11:06:40 +02:00
Dylan DPC
07f586fe74
Rollup merge of #96642 - thomcc:thinbox-zst-ugh, r=yaahc
Avoid zero-sized allocs in ThinBox if T and H are both ZSTs.

This was surprisingly tricky, and took longer to get right than expected. `ThinBox` is a surprisingly subtle piece of code. That said, in the end, a lot of this was due to overthinking[^overthink] -- ultimately the fix ended up fairly clean and simple.

[^overthink]: Honestly, for a while I was convinced this couldn't be done without allocations or runtime branches in these cases, but that's obviously untrue.

Anyway, as a result of spending all that time debugging, I've extended the tests quite a bit, and also added more debug assertions. Many of these helped for subtle bugs I made in the middle (for example, the alloc/drop tracking is because I ended up double-dropping the value in the case where both were ZSTs), they're arguably a bit of overkill at this point, although I imagine they could help in the future too.

Anyway, these tests cover a wide range of size/align cases, nd fully pass under miri[^1]. They also do some smoke-check asserting that the value has the correct alignment, although in practice it's totally within the compiler's rights to delete these assertions since we'd have already done UB if they get hit. They have more boilerplate than they really need, but it's not *too* bad on a per-test basis.

A notable absence from testing is atypical header types, but at the moment it's impossible to manually implement `Pointee`. It would be really nice to have testing here, since it's not 100% obvious to me that the aligned read/write we use for `H` are correct in the face of arbitrary combinations of `size_of::<H>()`, `align_of::<H>()`, and `align_of::<T>()`. (That said, I spent a while thinking through it and am *pretty* sure it's fine -- I'd just feel... better if we could test some cases for non-ZST headers which have unequal and align).

[^1]: Or at least, they pass under miri if I copy the code and tests into a new crate and run miri on it (after making it less stdlibified).

Fixes #96485.

I'd request review ``@yaahc,`` but I believe you're taking some time away from reviews, so I'll request from the previous PR's reviewer (I think that the context helps, even if the actual change didn't end up being bad here).

r? ``@joshtriplett``
2022-06-04 11:06:39 +02:00
bors
4a52e0fd7d Auto merge of #97690 - nikic:update-llvm-4, r=cuviper
Update LLVM submodule

Merge upstream release/14.x branch.

Fixes #97428.
2022-06-04 08:48:32 +00:00
bors
b1a3e7e9c8 Auto merge of #8937 - Jarcho:merge_match_passes, r=llogiq
Merge various passes into `Matches`

changelog: None
2022-06-04 07:41:27 +00:00
bors
cb0584f86b Auto merge of #97604 - nnethercote:inline-bridge-Buffer-methods, r=eddyb
Inline `bridge::Buffer` methods.

This fixes a performance regression caused by making `Buffer`
non-generic in #97004.

r? `@eddyb`
2022-06-04 04:51:26 +00:00
Michael Goulet
4c6a6bc3f9 Tighten spans for bad fields in Copy struct 2022-06-03 19:17:12 -07:00
bors
c3384ea35c Auto merge of #97717 - matthiaskrgr:rollup-lalaii2, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #97446 (Make hir().get_generics and generics_of consistent.)
 - #97656 (Add a suggestion to replace parentheses with angle brackets on associated trait constraint)
 - #97692 (Add `#T-types/nominated` zulip notification)
 - #97696 (Do not ICE when failing to normalize during inlining.)
 - #97702 (Remove useless LocalDefId in ImplTraitContext::Universal.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-04 02:10:35 +00:00
Michael Goulet
15cccb97d6 Encode MIR for 'unreachable' non-generic fns 2022-06-03 17:39:10 -07:00
bors
f15370b4e4 Auto merge of #97670 - spastorino:simplify-universal-impl-trait-lowering2, r=Dylan-DPC
Make params be SmallVec as originally was

r? `@cjgillot`
It was originally a [`SmallVec`](https://github.com/rust-lang/rust/pull/97598/files#diff-0a61b538a3cec072c76fecae4635af6a12ec3256860029ac70549c2aa53ab394L1497), I've mistakenly changed it [here](https://github.com/rust-lang/rust/pull/97598/files#diff-0a61b538a3cec072c76fecae4635af6a12ec3256860029ac70549c2aa53ab394R1377) to a `Vec`
2022-06-03 23:29:30 +00:00
Jason Newcomb
68c411ff94 Move ManualMap into Matches lint pass 2022-06-03 19:09:50 -04:00
Jason Newcomb
67cb5ec29f Move TryErr into Matches lint pass 2022-06-03 19:09:49 -04:00
Jason Newcomb
dbc7753fb2 Merge SignificantDropInScrutinee into Matches lint pass 2022-06-03 19:09:49 -04:00
Jason Newcomb
8c8a52eeeb Move MatchStrCaseMismatch into Matches lint pass 2022-06-03 19:09:49 -04:00
Jason Newcomb
3d8d734150 Move MatchOnVecItems into Matches lint pass 2022-06-03 19:09:49 -04:00
Jason Newcomb
b337f9e62e Merge ManualUnwrapOr into Matches lint pass 2022-06-03 19:09:49 -04:00
xFrednet
b5eee17088
Support the #[expect] attribute on fn parameters (RFC-2383) 2022-06-04 00:50:45 +02:00
Matthias Krüger
a88d94b072
Rollup merge of #97702 - cjgillot:no-universal-did, r=spastorino
Remove useless LocalDefId in ImplTraitContext::Universal.
2022-06-04 00:42:52 +02:00
Matthias Krüger
74f0bcc9c7
Rollup merge of #97696 - cjgillot:normalize-inline, r=compiler-errors
Do not ICE when failing to normalize during inlining.

Fixes https://github.com/rust-lang/rust/issues/97695
2022-06-04 00:42:51 +02:00