- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Rollup of 11 pull requests #52616
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 #52616
Conversation
… 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".
Previously when building the error index tool in stage 0 we would attempt to use stage 0 libraries, but because it depends on rustdoc, those don't exist: rustdoc is built against stage 1 libraries. This patch aligns those two and passes the stage 1 libdir to the error index.
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.
Smaller platforms don't merge the loads the same way.
…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`.
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. CC @kennytm @jamesmunns @nerdyvaishali
Reword when `_` couldn't be inferred r? @nikomatsakis
… 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.
Fix links in rustdoc book. Due to a change in how mdbook generates section anchors, headers with non-alphabetic characters now start with "a".
| 
           @bors r+ p=11  | 
    
| 
           📌 Commit 563df6c95a5f470bc16d5ba643632b7f641a5d41 has been approved by   | 
    
| 
           ⌛ Testing commit 563df6c95a5f470bc16d5ba643632b7f641a5d41 with merge 73034f6915859dccb6dcbf9951b84cc98a5b229c...  | 
    
| 
           💔 Test failed - status-travis  | 
    
| 
           The job  Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact   | 
    
Avoid using `#[macro_export]` for documenting builtin macros Use a special `rustc_*` attribute instead. cc rust-lang#52234
Add missing backtick in UniversalRegions doc comment r? @QuietMisdreavus
… r=alexcrichton Run the error index tool against the sysroot libdir Previously when building the error index tool in stage 0 we would attempt to use stage 0 libraries, but because it depends on rustdoc, those don't exist: rustdoc is built against stage 1 libraries. This patch aligns those two and passes the stage 1 libdir to the error index. @GuillaumeGomez discovered that this hasn't worked (presumably for a long time now, but not sure). r? @alexcrichton
…atsakis,Mark-Simulacrum Added new lines to .gitignore. There are a handful of files that I often find in my local working directories that I never want to commit that aren't covered in the `.gitignore` file: `/mir_dump`: Default output location from `-Z mir-dump=all` for a specific test, I can't think of a reason why this should ever be commited. `tags*`/`TAGS*`: I use `vim-gutentags` which outputs `tags` and `tags.temp` which I don't want commited. I also collapsed the `TAGS`, `TAGS.vi`, `TAGS.emacs` into `TAGS*`. `Session.vim`: I use `vim-obsession` to save my current session in Vim, it outputs a `Session.vim` file, this also shouldn't be commited.
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>
    | 
           📌 Commit b954d4d has been approved by   | 
    
Rollup of 11 pull requests Successful merges: - #51807 (Deprecation of str::slice_unchecked(_mut)) - #52051 (mem::swap the obvious way for types smaller than the SIMD optimization's block size) - #52465 (Add CI test harness for `thumb*` targets. [IRR-2018-embedded]) - #52507 (Reword when `_` couldn't be inferred) - #52508 (Document that Unique::empty() and NonNull::dangling() aren't sentinel values) - #52521 (Fix links in rustdoc book.) - #52581 (Avoid using `#[macro_export]` for documenting builtin macros) - #52582 (Typo) - #52587 (Add missing backtick in UniversalRegions doc comment) - #52594 (Run the error index tool against the sysroot libdir) - #52615 (Added new lines to .gitignore.)
| 
           ☀️ Test successful - status-appveyor, status-travis  | 
    
Successful merges:
thumb*targets. [IRR-2018-embedded] #52465 (Add CI test harness forthumb*targets. [IRR-2018-embedded])_couldn't be inferred #52507 (Reword when_couldn't be inferred)#[macro_export]for documenting builtin macros #52581 (Avoid using#[macro_export]for documenting builtin macros)