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 4 pull requests #71367

Merged
merged 14 commits into from
Apr 21, 2020
Merged

Rollup of 4 pull requests #71367

merged 14 commits into from
Apr 21, 2020

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost

CAD97 and others added 14 commits April 8, 2020 02:09
Co-Authored-By: Ralf Jung <post@ralfj.de>
* Add new error code E0752
* Add span to hir::IsAsync::Yes
* Emit an error if main or the start function is marked as async
* Add two regression tests

Fix formatting errors and bless test outputs
* move tests to ui/async-await

fix test error text

remove span from IsAsync
Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
Stabilize most common subset of alloc_layout_extras

Tracking issue: rust-lang#55724

Specifically, this stabilizes:

```rust
pub fn Layout::align_to(&self, align: usize) -> Result<Layout, LayoutErr>;
pub fn Layout::pad_to_align(&self) -> Layout;
pub fn Layout::extend(&self, next: Layout) -> Result<(Layout, usize), LayoutErr>;
pub fn Layout::array<T>(n: usize) -> Result<Layout, LayoutErr>;
```

Methods that are tracked by rust-lang#55724 but are not stabilized here:

```rust
pub fn Layout::padding_needed_for(&self, align: usize) -> usize;
pub fn Layout::repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>;
pub fn Layout::repeat_packed(&self, n: usize) -> Result<Layout, LayoutErr>;
pub fn Layout::extend_packed(&self, next: Layout) -> Result<Layout, LayoutErr>;
```

Combined, these stabilized functions allow code to construct and manipulate `repr(C)` layouts while letting the standard library handle correctness in the face of edge cases. For example use cases, consider the usage in [hashbrown](https://github.com/Amanieu/hashbrown/blob/2f2af1d/src/raw/mod.rs#L143), [crossbeam-skiplist](https://github.com/crossbeam-rs/crossbeam-skiplist/blob/master/src/base.rs#L99), [pointer-utils/slice-dst](https://github.com/CAD97/pointer-utils/blob/92aeefeed9399f28d1b1654b63f8dcbe1242d8d4/crates/slice-dst/src/layout_polyfill.rs), and of course the standard library itself.

Providing a higher-level API such as `Layout::repr_c<const N: usize>(fields: [Layout; N]) -> Result<(Layout, [usize; N]), LayoutErr>` is blocked on const generics, which are a ways off. Providing an API that doesn't provide offsets would be quite suboptimal, as the reason for calculating the layout like this rather than `Layout::new` is to get the field offsets.

The primary issue with the current API is having to call `.pad_to_align()` to match the layout of a `repr(C)` struct. However, I think this is not just a (failing? limitation?) of the API, but rather intrinsic complexity. While all Rust-defined types have size==stride, and probably will for the foreseeable future, there is no inherent reason why this is a limitation of all allocations. As such, the `Layout` manipulation APIs shouldn't impose this limitation, and instead the higher level api of `repr_c` (or just plain old using `Layout::new`) can make keeping it simple.

cc @matklad r? @rust-lang/libs
…rochenkov

Check that main/start is not async

* Add new error code E0752
* Add span to hir::IsAsync::Yes
* Emit an error if main or the start function is marked as async
* Add two regression tests

This PR fixes rust-lang#68523.
…d_mir, r=ecstatic-morse

MIR: use HirId instead of NodeId to avoid cycles while inlining

I wanted to see if I could limit the number of uses of `NodeId` when `HirId` is available and I saw that some of the MIR `Inliner` code could use `Span` instead of `NodeId`, not unlike in rust-lang#71197.

~If I'm understanding the reason for not calling `optimized_mir` in incremental builds here correctly, this change could also allow us to do so.~

This change could affect performance, so if this approach makes sense, a perf run is probably a good idea.
…ulacrum

Do not build tools if user do not want them

Fixes rust-lang#71307
@Dylan-DPC-zz
Copy link
Author

@bors r+ p=4 rollup=never

@bors
Copy link
Contributor

bors commented Apr 20, 2020

📌 Commit 9a0e702 has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 20, 2020
@bors
Copy link
Contributor

bors commented Apr 21, 2020

⌛ Testing commit 9a0e702 with merge 073744f...

@JohnTitor JohnTitor added the rollup A PR which is a rollup label Apr 21, 2020
@bors
Copy link
Contributor

bors commented Apr 21, 2020

☀️ Test successful - checks-azure
Approved by: Dylan-DPC
Pushing 073744f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 21, 2020
@bors bors merged commit 073744f into rust-lang:master Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants