Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0e4beba
Add basic triagebot configuration
Urgau Jan 29, 2026
bad7930
Merge pull request #504 from Urgau/triagebot-config
calebzulawski Jan 29, 2026
01f91e4
Add `Select` and `ToBytes` to prelude
okaneco Feb 7, 2026
e797bc7
Merge pull request #506 from okaneco/prelude
programmerjake Feb 8, 2026
a8af194
docs(simd): fix `load_select_or_default` documentation
b01o Feb 8, 2026
08aa04d
show both kinds of masking-out elements in the example
b01o Feb 8, 2026
81dcf4c
more clear example
b01o Feb 8, 2026
b6a0170
Merge pull request #507 from b01o/fix-doc-simd-load-select-or-default
programmerjake Feb 8, 2026
af51712
Fix typos in documentation
him2him2 Feb 10, 2026
b8bef67
Merge pull request #508 from him2him2/fix-typos
programmerjake Feb 10, 2026
e66819d
Add round_ties_even to StdFloat trait
zRedShift Feb 21, 2026
dc5ab0d
update `proptest` from `0.10` to `1.0`
folkertdev Mar 14, 2026
5c37faf
Add tests for `Mask::first_set`
Kmeakin Mar 14, 2026
b99b62c
Optimize `Mask::first_set`
Kmeakin Mar 14, 2026
7d6df68
Merge pull request #511 from folkertdev/update-proptest
calebzulawski Mar 14, 2026
3bc9bcf
Merge pull request #512 from Kmeakin/km/simd-first-set
calebzulawski Mar 14, 2026
99e9d40
Merge pull request #510 from zRedShift/add-round-ties-even
calebzulawski Mar 15, 2026
ed150fb
bump toolchain to `nightly-2026-03-18`
folkertdev Mar 18, 2026
0c17257
Merge pull request #514 from folkertdev/toolchain-bump
calebzulawski Mar 19, 2026
8ada24a
Add support for Hexagon HVX (#509)
androm3da Mar 27, 2026
63d7f8e
Initial methods to start on transmute v2
scottmcm Apr 10, 2026
6bcd172
add `cfg(target_object_format = "...")`
Apr 10, 2026
9371fea
fix spurious test failure in `metadata_access_times`
mattiapitossi Apr 11, 2026
0557e34
Add `f16` vector support (#513)
folkertdev Apr 11, 2026
aa656a9
Merge commit '0557e3478104037c76c2e5be7ea21e56ebbaff6e' into sync-fro…
folkertdev Apr 11, 2026
02c87fd
Rollup merge of #155084 - scottmcm:add-transmute-prefix, r=Mark-Simul…
JonathanBrouwer Apr 11, 2026
578ae02
Rollup merge of #155126 - folkertdev:target-object-format, r=Urgau
JonathanBrouwer Apr 11, 2026
0ef758c
Rollup merge of #155165 - folkertdev:sync-from-portable-simd-2026-04-…
JonathanBrouwer Apr 11, 2026
22eb361
Rollup merge of #153871 - mattiapitossi:issue-148408, r=Mark-Simulacrum
JonathanBrouwer Apr 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ use rustc_hashes::Hash64;
use rustc_index::{Idx, IndexSlice, IndexVec};
#[cfg(feature = "nightly")]
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_Generic};
#[cfg(feature = "nightly")]
use rustc_span::{Symbol, sym};

mod callconv;
mod canon_abi;
Expand Down Expand Up @@ -770,6 +772,14 @@ impl Endian {
Self::Big => "big",
}
}

#[cfg(feature = "nightly")]
pub fn desc_symbol(&self) -> Symbol {
match self {
Self::Little => sym::little,
Self::Big => sym::big,
}
}
}

impl fmt::Debug for Endian {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const GATED_CFGS: &[GatedCfg] = &[
sym::cfg_target_has_reliable_f16_f128,
Features::cfg_target_has_reliable_f16_f128,
),
(sym::target_object_format, sym::cfg_target_object_format, Features::cfg_target_object_format),
];

