Commit Graph

240303 Commits

Author SHA1 Message Date
Guillaume Gomez
13b2156c68 Update rustdoc headings tests 2023-12-05 15:59:40 +01:00
Guillaume Gomez
d1dd589a1d Allow links in doc blocks headings 2023-12-05 15:59:40 +01:00
Guillaume Gomez
8bc123e321 Rework doc blocks headings by not turning them into links anymore and putting an anchor to their left side 2023-12-05 15:59:39 +01:00
bors
cf8d81213c Auto merge of #118490 - Nadrieril:arena-alloc-matrix, r=nnethercote
Exhaustiveness: allocate memory better

Exhaustiveness is a recursive algorithm that allocates a bunch of slices at every step. Let's see if I can improve performance by improving allocations.

Already just using `Vec::with_capacity` is showing impressive improvements on my local measurements.

r? `@ghost`
2023-12-04 07:06:36 +00:00
bors
85a4bd8f58 Auto merge of #116915 - bend-n:unwet, r=saethlin
Add an assume that the index is inbounds to slice::get_unchecked

Fixes #116878
2023-12-04 03:09:45 +00:00
Nadrieril
c1774a137d Document reentrancy in *Arena::alloc_from_iter 2023-12-04 02:24:10 +01:00
bendn
73afc00cf9
use assume(idx < self.len()) in [T]::get_unchecked 2023-12-04 06:00:12 +07:00
bors
c9808f8702 Auto merge of #117840 - RalfJung:miri-promise-align, r=cjgillot
miri: support 'promising' alignment for symbolic alignment check

Then use that ability in `slice::align_to`, so that even with `-Zmiri-symbolic-alignment-check`, it no longer has to return spuriously empty "middle" parts.

Fixes https://github.com/rust-lang/miri/issues/3068
2023-12-03 22:53:44 +00:00
bors
9fad685992 Auto merge of #118579 - matthiaskrgr:rollup-22kn8sa, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #117869 ([rustdoc] Add highlighting for comments in items declaration)
 - #118525 (coverage: Skip spans that can't be un-expanded back to the function body)
 - #118574 (rustc_session: Address all `rustc::potential_query_instability` lints)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-03 20:54:56 +00:00
Ralf Jung
2a3fcc0a57 move calling miri_promise_symbolic_alignment to a shared helper 2023-12-03 21:51:14 +01:00
Ralf Jung
bebba4f6e0 miri: support 'promising' alignment for symbolic alignment check 2023-12-03 21:51:14 +01:00
Matthias Krüger
caeaf31316
Rollup merge of #118574 - Enselic:query-instability, r=cjgillot
rustc_session: Address all `rustc::potential_query_instability` lints

Instead of allowing `rustc::potential_query_instability` on the whole crate we go over each lint and allow it individually if it is safe to do. Turns out all instances were safe to allow in this crate.

Part of #84447 which is **E-help-wanted**.
2023-12-03 21:28:32 +01:00
Matthias Krüger
80c94e81d9
Rollup merge of #118525 - Zalathar:skip-spans, r=cjgillot
coverage: Skip spans that can't be un-expanded back to the function body

When we extract coverage spans from MIR, we try to "un-expand" them back to spans that are inside the function's body span.

In cases where that doesn't succeed, the current code just swaps in the entire body span instead. But that tends to result in coverage spans that are completely unrelated to the control flow of the affected code, so it's better to just discard those spans.

---

Extracted from #118305, since this is a general improvement that isn't specific to branch coverage.

---

`@rustbot` label +A-code-coverage
2023-12-03 21:28:32 +01:00
Matthias Krüger
591b84583c
Rollup merge of #117869 - GuillaumeGomez:comment-highlighting-item-decl, r=notriddle
[rustdoc] Add highlighting for comments in items declaration

Fixes #117555.

So after the discussion in https://github.com/rust-lang/rust/pull/117643, the outcome was that having the comments in the item declaration at the same level (in term of color) as the rest of the code was actually a bit distracting and could be improved.

The current highlighting color for comments is "lighter" than the rest and I think it fits perfectly to improve the current situation. With this, we now have different "levels" which makes it easier to read and filter out what we want when reading the items declaration.

Here's a screenshot:

