Commit Graph

303456 Commits

Author SHA1 Message Date
bors
10bcdad7df Auto merge of #138583 - jhpratt:rollup-h699hty, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - #136293 (document capacity for ZST as example)
 - #136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove)
 - #136816 (refactor `notable_traits_button` to use iterator combinators  instead of for loop)
 - #138552 (Misc print request handling cleanups + a centralized test for print request stability gating)
 - #138573 (Make `_Unwind_Action` a type alias, not enum)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-17 03:45:06 +00:00
Alex Touchet
04c9956c9a Update Rust Foundation links in Readme 2025-03-16 19:03:40 -07:00
Jacob Pratt
5144055055 Rollup merge of #138573 - Noratrieb:no-unsound-bad-bonk-bonk, r=workingjubilee
Make `_Unwind_Action` a type alias, not enum

It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check.

I ran `x check library --target aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-fortanix-unknown-sgx,x86_64-unknown-haiku,x86_64-unknown-fuchsi
a,x86_64-unknown-freebsd,x86_64-unknown-dragonfly,x86_64-unknown-netbsd,x86_64-unknown-openbsd,x86_64-unknown-redox,riscv64-linux-android,armv7-unknown-freebsd` (and some more but they failed to build for other reasons :D)

fixes #138558

r? workingjubilee have fun
2025-03-16 21:47:45 -04:00
Jacob Pratt
6da26f7cfe Rollup merge of #138552 - jieyouxu:print-request-cleanups, r=Urgau
Misc print request handling cleanups + a centralized test for print request stability gating

I was working on implementing `--print=supported-crate-types`, then I noticed some things that were mildly annoying me, so I pulled out these changes. In this PR:

- First commit adds a centralized test `tests/ui/print/stability.rs` that is responsible for exercising stability gating of the print requests.
    - AFAICT we didn't have any test that systematically checks this.
    - I coalesced `tests/ui/feature-gates/feature-gate-print-check-cfg.rs` (for `--print=check-cfg`) into this test too, since `--print=check-cfg` is only `-Z unstable-options`-gated like other unstable print requests, and is not additionally feature-gated. cc ``@Urgau`` in case you have any concerns.
- Second commit alphabetically sorts the `PrintKind` enum for consistency because the `PRINT_KINDS` list (using the enum) is *already* alphabetically sorted.
- Third commit pulls out two helpers:
    1. A helper `check_print_request_stability` for checking stability of print requests and the diagnostics for using unstable print requests without `-Z unstable-options`, to avoid repeating the same logic over and over.
    2. A helper `emit_unknown_print_request_help` for the unknown print request diagnostics to make print request collection control flow more obvious.
- Fourth commit renames `PrintKind::{TargetSpec,AllTargetSpecs}` to `PrintKind::{TargetSpecJson,AllTargetSpecsJson}` to better reflect their actual print names, `--print={target-spec-json,all-target-specs-json}`.

r? ``@nnethercote`` (or compiler/reroll)
2025-03-16 21:47:44 -04:00
Jacob Pratt
04032ab233 Rollup merge of #136816 - yotamofek:pr/notable-traits-button-cleanup, r=aDotInTheVoid
refactor `notable_traits_button` to use iterator combinators  instead of for loop

~Small cleanup.
Use `Iterator::any` instead of `for` loop with `predicate = true;`.
I think this makes the code more readable... and also has the additional benefit of short-circuiting the iterator when a notable trait is found (a `break` statement was missing in the `for` loop version, I think). Probably won't be significant enough to show on perf results, though.~

Three commits, each attempting to optimize `notable_trait_buttons` by a little bit.
2025-03-16 21:47:43 -04:00
Jacob Pratt
feb6cb4132 Rollup merge of #136359 - hkBst:ptr_copy_docs, r=Amanieu
doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove

Fixes #79430
2025-03-16 21:47:42 -04:00
Jacob Pratt
c7700406f4 Rollup merge of #136293 - hkBst:patch-32, r=Amanieu
document capacity for ZST as example

