Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #52588

Closed
wants to merge 40 commits into from
Closed

Rollup of 11 pull requests #52588

wants to merge 40 commits into from

Conversation

kennytm
Copy link
Member

@kennytm kennytm commented Jul 21, 2018

Successful merges:

Failed merges:

r? @ghost

estebank and others added 29 commits June 11, 2018 15:52
Deemphasize the secondary messages so that all other highlights stand
out more.
LLVM isn't able to remove the alloca for the unaligned block in the SIMD tail in some cases, so doing this helps SRoA work in cases where it currently doesn't.  Found in the `replace_with` RFC discussion.
… values

The documentation of Unique::empty() and NonNull::dangling() could
potentially suggest that they work as sentinel values indicating a
not-yet-initialized pointer. However, they both declare a non-null
pointer equal to the alignment of the type, which could potentially
reference a valid value of that type (specifically, the first such valid
value in memory). Explicitly document that the return value of these
functions does not work as a sentinel value.
Due to a change in how mdbook generates section anchors, headers
with non-alphabetic characters now start with "a".
@kennytm
Copy link
Member Author

kennytm commented Jul 21, 2018

@bors r+ p=8

…excrichton

Deprecation of str::slice_unchecked(_mut)

Closes rust-lang#51715

I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0.

Additionally I've replaced `slice_unchecked` uses with `get_unchecked`. The only places where this method is still used are `src/liballoc/tests/str.rs` and `src/liballoc/tests/str.rs`.
mem::swap the obvious way for types smaller than the SIMD optimization's block size

LLVM isn't able to remove the alloca for the unaligned block in the post-SIMD tail in some cases, so doing this helps SRoA work in cases where it currently doesn't.  Found in the `replace_with` RFC discussion.

Examples of the improvements:
<details>
 <summary>swapping `[u16; 3]` takes 1/3 fewer instructions and no stackalloc</summary>

```rust
type Demo = [u16; 3];
pub fn swap_demo(x: &mut Demo, y: &mut Demo) {
    std::mem::swap(x, y);
}
```

nightly:
```asm
_ZN4blah9swap_demo17ha1732a9b71393a7eE:
.seh_proc _ZN4blah9swap_demo17ha1732a9b71393a7eE
	sub	rsp, 32
	.seh_stackalloc 32
	.seh_endprologue
	movzx	eax, word ptr [rcx + 4]
	mov	word ptr [rsp + 4], ax
	mov	eax, dword ptr [rcx]
	mov	dword ptr [rsp], eax
	movzx	eax, word ptr [rdx + 4]
	mov	word ptr [rcx + 4], ax
	mov	eax, dword ptr [rdx]
	mov	dword ptr [rcx], eax
	movzx	eax, word ptr [rsp + 4]
	mov	word ptr [rdx + 4], ax
	mov	eax, dword ptr [rsp]
	mov	dword ptr [rdx], eax
	add	rsp, 32
	ret
	.seh_handlerdata
	.section	.text,"xr",one_only,_ZN4blah9swap_demo17ha1732a9b71393a7eE
	.seh_endproc
```

this PR:
```asm
_ZN4blah9swap_demo17ha1732a9b71393a7eE:
	mov	r8d, dword ptr [rcx]
	movzx	r9d, word ptr [rcx + 4]
	movzx	eax, word ptr [rdx + 4]
	mov	word ptr [rcx + 4], ax
	mov	eax, dword ptr [rdx]
	mov	dword ptr [rcx], eax
	mov	word ptr [rdx + 4], r9w
	mov	dword ptr [rdx], r8d
	ret
```
</details>

<details>
 <summary>`replace_with` optimizes down much better</summary>

Inspired by rust-lang/rfcs#2490,

```rust
fn replace_with<T, F>(x: &mut Option<T>, f: F)
    where F: FnOnce(Option<T>) -> Option<T>
{
    *x = f(x.take());
}

pub fn inc_opt(mut x: &mut Option<i32>) {
    replace_with(&mut x, |i| i.map(|j| j + 1));
}
```

Rust 1.26.0:
```asm
_ZN4blah7inc_opt17heb0acb64c51777cfE:
	mov	rax, qword ptr [rcx]
	movabs	r8, 4294967296
	add	r8, rax
	shl	rax, 32
	movabs	rdx, -4294967296
	and	rdx, r8
	xor	r8d, r8d
	test	rax, rax
	cmove	rdx, rax
	setne	r8b
	or	rdx, r8
	mov	qword ptr [rcx], rdx
	ret
```

