Commit graph

124480 commits

Author SHA1 Message Date
bors
45d050cde2 Auto merge of #71170 - spastorino:dyn-fnonce-alignment, r=nikomatsakis
Make Box<dyn FnOnce> respect self alignment

Closes #68304

r? @eddyb @nikomatsakis
2020-04-21 08:58:44 +00:00
Niko Matsakis
cb9458d3ff sccs are computed in dependency order
We don't need the `scc_dependency_order` vector, `all_sccs` is already
in dependency order.
2020-04-21 08:57:14 +00:00
Niko Matsakis
c7526fec8a update ref test 2020-04-21 08:40:07 +00:00
Ayush Kumar Mishra
0315864260 Fix #! (shebang) stripping account space issue #70528 2020-04-21 11:44:00 +05:30
Philipp Hansch
30c28a796d
Also mention --fix for nightly users 2020-04-21 07:06:44 +02:00
bors
25f070d1ed Auto merge of #71267 - pnkfelix:issue-71248-dont-need-exports-all-green, r=nagisa
attempt to recover perf by removing `exports_all_green`

attempt to recover perf by removing `exports_all_green` flag.

cc #71248

(My hypothesis is that my use of this flag was an overly conservative generalization of PR #67020.)
2020-04-21 04:35:17 +00:00
Cameron Taggart
6fb524a455 ./x.py fmt 2020-04-20 20:47:27 -06:00
bors
073744f554 Auto merge of #71367 - Dylan-DPC:rollup-ysj4olr, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #69362 (Stabilize most common subset of alloc_layout_extras)
 - #71174 (Check that main/start is not async)
 - #71285 (MIR: use HirId instead of NodeId to avoid cycles while inlining)
 - #71346 (Do not build tools if user do not want them)

Failed merges:

r? @ghost
2020-04-21 01:26:56 +00:00
Cameron Taggart
df3776bc0f allow wasm32 compilation of librustc_data_structures/profiling.rs 2020-04-20 18:09:11 -06:00
bors
b3cb9b8376 Auto merge of #5499 - matthiaskrgr:crash_5497, r=flip1995
fix crash on issue-69020-assoc-const-arith-overflow.rs

Fixes #5497

changelog: fix crash on rustc test issue-69020-assoc-const-arith-overflow.rs
2020-04-20 23:54:15 +00:00
Dylan DPC
9a0e702906
Rollup merge of #71346 - mati865:rustbuild-tools, r=Mark-Simulacrum
Do not build tools if user do not want them

Fixes https://github.com/rust-lang/rust/issues/71307
2020-04-21 00:30:58 +02:00
Dylan DPC
42b533d7ba
Rollup merge of #71285 - ljedrz:mir_inline_span_for_optimized_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 https://github.com/rust-lang/rust/pull/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.
2020-04-21 00:30:57 +02:00
Dylan DPC
e3a514c44a
Rollup merge of #71174 - Nokel81:fix-async-main-error, r=petrochenkov
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 #68523.
2020-04-21 00:30:55 +02:00
Dylan DPC
69a528eda6
Rollup merge of #69362 - CAD97:alloc_layout_extras, r=Amanieu
Stabilize most common subset of alloc_layout_extras

Tracking issue: https://github.com/rust-lang/rust/issues/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 #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](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](92aeefeed9/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
2020-04-21 00:30:53 +02:00
Linus Färnstrand
9af047ff74 Fix show-const-contents rustdoc test 2020-04-20 23:38:07 +02:00
Linus Färnstrand
6850e4a1ae Use assoc float consts instead of module level 2020-04-20 23:38:06 +02:00
Linus Färnstrand
4ddf66187a Define module level int consts from assoc consts 2020-04-20 23:38:06 +02:00
Linus Färnstrand
9fc0833235 Stop accessing module level int consts via crate::<Ty> 2020-04-20 23:38:06 +02:00
Matthias Krüger
7221db2dc3 fix crash on issue-69020-assoc-const-arith-overflow.rs
Fixes #5497
2020-04-20 23:01:34 +02:00
bors
6507728f23 Auto merge of #5496 - phansch:markdown-link, r=flip1995
util/fetch_prs_between.sh: Add Markdown formatted link

This can then be easily copy/pasted into the changelog 💙

changelog: none
2020-04-20 21:00:25 +00:00
Philipp Hansch
803670eeb2
Address review comments 2020-04-20 22:53:00 +02:00
bors
ef6ba82fee Auto merge of #5495 - phansch:update_changelog_docs, r=flip1995
Update the changelog update documentation

I just started working on updating the changelog. Hopefully the docs are a bit clearer now?

r? @flip1995

changelog: none
2020-04-20 20:40:45 +00:00
Philipp Hansch
ca59ff2031
remark fixes 2020-04-20 22:29:27 +02:00
Philipp Hansch
4e63faa6df
Update CHANGELOG.md for Rust 1.43 and 1.44 2020-04-20 22:22:05 +02:00
bors
6ce05bf849 Auto merge of #5332 - DevinR528:if-let-else-mutex, r=flip1995
If let else mutex

changelog: Adds lint to catch incorrect use of `Mutex::lock` in `if let` expressions with lock calls in any of the blocks.

closes: #5219
2020-04-20 20:21:33 +00:00
Devin R
3fbe321440 update stderr file 2020-04-20 15:47:08 -04:00
Amanieu d'Antras
3eb1c43720 Ignore -Zprofile when building compiler_builtins 2020-04-20 20:31:32 +01:00
Jonas Schievink
415fd0cc1a const prop: don't special case return place 2020-04-20 21:18:20 +02:00
Jonas Schievink
9e6f38ab0d Use copy_op_transmute 2020-04-20 21:18:20 +02:00
Jonas Schievink
1ce6e6a999 Bless 32-bit test output 2020-04-20 21:18:20 +02:00
Jonas Schievink
f0ab46953b Remove unnecessary block 2020-04-20 21:18:20 +02:00
Jonas Schievink
a5c1851607 Fix codegen and mir-opt tests
Mostly renamed allocations, but I'm not sure about the const prop tests
2020-04-20 21:18:20 +02:00
Jonas Schievink
c5bfbb6ad1 Update const prop 2020-04-20 21:18:20 +02:00
Jonas Schievink
0fda0fd859 Dump return_place upon returning 2020-04-20 21:18:20 +02:00
Jonas Schievink
34ed891895 Fix pop_stack_frame logic 2020-04-20 21:18:20 +02:00
Jonas Schievink
a417f963fe Remove null places 2020-04-20 21:18:20 +02:00
Jonas Schievink
4eaf535d2b Treat RETURN_PLACE as a normal Local
Copy its value to the `return_place` upon leaving a call frame
2020-04-20 21:18:18 +02:00
bors
20fc02f836 Auto merge of #71356 - Dylan-DPC:rollup-liockhk, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71250 (Replace big JS dict with JSON parsing)
 - #71270 (Fix `has_no_input_arg` check and rename it to `has_only_self_parameter`)
 - #71284 (fix -Zast-json to output correct JSON form)
 - #71328 (Stabilize PathBuf capacity methods)
 - #71334 (Update pattern docs.)

Failed merges:

r? @ghost
2020-04-20 19:11:28 +00:00
Philipp Hansch
90d8b6354e
util/fetch_prs_between.sh: Add Markdown formatted Link
This can then be easily copy/pasted into the changelog 💙
2020-04-20 21:08:55 +02:00
Devin R
489dd2e504 factor ifs into function, add differing mutex test 2020-04-20 15:08:44 -04:00
Philipp Hansch
2141db84eb
Update the changelog update documentation 2020-04-20 20:39:49 +02:00
Mateusz Mikuła
9296d3ba82 Do not build tools if user do not want them 2020-04-20 20:30:13 +02:00
bors
1336558818 Auto merge of #5493 - ebroto:unsafe_derive_deserialize, r=flip1995
Implement unsafe_derive_deserialize lint

Added `unsafe_derive_deserialize` lint to check for cases when automatically deriving `serde::Deserialize` can be problematic, i.e. with types that have methods using `unsafe`.

Closes #5471

changelog: Add lint [`unsafe_derive_deserialize`]
2020-04-20 18:29:00 +00:00
Esteban Küber
e536257061 Ensure tail expression will have a Ty for E0746
When the return type is `!Sized` we look for all the returned
expressions in the body to fetch their types and provide a reasonable
suggestion. The tail expression of the body is normally evaluated after
checking whether the return type is `Sized`. Changing the order of the
evaluation produces undesirable knock down effects, so we detect the
specific case that newcomers are likely to encounter ,returning a single
bare trait object, and only in that case we evaluate the tail
expression's type so that the suggestion will be accurate.
2020-04-20 11:17:03 -07:00
Eduardo Broto
b7f85e8706 Apply suggestions from PR review
* Move the lint to pedantic
* Import used types instead of prefixing with `hir::`
2020-04-20 20:05:15 +02:00
Esteban Küber
e7e3001557 Remove some allocations in predicate evaluation 2020-04-20 10:42:25 -07:00
Esteban Küber
6c921c2c5f Use more Iterators instead of Vecs 2020-04-20 10:42:25 -07:00
Esteban Küber
faeb0404a5 Remove unnecessary allocation 2020-04-20 10:42:25 -07:00
Esteban Küber
2000f91f68 Remove some Vec allocations in an effort to improve perf 2020-04-20 10:42:25 -07:00
CAD97
98f0a8241b Improve Layout::extend docs 2020-04-20 12:30:35 -04:00