Commit Graph

246201 Commits

Author SHA1 Message Date
Matthias Krüger
3d7d709925
Rollup merge of #120880 - RalfJung:vtable-fnptr-partialeq, r=cuviper
add note on comparing vtables / function pointers

Fixes https://github.com/rust-lang/rust/issues/99388
Fixes https://github.com/rust-lang/rust/issues/117047
2024-02-11 23:19:09 +01:00
Matthias Krüger
4c154a1a48
Rollup merge of #120872 - petrochenkov:opthirpar, r=cjgillot
hir: Refactor getters for HIR parents

See individual commits.

I ended up removing on of the FIXMEs from https://github.com/rust-lang/rust/pull/120206 instead of addressing it.
2024-02-11 23:19:08 +01:00
Matthias Krüger
f64bc316f6
Rollup merge of #120740 - ChrisDenton:cmaths, r=Mark-Simulacrum
Make cmath.rs a single file

It makes sense to have this all in one file. There's essentially only one target that has missing symbols and that's easy enough to handle inline.

Note that the Windows definitions used to use `c_float` and `c_double` whereas the other platforms all used `f32` and `f64`. They've now been made consistent. However, `c_float` and `c_double` have the expected definitions on all Windows platforms we support.
2024-02-11 23:19:08 +01:00
Matthias Krüger
251a09e151
Rollup merge of #110483 - tleibert:thin-box-try-new, r=dtolnay
Create try_new function for ThinBox

The `allocator_api` feature has proven very useful in my work in the FreeBSD kernel. I've found a few places where a `ThinBox` #92791 would be useful, but it must be able to be fallibly allocated for it to be used in the kernel.

This PR proposes a change to add such a constructor for ThinBox.

ACP: https://github.com/rust-lang/libs-team/issues/213
2024-02-11 23:19:07 +01:00
Nicholas Nethercote
b7b6ebca0c Fix inconsistencies in the diagnostic API methods.
- Remove low-value comments about functionality that is obvious.

- Add missing `track_caller` attributes -- every method should have one.

- Adjust `rustc_lint_diagnostic` attributes. Every method involving a
  `impl Into<DiagnosticMessage>` or `impl Into<SubdiangnosticMessage>`
  argument should have one, except for those producing bugs, which
  aren't user-facing.
2024-02-12 09:16:48 +11:00
Nicholas Nethercote
c35983a748 Reorder the diagnostic API methods.
The current order is almost perfectly random. This commit puts them into
a predictable order in their own impl block, going from the highest
level (`Block`) to the lowest (`Expect`). Within each level this is the
order:

- struct_err, err
- struct_span_err, span_err
- create_err, emit_err

The first one in each pair creates a diagnostic, the second one creates
*and* emits a diagnostic. Not every method is present for every level.

The diff is messy, but other than moving methods around, the only thing
it does is create the new `impl DiagCtxt` block with its own comment.
2024-02-12 09:16:45 +11:00
bors
520b0b20aa Auto merge of #120619 - compiler-errors:param, r=lcnr
Assert that params with the same *index* have the same *name*

Found this bug when trying to build libcore with the new solver, since it will canonicalize two params with the same index into *different* placeholders if those params differ by name.
2024-02-11 22:13:52 +00:00
Michael Goulet
87816378ab Fix async closures in CTFE 2024-02-11 22:09:52 +00:00
Michael Goulet
cb024ba6e3 is_closure_like 2024-02-11 22:09:52 +00:00
Ralf Jung
aaa6d3bec2 add comparison warning to RawWakerVTable as well 2024-02-11 23:06:09 +01:00
ripytide
f34d9da7db
fix intra-doc links 2024-02-11 20:26:05 +00:00
bors
1a648b397d Auto merge of #120803 - onur-ozkan:fix-compilation-cache, r=Mark-Simulacrum
always run `configure_linker` except for mir-opt tests

`configure_linker` now runs consistently unless it's for mir-opt tests. Previously `!= "check"` condition was causing dirt in the cargo cache between runs of `x anything-but-not-check` and `x check`.

 Fixes #120768

 cc `@saethlin`