Nightly (better thanks to ScalarPair, maybe?):
```asm
_ZN4blah7inc_opt17h66df690be0b5899dE:
	mov	r8, qword ptr [rcx]
	mov	rdx, r8
	shr	rdx, 32
	xor	eax, eax
	test	r8d, r8d
	setne	al
	add	edx, 1
	mov	dword ptr [rcx], eax
	mov	dword ptr [rcx + 4], edx
	ret
```

This PR:
```asm
_ZN4blah7inc_opt17h1426dc215ecbdb19E:
	xor	eax, eax
	cmp	dword ptr [rcx], 0
	setne	al
	mov	dword ptr [rcx], eax
	add	dword ptr [rcx + 4], 1
	ret
```

Where that add is beautiful -- using an addressing mode to not even need to explicitly go through a register -- and the remaining imperfection is well-known (rust-lang#49420 (comment)).
</details>
Add tests for ICEs which no longer repro

Adds tests for some ICEs which no longer repro and closes the associated issues.
Avoid using `#[macro_export]` for documenting builtin macros

Use a special `rustc_*` attribute instead.

cc rust-lang#52234
Fix links in rustdoc book.

Due to a change in how mdbook generates section anchors, headers
with non-alphabetic characters now start with "a".
Add missing backtick in UniversalRegions doc comment
Add CI test harness for `thumb*` targets. [IRR-2018-embedded]

This pull request will do the following (rather trivial) changes:
- Fix rust-lang#52163. In other words, we enabled `./x.py test src/test/run-make` for `no_std` targets.
- Modify `dist-various-1` Dockerfile.
  - CI now performs `run-make` test run on the targets below:
    - `thumbv6m-none-eabi`
    - `thumbv7m-none-eabi`
    - `thumbv7em-none-eabi`
    - `thumbv7em-none-eabihf`.
- ~~Add `thumb-none` Dockerfile.~~
  - ~~Initially, `thumbv7m-none-eabi`, `thumbv7em-none-eabi` and `thumbv7em-none-eabihf` are included as the tested target. `thumbv6m-none-eabi` is disabled for now because LLVM support is not certain.~~
- ~~Add `thumb-none` to .travis.yml~~

Note:
- `run-make` tests are not implemented yet. This PR is test harness only.

The amount of change is very small, but I'd like to open the pull request while the change is trivial.
Because I'm not very used to pull request process, I want to make a small progress first.  This PR will be a foundation for later additions.
@kennytm kennytm changed the title Rollup of 8 pull requests Rollup of 9 pull requests Jul 21, 2018
@kennytm
Copy link
Member Author

kennytm commented Jul 21, 2018

@bors r+

Removed #51485 (already testing)
Removed #52571 (caused test failure)
Added #52521, #52587, #52465.

@bors
Copy link
Contributor

bors commented Jul 21, 2018

📌 Commit f79284a has been approved by kennytm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 21, 2018
…, r=GuillaumeGomez

Remove highlighting from secondary messages

Deemphasize the secondary messages so that all other highlights stand
out more.

<img width="684" alt="" src="https://user-images.githubusercontent.com/1606434/41261199-7b4fe96e-6d8f-11e8-8619-04d170617df2.png">
@kennytm kennytm changed the title Rollup of 9 pull requests Rollup of 10 pull requests Jul 21, 2018
@kennytm
Copy link
Member Author

kennytm commented Jul 21, 2018

@bors r+

Added back #51485 (interrupted by spurious error)

@bors
Copy link
Contributor

bors commented Jul 21, 2018

📌 Commit 51f50ad has been approved by kennytm

… r=Mark-Simulacrum

Document that Unique::empty() and NonNull::dangling() aren't sentinel values

The documentation of Unique::empty() and NonNull::dangling() could
potentially suggest that they work as sentinel values indicating a
not-yet-initialized pointer. However, they both declare a non-null
pointer equal to the alignment of the type, which could potentially
reference a valid value of that type (specifically, the first such valid
value in memory). Explicitly document that the return value of these
functions does not work as a sentinel value.
@kennytm kennytm changed the title Rollup of 10 pull requests Rollup of 11 pull requests Jul 21, 2018
@kennytm
Copy link
Member Author

kennytm commented Jul 21, 2018

@bors r+

Added #52508

@bors
Copy link
Contributor

bors commented Jul 21, 2018

📌 Commit 3c66e8b has been approved by kennytm

@bors
Copy link
Contributor

bors commented Jul 21, 2018

⌛ Testing commit 3c66e8b with merge 84454cc2a7ff990ee18efefd122d055e434a4053...

@bors
Copy link
Contributor

bors commented Jul 21, 2018

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 21, 2018
@kennytm kennytm closed this Jul 22, 2018
@Centril Centril added the rollup A PR which is a rollup label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.