/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ declare_features! (
(unstable, cfg_target_has_atomic, "1.60.0", Some(94039)),
/// Allows `cfg(target_has_atomic_equal_alignment = "...")`.
(unstable, cfg_target_has_atomic_equal_alignment, "1.60.0", Some(93822)),
/// Allows `cfg(target_object_format = "...")`.
(unstable, cfg_target_object_format, "CURRENT_RUSTC_VERSION", Some(152586)),
/// Allows `cfg(target_thread_local)`.
(unstable, cfg_target_thread_local, "1.7.0", Some(29594)),
/// Allows the use of `#[cfg(ub_checks)` to check if UB checks are enabled.
Expand Down
11 changes: 8 additions & 3 deletions compiler/rustc_session/src/config/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
| (sym::target_endian, Some(_))
| (sym::target_env, None | Some(_))
| (sym::target_family, Some(_))
| (sym::target_object_format, Some(_))
| (sym::target_os, Some(_))
| (sym::target_pointer_width, Some(_))
| (sym::target_vendor, None | Some(_))
Expand Down Expand Up @@ -252,8 +253,9 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {

ins_sym!(sym::target_abi, sess.target.cfg_abi.desc_symbol());
ins_sym!(sym::target_arch, sess.target.arch.desc_symbol());
ins_str!(sym::target_endian, sess.target.endian.as_str());
ins_sym!(sym::target_endian, sess.target.endian.desc_symbol());
ins_sym!(sym::target_env, sess.target.env.desc_symbol());
ins_sym!(sym::target_object_format, sess.target.options.binary_format.desc_symbol());

for family in sess.target.families.as_ref() {
ins_str!(sym::target_family, family);
Expand Down Expand Up @@ -420,12 +422,13 @@ impl CheckCfg {

// sym::target_*
{
const VALUES: [&Symbol; 8] = [
const VALUES: [&Symbol; 9] = [
&sym::target_abi,
&sym::target_arch,
&sym::target_endian,
&sym::target_env,
&sym::target_family,
&sym::target_object_format,
&sym::target_os,
&sym::target_pointer_width,
&sym::target_vendor,
Expand All @@ -449,6 +452,7 @@ impl CheckCfg {
Some(values_target_endian),
Some(values_target_env),
Some(values_target_family),
Some(values_target_object_format),
Some(values_target_os),
Some(values_target_pointer_width),
Some(values_target_vendor),
Expand All @@ -460,11 +464,12 @@ impl CheckCfg {
for target in Target::builtins().chain(iter::once(current_target.clone())) {
values_target_abi.insert(target.options.cfg_abi.desc_symbol());
values_target_arch.insert(target.arch.desc_symbol());
values_target_endian.insert(Symbol::intern(target.options.endian.as_str()));
values_target_endian.insert(target.options.endian.desc_symbol());
values_target_env.insert(target.options.env.desc_symbol());
values_target_family.extend(
target.options.families.iter().map(|family| Symbol::intern(family)),
);
values_target_object_format.insert(target.options.binary_format.desc_symbol());
values_target_os.insert(target.options.os.desc_symbol());
values_target_pointer_width.insert(sym::integer(target.pointer_width));
values_target_vendor.insert(target.vendor_symbol());
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ symbols! {
cfg_target_has_atomic,
cfg_target_has_atomic_equal_alignment,
cfg_target_has_reliable_f16_f128,
cfg_target_object_format,
cfg_target_thread_local,
cfg_target_vendor,
cfg_trace: "<cfg_trace>", // must not be a valid identifier
Expand Down Expand Up @@ -623,6 +624,7 @@ symbols! {
coerce_pointee_validated,
coerce_shared,
coerce_unsized,
coff,
cold,
cold_path,
collapse_debuginfo,
Expand Down Expand Up @@ -853,6 +855,7 @@ symbols! {
eii_internals,
eii_shared_macro,
element_ty,
elf,
// Notes about `sym::empty`:
// - It should only be used when it genuinely means "empty symbol". Use
// `Option<Symbol>` when "no symbol" is a possibility.
Expand Down Expand Up @@ -1167,6 +1170,7 @@ symbols! {
linkonce_odr,
lint_reasons,
literal,
little, big,
load,
loaded_from_disk,
local,
Expand All @@ -1193,6 +1197,7 @@ symbols! {
lt,
m68k,
m68k_target_feature,
macho: "mach-o",
macro_at_most_once_rep,
macro_attr,
macro_attributes_in_derive_output,
Expand Down Expand Up @@ -2014,6 +2019,7 @@ symbols! {
target_has_reliable_f16_math,
target_has_reliable_f128,
target_has_reliable_f128_math,
target_object_format,
target_os,
target_pointer_width,
target_thread_local,
Expand Down Expand Up @@ -2237,6 +2243,7 @@ symbols! {
vtable_size,
warn,
wasip2,
wasm,
wasm32,
wasm64,
wasm_abi,
Expand Down Expand Up @@ -2271,6 +2278,7 @@ symbols! {
x86_amx_intrinsics,
x87_reg,
x87_target_feature,
xcoff,
xer,
xmm_reg,
xop_target_feature,
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,16 @@ impl BinaryFormat {
Self::Xcoff => object::BinaryFormat::Xcoff,
}
}

pub fn desc_symbol(&self) -> Symbol {
match self {
Self::Coff => sym::coff,
Self::Elf => sym::elf,
Self::MachO => sym::macho,
Self::Wasm => sym::wasm,
Self::Xcoff => sym::xcoff,
}
}
}

impl ToJson for Align {
Expand Down
97 changes: 97 additions & 0 deletions library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

use crate::alloc::Layout;
use crate::clone::TrivialClone;
use crate::cmp::Ordering;
use crate::marker::{Destruct, DiscriminantKind};
use crate::panic::const_assert;
use crate::{clone, cmp, fmt, hash, intrinsics, ptr};
Expand Down Expand Up @@ -1088,6 +1089,102 @@ pub const unsafe fn transmute_copy<Src, Dst>(src: &Src) -> Dst {
}
}

/// Like [`transmute`], but only initializes the "common prefix" of the first
/// `min(size_of::<Src>(), size_of::<Dst>())` bytes of the destination from the
/// corresponding bytes of the source.
///
/// This is equivalent to a "union cast" through a `union` with `#[repr(C)]`.
///
/// That means some size mismatches are not UB, like `[T; 2]` to `[T; 1]`.
/// Increasing size is usually UB from being insufficiently initialized -- like
/// `u8` to `u32` -- but isn't always. For example, going from `u8` to
/// `#[repr(C, align(4))] AlignedU8(u8);` is sound.
///
/// Prefer normal `transmute` where possible, for the extra checking, since
/// both do exactly the same thing at runtime, if they both compile.
///
/// # Safety
///
/// If `size_of::<Src>() >= size_of::<Dst>()`, the first `size_of::<Dst>()` bytes
/// of `src` must be be *valid* when interpreted as a `Dst`. (In this case, the
/// preconditions are the same as for `transmute_copy(&ManuallyDrop::new(src))`.)
///
/// If `size_of::<Src>() <= size_of::<Dst>()`, the bytes of `src` padded with
/// uninitialized bytes afterwards up to a total size of `size_of::<Dst>()`
/// must be *valid* when interpreted as a `Dst`.
///
/// In both cases, any safety preconditions of the `Dst` type must also be upheld.
///
/// # Examples
///
/// ```
/// #![feature(transmute_prefix)]
/// use std::mem::transmute_prefix;
///
/// assert_eq!(unsafe { transmute_prefix::<[i32; 4], [i32; 2]>([1, 2, 3, 4]) }, [1, 2]);
///
/// let expected = if cfg!(target_endian = "little") { 0x34 } else { 0x12 };
/// assert_eq!(unsafe { transmute_prefix::<u16, u8>(0x1234) }, expected);
///
/// // Would be UB because the destination is incompletely initialized.
/// // transmute_prefix::<u8, u16>(123)
///
/// // OK because the destination is allowed to be partially initialized.
/// let _: std::mem::MaybeUninit<u16> = unsafe { transmute_prefix(123_u8) };
/// ```
#[unstable(feature = "transmute_prefix", issue = "155079")]
pub const unsafe fn transmute_prefix<Src, Dst>(src: Src) -> Dst {
#[repr(C)]
union Transmute<A, B> {
a: ManuallyDrop<A>,
b: ManuallyDrop<B>,
}

match const { Ord::cmp(&Src::SIZE, &Dst::SIZE) } {
// SAFETY: When Dst is bigger, the union is the size of Dst
Ordering::Less => unsafe {
let a = transmute_neo(src);
intrinsics::transmute_unchecked(Transmute::<Src, Dst> { a })
},
// SAFETY: When they're the same size, we can use the MIR primitive
Ordering::Equal => unsafe { intrinsics::transmute_unchecked::<Src, Dst>(src) },
// SAFETY: When Src is bigger, the union is the size of Src
Ordering::Greater => unsafe {
let u: Transmute<Src, Dst> = intrinsics::transmute_unchecked(src);
transmute_neo(u.b)
},
}
}

/// New version of `transmute`, exposed under this name so it can be iterated upon
/// without risking breakage to uses of "real" transmute.
///
/// It will not be stabilized under this name.
///
/// # Examples
///
/// ```
/// #![feature(transmute_neo)]
/// use std::mem::transmute_neo;
///
/// assert_eq!(unsafe { transmute_neo::<f32, u32>(0.0) }, 0);
/// ```
///
/// ```compile_fail,E0080
/// #![feature(transmute_neo)]
/// use std::mem::transmute_neo;
///
/// unsafe { transmute_neo::<u32, u16>(123) };
/// ```
#[unstable(feature = "transmute_neo", issue = "155079")]
pub const unsafe fn transmute_neo<Src, Dst>(src: Src) -> Dst {
const { assert!(Src::SIZE == Dst::SIZE) };

// SAFETY: the const-assert just checked that they're the same size,
// and any other safety invariants need to be upheld by the caller.
unsafe { intrinsics::transmute_unchecked(src) }
}

/// Opaque type representing the discriminant of an enum.
///
/// See the [`discriminant`] function in this module for more information.
Expand Down
2 changes: 1 addition & 1 deletion library/portable-simd/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For a given vector math operation on TxN, please add tests for interactions with
- [ ] 0


For a given vector math operation on TxN where T is a float, please add tests for test interactions with:
For a given vector math operation on TxN where T is a float, please add tests for interactions with:
- [ ] a really large number, larger than the mantissa
- [ ] a really small "subnormal" number
- [ ] NaN
Expand Down
Loading
Loading