rust/src/test
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
..
auxiliary Remove directory src/rt 2018-02-24 16:45:39 +03:00
codegen Auto merge of #49297 - scottmcm:offset-from, r=dtolnay 2018-03-26 00:15:34 +00:00
codegen-units
compile-fail Auto merge of #49141 - gnzlbg:simd_select, r=alexcrichton 2018-03-25 00:02:48 +00:00
compile-fail-fulldeps Add test for issue 48941 2018-03-13 15:23:36 -04:00
debuginfo travis: Upgrade OSX builders 2018-03-07 10:47:38 -08:00
incremental Fixed issues with incremental tests. 2018-03-23 14:04:08 +00:00
incremental-fulldeps Add incremental-fulldeps test suite and regression test for #47290. 2018-01-16 19:31:15 +01:00
mir-opt Updated MIR with UserAssertTy in mir-opt tests. 2018-03-23 11:34:06 +00:00
parse-fail Initial implementation of RFC 2151, Raw Identifiers 2018-03-18 10:07:19 -05:00
pretty fix more typos found by codespell. 2018-02-17 17:38:49 +01:00
run-fail Stabilize termination_trait 2018-03-19 01:31:04 -05:00
run-fail-fulldeps Remove syntax and syntax_pos thread locals 2018-03-14 11:56:01 +01:00
run-make rustc: Add a #[wasm_import_module] attribute 2018-03-22 13:16:38 -07:00
run-make-fulldeps rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
run-pass Auto merge of #49141 - gnzlbg:simd_select, r=alexcrichton 2018-03-25 00:02:48 +00:00
run-pass-fulldeps Merge branch 'master' of https://github.com/Lymia/rust into rollup 2018-03-23 10:16:40 -07:00
run-pass-valgrind
rustdoc Rollup merge of #49189 - GuillaumeGomez:fix-implied-shortcut-links, r=QuietMisdreavus 2018-03-22 22:43:43 +08:00
rustdoc-js Merge branch 'rustdoc_masked' of https://github.com/ollie27/rust into rollup 2018-01-26 06:51:58 -08:00
ui Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakis 2018-03-25 01:30:12 +08:00
ui-fulldeps Update tests 2018-03-16 11:52:46 +01:00
COMPILER_TESTS.md Document only-X test header 2018-03-19 22:09:47 +09:00