![image](https://github.com/rust-lang/rust/assets/3050060/dbd98029-e98b-4997-9a89-6b823eaac9a4)

r? `@notriddle`
2023-12-03 21:28:32 +01:00
bors
d12dc74a2c Auto merge of #118072 - estebank:issue-98982, r=cjgillot
Provide structured suggestion for type mismatch in loop

We currently provide only a `help` message, this PR introduces the last two structured suggestions instead:

```
error[E0308]: mismatched types
  --> $DIR/issue-98982.rs:2:5
   |
LL |   fn foo() -> i32 {
   |               --- expected `i32` because of return type
LL | /     for i in 0..0 {
LL | |         return i;
LL | |     }
   | |_____^ expected `i32`, found `()`
   |
note: the function expects a value to always be returned, but loops might run zero times
  --> $DIR/issue-98982.rs:2:5
   |
LL |     for i in 0..0 {
   |     ^^^^^^^^^^^^^ this might have zero elements to iterate on
LL |         return i;
   |         -------- if the loop doesn't execute, this value would never get returned
help: return a value for the case when the loop has zero elements to iterate on
   |
LL ~     }
LL ~     /* `i32` value */
   |
help: otherwise consider changing the return type to account for that possibility
   |
LL ~ fn foo() -> Option<i32> {
LL |     for i in 0..0 {
LL ~         return Some(i);
LL ~     }
LL ~     None
   |
```

Fix #98982.
2023-12-03 18:57:49 +00:00
bors
db07cccb1e Auto merge of #113730 - belovdv:jobserver-init-check, r=petrochenkov
Report errors in jobserver inherited through environment variables

This pr attempts to catch situations, when jobserver exists, but is not being inherited.

r? `@petrochenkov`
2023-12-03 16:28:22 +00:00
bors
21d88b32cb Auto merge of #118526 - sjwang05:issue-118510, r=petrochenkov
Fix ICE: `fn_arg_names: unexpected item DefId(..)`

Fixes #118510
2023-12-03 14:26:39 +00:00
Martin Nordholts
d87460a507 rustc_session: Address all rustc::potential_query_instability lints
Instead of allowing `rustc::potential_query_instability` on the whole
crate we go over each lint and allow it individually if it is safe to
do. Turns out all instances were safe to allow in this crate.
2023-12-03 15:05:39 +01:00
bors
8b6a4a93ed Auto merge of #118567 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2023-12-03 11:59:32 +00:00
bors
28f9fe3262 Auto merge of #3204 - RalfJung:simd, r=RalfJung
add new SIMD intrinsics
2023-12-03 11:11:20 +00:00
Ralf Jung
2903f1c322 add simd_bswap and simd_bitreverse 2023-12-03 12:08:02 +01:00
Ralf Jung
31ea5181b6 add simd_cttz and simd_ctlz 2023-12-03 12:07:51 +01:00
Ralf Jung
11db9de728 simd_select_bitmask: support passing the mask as an array 2023-12-03 11:28:40 +01:00
bors
2a316c410d Auto merge of #3203 - RalfJung:trophy, r=RalfJung
new trophy case entry

Cc https://github.com/rust-lang/rust/pull/118460
2023-12-03 09:49:42 +00:00
Ralf Jung
323ca94d92 new trophy case entry 2023-12-03 10:47:59 +01:00
bors
7ceaf19868 Auto merge of #118546 - RalfJung:hashbrown, r=Amanieu
update hashbrown

I had to also pull in an updated syn to make that work, and then cargo pulled in some more package updates.

r? `@Amanieu`
2023-12-03 09:03:14 +00:00
bors
71940e0a8a Auto merge of #118487 - RalfJung:exposed-provenance, r=thomcc
move exposed-provenance APIs into separate feature gate

We have already stated explicitly for all the 'exposed' functions that

> Using this method means that code is *not* following strict provenance rules.

However, they were part of the same feature gate and still described as part of the strict provenance experiment. Unfortunately, their semantics are much less clear and certainly nowhere near stabilization, so in preparation for an attempt to stabilize the strict provenance APIs, I suggest we split the things related to "exposed" into their own feature gate. I also used this opportunity to better explain how Exposed Provenance fits into the larger plan here: this is *one possible candidate* for `as` semantics, but we don't know if it is actually viable, so we can't really promise that it is equivalent to `as`. If it works out we probably want to make `as` equivalent to the 'exposed' APIs; if it doesn't, we will remove them again and try to find some other semantics for `as`.
2023-12-03 07:04:12 +00:00
bors
6318e9dd89 Auto merge of #3202 - rust-lang:rustup-2023-12-03, r=saethlin
Automatic Rustup
2023-12-03 05:23:24 +00:00
The Miri Conjob Bot
3a6753b8b9 Merge from rustc 2023-12-03 05:11:24 +00:00
The Miri Conjob Bot
48176d4447 Preparing for merge from rustc 2023-12-03 05:04:26 +00:00
bors
2f1ba4a0af Auto merge of #118128 - RalfJung:bad-intrinsics, r=the8472
warn against using intrinsics that leave the scope of our memory model
2023-12-03 05:03:12 +00:00
bors
225e36cff9 Auto merge of #118542 - chenyukang:yukang-fix-parser-ice-118531, r=cjgillot
Fix parser ICE from attrs

Fixes #118531,
Fixes #118530.
2023-12-03 03:05:17 +00:00
Zalathar
eb2d4cb541 coverage: Skip spans that can't be un-expanded back to the function body
When we extract coverage spans from MIR, we try to "un-expand" them back to
spans that are inside the function's body span.

In cases where that doesn't succeed, the current code just swaps in the entire
body span instead. But that tends to result in coverage spans that are
completely unrelated to the control flow of the affected code, so it's better
to just discard those spans.
2023-12-03 12:35:33 +11:00
bors
1ca8b71cff Auto merge of #118541 - weihanglo:update-cargo, r=weihanglo
Update cargo

27 commits in 26333c732095d207aa05932ce863d850fb309386..623b788496b3e51dc2f9282373cf0f6971a229b5
2023-11-28 20:07:39 +0000 to 2023-12-02 18:10:03 +0000
- docs(book): make old title anchorable (rust-lang/cargo#13102)
- Revert "chore(deps): update rust crate openssl to 0.10.60 [security]" (rust-lang/cargo#13101)
- test(install): use TCP connection instead of thread sleep (rust-lang/cargo#13099)
- test(mdman): Switch to snapbox (rust-lang/cargo#13098)
- Include declared list of features in fingerprint for `-Zcheck-cfg` (rust-lang/cargo#13012)
- chore(deps): update compatible (rust-lang/cargo#13083)
- chore(ci): Always update gix packages together (rust-lang/cargo#13093)
- chore(deps): update rust crate windows-sys to 0.52 (rust-lang/cargo#13089)
- refactor(toml): Decouple logic from schema (rust-lang/cargo#13080)
- Have cargo add --optional &lt;dep&gt; create a &lt;dep&gt; = "dep:&lt;dep&gt; feature (rust-lang/cargo#13071)
- Add `--public` for `cargo add` (rust-lang/cargo#13046)
- chore(deps): update rust crate toml_edit to 0.21.0 (rust-lang/cargo#13088)
- chore(deps): update rust crate rusqlite to 0.30.0 (rust-lang/cargo#13087)
- test(trim-paths): exercise with real world debugger (rust-lang/cargo#13091)
- Fixed uninstall a running binary failed on Windows (rust-lang/cargo#13053)
- chore(deps): update rust crate itertools to 0.12.0 (rust-lang/cargo#13086)
- Add more options to registry test support. (rust-lang/cargo#13085)
- Don't filter on workspace members when scraping doc examples (rust-lang/cargo#13077)
- Remove the outdated comment (rust-lang/cargo#13076)
- fix(resolver): Remove unused public-deps error handling (rust-lang/cargo#13036)
- Fixes error count display is different when there's only one error left (rust-lang/cargo#12484)
- fix: reorder `--remap-path-prefix` flags for `-Zbuild-std` (rust-lang/cargo#13065)
- remove jobserver env var in some tests (rust-lang/cargo#13072)
- doc: clarify different target has different set of `CARGO_CFG_*` values (rust-lang/cargo#13069)
- docs: remove review capacity notice in PR template (rust-lang/cargo#13070)
- chore(deps): update rust crate openssl to 0.10.60 [security] (rust-lang/cargo#13068)
- fix(resolver): De-prioritize no-rust-version in MSRV resolver (rust-lang/cargo#13066)
2023-12-02 23:59:15 +00:00
Weihang Lo
c1f6925a49
Update cargo 2023-12-02 18:29:33 -05:00
sjwang05
a2171feb33
Fix ICE when suggesting closures for non-fn-like defs 2023-12-02 15:03:24 -08:00
bors
90e321d82a Auto merge of #118347 - Mark-Simulacrum:asm-code-size, r=spastorino
Avoid per-register closure expansions

Best reviewed with whitespace ignored.

This hopefully reduces overall size of the binary. Probably zero impact in instructions/cycles in rustc-perf since we don't really have any asm benchmarks AFAIK...
2023-12-02 22:00:48 +00:00
Mark Rousskov
5980a17c52 Avoid per-register closure expansions 2023-12-02 15:31:18 -05:00
bors
d5fab33766 Auto merge of #118484 - blyxxyz:os-str-slice, r=BurntSushi
Add substring API for `OsStr`

This adds a method for taking a substring of an `OsStr`, which in combination with [`OsStr::as_encoded_bytes()`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.as_encoded_bytes) makes it possible to implement most string operations in safe code.

API:
```rust
impl OsStr {
    pub fn slice_encoded_bytes<R: ops::RangeBounds<usize>>(&self, range: R) -> &Self;
}
```
Motivation, examples and research at https://github.com/rust-lang/libs-team/issues/306.

Tracking issue: #118485

cc `@epage`
r? libs-api
2023-12-02 20:02:15 +00:00
Ralf Jung
c0c0b5b5a6 allow zerocopy license 2023-12-02 19:38:50 +01:00
Ralf Jung
71c9ceb4da update hashbrown 2023-12-02 19:16:09 +01:00
bors
3f1e30a0a5 Auto merge of #118077 - calebzulawski:sync-portable-simd-2023-11-19, r=workingjubilee
Portable SIMD subtree update

Syncs nightly to the latest changes from rust-lang/portable-simd

r? `@rust-lang/libs`
2023-12-02 18:04:01 +00:00
bors
0908f173fd Auto merge of #118543 - matthiaskrgr:rollup-0kl4o90, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #118514 (rustc_hir_typeck: Fix ICE when probing for non-ASCII function alternative)
 - #118524 (Add more information to StableMIR Instance)
 - #118528 (replace `once_cell::sync::OnceCell` with std `OnceLock`)
 - #118539 (move packed-struct tests into packed/ folder)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-02 16:06:01 +00:00
Matthias Krüger
613f4ec97d
Rollup merge of #118539 - RalfJung:packed-struct-tests, r=lqd
move packed-struct tests into packed/ folder

We already have a bunch of other tests named `packed/packed-struct*`, no reason to have these two tests be separate.
2023-12-02 16:58:41 +01:00
Matthias Krüger
99aadedfe6
Rollup merge of #118528 - onur-ozkan:use-std-once-lock, r=clubby789
replace `once_cell::sync::OnceCell` with std `OnceLock`

> 0919ad1838/src/bootstrap/src/core/builder.rs (L28-L33)

Partially resolves that.
2023-12-02 16:58:41 +01:00
Matthias Krüger
b384767b0a
Rollup merge of #118524 - celinval:smir-instance-def, r=ouz-a
Add more information to StableMIR Instance

Allow stable MIR users to retrieve an instance function signature, the index for a VTable instance and more information about its underlying definition.

These are needed to properly interpret function calls, either via VTable or direct calls. The `CrateDef` implementation will also allow users to emit diagnostic messages.

I also fixed a few issues that we had identified before with how we were retrieving body of things that may not have a body available.
2023-12-02 16:58:40 +01:00
Matthias Krüger
c0f37fa5cf
Rollup merge of #118514 - Enselic:ice-probe, r=cjgillot
rustc_hir_typeck: Fix ICE when probing for non-ASCII function alternative

Closes #118499

Apparently triggered by https://github.com/rust-lang/rust/pull/118381
2023-12-02 16:58:40 +01:00
Caleb Zulawski
bcb1c41628 Remove link to core::arch::x86_64 2023-12-02 10:49:21 -05:00
yukang
5ff428c1ff Fix parser ICE from attrs 2023-12-02 23:47:39 +08:00
Jan Verbeek
729851ef9e Add substring API for OsStr 2023-12-02 15:22:29 +01:00