Commit Graph

167848 Commits

Author SHA1 Message Date
bors 2fcbda6c1a Auto merge of #148466 - liigo:better-rustdoc, r=GuillaumeGomez
rustdoc: quality of life changes

- Support `=` shortcut (alongside `+`) to expand all sections. Already support `s` and `S`, `Shift` or not.
- ~~Fix search-input's placeholder. The input is auto focused, any key press will be accepted as input not shortcut, current placeholder is missleading.~~
2025-11-12 10:58:49 +00:00
bors 95aeb46965 Auto merge of #148424 - Zalathar:tests, r=Kobzol
bootstrap: Add snapshot tests for path-to-step handling

This PR adds a suite of snapshot tests for how bootstrap translates command-line “paths” (which are not necessarily actual paths) into a set of top-level steps to execute.

Unlike the existing suite of snapshot tests (for transitive step logging), I decided to use `.snap` files over inline snapshots, because I find that inline snapshots quickly make test files impossible to navigate. Instead, I set up a macro that makes it relatively easy to add or modify test cases.

Using `.snap` files also means that the tests can be blessed by setting `INSTA_UPDATE=always`, without necessarily needing the `cargo insta` tool installed, though the tool can still be used instead if desired.

These snapshot tests capture _current_ behavior, to prevent unintended changes or regressions. If the current behavior is wrong or undersirable, then any fix will necessarily have to re-bless the affected tests!

r? Kobzol
2025-11-12 06:53:53 +00:00
Liigo Zhuang 9f3d84b226 rustdoc: add = shortcut to expand all sections.
Essentially, `=` is "`+` without shift". Current `+` shortcut requires an extra `shift`, unless you use numpad `+`.
2025-11-12 14:29:10 +08:00
Zalathar 2412e1555c Add several snapshot tests for path-to-step handling 2025-11-12 13:16:52 +11:00
Zalathar 9d4620dde7 Set up snapshot tests for bootstrap's path-to-step handling 2025-11-12 13:15:15 +11:00
Stuart Cook 0675923ef8 Rollup merge of #148834 - Muscraft:fix-doctest-colors, r=fmease
fix(rustdoc): Color doctest errors

