rust/src
bors faae5f1ffe Auto merge of #122520 - scottmcm:stabilize_unchecked_math_basics, r=jhpratt
Stabilize `unchecked_{add,sub,mul}`

Tracking issue: #85122

I think we might as well just stabilize these basic three.  They're the ones that have `nuw`/`nsw` flags in LLVM.

Notably, this doesn't include the potentially-more-complex or -more-situational things like `unchecked_neg` or `unchecked_shr` that are under different feature flags.

To quote Ralf https://github.com/rust-lang/rust/issues/85122#issuecomment-1681669646,

> Are there any objections to stabilizing at least `unchecked_{add,sub,mul}`? For those there shouldn't be any surprises about what their safety requirements are.

*Semantially* these are [already available on stable, even in `const`, via](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=bdb1ff889b61950897f1e9f56d0c9a36) `checked_*`+`unreachable_unchecked`.  So IMHO we might as well just let people write them directly, rather than try to go through a `let Some(x) = x.checked_add(y) else { unsafe { hint::unreachable_unchecked() }};` dance.

I added additional text to each method to attempt to better describe the behaviour and encourage `wrapping_*` instead.

r? rust-lang/libs-api
2024-03-29 20:25:08 +00:00
..
bootstrap Rollup merge of #123186 - onur-ozkan:llvm-library-bug, r=Kobzol 2024-03-29 15:17:10 +01:00
ci Auto merge of #123178 - Nilstrieb:🥷-build, r=Mark-Simulacrum 2024-03-28 22:16:03 +00:00
doc Simplify trim-paths feature by merging all debuginfo options together 2024-03-28 18:47:26 +01:00
etc Auto merge of #121885 - reitermarkus:generic-nonzero-inner, r=oli-obk,wesleywiser 2024-03-17 02:27:52 +00:00
librustdoc Auto merge of #122450 - Urgau:simplify-trim-paths-feature, r=michaelwoerister 2024-03-29 14:00:21 +00:00
llvm-project@0af6c732ec Update to LLVM 18.1.2 2024-03-20 12:26:19 +01:00
rustdoc-json-types Add is_object_safe information for traits in JSON output 2023-12-23 11:43:31 +01:00
tools Auto merge of #122520 - scottmcm:stabilize_unchecked_math_basics, r=jhpratt 2024-03-29 20:25:08 +00:00
README.md
stage0.json Bump stage0 2024-03-19 19:27:24 -04:00
version Bump to 1.79.0 2024-03-16 09:56:09 -04:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.