Commit Graph

245882 Commits

Author SHA1 Message Date
Matthias Krüger
8305686126
Rollup merge of #120936 - ripytide:master, r=Amanieu
improve `btree_cursors` functions documentation

As suggested by ``@Amanieu`` (and others) in #107540 (https://github.com/rust-lang/rust/issues/107540#issuecomment-1937760547)

Improvements:
- Document exact behavior of `{upper/lower}_bound{,_mut}` with each of the three `Bound` types using unambigous words `{greatest,greater,smallest,smaller,before,after}`.
- Added another doc-example for the `Bound::Unbounded` for each of the methods
- Changed doc-example to use From<[T; N]> rather than lots of `insert()`s which requires a mutable map which clutters the example when `mut` may not be required for the method (such as for `{upper,lower}_bound`.
- Removed `# Panics` section from `insert_{before,after}` methods since they were changed to return an error instead a while ago.
- Reworded some phrases to be more consistent with the more regular `BTreeMap` methods such as calling entries "key-value" rather than "element"s.
2024-02-12 18:04:10 +01:00
Matthias Krüger
3f67169a5f
Rollup merge of #120933 - RalfJung:const-check-misc, r=oli-obk
check_consts: fix duplicate errors, make importance consistent

This is stuff I noticed while working on https://github.com/rust-lang/rust/pull/120932, but it's orthogonal to that PR.

r? ``@oli-obk``
2024-02-12 18:04:09 +01:00
Matthias Krüger
02c1e3ed07
Rollup merge of #120928 - c410-f3r:tests-tests-tests, r=davidtwco
Add test for recently fixed issue

Adds a test for issue #116864.
2024-02-12 18:04:09 +01:00
Matthias Krüger
ebe36ac815
Rollup merge of #120917 - chenyukang:yukang-dead-parameters, r=compiler-errors
Remove a bunch of dead parameters in functions

Found this kind of issue when working on https://github.com/rust-lang/rust/pull/119650
I wrote a trivial toy lint and manual review to find these.
2024-02-12 18:04:08 +01:00
Matthias Krüger
733f93d60c
Rollup merge of #120899 - compiler-errors:non-wf-alias, r=lcnr
Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`

See explanation in test. I think it's fine to delay a bug here -- I don't believe we ever construct a non-wf alias on the good path? If so, then we can just remove the delay.

Fixes #120891

r? lcnr
2024-02-12 18:04:08 +01:00
Matthias Krüger
f08ece38a8
Rollup merge of #120833 - nnethercote:more-internal-emit_diagnostics-cleanups, r=oli-obk
More internal emit diagnostics cleanups

Miscellaneous improvements.

r? ``@oli-obk``
2024-02-12 18:04:07 +01:00
Matthias Krüger
57a2e91ae8
Rollup merge of #120765 - nnethercote:reorder-diag-API, r=compiler-errors
Reorder diagnostics API

The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.

r? ``@compiler-errors``
2024-02-12 18:04:07 +01:00
bors
ed19532868 Auto merge of #120960 - RalfJung:static-promoted-cycle, r=oli-obk
fix cycle error when a static and a promoted are mutually recursive

This also now allows promoteds everywhere to point to 'extern static', because why not? We still check that constants cannot transitively reach 'extern static' through references. (We allow it through raw pointers.)

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/120949
2024-02-12 12:09:20 +00:00
bors
b17491c8f6 Auto merge of #110211 - joboet:queue_lock, r=Amanieu
Replace pthread `RwLock` with custom implementation

This is one of the last items in #93740. I'm doing `RwLock` first because it is more self-contained and has less tradeoffs to make. The motivation is explained in the documentation, but in short: the pthread rwlock is slow and buggy and `std` can do much better. I considered implementing a parking lot, as was discussed in the tracking issue, but settled for the queue-based version because writing self-balancing binary trees is not fun in Rust...

This is a rather complex change, so I have added quite a bit of documentation to help explain it. Please point out any part that could be explained better.

~~The read performance is really good, I'm getting 4x the throughput of the pthread version and about the same performance as usync/parking_lot on an Apple M1 Max in the usync benchmark suite, but the write performance still falls way behind what usync and parking_lot achieve. I tried using a separate queue lock like what usync uses, but that didn't help. I'll try to investigate further in the future, but I wanted to get some eyes on this first.~~ [Resolved](https://github.com/rust-lang/rust/pull/110211#issuecomment-1513682336)

r? `@m-ou-se`
CC `@kprotty`
2024-02-12 09:45:22 +00:00
Ralf Jung
5fa69deb00 fix cycle error when a static and a promoted are mutually recursive
This also now allows promoteds everywhere to point to 'extern static', because why not?
We still check that constants cannot transitively reach 'extern static' through references.
(We allow it through raw pointers.)
2024-02-12 09:48:14 +01:00
Nicholas Nethercote
1f39c8b08f Change level used in print_error_count.
From `Fatal` to `Error`. It has no functional effect, but `Error` makes
more sense and lines up better with the `Warning` level used just above.
2024-02-12 18:39:20 +11:00
Nicholas Nethercote
d4b77f64e4 Tweak delayed bug mentions.
Now that we have both `delayed_bug` and `span_delayed_bug`, it makes
sense to use the generic term "delayed bug" more.
2024-02-12 18:39:20 +11:00
Nicholas Nethercote
e0a0cc2971 Remove dcx arg from ReportErrorExt::add_args.
Because it also has a `DiagnosticBuilder` arg, which contains a `dcx`
reference.

Also rename some `builder` variables as `diag`, because that's the usual
name.
2024-02-12 18:39:18 +11:00
Nicholas Nethercote
30774b0061 Remove final unwanted unchecked_error_guaranteed calls.
Now that error counts can't go up and down due to stashing/stealing, we
have a nice property:

  (err_count > 0) iff (an ErrorGuaranteed has been produced)

So we can now record `ErrorGuaranteed`s within `DiagCtxt` and use that
in methods like `has_error`, instead of checking that the count is
greater than 0 and calling `unchecked_error_guaranteed` to create the
`ErrorGuaranteed`.

In fact, we can record a `Vec<ErrorGuaranteed>` and use its length to
count the number, instead of maintaining a separate count.
2024-02-12 18:29:19 +11:00
bors
aebf4511e9 Auto merge of #120835 - oli-obk:no_hir_coherence, r=cjgillot
Avoid accessing the HIR in the happy path of `coherent_trait`

Unfortunately the hir is still used in unsafety checks, and we do not have a way to avoid that. An impl's unsafety is not part of any query other than hir.

So this PR does not affect perf, but could still be considered a cleanup
2024-02-12 07:28:13 +00:00
bors
de4d615e6b Auto merge of #120834 - oli-obk:only_local_coherence, r=lcnr
A trait's local impls are trivially coherent if there are no impls.

This avoids creating a dependency edge on the hir or the specialization graph

This may resolve part of the performance issue of https://github.com/rust-lang/rust/pull/120558
2024-02-12 05:05:57 +00:00
yukang
2bcbc16caf remove a bunch of dead parameters in fn 2024-02-12 09:51:35 +08:00
bors
084ce5bdb5 Auto merge of #120951 - matthiaskrgr:rollup-0nnm7dv, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #110483 (Create try_new function for ThinBox)
 - #120740 (Make cmath.rs a single file)
 - #120872 (hir: Refactor getters for HIR parents)
 - #120880 (add note on comparing vtables / function pointers)
 - #120885 (interpret/visitor: ensure we only see normalized types)
 - #120888 (assert_unsafe_precondition cleanup)
 - #120897 (Encode `coroutine_for_closure` for foreign crates)
 - #120937 ([docs] Update armv6k-nintendo-3ds platform docs for outdated info)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-12 00:34:22 +00:00
Matthias Krüger
9bd630af97
Rollup merge of #120937 - ian-h-chamberlain:docs/update-3ds-links-and-info, r=JohnTitor
[docs] Update armv6k-nintendo-3ds platform docs for outdated info

Mostly just fixing links and references to renamed crates, but also updating a bit of outdated info as well.

CC `@Meziu` `@AzureMarker`
2024-02-11 23:19:11 +01:00
Matthias Krüger
aeafbbeded
Rollup merge of #120897 - compiler-errors:foreign-async-closure, r=oli-obk
Encode `coroutine_for_closure` for foreign crates

Async closures (and "coroutine closures" in general) need to have their child coroutine encoded. This PR does that.

r? oli-obk
2024-02-11 23:19:10 +01:00
Matthias Krüger
d71154f80f
Rollup merge of #120888 - saethlin:unsafe-precondition-cleanup, r=RalfJung
assert_unsafe_precondition cleanup

I moved the polymorphic `is_nonoverlapping` into the `Cell` function that uses it and renamed `intrinsics::is_nonoverlapping_mono` to just `intrinsics::is_nonoverlapping`.

We now also have some docs for `intrinsics::debug_assertions`.

r? RalfJung
2024-02-11 23:19:10 +01:00
Matthias Krüger
90b4e4116f
Rollup merge of #120885 - RalfJung:normal-visitor, r=compiler-errors
interpret/visitor: ensure we only see normalized types

[Prior discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Normalization.20after.20field.20projection)
r? `@compiler-errors`
2024-02-11 23:19:09 +01:00
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
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
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
Caio
1fa75af173 Add test 2024-02-11 08:02:32 -03: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