`@fmease's` [Deep analysis](https://github.com/rust-lang/rust/issues/148749#issuecomment-3508455278) on the problem
> Yeah, here's a deep analysis by me from a few weeks back of what's going on ([#148101 (comment)](https://github.com/rust-lang/rust/pull/148101#discussion_r2462756875)):
>
> > […]
> > However, since said PR ([#147207](https://github.com/rust-lang/rust/pull/147207): migrating coloring crates), `HumanEmitter::supports_color()` unconditionally(!) returns `false` (in fact, `Emitter::supports_color` is no longer used by anyone else and should be removed), so there's no reason to keep it. Rephrased, since that PR all compiler diagnostics for doctests are uncolored.
> > You could argue that I should keep it and patch `supports_color` in rustc to "work again". However, I'd rather rework our doctest coloring wholesale in a separate PR. At least before that migration PR, our setup was quite busted:
> >
> > 1. First of all, it didn't query+set `supports_color` for syntactically invalid doctests, so syntax errors were always shown without color (contrary to e.g., name resolution errors).
> > 2. Second of all, calling `supports_color()` here was quite frankly wrong: Piping the output of `rustdoc … --test` into a file (or `| cat` or whatever) did **not** suppress colors. I'm not actually sure if we can ever address that nicely (without stripping ANSI codes after the fact) since we pass that diagnostic to `libtest`, right? I might very well be wrong here, maybe it's a non-issue.

<hr>

```rust
/// ```
/// foo
/// ```
fn foo() {}
```
```
rustdoc --test lib.rs
```

Stable:
<img width="377" height="290" alt="stable" src="https://github.com/user-attachments/assets/cd20f947-b58d-42db-8735-797613baa9cc" />

Beta:
<img width="377" height="290" alt="beta" src="https://github.com/user-attachments/assets/f02588fd-41d2-4642-b03a-5554a68671eb" />

Nightly:
<img width="377" height="290" alt="nightly" src="https://github.com/user-attachments/assets/871cb417-f47e-4058-8a76-3bcd538ce141" />

After:
<img width="377" height="290" alt="after" src="https://github.com/user-attachments/assets/5734c01f-3f1c-44bb-9404-628c0c33b440" />

Note: This will need to be backported to `beta`

Fixes: rust-lang/rust#148749
2025-11-12 12:26:43 +11:00
Stuart Cook 9b7cfdfa0c Rollup merge of #148833 - clubby789:cargo-update-rustbook-11-11-25, r=ehuss
Update rustbook dependencies

https://github.com/rust-lang/rust/pull/145849#issuecomment-3394832713
2025-11-12 12:26:42 +11:00
Stuart Cook 39066236df Rollup merge of #148830 - RalfJung:miri, r=RalfJung
miri subtree update

Lands the new avx512 support for zlib-rs, and the epoll fixes for Tokio.

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/667796bf66d8ff81feaed139d00f44878e26532b.

Created using https://github.com/rust-lang/josh-sync.

r? ````@ghost````
2025-11-12 12:26:42 +11:00
Stuart Cook 3b8d30becb Rollup merge of #148531 - tamird:vendor-enum, r=nnethercote
rustc_target: introduce Abi, Env, Os

Improve type safety by using an enum rather than strings.

I'm not really sure this is better since only a few vendors have special semantics. r? ``@nnethercote``
2025-11-12 12:26:39 +11:00
Stuart Cook de8f0c016f Rollup merge of #148500 - Kobzol:git-update-inex, r=jieyouxu
Update git index before running diff-index

Discussed in https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/tidy.3A.20strange.20number.20of.20modified.20files/with/553714742.

This is apparently the cause of `x test tidy` printing weird number of formatted files, and also of sometimes quirky behavior of finding the files modified from a base commit.
2025-11-12 12:26:39 +11:00
Stuart Cook 87ba9a5251 Rollup merge of #148080 - GuillaumeGomez:fix-jump-def-links, r=lolbinarycat
[rustdoc] Fix invalid jump to def macro link generation

Follow-up of https://github.com/rust-lang/rust/issues/147820.

I realized that when there was no intra-doc link linking to the same item, then the generated link for macros in jump to def would be invalid.

To make the code less redundant, I merged the "registering" of items and the href generation use the same code for macros.

r? `````@notriddle`````
2025-11-12 12:26:37 +11:00
Stuart Cook 203130b258 Rollup merge of #147832 - aDotInTheVoid:rustdoc-format-options, r=GuillaumeGomez
rustdoc: Don't pass `RenderOptions` to `DocContext`

`RenderOptions` is full of HTML specific fields. The only ones that `DocContext` needs are `document_private` and `document_hidden`, which are accessable via `Cache` anyway.

Part of a larger campeign against `RenderOption`:
https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Using.20.60RenderOptions.60.20in.20less.20places.2E/with/545705812
2025-11-12 12:26:36 +11:00
Scott Schafer c523b65245 fix(rustdoc): Color doctest errors 2025-11-11 17:23:35 -07:00
Tamir Duberstein fcf6809b05 rustc_target: introduce Os
Improve type safety by using an enum rather than strings.
2025-11-11 18:55:40 -05:00
Tamir Duberstein ddd7596400 rustc_target: introduce Env
Improve type safety by using an enum rather than strings.
2025-11-11 18:34:47 -05:00
Alona Enraght-Moony b808f330ed rustdoc: Don't pass RenderOptions to DocContext
`RenderOptions` is full of HTML specific fields. The only ones that
`DocContext` needs are `document_private` and `document_hidden`, which
are accessable via `Cache` anyway.

Part of a larger campeign against `RenderOptions`:
https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Using.20.60RenderOptions.60.20in.20less.20places.2E/with/545705812
2025-11-11 22:00:28 +00:00
Tamir Duberstein a1122a1088 rustc_target: rename Arch::{Uknown,Other}
Prepare for additional enums like Vendor and Os which have true
`Unknown` variants. We want to use the same name for the escape hatch
for all of these, thus rename this one.
2025-11-11 16:47:24 -05:00
Jamie Hill-Daniel 54ee4925df Update rustbook dependencies
Locking 113 packages to latest compatible versions
    Updating aho-corasick v1.1.3 -> v1.1.4
    Updating ammonia v4.1.1 -> v4.1.2
    Removing android-tzdata v0.1.1
    Updating anstream v0.6.20 -> v0.6.21
    Updating anstyle v1.0.11 -> v1.0.13
    Updating anyhow v1.0.99 -> v1.0.100
    Removing bitflags v1.3.2
    Removing bitflags v2.9.2
      Adding bitflags v2.10.0
    Updating bstr v1.12.0 -> v1.12.1
    Updating cc v1.2.33 -> v1.2.45
    Updating cfg-if v1.0.1 -> v1.0.4
    Updating chrono v0.4.41 -> v0.4.42
    Updating clap v4.5.45 -> v4.5.51
    Updating clap_builder v4.5.44 -> v4.5.51
    Updating clap_complete v4.5.57 -> v4.5.60
    Updating clap_derive v4.5.45 -> v4.5.49
    Updating clap_lex v0.7.5 -> v0.7.6
    Updating doc-comment v0.3.3 -> v0.3.4
    Updating env_filter v0.1.3 -> v0.1.4
    Updating errno v0.3.13 -> v0.3.14
      Adding find-msvc-tools v0.1.4
    Updating flate2 v1.1.2 -> v1.1.5
    Updating form_urlencoded v1.2.1 -> v1.2.2
    Updating generic-array v0.14.7 -> v0.14.9
    Updating getopts v0.2.23 -> v0.2.24
    Updating getrandom v0.3.3 -> v0.3.4
    Updating hashbrown v0.15.5 -> v0.16.0
    Updating iana-time-zone v0.1.63 -> v0.1.64
    Updating icu_collections v2.0.0 -> v2.1.1
    Updating icu_locale_core v2.0.0 -> v2.1.1
    Updating icu_normalizer v2.0.0 -> v2.1.1
    Updating icu_normalizer_data v2.0.0 -> v2.1.1
    Updating icu_properties v2.0.1 -> v2.1.1
    Updating icu_properties_data v2.0.1 -> v2.1.1
    Updating icu_provider v2.0.0 -> v2.1.1
    Updating idna v1.0.3 -> v1.1.0
    Updating indexmap v2.10.0 -> v2.12.0
    Updating is_terminal_polyfill v1.70.1 -> v1.70.2
    Updating jiff v0.2.15 -> v0.2.16
    Updating jiff-static v0.2.15 -> v0.2.16
    Updating js-sys v0.3.77 -> v0.3.82
    Updating litemap v0.8.0 -> v0.8.1
    Updating lock_api v0.4.13 -> v0.4.14
    Updating log v0.4.27 -> v0.4.28
    Updating normpath v1.3.0 -> v1.5.0
    Updating once_cell_polyfill v1.70.1 -> v1.70.2
    Updating opener v0.8.2 -> v0.8.3
    Updating parking_lot v0.12.4 -> v0.12.5
    Updating parking_lot_core v0.9.11 -> v0.9.12
    Updating percent-encoding v2.3.1 -> v2.3.2
    Updating pest v2.8.1 -> v2.8.3
    Updating pest_derive v2.8.1 -> v2.8.3
    Updating pest_generator v2.8.1 -> v2.8.3
    Updating pest_meta v2.8.1 -> v2.8.3
      Adding phf v0.13.1
    Updating phf_codegen v0.11.3 -> v0.13.1
      Adding phf_generator v0.13.1
      Adding phf_shared v0.13.1
    Updating potential_utf v0.1.2 -> v0.1.4
    Updating proc-macro2 v1.0.101 -> v1.0.103
    Updating quote v1.0.40 -> v1.0.42
    Updating redox_syscall v0.5.17 -> v0.5.18
    Updating regex v1.11.1 -> v1.12.2
    Updating regex-automata v0.4.9 -> v0.4.13
    Updating regex-syntax v0.8.5 -> v0.8.8
    Updating semver v1.0.26 -> v1.0.27
    Updating serde v1.0.219 -> v1.0.228
      Adding serde_core v1.0.228
    Updating serde_derive v1.0.219 -> v1.0.228
    Updating serde_json v1.0.142 -> v1.0.145
      Adding simd-adler32 v0.3.7
    Updating stable_deref_trait v1.2.0 -> v1.2.1
    Updating string_cache v0.8.9 -> v0.9.0
    Updating string_cache_codegen v0.5.4 -> v0.6.1
    Updating syn v2.0.106 -> v2.0.110
    Updating syntect v5.2.0 -> v5.3.0
    Updating tempfile v3.20.0 -> v3.23.0
    Updating thiserror v2.0.15 -> v2.0.17
    Updating thiserror-impl v2.0.15 -> v2.0.17
    Updating tinystr v0.8.1 -> v0.8.2
    Updating typenum v1.18.0 -> v1.19.0
    Updating unicode-ident v1.0.18 -> v1.0.22
    Updating unicode-width v0.2.1 -> v0.2.2
    Updating url v2.5.4 -> v2.5.7
    Removing wasi v0.14.2+wasi-0.2.4
      Adding wasip2 v1.0.1+wasi-0.2.4
    Updating wasm-bindgen v0.2.100 -> v0.2.105
    Removing wasm-bindgen-backend v0.2.100
    Updating wasm-bindgen-macro v0.2.100 -> v0.2.105
    Updating wasm-bindgen-macro-support v0.2.100 -> v0.2.105
    Updating wasm-bindgen-shared v0.2.100 -> v0.2.105
    Updating web_atoms v0.1.3 -> v0.1.4
    Updating winapi-util v0.1.9 -> v0.1.11
    Updating windows-core v0.61.2 -> v0.62.2
    Updating windows-implement v0.60.0 -> v0.60.2
    Updating windows-interface v0.59.1 -> v0.59.3
    Updating windows-link v0.1.3 -> v0.2.1
    Updating windows-result v0.3.4 -> v0.4.1
    Updating windows-strings v0.4.2 -> v0.5.1
    Updating windows-sys v0.59.0 -> v0.61.2
    Removing windows-targets v0.52.6
    Removing windows-targets v0.53.3
      Adding windows-targets v0.53.5
    Removing windows_aarch64_gnullvm v0.52.6
    Removing windows_aarch64_gnullvm v0.53.0
      Adding windows_aarch64_gnullvm v0.53.1
    Removing windows_aarch64_msvc v0.52.6
    Removing windows_aarch64_msvc v0.53.0
      Adding windows_aarch64_msvc v0.53.1
    Removing windows_i686_gnu v0.52.6
    Removing windows_i686_gnu v0.53.0
      Adding windows_i686_gnu v0.53.1
    Removing windows_i686_gnullvm v0.52.6
    Removing windows_i686_gnullvm v0.53.0
      Adding windows_i686_gnullvm v0.53.1
    Removing windows_i686_msvc v0.52.6
    Removing windows_i686_msvc v0.53.0
      Adding windows_i686_msvc v0.53.1
    Removing windows_x86_64_gnu v0.52.6
    Removing windows_x86_64_gnu v0.53.0
      Adding windows_x86_64_gnu v0.53.1
    Removing windows_x86_64_gnullvm v0.52.6
    Removing windows_x86_64_gnullvm v0.53.0
      Adding windows_x86_64_gnullvm v0.53.1
    Removing windows_x86_64_msvc v0.52.6
    Removing windows_x86_64_msvc v0.53.0
      Adding windows_x86_64_msvc v0.53.1
    Updating winnow v0.7.12 -> v0.7.13
      Adding wit-bindgen v0.46.0
    Removing wit-bindgen-rt v0.39.0
    Updating writeable v0.6.1 -> v0.6.2
    Updating yoke v0.8.0 -> v0.8.1
    Updating yoke-derive v0.8.0 -> v0.8.1
    Updating zerotrie v0.2.2 -> v0.2.3
    Updating zerovec v0.11.4 -> v0.11.5
    Updating zerovec-derive v0.11.1 -> v0.11.2
2025-11-11 19:29:13 +00:00
Mads Marquart 65f0b7aad4 Fix building rustdoc and clippy with jemalloc feature 2025-11-11 20:16:16 +01:00
Mads Marquart dd2159e75d Simplify jemalloc setup
Using the new `override_allocator_on_supported_platforms` feature in
`tikv-jemalloc-sys v0.6.1` we can avoid the manual statics.
2025-11-11 20:16:15 +01:00
Ralf Jung 13b8cf5faf Merge pull request #4678 from folkertdev/ternary-logic
add shim for avx512 ternarylogic functions
2025-11-11 18:12:27 +00:00
Guillaume Gomez 4d3d3b39bd Improve code 2025-11-11 18:45:36 +01:00
Folkert de Vries 050412a5ab add shim for avx512 ternarylogic functions 2025-11-11 18:39:58 +01:00
Guillaume Gomez f4e1ffc55e Add missing documentation 2025-11-11 17:41:17 +01:00
Guillaume Gomez 04f798b83a Fix invalid jump to def macro link generation 2025-11-11 17:41:17 +01:00
bors 2636cb4c13 Auto merge of #148818 - Zalathar:rollup-4vujcg0, r=Zalathar
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#148694 (std: support `RwLock` and thread parking on TEEOS)
 - rust-lang/rust#148712 (Port `cfg_select!` to the new attribute parsing system)
 - rust-lang/rust#148760 (rustc_target: hide TargetOptions::vendor)
 - rust-lang/rust#148771 (IAT: Reinstate early bailout)
 - rust-lang/rust#148775 (Fix a typo in the documentation for the strict_shr function)
 - rust-lang/rust#148779 (Implement DynSend and DynSync for std::panic::Location.)
 - rust-lang/rust#148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - rust-lang/rust#148783 (add test for assoc type norm wf check)
 - rust-lang/rust#148785 (Replace `master` branch references with `main`)
 - rust-lang/rust#148791 (fix "is_closure_like" doc comment)
 - rust-lang/rust#148792 (Prefer to use file.stable_id over file.name from source map)
 - rust-lang/rust#148805 (rustc-dev-guide subtree update)
 - rust-lang/rust#148807 (Document (and test) a problem with `Clone`/`Copy` deriving.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-11 13:30:50 +00:00
Jakub Beránek 69da9af387 Update git index before running diff-index 2025-11-11 11:19:47 +01:00
Stuart Cook b30c0045a9 Rollup merge of #148805 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to https://github.com/rust-lang/rustc-dev-guide/commit/02ba22e3a9b6c26946b0430e9f49e52d4c573381.

Created using https://github.com/rust-lang/josh-sync.

r? `@ghost`
2025-11-11 21:11:56 +11:00
Stuart Cook 3382d31b99 Rollup merge of #148785 - reddevilmidzy:rename-to-main, r=Kobzol
Replace `master` branch references with `main`

Additional work on branch name changes

r? ```@Kobzol```

related pr: https://github.com/rust-lang/rust/pull/148564
2025-11-11 21:11:54 +11:00
Stuart Cook 2171eeeb6a Rollup merge of #148781 - GuillaumeGomez:rm-unneeded-attr, r=yotamofek
[rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`

Originally replaced it with an `expect` and since it failed compilation because it wasn't triggered, I removed it.
2025-11-11 21:11:53 +11:00
Stuart Cook d738f03a27 Rollup merge of #148760 - tamird:avoid-vendor-logic, r=madsmtm
rustc_target: hide TargetOptions::vendor

Discussed in https://github.com/rust-lang/rust/pull/148531#discussion_r2507383167.

r? `````@bjorn3`````
2025-11-11 21:11:49 +11:00
Stuart Cook 3150714f40 Rollup merge of #148694 - joboet:teeos-sync, r=ChrisDenton
std: support `RwLock` and thread parking on TEEOS

Since TEEOS supports pthread mutexes and condvars, it can share the pthread-based thread parking implementation and thus also the queue-based `RwLock` implementation used on other platforms.

CC ``@petrochenkov`` ``@Sword-Destiny``
2025-11-11 21:11:47 +11:00
Stuart Cook e8404e4e7d Rollup merge of #148636 - xSetech:boostrap/set-python-on-macos, r=jieyouxu
bootstrap: respect `build.python` on macOS

The `python()` method was hardcoded to return `/usr/bin/python3` on macOS, ignoring the `build.python` config option. This change respects the config while maintaining the system Python as the default.
2025-11-11 21:09:39 +11:00
Stuart Cook 3227f260f7 Rollup merge of #148530 - Shourya742:2025-11-05-update-bootstrap-documentation, r=Kobzol
update the bootstrap readme

This PR updates the bootstrap readme and makes it consistent with the latest stage 0 redesign.

r? ```@Kobzol```
2025-11-11 21:09:38 +11:00
Stuart Cook 24873aac00 Rollup merge of #147955 - Zalathar:handlers, r=jieyouxu
compiletest: Migrate `TestProps` directive handling to a system of named handlers

One of the very silly things about directive processing in compiletest is that for each directive in the test file, we proceed to check it against dozens of different directive names in linear sequence, without any kind of indexed lookup, and without any early-exit after a known directive name is found (unless a panic occurs).

This PR is a big step away from that, by taking the `iter_directives` loop in `TestProps::load_from` and making all of its directive processing dispatch to a hashtable of individual name-specific handlers instead.

---

The handler system is set up in a way that should allow us to add capabilities or change the implementation as needed, without having to mass-modify the existing handlers (e.g. this is why the `handler` and `multi_handler` functions are used).

---

This PR is focused on mass-migrating all of the `TestProps` directive processing into handlers. Most of the resulting handlers could obviously be simplified further (e.g. by avoiding the redundant name checks that were needed in the pre-migration code), but I've avoided doing any such simplifications in this PR to keep its scope limited and make reviewing easier.

The patches in this PR have been arranged so that the main migration can be inspected with `git diff --color-moved --color-moved-ws=ignore-all-space` to verify that it moves all of the relevant lines intact, without modifying or discarding any of them.

r? jieyouxu
2025-11-11 21:09:36 +11:00
Stuart Cook c7bfd7f599 Rollup merge of #147833 - aDotInTheVoid:rdj-shuffle, r=camelid
rustdoc-json: move `target` to `json::conversions`

It belongs here, because it moves from a `rustc_*` type to a `rustdoc_json_types` type.

r? ```````@GuillaumeGomez```````
2025-11-11 21:09:35 +11:00
Stuart Cook 6487148d80 Rollup merge of #146495 - fmease:rustdoc-erase-doc-priv-items-attr, r=GuillaumeGomez
rustdoc: Erase `#![doc(document_private_items)]`

I just found out about the existence of `#![doc(document_private_items)]`. Apparently it was added by PR rust-lang/rust#50669 back in 2018 without any tests or docs as a replacement for some specific forms of the removed `#![doc(passes)]` / `#![doc(no_default_passes)]`.

However, rustc and rustdoc actually emit the deny-by-default lint `invalid_doc_attributes` for it (but if you allow it, the attribute does function)! To be more precise since PR rust-lang/rust#82708 (1.52, May 2021) which introduced lint `invalid_doc_attributes`, rust{,do}c has emitted a future-incompat warning for this attribute. And since PR rust-lang/rust#111505 (1.78, May 2024) that lint is deny by default. I presume nobody knew this attribute existed and thus it was never allowlisted.

Given the fact that since 2021 nobody has ever opened a ticket ([via](https://github.com/rust-lang/rust/issues?q=is%3Aissue+document_private_items)) complaining about the lint emission and the fact that GitHub code search doesn't yield any actual uses ([via](https://github.com/search?q=%2F%23%21%5C%5Bdoc%5C%28.*%3Fdocument_private_items%2F+language%3ARust&type=code&ref=advsearch)), I'm led to believe that nobody knows about and uses this attribute.

I don't find the existence of this attribute to be justified since in my view the flag `--document-private-items` is strictly superior: In most if not all cases, you don't want to "couple" your crate with this "mode" even if you gate it behind a cfg; instead, you most likely want to set this manually at invocation time, via a build config file like `.cargo/config.toml` or via a command runner like `just` I'd say.

Because of this I propose to wipe this attribute from existence. I don't believe it's worth cratering this (i.e., temporarily emitting a hard error for this attribute and running crater) given the fact that it's been undocumented since forever and led to a warning for years.
2025-11-11 21:09:33 +11:00
Stuart Cook 5b9211c5b3 Rollup merge of #141470 - GuillaumeGomez:function_casts_as_integer, r=urgau
Add new `function_casts_as_integer` lint

The `function_casts_as_integer` lint detects cases where users cast a function pointer into an integer.

*warn-by-default*

### Example

```rust
fn foo() {}
let x = foo as usize;
```

```
warning: casting a function into an integer implicitly
  --> $DIR/function_casts_as_integer.rs:9:17
   |
LL |     let x = foo as usize;
   |                 ^^^^^^^^
   |
help: add `fn() as usize`
   |
LL |     let x = foo as fn() as usize;
   |                 +++++++
```

### Explanation

You should never cast a function directly into an integer but go through a cast as `fn` first to make it obvious what's going on. It also allows to prevent confusion with (associated) constants.

Related to https://github.com/rust-lang/rust/issues/81686 and https://stackoverflow.com/questions/68701177/whats-the-meaning-of-casting-a-rust-enum-variant-to-a-numeric-data-type

r? ````@urgau````
2025-11-11 21:09:32 +11:00
Tshepang Mbambo de1b7754d1 some text improvements 2025-11-11 00:38:30 +02:00
Tshepang Mbambo 7675d7a1f0 sembr sanitizers.md 2025-11-11 00:27:59 +02:00
Tshepang Mbambo 6e14d2a7b1 a more suitable marker 2025-11-11 00:12:04 +02:00
Tshepang Mbambo 87c406469f fix code block language marker 2025-11-11 00:10:42 +02:00
Tshepang Mbambo 241e8909a0 tests/running.md: minor improvements 2025-11-11 00:08:31 +02:00
Tshepang Mbambo b271341781 sembr: handle text inside div blocks
The hackiness of this tool is getting more and more embarassing
2025-11-11 00:08:31 +02:00
Tshepang Mbambo 299a13b060 sembr tests/running.md 2025-11-10 23:36:16 +02:00
Seth Junot 191a3e3c19 Noted the previous forced default in the change tracker 2025-11-10 13:32:39 -08:00
Tshepang Mbambo b4a91c396b a double dot is not end of sentence 2025-11-10 23:27:51 +02:00
Tshepang Mbambo 7a7608cd0e overlong 2025-11-10 23:27:51 +02:00
Tshepang Mbambo 49143e5be8 use chapter name instead of text that does not fit well 2025-11-10 23:27:51 +02:00
Tshepang Mbambo f4e2f0b10b sembr src/getting-started.md 2025-11-10 23:27:32 +02:00