rust/src
bors 39ee3aaa13 Auto merge of #49297 - scottmcm:offset-from, r=dtolnay
Introduce unsafe offset_from on pointers

Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from
```asm
    sub rcx, rdx
    mov rax, rcx
    sar rax, 63
    shr rax, 62
    lea rax, [rax + rcx]
    sar rax, 2
    ret
```
down to
```asm
    sub rcx, rdx
    sar rcx, 2
    mov rax, rcx
    ret
```
(for `*const i32`)

See discussion on the `offset_to` tracking issue https://github.com/rust-lang/rust/issues/41079

Some open questions
- Would you rather I split the intrinsic PR from the library PR?
- Do we even want the safe version of the API?  https://github.com/rust-lang/rust/issues/41079#issuecomment-374426786  I've added some text to its documentation that even if it's not UB, it's useless to use it between pointers into different objects.

and todos
- [x] ~~I need to make a codegen test~~ Done
- [x] ~~Can the subtraction use nsw/nuw?~~ No, it can't https://github.com/rust-lang/rust/pull/49297#discussion_r176697574
- [x] ~~Should there be `usize` variants of this, like there are now `add` and `sub` that you almost always want over `offset`?  For example, I imagine `sub_ptr` that returns `usize` and where it's UB if the distance is negative.~~ Can wait for later; C gives a signed result https://github.com/rust-lang/rust/issues/41079#issuecomment-375842235, so we might as well, and this existing to go with `offset` makes sense.
2018-03-26 00:15:34 +00:00
..
bootstrap Rollup merge of #49290 - cuviper:unextended-dist-rustfmt, r=nikomatsakis 2018-03-25 01:26:44 +08:00
build_helper
ci Auto merge of #49284 - alexcrichton:use-our-own-cache, r=kennytm 2018-03-25 02:42:58 +00:00
dlmalloc@9b2dcac06c
doc Rollup merge of #49318 - steveklabnik:update-books, r=kennytm 2018-03-25 01:26:48 +08:00
etc Use GNU version of fgrep/egrep tool if available 2018-03-22 14:38:05 +01:00
grammar
jemalloc@1f5a28755e
liballoc Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertj 2018-03-25 01:26:34 +08:00
liballoc_jemalloc
liballoc_system
libarena
libbacktrace
libcompiler_builtins@266ea0740a
libcore Auto merge of #49297 - scottmcm:offset-from, r=dtolnay 2018-03-26 00:15:34 +00:00
libfmt_macros
libgraphviz
liblibc@ed04152aac
libpanic_abort
libpanic_unwind
libproc_macro Initial implementation of RFC 2151, Raw Identifiers 2018-03-18 10:07:19 -05:00
libprofiler_builtins
librustc Auto merge of #49212 - kyrias:strip-debug-no-debuginfo, r=michaelwoerister 2018-03-25 21:46:15 +00:00
librustc_allocator Rename Span::empty to Span::shrink_to_lo, add Span::shrink_to_hi 2018-03-17 22:12:21 +03:00
librustc_apfloat Stabilize slice patterns without .. 2018-03-20 02:27:40 +03:00
librustc_asan
librustc_back Replace many of the last references to readmes 2018-03-16 12:43:22 -05:00
librustc_borrowck Rollup merge of #49092 - mark-i-m:deptrack_readme, r=nikomatsakis 2018-03-20 07:15:19 +08:00
librustc_const_eval Stabilize slice patterns without .. 2018-03-20 02:27:40 +03:00
librustc_const_math
librustc_cratesio_shim
librustc_data_structures Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister 2018-03-23 10:16:09 -07:00
librustc_driver Rollup merge of #49046 - Zoxc:error-summary, r=michaelwoerister 2018-03-25 01:26:24 +08:00
librustc_errors Rollup merge of #49046 - Zoxc:error-summary, r=michaelwoerister 2018-03-25 01:26:24 +08:00
librustc_incremental Convert SerializedDepGraph to be a struct-of-arrays 2018-03-19 19:45:35 -04:00
librustc_lint Filed a proper tracking issue. 2018-03-24 07:02:35 +08:00
librustc_llvm Introduce unsafe offset_from on pointers 2018-03-23 01:30:23 -07:00
librustc_lsan
librustc_metadata Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakis 2018-03-25 01:30:12 +08:00
librustc_mir Rollup merge of #49274 - oli-obk:slow_miri, r=michaelwoerister,eddyb 2018-03-25 01:26:43 +08:00
librustc_msan
librustc_passes Auto merge of #48482 - davidtwco:issue-47184, r=nikomatsakis 2018-03-24 02:08:22 +00:00
librustc_platform_intrinsics
librustc_plugin Auto merge of #48524 - abonander:check-macro-stability, r=petrochenkov 2018-03-16 02:46:23 +00:00
librustc_privacy
librustc_resolve Merge branch 'master' of https://github.com/Lymia/rust into rollup 2018-03-23 10:16:40 -07:00
librustc_save_analysis Rename Span::empty to Span::shrink_to_lo, add Span::shrink_to_hi 2018-03-17 22:12:21 +03:00
librustc_traits Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister 2018-03-23 10:16:09 -07:00
librustc_trans Auto merge of #49297 - scottmcm:offset-from, r=dtolnay 2018-03-26 00:15:34 +00:00
librustc_trans_utils Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebank 2018-03-22 22:43:37 +08:00
librustc_tsan
librustc_typeck Auto merge of #49297 - scottmcm:offset-from, r=dtolnay 2018-03-26 00:15:34 +00:00
librustdoc Rollup merge of #49312 - GuillaumeGomez:fix-ie11-search, r=QuietMisdreavus 2018-03-25 01:26:45 +08:00
libserialize
libstd Auto merge of #49315 - TheDan64:smaller_unsafe_block, r=joshtriplett 2018-03-25 05:26:58 +00:00
libstd_unicode
libsyntax Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakis 2018-03-25 01:30:12 +08:00
libsyntax_ext Initial implementation of RFC 2151, Raw Identifiers 2018-03-18 10:07:19 -05:00
libsyntax_pos Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister 2018-03-23 10:16:09 -07:00
libterm
libtest Cargo fmt libtest 2018-03-21 23:12:24 +09:00
libunwind
llvm@6ceaaa4b01
llvm-emscripten@2717444753
rtstartup
rustc
rustllvm Polyfill LLVMBuildExactUDiv 2018-03-24 19:15:12 -07:00
stdsimd@bcb720e558 update stdsimd 2018-03-21 15:43:06 -05:00
test Auto merge of #49297 - scottmcm:offset-from, r=dtolnay 2018-03-26 00:15:34 +00:00
tools Test fixes 2018-03-23 11:37:42 -07:00
Cargo.lock Rollup merge of #49203 - Eijebong:lets-cleanup-dependencies, r=Mark-Simulacrum 2018-03-25 01:26:36 +08:00
Cargo.toml Automatically enable the clippy feature of rls if clippy builds 2018-03-16 18:24:08 +01:00
README.md
stage0.txt Update beta to version with fixed FreeBSD support from #49023. 2018-03-19 12:40:42 -07:00

This directory contains the source code of the rust project, including:

  • rustc and its tests
  • libstd
  • Various submodules for tools, like rustdoc, rls, etc.

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

Their is also useful content in the following READMEs, which are gradually being moved over to the guide: