mark riscv intrinsics as safe by usamoi · Pull Request #1717 · rust-lang/stdarch (original) (raw)
Coming soon: The Renovate bot (GitHub App) will be renamed to Mend. PRs from Renovate will soon appear from 'Mend'. Learn more here.
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| STABLE | minor | |
1.80.0 -> 1.90 |
Release Notes
rust-lang/rust (STABLE)
===========================
Language
- Split up the
unknown_or_malformed_diagnostic_attributeslint. This lint has been split up into four finer-grained lints, withunknown_or_malformed_diagnostic_attributesnow being the lint group that contains these lints:unknown_diagnostic_attributes: unknown to the current compilermisplaced_diagnostic_attributes: placed on the wrong item
malformed_diagnostic_attributes: malformed attribute syntax or optionsmalformed_diagnostic_format_literals: malformed format string literal
- Allow constants whose final value has references to mutable/external memory, but reject such constants as patterns
- Allow volatile access to non-Rust memory, including address 0
Compiler
- Use
lldby default onx86_64-unknown-linux-gnu. - Tier 3
musltargets now link dynamically by default. Affected targets:mips64-unknown-linux-muslabi64powerpc64-unknown-linux-muslpowerpc-unknown-linux-muslpowerpc-unknown-linux-muslsperiscv32gc-unknown-linux-musls390x-unknown-linux-muslthumbv7neon-unknown-linux-musleabihf
Platform Support
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Stabilize
u*::{checked,overflowing,saturating,wrapping}_sub_signed - Allow comparisons between
CStr,CString, andCow<CStr> - Remove some unsized tuple impls since unsized tuples can't be constructed
- Set
MSG_NOSIGNALforUnixStream proc_macro::Ident::newnow supports$crate.- Guarantee the pointer returned from
Thread::into_rawhas at least 8 bytes of alignment
Stabilized APIs
u{n}::checked_sub_signedu{n}::overflowing_sub_signedu{n}::saturating_sub_signedu{n}::wrapping_sub_signedimpl Copy for IntErrorKindimpl Hash for IntErrorKindimpl PartialEq<&CStr> for CStrimpl PartialEq<CString> for CStrimpl PartialEq<Cow<CStr>> for CStrimpl PartialEq<&CStr> for CStringimpl PartialEq<CStr> for CStringimpl PartialEq<Cow<CStr>> for CStringimpl PartialEq<&CStr> for Cow<CStr>impl PartialEq<CStr> for Cow<CStr>impl PartialEq<CString> for Cow<CStr>
These previously stable APIs are now stable in const contexts:
<[T]>::reversef32::floorf32::ceilf32::truncf32::fractf32::roundf32::round_ties_evenf64::floorf64::ceilf64::truncf64::fractf64::roundf64::round_ties_even
Cargo
- Add
http.proxy-cainfoconfig for proxy certs - Use
gixforcargo package - feat(publish): Stabilize multi-package publishing
Rustdoc
- Add ways to collapse all impl
blocks.
Previously the "Summary" button and "-" keyboard shortcut would never
collapse
implblocks, now they do when shift is held - Display unsafe attributes with
unsafe()wrappers
Compatibility Notes
- Use
lldby default onx86_64-unknown-linux-gnu. See also https://blog.rust-lang.org/2025/09/01/rust-lld-on-1.90.0-stable/. - Make
core::iter::Fuse'sDefaultimpl constructI::default()internally as promised in the docs instead of always being empty - Set
MSG_NOSIGNALforUnixStreamThis may change program behavior but results in the same behavior as other primitives (e.g., stdout, network sockets). Programs relying on signals to terminate them should update handling of sockets to handle errors on write by exiting. - On Unix
std::env::home_dirwill use the fallback if theHOMEenvironment variable is empty - We now reject unsupported
extern "{abi}"s consistently in all positions. This primarily affects the use of implementing traits on anextern "{abi}"function pointer, likeextern "stdcall" fn(), on a platform that doesn't support that, like aarch64-unknown-linux-gnu. Direct usage of these unsupported ABI strings by declaring or defining functions was already rejected, so this is only a change for consistency. - const-eval: error when initializing a static writes to that static
- Check that the
proc_macro_derivemacro has correct arguments when applied to the crate root
==========================
Language
- Stabilize explicitly inferred const arguments
(
feature(generic_arg_infer)) - Add a warn-by-default
mismatched_lifetime_syntaxeslint. This lint detects when the same lifetime is referred to by different syntax categories between function arguments and return values, which can be confusing to read, especially in unsafe code. This lint supersedes the warn-by-defaultelided_named_lifetimeslint. - Expand
unpredictable_function_pointer_comparisonsto also lint on function pointer comparisons in external macros - Make the
dangerous_implicit_autorefslint deny-by-default - Stabilize the avx512 target features
- Stabilize
klandwidekltarget features for x86 - Stabilize
sha512,sm3andsm4target features for x86 - Stabilize LoongArch target features
f,d,frecipe,lasx,lbt,lsx, andlvz - Remove
i128andu128fromimproper_ctypes_definitions - Stabilize
repr128(#[repr(u128)],#[repr(i128)]) - Allow
#![doc(test(attr(..)))]everywhere - Extend temporary lifetime extension to also go through tuple struct and tuple variant constructors
extern "C"functions on thewasm32-unknown-unknowntarget now have a standards compliant ABI
Compiler
- Default to non-leaf frame pointers on aarch64-linux
- Enable non-leaf frame pointers for Arm64EC Windows
- Set Apple frame pointers by architecture
Platform Support
- Add new Tier-3 targets
loongarch32-unknown-noneandloongarch32-unknown-none-softfloat x86_64-apple-darwinis in the process of being demoted to Tier 2 with host tools
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Specify the base path for
file! - Allow storing
format_args!()in a variable - Add
#[must_use]to[T; N]::map - Implement
DerefMutforLazy{Cell,Lock} - Implement
Defaultforarray::IntoIter - Implement
Cloneforslice::ChunkBy - Implement
io::Seekforio::Take
Stabilized APIs
NonZero<char>- Many intrinsics for x86, not enumerated here
- AVX512 intrinsics
SHA512,SM3andSM4intrinsicsFile::lockFile::lock_sharedFile::try_lockFile::try_lock_sharedFile::unlockNonNull::from_refNonNull::from_mutNonNull::without_provenanceNonNull::with_exposed_provenanceNonNull::expose_provenanceOsString::leakPathBuf::leakResult::flattenstd::os::linux:🥅:TcpStreamExt::quickackstd::os::linux:🥅:TcpStreamExt::set_quickack
These previously stable APIs are now stable in const contexts:
Cargo
cargo fixandcargo clippy --fixnow default to the same Cargo target selection as other build commands. Previously it would apply to all targets (like binaries, examples, tests, etc.). The--editionflag still applies to all targets.- Stabilize
doctest-xcompile.
Doctests are now tested when cross-compiling. Just like other tests, it
will use the
runnersetting to run the tests. If you need to disable tests for a target, you can use the ignore doctest attribute to specify the targets to ignore.
Rustdoc
- On mobile, make the sidebar full width and linewrap. This makes long section and item names much easier to deal with on mobile.
Compatibility Notes
- Make
missing_fragment_specifieran unconditional error - Enabling the
neontarget feature onaarch64-unknown-none-softfloatcauses a warning because mixing code with and without that target feature is not properly supported by LLVM - Sized Hierarchy: Part I
- Introduces a small breaking change affecting
?Sizedbounds on impls on recursive types which contain associated type projections. It is not expected to affect any existing published crates. Can be fixed by refactoring the involved types or opting into thesized_hierarchyunstable feature. See the FCP report for a code example. - The warn-by-default
elided_named_lifetimeslint is superseded by the warn-by-defaultmismatched_lifetime_syntaxeslint. - Error on recursive opaque types earlier in the type checker
- Type inference side effects from requiring element types of array
repeat expressions are
Copyare now only available at the end of type checking - The deprecated accidentally-stable
std::intrinsics::{copy,copy_nonoverlapping,write_bytes}are now proper intrinsics. There are no debug assertions guarding against UB, and they cannot be coerced to function pointers. - Remove long-deprecated
std::intrinsics::drop_in_place - Make well-formedness predicates no longer coinductive
- Remove hack when checking impl method compatibility
- Remove unnecessary type inference due to built-in trait object impls
- Lint against "stdcall", "fastcall", and "cdecl" on non-x86-32 targets
- Future incompatibility warnings relating to the never type (
!) are now reported in dependencies - Ensure
std::ptr::copy_*intrinsics also perform the static self-init checks extern "C"functions on thewasm32-unknown-unknowntarget now have a standards compliant ABI
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
==========================
Language
- Stabilize
#![feature(let_chains)]in the 2024 edition. This feature allows&&-chainingletstatements insideifandwhile, allowing intermixture with boolean expressions. The patterns inside theletsub-expressions can be irrefutable or refutable. - Stabilize
#![feature(naked_functions)]. Naked functions allow writing functions with no compiler-generated epilogue and prologue, allowing full control over the generated assembly for a particular function. - Stabilize
#![feature(cfg_boolean_literals)]. This allows using boolean literals ascfgpredicates, e.g.#[cfg(true)]and#[cfg(false)]. - Fully de-stabilize the
#[bench]attribute. Usage of#[bench]without#![feature(custom_test_frameworks)]already triggered a deny-by-default future-incompatibility lint since Rust 1.77, but will now become a hard error. - Add warn-by-default
dangerous_implicit_autorefslint against implicit autoref of raw pointer dereference. The lint will be bumped to deny-by-default in the next version of Rust. - Add
invalid_null_argumentslint to prevent invalid usage of null pointers. This lint is uplifted fromclippy::invalid_null_ptr_usage. - Change trait impl candidate preference for builtin impls and trivial where-clauses.
- Check types of generic const parameter defaults
Compiler
Platform Support
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Remove backticks from
#[should_panic]test failure message. - Guarantee that
[T; N]::from_fnis generated in order of increasing indices., for those passing it a stateful closure. - The libtest flag
--nocaptureis deprecated in favor of the more consistent--no-captureflag. - Guarantee that
{float}::NANis a quiet NaN.
Stabilized APIs
Cell::updateimpl Default for *const Timpl Default for *mut THashMap::extract_ifHashSet::extract_ifhint::select_unpredictableproc_macro::Span::lineproc_macro::Span::columnproc_macro::Span::startproc_macro::Span::endproc_macro::Span::fileproc_macro::Span::local_file<[T]>::as_chunks<[T]>::as_chunks_mut<[T]>::as_chunks_unchecked<[T]>::as_chunks_unchecked_mut<[T]>::as_rchunks<[T]>::as_rchunks_mutmod ffi::c_str
These previously stable APIs are now stable in const contexts:
NonNull<T>::replace<*mut T>::replacestd::ptr::swap_nonoverlappingCell::replaceCell::getCell::get_mutCell::from_mutCell::as_slice_of_cells
Cargo
Rustdoc
- Doctests can be ignored based on target names using
ignore-*attributes. - Stabilize the
--test-runtooland--test-runtool-argCLI options to specify a program (like qemu) and its arguments to run a doctest.
Compatibility Notes
- Finish changing the internal representation of pasted
tokens. Certain
invalid declarative macros that were previously accepted in obscure
circumstances are now correctly rejected by the compiler. Use of a
ttfragment specifier can often fix these macros. - Fully de-stabilize the
#[bench]attribute. Usage of#[bench]without#![feature(custom_test_frameworks)]already triggered a deny-by-default future-incompatibility lint since Rust 1.77, but will now become a hard error. - Fix borrow checking some always-true patterns. The borrow checker was overly permissive in some cases, allowing programs that shouldn't have compiled.
- Update the minimum external LLVM to 19.
- Make it a hard error to use a vector type with a non-Rust ABI without enabling the required target feature.
==========================
Language
- Stabilize
asm_gotofeature - Allow parsing open beginning ranges (
..EXPR) after unary operators!,-, and*. - Don't require method impls for methods with
Self: Sizedbounds inimpls for unsized types - Stabilize
feature(precise_capturing_in_traits)allowinguse<...>bounds on return positionimpl Traitintraits
Compiler
Platform Support
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Stabilize the anonymous pipe API
- Add support for unbounded left/right shift operations
- Print pointer metadata in
Debugimpl of raw pointers Vec::with_capacityguarantees it allocates with the amount requested, even ifVec::capacityreturns a different number.- Most
std::archintrinsics which don't take pointer arguments can now be called from safe code if the caller has the appropriate target features already enabled (rust-lang/stdarch#1714, rust-lang/stdarch#1716, rust-lang/stdarch#1717) - Undeprecate
env::home_dir - Denote
ControlFlowas#[must_use] - Macros such as
assert_eq!andvec!now supportconst {...}expressions
Stabilized APIs
Vec::extract_ifvec::ExtractIfLinkedList::extract_iflinked_list::ExtractIf<[T]>::split_off<[T]>::split_off_mut<[T]>::split_off_first<[T]>::split_off_first_mut<[T]>::split_off_last<[T]>::split_off_last_mutString::extend_from_withinos_str::DisplayOsString::displayOsStr::displayio::pipeio::PipeReaderio::PipeWriterimpl From<PipeReader> for OwnedHandleimpl From<PipeWriter> for OwnedHandleimpl From<PipeReader> for Stdioimpl From<PipeWriter> for Stdioimpl From<PipeReader> for OwnedFdimpl From<PipeWriter> for OwnedFdBox<MaybeUninit<T>>::writeimpl TryFrom<Vec<u8>> for String<*const T>::offset_from_unsigned<*const T>::byte_offset_from_unsigned<*mut T>::offset_from_unsigned<*mut T>::byte_offset_from_unsignedNonNull::offset_from_unsignedNonNull::byte_offset_from_unsigned<uN>::cast_signedNonZero::<uN>::cast_signed.<iN>::cast_unsigned.NonZero::<iN>::cast_unsigned.<uN>::is_multiple_of<uN>::unbounded_shl<uN>::unbounded_shr<iN>::unbounded_shl<iN>::unbounded_shr<iN>::midpoint<str>::from_utf8<str>::from_utf8_mut<str>::from_utf8_unchecked<str>::from_utf8_unchecked_mut
These previously stable APIs are now stable in const contexts:
core::str::from_utf8_mut<[T]>::copy_from_sliceSocketAddr::set_ipSocketAddr::set_port,SocketAddrV4::set_ipSocketAddrV4::set_port,SocketAddrV6::set_ipSocketAddrV6::set_portSocketAddrV6::set_flowinfoSocketAddrV6::set_scope_idchar::is_digitchar::is_whitespace<[[T; N]]>::as_flattened<[[T; N]]>::as_flattened_mutString::into_bytesString::as_strString::capacityString::as_bytesString::lenString::is_emptyString::as_mut_strString::as_mut_vecVec::as_ptrVec::as_sliceVec::capacityVec::lenVec::is_emptyVec::as_mut_sliceVec::as_mut_ptr
Cargo
- Add terminal integration via ANSI OSC 9;4 sequences
- chore: bump openssl to v3
- feat(package): add --exclude-lockfile flag
Compatibility Notes
- Rust now raises an error for macro invocations inside the
#![crate_name]attribute - Unstable fields are now always considered to be inhabited
- Macro arguments of unary operators followed by open beginning ranges may now be matched differently
- Make
Debugimpl of raw pointers print metadata if present - Warn against function pointers using unsupported ABI strings in dependencies
- Associated types on
dyntypes are no longer deduplicated - [Forbid attributes on
..inside of struct patterns (`let Struct {
#[attribute] .. }) =`](https://redirect.github.com/rust-lang/rust/pull/136490)
- Make
ptr_cast_add_auto_to_objectlint into hard error - Many
std::archintrinsics are now safe to call in some contexts, there may now be newunused_unsafewarnings in existing codebases. - Limit
widthandprecisionformatting options to 16 bits on all targets - Turn order dependent trait objects future incompat warning into a hard error
- Denote
ControlFlowas#[must_use] - Windows: The standard library no longer links
advapi32, except on win7. Code such as C libraries that were relying on this assumption may need to explicitly link advapi32. - Proc macros can no longer observe expanded
cfg(true)attributes. - Start changing the internal representation of pasted
tokens. Certain
invalid declarative macros that were previously accepted in obscure
circumstances are now correctly rejected by the compiler. Use of a
ttfragment specifier can often fix these macros. - Don't allow flattened format_args in const.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
==========================
Language
- Stabilize upcasting trait objects to supertraits.
- Allow safe functions to be marked with the
#[target_feature]attribute. - The
missing_abilint now warns-by-default. - Rust now lints about double negations, to catch cases that might have
intended to be a prefix decrement operator (
--x) as written in other languages. This was previously a clippy lint,clippy::double_neg, and is now available directly in Rust asdouble_negations. - More pointers are now detected as definitely not-null based on their alignment in const eval.
- Empty
repr()attribute applied to invalid items are now correctly rejected. - Inner attributes
#![test]and#![rustfmt::skip]are no longer accepted in more places than intended.
Compiler
- Debug-assert that raw pointers are non-null on access.
- Change
-Oto mean-C opt-level=3instead of-C opt-level=2to match Cargo's defaults. - Fix emission of
overflowing_literalsunder certain macro environments.
Platform Support
- Replace
i686-unknown-redoxtarget withi586-unknown-redox. - Increase baseline CPU of
i686-unknown-hurd-gnuto Pentium 4. - New tier 3 targets:
{aarch64-unknown,x86_64-pc}-nto-qnx710_iosock. For supporting Neutrino QNX 7.1 withio-socketnetwork stack.{aarch64-unknown,x86_64-pc}-nto-qnx800. For supporting Neutrino QNX 8.0 (no_std-only).{x86_64,i686}-win7-windows-gnu. Intended for backwards compatibility with Windows 7.{x86_64,i686}-win7-windows-msvcare the Windows MSVC counterparts that already exist as Tier 3 targets.amdgcn-amd-amdhsa.x86_64-pc-cygwin.{mips,mipsel}-mti-none-elf. Initial bare-metal support.m68k-unknown-none-elf.armv7a-nuttx-{eabi,eabihf},aarch64-unknown-nuttx, andthumbv7a-nuttx-{eabi,eabihf}.
Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
Libraries
- The type of
FromBytesWithNulErrorinCStr::from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>was changed from an opaque struct to an enum, allowing users to examine why the conversion failed. - Remove
RustcDecodableandRustcEncodable. - Deprecate libtest's
--logfileoption. - On recent versions of Windows,
std::fs::remove_filewill now remove read-only files.
Stabilized APIs
{float}::next_down{float}::next_up<[_]>::get_disjoint_mut<[_]>::get_disjoint_unchecked_mutslice::GetDisjointMutErrorHashMap::get_disjoint_mutHashMap::get_disjoint_unchecked_mutNonZero::count_onesVec::pop_ifsync::Once::waitsync::Once::wait_forcesync::OnceLock::wait
These APIs are now stable in const contexts:
hint::black_boxio::Cursor::get_mutio::Cursor::set_positionstr::is_char_boundarystr::split_atstr::split_at_checkedstr::split_at_mutstr::split_at_mut_checked
Cargo
- When merging, replace rather than combine configuration keys that refer to a program path and its arguments.
- Error if both
--packageand--workspaceare passed but the requested package is missing. This was previously silently ignored, which was considered a bug since missing packages should be reported. - Deprecate the token argument in
cargo loginto avoid shell history leaks. - Simplify the implementation of
SourceIDcomparisons. This may potentially change behavior if the canonicalized URL compares differently in alternative registries.
Rustdoc
Compatibility Notes
- The
wasm_c_abifuture compatibility warning is now a hard error. Users ofwasm-bindgenshould upgrade to at least version 0.2.89, otherwise compilation will fail. - Remove long-deprecated no-op attributes
#![no_start]and#![crate_id]. - The future incompatibility lint
cenum_impl_drop_casthas been made into a hard error. This means it is now an error to cast a field-less enum to an integer if the enum implementsDrop. - SSE2 is now required for "i686" 32-bit x86 hard-float targets; disabling it causes a warning that will become a hard error eventually. To compile for pre-SSE2 32-bit x86, use a "i586" target instead.
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
- Build the rustc on AArch64 Linux with ThinLTO + PGO. The ARM 64-bit compiler (AArch64) on Linux is now optimized with ThinLTO and PGO, similar to the optimizations we have already performed for the x86-64 compiler on Linux. This should make it up to 30% faster.
==========================
- Fix the doctest-merging feature of the 2024 Edition.
- Relax some
target_featurechecks when generating docs. - Fix errors in
std::fs::renameon Windows 10, version 1607. - Downgrade bootstrap
ccto fix custom targets. - Skip submodule updates when building Rust from a source tarball.
==========================
- Fix ICE 132920 in duplicate-crate diagnostics.
- Fix errors for overlapping impls in incremental rebuilds.
- Fix slow compilation related to the next-generation trait solver.
- Fix debuginfo when LLVM's location discriminator value limit is exceeded.
- Fixes for building Rust from source:
- Only try to distribute
llvm-objcopyif llvm tools are enabled. - Add Profile Override for Non-Git Sources.
- Resolve symlinks of LLVM tool binaries before copying them.
- Make it possible to use ci-rustc on tarball sources.
==========================
Language
- Stabilize
&mut,*mut,&Cell, and*const Cellin const. - Allow creating references to statics in
constinitializers. - Implement raw lifetimes and labels
(
'r#ident). - Define behavior when atomic and non-atomic reads race.
- Non-exhaustive structs may now be empty.
- Disallow implicit coercions from places of type
! const externfunctions can now be defined for other calling conventions.- Stabilize
expr_2021macro fragment specifier in all editions. - The
non_local_definitionslint now fires on less code and warns by default.
Compiler
- Deprecate unsound
-Csoft-floatflag. - Add many new tier 3 targets:
aarch64_unknown_nto_qnx700arm64e-apple-tvosarmv7-rtems-eabihfloongarch64-unknown-linux-ohosriscv32-wrs-vxworksandriscv64-wrs-vxworksriscv32{e|em|emc}-unknown-none-elfx86_64-unknown-hurd-gnux86_64-unknown-trusty
Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
Libraries
- Implement
PartialEqforExitCode. - Document that
catch_unwindcan deal with foreign exceptions without UB, although the exact behavior is unspecified. - Implement
DefaultforHashMap/HashSetiterators that don't already have it. - Bump Unicode to version 16.0.0.
- Change documentation of
ptr::add/subto not claim equivalence withoffset.
Stabilized APIs
BufRead::skip_untilControlFlow::break_valueControlFlow::continue_valueControlFlow::map_breakControlFlow::map_continueDebugList::finish_non_exhaustiveDebugMap::finish_non_exhaustiveDebugSet::finish_non_exhaustiveDebugTuple::finish_non_exhaustiveErrorKind::ArgumentListTooLongErrorKind::DeadlockErrorKind::DirectoryNotEmptyErrorKind::ExecutableFileBusy- [
ErrorKind::FileTooLarge](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.F
Configuration
📅 Schedule: Branch creation - Every minute ( * * * * * ) (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>