2024-02-11 19:58:12 +00:00
David Tolnay
ea6944a065
Address ThinBox::try_new PR review 2024-02-11 11:28:01 -08:00
Michael Goulet
9789e88cfe Check that the ABI of the instance we are inlining is correct 2024-02-11 19:17:42 +00:00
Michael Goulet
38df5bdcf1 Ignore own item bounds in parent alias types in for_each_item_bound 2024-02-11 18:23:05 +00:00
Ayush Singh
af428db01f
Implement sys/thread for UEFI
Since UEFI has no concept of threads, most of this module can be
ignored. However, implementing parts that make sense.

- Implement sleep
- Implement available_parallelism

Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-02-11 23:48:53 +05:30
Jakub Beránek
4a2939bcd2
Gate PR CI on clippy correctness lints 2024-02-11 19:04:43 +01:00
bors
a166af7729 Auto merge of #120903 - matthiaskrgr:rollup-tmsuzth, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #119213 (simd intrinsics: add simd_shuffle_generic and other missing intrinsics)
 - #120272 (Suppress suggestions in derive macro)
 - #120773 (large_assignments: Allow moves into functions)
 - #120874 (Take empty `where` bounds into account when suggesting predicates)
 - #120882 (interpret/write_discriminant: when encoding niched variant, ensure the stored value matches)
 - #120883 (interpret: rename ReadExternStatic → ExternStatic)
 - #120890 (Adapt `llvm-has-rust-patches` validation to take `llvm-config` into account.)
 - #120895 (don't skip coercions for types with errors)
 - #120896 (Print kind of coroutine closure)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-11 17:43:51 +00:00
Ben Kimock
f0de10039c Cleanup around the new assert_unsafe_precondition
Make the polymorphic is_nonoverlapping private

Fix assert_unsafe_precondition doc typos

Add docs for intrinsics::debug_assertions
2024-02-11 12:35:44 -05:00
ripytide
f415339052
fix incorrect doctest 2024-02-11 16:18:40 +00:00
Ian Chamberlain
07afd0fd51
Update links to rust3ds and outdated info 2024-02-11 11:07:02 -05:00
ripytide
792fa24595
improve btree_cursors functions documentation 2024-02-11 15:51:07 +00:00
bors
980cf089f4 Auto merge of #120920 - matthiaskrgr:rollup-jsryr8e, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #117740 (Add some links and minor explanatory comments to `std::fmt`)
 - #118307 (Remove an unneeded helper from the tuple library code)
 - #119242 (Suggest less bug-prone construction of Duration in docs)
 - #119449 (Fix `clippy::correctness` in the library)
 - #120307 (core: add Duration constructors)
 - #120459 (Document various I/O descriptor/handle conversions)
 - #120729 (Update mdbook to 0.4.37)
 - #120763 (Suggest pattern tests when modifying exhaustiveness)
 - #120906 (Remove myself from some review rotations)
 - #120916 (Subtree update of ` rust-analyzer`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-11 15:28:17 +00:00
Ralf Jung
e13de311d5 make Primary/Secondary importance consistent between CellBorrow and MutBorrow 2024-02-11 15:12:10 +01:00
Ralf Jung
d5de9a6105 check_consts: fix some duplicate errors by not calling check_static unnecessarily 2024-02-11 15:12:10 +01:00
bors
899c895ba4 Auto merge of #120914 - ehuss:downgrade-xcode, r=Mark-Simulacrum
Downgrade xcode

