Skip to content

Rollup of 7 pull requests - #83789

Closed
Dylan-DPC-zz wants to merge 29 commits into
rust-lang:masterfrom
Dylan-DPC-zz:rollup-rjgh15s
Closed

Rollup of 7 pull requests#83789
Dylan-DPC-zz wants to merge 29 commits into
rust-lang:masterfrom
Dylan-DPC-zz:rollup-rjgh15s

Conversation

@Dylan-DPC-zz

Copy link
Copy Markdown

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

jyn514and others added 29 commits March 25, 2021 11:40
This cleans up the code quite a bit, and also makes the next commit much
easier.
The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: rust-lang/docs.rs#1312 (comment)
The end goal is to fixrust-lang/docs.rs#1327
by reverting rust-lang/docs.rs#1324.
This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.
Add documentation to the system functions and `SAFETY` comments.
Refactored helper functions, fixing the correctness of `get_header`.
Co-authored-by: David Tolnay <dtolnay@gmail.com>
This also changes custom themes from Toolchain to Crate files.
This change reduces the risk of impacting coverage tests on unrelated
changes (such as MIR and Span changes), and reduces the burden when
blessing coverage changes in case it is necessary.
* Remove all spanview tests. The spanview tests were useful during
development, but they can be generated as needed, via compiler command
line flags. They aren't critical to confirming coverage results. (The
coverage report tests are sufficient.)
When spanview regeneration was necessary, the diffs were way too hard
to read to be useful anyway. So I'm removing them to reduce friction
from a feature that is no longer useful.
* Remove the requirement for `llvm-cov show --debug` when blessing
tests. The `--debug` flag is, unfortunately, only available if LLVM is
built with `optimize = false` (in Rust's config.toml). This adds
significant time and resource burdens to the contributor's build. As
it turns out, for other reasons in the past, I wasn't actually using
the debug output (counter info) to validate coverage anymore either,
so it was required for no reason, I now realize.
Rework `std::sys::windows::alloc`
I came across rust-lang#76676 (comment), which points out that there was unsound code in the Windows alloc code, creating a &mut to possibly uninitialized memory. I reworked the code so that that particular issue does not occur anymore, and started adding more documentation and safety comments.
Full list of changes:
- moved and documented the relevant Windows Heap API functions
- refactor `allocate_with_flags` to `allocate` (and remove the other helper functions), which now takes just a `bool` if the memory should be zeroed
- add checks for if `GetProcessHeap` returned null
- add a test that checks if the size and alignment of a `Header` are indeed <= `MIN_ALIGN`
- add `#![deny(unsafe_op_in_unsafe_fn)]` and the necessary unsafe blocks with safety comments
I feel like I may have overdone the documenting, the unsoundness fix is the most important part; I could spit this PR up in separate parts.
…imulacrum
rustdoc: Add unstable option to only emit shared/crate-specific files
The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: rust-lang/docs.rs#1312 (comment)
The end goal is to fixrust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324.
This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.
I recommend reviewing this one commit at a time.
r? `@GuillaumeGomez` cc `@Nemo157` `@pietroalbini`
…r=m-ou-se
Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic
This fixes the double-drop but it leaves a behavioral difference compared to the default implementation intact: In the default implementation the source and the destination vec are separate objects, so they get dropped separately. Here they share an allocation and the latter only exists as a pointer into the former. So if dropping the former panics then this fix will leak more items than the default implementation would. Is this acceptable or should the specialization also mimic the default implementation's drops-during-panic behavior?
Fixesrust-lang#83618
`@rustbot` label T-libs-impl
…r=estebank
give full path of constraint in suggest_constraining_type_param
closerust-lang#83513
Use undef for uninitialized bytes in constants
Fixesrust-lang#83657
This generates good code when the const is fully uninit, e.g.
```rust
#[no_mangle]
pub const fn fully_uninit() -> MaybeUninit<[u8; 10]> {
const M: MaybeUninit<[u8; 10]> = MaybeUninit::uninit();
M
}
```
generates
```asm
fully_uninit:
ret
```
as you would expect.
There is no improvement, however, when it's partially uninit, e.g.
```rust
pub struct PartiallyUninit {
x: u64,
y: MaybeUninit<[u8; 10]>
}
#[no_mangle]
pub const fn partially_uninit() -> PartiallyUninit {
const X: PartiallyUninit = PartiallyUninit { x: 0xdeadbeefcafe, y: MaybeUninit::uninit() };
X
}
```
generates
```asm
partially_uninit:
mov	rax, rdi
mov	rcx, qword ptr [rip + .L__unnamed_1+16]
mov	qword ptr [rdi + 16], rcx
movups	xmm0, xmmword ptr [rip + .L__unnamed_1]
movups	xmmword ptr [rdi], xmm0
ret
.L__unnamed_1:
.asciz	"\376\312\357\276\255\336\000"
.zero	16
.size	.L__unnamed_1, 24
```
which copies a bunch of zeros in place of the undef bytes, the same as before this change.
The constant is undef where it should be, though (see the added test) so this seems to be a missed optimization in LLVM.
Simplify coverage tests
This change reduces the risk of impacting coverage tests on unrelated
changes (such as MIR and Span changes), and reduces the burden when
blessing coverage changes in case it is necessary.
* Remove all spanview tests. The spanview tests were useful during
development, but they can be generated as needed, via compiler command
line flags. They aren't critical to confirming coverage results. (The
coverage report tests are sufficient.)
When spanview regeneration was necessary, the diffs were way too hard
to read to be useful anyway. So I'm removing them to reduce friction
from a feature that is no longer useful.
* Remove the requirement for `llvm-cov show --debug` when blessing
tests. The `--debug` flag is, unfortunately, only available if LLVM is
built with `optimize = false` (in Rust's config.toml). This adds
significant time and resource burdens to the contributor's build. As
it turns out, for other reasons in the past, I wasn't actually using
the debug output (counter info) to validate coverage anymore either,
so it was required for no reason, I now realize.
…atsakis
2229: Support migration via rustfix
- Adds support of machine applicable suggestions for `disjoint_capture_drop_reorder`.
- Doesn't migrate in the case of pre-existing bugs in user code
r? `@nikomatsakis`
@rustbotrustbot added the rollup A PR which is a rollup label Apr 2, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollupA PR which is a rollup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@Dylan-DPC-zz@rustbot@jyn514@CDirkx@the8472@arora-aman@0xPoe@erikdesjardins@Dylan-DPC