The main text already covers this, although it provides weaker guarantees, but I think an example in the right spot does not hurt. Fixes #80747
2025-03-16 21:47:42 -04:00
jyn
4aee995750 expand ${workspaceFolder} in sample vim config 2025-03-16 21:06:18 -04:00
bors
c3dd4eefd6 Auto merge of #138363 - beetrees:f16-f128-integer-convert, r=Amanieu
Add `From<{integer}>` for `f16`/`f128` impls

This PR adds `impl From<{bool,i8,u8}> for f16` and `impl From<{bool,i8,u8,i16,u16,i32,u32}> for f128`.

The `From<{i64,u64}> for f128` impls are left commented out as adding them would allow using `f128` on stable before it is stabilised like in the following example:
```rust
fn f<T: From<u64>>(x: T) -> T { x }

fn main() {
    let x = f(1.0); // the type of the literal is inferred to be `f128`
}
```
None of the impls added in this PR have this issue as they are all, at minimum, also implemented by `f64`.

This PR will need a crater run for the `From<{i32,u32}>` impls, as `f64` is no longer the only float type to implement them (similar to the cause of #125198).

cc `@bjoernager`
r? `@tgross35`

Tracking issue: #116909
2025-03-17 00:33:36 +00:00
Alejandra González
4800557857 question_mark: avoid incorrect suggestion when ref binding used (#14158)
changelog: [`question_mark`]: avoid incorrect suggestion when `ref`
binding used

Fixes #13417
2025-03-16 23:25:26 +00:00
Charalampos Mitrodimas
b14810669a Fix ICE: attempted to remap an already remapped filename
This commit fixes an internal compiler error (ICE) that occurs when
rustdoc attempts to process macros with a remapped filename. The issue
arose during macro expansion when the `--remap-path-prefix` option was
used.

Instead of passing remapped filenames through, which would trigger the
"attempted to remap an already remapped filename" panic, we now
extract the original local path from remapped filenames before
processing them.

A test case has been added to verify this behavior.

Fixes #138520

Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
2025-03-16 23:37:09 +01:00
Alona Enraght-Moony
677489fb3e rustdoc-json: Don't also include #[deprecated] in Item::attrs 2025-03-16 21:27:54 +00:00
Nicholas Nethercote
2b431f768b Fix is_relevant_impl.
It determines if a function should have any `inline` attributes checked.
For `ItemKind::Fn` it returns true or false depending on the details of
the function; for anything other item kind it returns *true*. This
latter case should instead be *false*. (In the nearby and similar
functions `is_relevant_impl` and `is_relevant_trait` the non-function
cases return false.)

The effect of this is that non-functions are no longer checked. But
rustc already disallows `inline` on any non-function items. So if
anything its a tiny performance win, because that was useless anyway.
2025-03-17 08:20:56 +11:00
Nicholas Nethercote
6698c26b3a Fix is_relevant_impl.
It determines if a function should have any `inline` attributes checked.
For `ItemKind::Fn` it returns true or false depending on the details of
the function; for anything other item kind it returns *true*. This
latter case should instead be *false*. (In the nearby and similar
functions `is_relevant_impl` and `is_relevant_trait` the non-function
cases return false.)

The effect of this is that non-functions are no longer checked. But
rustc already disallows `inline` on any non-function items. So if
anything its a tiny performance win, because that was useless anyway.
2025-03-17 08:20:56 +11:00
Alona Enraght-Moony
a8a913dcd2 rustdoc: Rename Item::attributes param to is_json
This makes it clearer what it's actually used for, and makes it easier
to think about modifying `Item::attributes`.
2025-03-16 21:15:49 +00:00
Alona Enraght-Moony
2ff28159d3 rustdoc-json: Add tests for #[deprecated(...)] 2025-03-16 21:09:46 +00:00
Folkert de Vries
c26142697c add naked_functions_target_feature unstable feature 2025-03-16 22:07:43 +01:00
Guillaume Gomez
417bfe2125 Exclude literal-escaper from library workspace 2025-03-16 21:46:39 +01:00
Noratrieb
f20a6c70fb make _Unwind_Action a type alias, not enum
It's bitflags in practice, so an enum is unsound, as an enum must only
have the described values. The x86_64 psABI declares it as a `typedef
int _Unwind_Action`, which seems reasonable. I made a newtype first but
that was more annoying than just a typedef. We don't really use this
value for much other than a short check.
2025-03-16 21:32:41 +01:00
Alona Enraght-Moony
f5ecb74bf9 rustdoc-json: Add tests for #[repr(...)]
Co-authored-by: Predrag Gruevski <obi1kenobi82@gmail.com>
2025-03-16 20:28:17 +00:00
Folkert de Vries
81f6100463 move unsafe pointer writes to the surface 2025-03-16 20:02:22 +00:00
Folkert de Vries
1f202e7fe7 shink the size of type signatures 2025-03-16 20:02:22 +00:00
Folkert de Vries
3b8973d216 add vec_meadd, vec_moadd, vec_mhadd and vec_mladd 2025-03-16 20:02:22 +00:00
Folkert de Vries
44cda131be add vec_mulh 2025-03-16 20:02:22 +00:00
Folkert de Vries
f7dc654108 add vec_mulo 2025-03-16 20:02:22 +00:00
Folkert de Vries
5c61b664e7 add vec_any_* and vec_all_* 2025-03-16 20:02:22 +00:00
Folkert de Vries
e30905984c add vec_all_nan, vec_any_nan, vec_all_numeric and vec_any_numeric 2025-03-16 20:02:22 +00:00
Folkert de Vries
2667fd06ff add vec_cmpeq_idx and variations 2025-03-16 20:02:22 +00:00
Folkert de Vries
b866e43594 add vec_cmpeq and vec_cmpne 2025-03-16 20:02:22 +00:00
Folkert de Vries
8affaabfaf add vec_cmpgt, vec_cmplt, vec_cmpge, vec_cmple 2025-03-16 20:02:22 +00:00
Folkert de Vries
81a2841164 let's not use &mut until we get confirmation it's OK 2025-03-16 20:02:22 +00:00
Folkert de Vries
d218bd1624 add vec_cmprg_or_0_idx_cc and vec_cmpnrg_or_0_idx_cc 2025-03-16 20:02:22 +00:00
Folkert de Vries
790d77e4e6 add vec_cmprg_or_0_idx and vec_cmpnrg_or_0_idx 2025-03-16 20:02:22 +00:00
Folkert de Vries
3660dfff5a add vec_cmprg_cc and friends 2025-03-16 20:02:22 +00:00
Folkert de Vries
895d11f085 add vec_cmprg_idx and vec_cmpnrg_idx 2025-03-16 20:02:22 +00:00
Folkert de Vries
511a8eb3cd add vec_cmpnrg 2025-03-16 20:02:22 +00:00
Folkert de Vries
edbeee5b25 add vec_cmprg 2025-03-16 20:02:22 +00:00
Folkert de Vries
b4b126edfc add vec_sld, vec_sldb, vec_sldw and vec_srdb 2025-03-16 20:02:22 +00:00
Folkert de Vries
239f240515 add vec_msum_u128 2025-03-16 20:02:22 +00:00
Folkert de Vries
0c011430d9 add vec_cp_until_zero and vec_cp_until_zero_cc 2025-03-16 20:02:22 +00:00
Folkert de Vries
efe09e0c85 add vec_signed and vec_unsigned 2025-03-16 20:02:22 +00:00
Folkert de Vries
c29266a029 add vec_extend_s64 2025-03-16 20:02:22 +00:00
Folkert de Vries
68b9d71cb8 add vec_double and vec_float 2025-03-16 20:02:22 +00:00
Folkert de Vries
d4c98b0930 add vec_search_string_cc and vec_search_string_until_zero_cc 2025-03-16 20:02:22 +00:00
Folkert de Vries
2ba9c9cf38 add vec_test_mask 2025-03-16 20:02:22 +00:00
Folkert de Vries
9dcbd2f873 add vec_fp_test_data_class 2025-03-16 20:02:22 +00:00
Folkert de Vries
45767c74d0 add vec_scatter 2025-03-16 20:02:22 +00:00
Folkert de Vries
8ad4a919dc add vec_sel 2025-03-16 20:02:22 +00:00
Folkert de Vries
57f9b31542 add vec_bperm_u128 2025-03-16 20:02:22 +00:00
Folkert de Vries
9815ca674a add vec_gather_element 2025-03-16 20:02:22 +00:00