This is a temporary fix for the CI issues that have been plaguing the macOS builders. GitHub updated the default Xcode to 15 in the [2024-02-04](https://github.com/actions/runner-images/releases/tag/macos-13%2F20240204.1) update. This caused two issues to start appearing in CI:

* cmake fails to verify that clang can build a simple test program.
* An `invalid r_symbolnum` linking error when trying to build one of cranelift's tests.

I believe I have a solution for the first problem, but not the second. In the meantime, to help with the CI problems, this PR should temporarily resolve the issue until we have a solution.
2024-02-11 13:13:02 +00:00
joboet
04282db5b3
add doc-comment to unlock_queue 2024-02-11 13:59:00 +01:00
Chris Denton
89abbb0b40
Add ChrisDenton to review queue 2024-02-11 09:13:12 -03:00
Caio
1fa75af173 Add test 2024-02-11 08:02:32 -03:00
David Carlier
114b0c799d std: enabling new netbsd (10) calls.
Introducing a new config for this purpose as NetBSD 9 or 8 will be still around
for a good while. For now, we re finally enabling sys::unix::rand::getrandom.
2024-02-11 08:48:02 +00:00
Matthias Krüger
3ac087229a
Rollup merge of #120916 - lnicola:sync-from-ra, r=lnicola
Subtree update of ` rust-analyzer`

r? `@ghost`
2024-02-11 08:25:44 +01:00
Matthias Krüger
db79df7c1a
Rollup merge of #120906 - joshtriplett:triage-my-bandwidth, r=Mark-Simulacrum
Remove myself from some review rotations

Severe lack of bandwidth. I want to make sure I have enough time for other Rust
work.
2024-02-11 08:25:44 +01:00
Matthias Krüger
040ecbfb9f
Rollup merge of #120763 - Nadrieril:suggest-patterns, r=Mark-Simulacrum
Suggest pattern tests when modifying exhaustiveness

The vast majority of exhaustiveness tests are in `tests/ui/pattern`, this is what I've been using for years. This PR is me telling `x suggest` about that.

cc `@Ezrashaw`
2024-02-11 08:25:44 +01:00
Matthias Krüger
9bbd146e86
Rollup merge of #120729 - ehuss:update-mdbook, r=Mark-Simulacrum
Update mdbook to 0.4.37

This updates mdbook to 0.4.37.
Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-0437

The primary change is the update to pulldown-cmark which has a large number of markdown parsing changes. There shouldn't be any significant changes to the rendering of any of the books (I have posted some PRs to fix some minor issues to the ones that were affected).
2024-02-11 08:25:43 +01:00
Matthias Krüger
3a198077c9
Rollup merge of #120459 - rytheo:handle-conversion-docs, r=Mark-Simulacrum
Document various I/O descriptor/handle conversions

Related to #51430
2024-02-11 08:25:43 +01:00
Matthias Krüger
ba405a47bd
Rollup merge of #120307 - djc:duration-constructors, r=Mark-Simulacrum
core: add Duration constructors

Add more `Duration` constructors.

Tracking issue: #120301.

These match similar convenience constructors available on both `chrono::Duration` and `time::Duration`.

What's the best ordering for these with respect to the existing constructors?
2024-02-11 08:25:42 +01:00
Matthias Krüger
0c5d8d3d3e
Rollup merge of #119449 - Nilstrieb:library-clippy, r=cuviper
Fix `clippy::correctness` in the library

needs https://github.com/rust-lang/backtrace-rs/pull/579 to be complete

for https://github.com/rust-lang/compiler-team/issues/709
2024-02-11 08:25:42 +01:00
Matthias Krüger
a576e81b1d
Rollup merge of #119242 - BenWiederhake:dev-from-nanos, r=joshtriplett
Suggest less bug-prone construction of Duration in docs

std::time::Duration has a well-known quirk: Duration::as_nanos() returns u128 [1], but Duration::from_nanos() takes u64 [2]. So these methods cannot easily roundtrip [3]. It is not possible to simply accept u128 in from_nanos [4], because it requires breaking other API [5].

It seems to me that callers have basically only two options:
1. `Duration::from_nanos(d.as_nanos() as u64)`, which is the "obvious" and buggy approach.
2. `Duration::new(d.as_secs(), d.subsecs_nanos())`, which only becomes apparent after reading and digesting the entire Duration struct documentation.

I suggest that the documentation of `from_nanos` is changed to make option 2 more easily discoverable.

There are two major usecases for this:
- "Weird math" operations that should not be supported directly by `Duration`, like squaring.
- "Disconnected roundtrips", where the u128 value is passed through various other stack frames, and perhaps reconstructed into a Duration on a different machine.

In both cases, it seems like a good idea to not tempt people into thinking "Eh, u64 is good enough, what could possibly go wrong!". That's why I want to add a note that points out the similarly-easy and *safe* way to reconstruct a Duration.

[1] https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.as_nanos
[2] https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_nanos
[3] https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=fa6bab2b6b72f20c14b5243610ea1dde
[4] https://github.com/rust-lang/rust/issues/103332
[5] https://github.com/rust-lang/rust/issues/51107#issuecomment-392353166
2024-02-11 08:25:41 +01:00
Matthias Krüger
1843dfd0d5
Rollup merge of #118307 - scottmcm:tuple-eq-simpler, r=joshtriplett
Remove an unneeded helper from the tuple library code

Thanks to https://github.com/rust-lang/rust/pull/107022, this is just what `==` does, so we don't need the helper here anymore.
2024-02-11 08:25:41 +01:00
Matthias Krüger
f4e6818bff
Rollup merge of #117740 - majaha:format_docs, r=joshtriplett
Add some links and minor explanatory comments to `std::fmt`

I thought the documentation for the `#` flag could do with a link to the explanation of the `?xXbo` flags, because at that point they haven't been explained yet and it's a bit confusing.

I also added that the `0` flag overrides the fill character and alignment flag, here's a [Rust Playgrond](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0d580b7b78b8a2d8c08a2fc7a936ef17) that shows what I mean.
2024-02-11 08:25:41 +01:00
Laurențiu Nicola
022af82827 Merge commit 'ddf105b646c6749a2de2451c9a499a354eec79c2' into sync-from-ra 2024-02-11 08:40:19 +02:00
Kevin Reid
a6c91f0ae3 Remove the link. 2024-02-10 22:17:11 -08:00
Kevin Reid
cef46f9e3d URL-encode chars in fragment. 2024-02-10 22:17:11 -08:00
Kevin Reid
ccd6513c67 Additional doc links and explanation of Wake.
This is intended to clarify:

* That `Wake` exists and can be used instead of `RawWaker`.
* How to construct a `Waker` when you are looking at `Wake`
  (which was previously only documented in the example).
2024-02-10 22:17:11 -08:00
Eric Huss
4ce1f1cffc Require that SELECT_XCODE is set.
Allowing the Xcode version to "float" based on whatever default GitHub
selects creates an unreliable environment. When GitHub changes the
default, we can have multiple jobs in the same run using different
versions as it rolls out across machines. It can also cause oscillation
between runs as different machines are used. It also causes
unpredictable timing when the updates happen.

This change helps ensure that the version that is used is pinned. The
downside is that it requires manually bumping the version, and the risk
that if we take too long, older Xcodes will be removed and that will
break the build.
2024-02-10 21:02:16 -08:00
Eric Huss
4fd3cf96a1 Downgrade Xcode from the default (15.0) to 14.3.1.
This seems to fix two sporadic errors that have been appearing in CI.
One is an issue with cmake being unable to verify that cmake is able to
build a simple test program. The other is a `invalid r_symbolnum`
linking error when trying to build one of cranelift's tests.

This is intended as a temporary fix until we can figure out how to
resolve those issues.
2024-02-10 20:59:20 -08:00
bors
9aa232ecc7 Auto merge of #120405 - cjgillot:gvn-pointer, r=oli-obk
Fold pointer operations in GVN

This PR proposes 2 combinations of cast operations in MIR GVN:
- a chain of `PtrToPtr` or `MutToConstPointer` casts can be folded together into a single `PtrToPtr` cast;
- we attempt to evaluate more ptr ops when there is no provenance.

In particular, this allows to read from static slices.

This is not yet sufficient to see through slice operations that use `PtrComponents` (because that's a union), but still a step forward.

r? `@ghost`
2024-02-11 04:24:40 +00:00
bors
0cbef48150 Auto merge of #120232 - c272:json-buildstd, r=Mark-Simulacrum
Add support for custom JSON targets when using build-std.

Currently, when building with `build-std`, some library build scripts check properties of the target by inspecting the target triple at `env::TARGET`, which is simply set to the filename of the JSON file when using JSON target files.

This patch alters these build scripts to use `env::CARGO_CFG_*` to fetch target information instead, allowing JSON target files describing platforms without `restricted_std` to build correctly when using `-Z build-std`. There are some weak assertions here (for example, `nintendo && newlib`), however this seems at least a marginal improvement on the existing solution.

Fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/60.
2024-02-11 02:10:17 +00:00
Josh Triplett
3ad94dbe06 Remove myself from some review rotations 2024-02-10 17:56:47 -08:00
Matthias Krüger
870435b50b
Rollup merge of #120896 - compiler-errors:coro-closure-kind, r=oli-obk
Print kind of coroutine closure

Make sure that we print "async closure" when we have an async closure, rather than calling it generically a ["coroutine-closure"](https://github.com/rust-lang/rust/pull/120361).

Fixes #120886

r? oli-obk
2024-02-11 01:37:57 +01:00