Commit Graph

107751 Commits

Author SHA1 Message Date
bors
d9051341a1 Auto merge of #68943 - ecstatic-morse:no-useless-drop-on-enum-variants, r=matthewjasper
Skip `Drop` terminators for enum variants without drop glue

Split out from #68528.

When doing drop elaboration for an `enum` that may or may not be moved out of (an open drop), we check the discriminant of the `enum` to see whether the live variant has any drop flags and then check the drop flags to see whether we need to drop each field. Sometimes, however, the live
variant has no move paths and thus no drop flags. In this case, we still emit a drop terminator
for the entire enum after checking the enum discriminant. This drop shim will check the discriminant of the enum *again* and then drop the fields of the active variant. If the active variant has no drop glue, nothing will be done.

This commit skips emitting the drop terminator during drop elaboration when the "otherwise" variants, those without move paths, have no drop glue. A common example of this scenario is when an `Option` is moved from, since `Option::None` never needs drop glue. Below is a fragment the pre-codegen CFG for `Option::unwrap_or` in which we check the drop flag (`_5`) for `self` (`_1`), before and after the change.

Before:

![image](https://user-images.githubusercontent.com/29463364/74078927-52942380-49e5-11ea-8e34-4b9d6d94ef25.png)

After:

![image](https://user-images.githubusercontent.com/29463364/74078945-78b9c380-49e5-11ea-8302-b043c4a7515a.png)

This change doesn't do much on its own, but it is a prerequisite to get the perf gains from #68528.

cc @arielb1
2020-03-01 04:42:21 +00:00
bors
2917d99302 Auto merge of #69592 - petrochenkov:nosyntax, r=Centril
Rename `libsyntax` to `librustc_ast`

This was the last rustc crate that wasn't following the `rustc_*` naming convention.

Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-03-01 01:36:58 +00:00
Oliver Middleton
3c97f8ad12 rustdoc: HTML escape crate version
As `--crate-version` accepts arbitrary strings they need to be escaped.
2020-03-01 00:15:44 +00:00
bors
d3c79346a3 Auto merge of #69590 - Dylan-DPC:rollup-i3z0sic, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #69504 (Use assert_ne in hash tests)
 - #69571 (remove unneeded .as_ref() calls.)
 - #69572 (use .iter() instead of .into_iter() on references)
 - #69581 (fix aliasing violation in align_to_mut)
 - #69582 (improve transmute and Vec::from_raw_parts docs)
 - #69584 (Correct comment to match behavior)
 - #69587 (rustc_parse: Tweak the function parameter name check)

Failed merges:

r? @ghost
2020-02-29 20:23:10 +00:00
David
453c505147 Replace ptr hashing with ptr casting
Implementes suggeseted changes by Centril.

This checks whether the memory location of the cast remains the same
after atttempting to parse a postfix operator after a cast has been
parsed. If the address is not the same, an illegal postfix operator
was parsed.

Previously the code generated a hash of the pointer, which was overly
complex and inefficent. Casting the pointers and comparing them
is simpler and more effcient.
2020-02-29 11:05:39 -08:00
Vadim Petrochenkov
e08c279eac Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
Jake Vossen
5f3ffee6b7
added try_find_description to distinguish no desc from invalid code 2020-02-29 11:53:51 -07:00
Dylan DPC
ad200af5c4
Rollup merge of #69587 - petrochenkov:reqname, r=Centril
rustc_parse: Tweak the function parameter name check

The function doesn't need a full token, only its edition.

Noticed while implementing https://github.com/rust-lang/rust/pull/69384.
I'm still not sure whether normalized or unnormalized token is a better fit for the edition check here, so  https://github.com/rust-lang/rust/pull/69384 and this PR just keep the status quo behavior.
r? @Centril
2020-02-29 18:54:07 +01:00
Dylan DPC
cf48ca6170
Rollup merge of #69584 - zantysor:fix-saturating-duration-since-comment, r=varkor
Correct comment to match behavior

Corrects the header comment on `saturating_duration_since` to match the behavior of returning 0 if the other timestamp is _later_ than the invocant, not earlier,

This is purely a documentation change, so hopefully it doesn't require an issue; if it does, I'll open one and resubmit.
2020-02-29 18:54:05 +01:00
Dylan DPC
015bb74650
Rollup merge of #69582 - RalfJung:vec-parts, r=Centril
improve transmute and Vec::from_raw_parts docs

I think this fixes https://github.com/rust-lang/rust/issues/64073. @Shnatsel please let me know if this is less confusing. :)
2020-02-29 18:54:04 +01:00
Dylan DPC
02381db8e0
Rollup merge of #69581 - RalfJung:align_to_mut, r=Centril
fix aliasing violation in align_to_mut

Fixes https://github.com/rust-lang/rust/issues/68549

I decided to add the testcase here to make it all one PR, but if you prefer I can also add that test case in the Miri repo instead.
2020-02-29 18:54:02 +01:00
Dylan DPC
7d43997053
Rollup merge of #69572 - matthiaskrgr:try_err_and_iter_on_ref, r=Centril
use .iter() instead of .into_iter() on references
2020-02-29 18:54:01 +01:00
Dylan DPC
b22631bfaf
Rollup merge of #69571 - matthiaskrgr:useless_asref, r=Centril
remove unneeded .as_ref() calls.
2020-02-29 18:53:59 +01:00
Vadim Petrochenkov
6054a30370 Make it build again 2020-02-29 20:47:10 +03:00
Vadim Petrochenkov
e94d3b70cb Move directory libsyntax -> librustc_ast 2020-02-29 20:47:10 +03:00
Mateusz Mikuła
cdb6955659 Update src/bootstrap/dist.rs
Co-Authored-By: kennytm <kennytm@gmail.com>
2020-02-29 18:42:42 +01:00
bors
4f0edbdfe5 Auto merge of #69263 - anyska:blacklist-powerpc-zst, r=nagisa
Blacklist powerpc-unknown-linux-{gnu,musl} as having non-ignored GNU C ZSTs.

Ref #64259 (this is a simpler alternative to that). See also https://github.com/rust-lang/rust/pull/64259#issuecomment-585815831.
2020-02-29 17:14:54 +00:00
Vadim Petrochenkov
65a666c339 rustc_parse: Tweak the function parameter name check 2020-02-29 18:56:05 +03:00
Ralf Jung
b6e847cc98
Fix typo
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-02-29 16:20:17 +01:00
Matthias Krüger
c9a02c2e42 use .copied() instead of .map(|x| *x) on iterators 2020-02-29 15:23:13 +01:00
bors
e9bca510fe Auto merge of #69260 - GuillaumeGomez:create-E0747-error-code, r=varkor,estebank
Create E0747 error code for unterminated raw strings

Reopening of #66035.

r? @estebank
2020-02-29 13:59:45 +00:00
Ralf Jung
c34451ffb7 fix aliasing violation in align_to_mut 2020-02-29 14:53:20 +01:00
Zan Tysor
435de171a3 correct comment to match behavior 2020-02-29 08:40:09 -05:00
LeSeulArtichaut
febf72861b Add regression test 2020-02-29 14:38:39 +01:00
LeSeulArtichaut
c8401a5046 Do not ICE on invalid type node 2020-02-29 14:19:48 +01:00
Ralf Jung
0edc90cd18 clarify alignment requirements in Vec::from_raw_parts 2020-02-29 14:07:20 +01:00
Ralf Jung
b961a03060 transmute: improve Vec example 2020-02-29 14:03:25 +01:00
Vadim Petrochenkov
7de9a72ca3 parser: Remove Parser::prev_span 2020-02-29 15:00:58 +03:00
Vadim Petrochenkov
d0ba4387c2 parser: prev_span -> prev_token.span 2020-02-29 14:57:14 +03:00
Guillaume Gomez
6fba47f66f Clean up E0375 explanation 2020-02-29 12:18:46 +01:00
Guillaume Gomez
45053d1fa6 Clean up E0374 explanation 2020-02-29 12:13:42 +01:00
Matthias Krüger
10b814608b nightly: bootstrap from 1.42.0-beta.5 (4e1c5f0e9 2020-02-28)
This beta snapshot has the llvm miscompilation fix included and is bootstrapped from the stable version that also has it included.
2020-02-29 11:44:09 +01:00
bors
3f9bddc7fe Auto merge of #69570 - Dylan-DPC:rollup-d6boczt, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #69477 (docs: add mention of async blocks in move keyword docs)
 - #69504 (Use assert_ne in hash tests)
 - #69546 (use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.)
 - #69551 (use is_empty() instead of len() == x  to determine if structs are empty.)
 - #69563 (Fix no_std detection for target triples)
 - #69567 (use .to_string() instead of format!() macro to create strings)

Failed merges:

r? @ghost
2020-02-29 10:43:32 +00:00
Matthias Krüger
56a3da3bd0 simplify boolean expressions 2020-02-29 11:36:18 +01:00
Ralf Jung
5982e9d3ca downgrade some assertions to debug_ again 2020-02-29 10:25:57 +01:00
bors
04e7f96dd8 Auto merge of #69227 - Marwes:buffer_stderr, r=varkor
perf: Buffer stderr when writing json errors/warnings

Since `stderr` is unbuffered, writing out json messages actually take up
about ~10%/0.1s of the runtime of the `inflate` benchmark as it generates a fair number of warnings.

cc #64413
2020-02-29 07:27:29 +00:00
Youngsuk Kim
6e265c5bc5
Remove trailing whitespace
Removed trailing whitespace which caused to fail pretty-check
2020-02-29 00:55:05 -05:00
Youngsuk Kim
fb46d2b82e
Update src/liballoc/vec.rs
Following suggestion from @jonas-schievink

Co-Authored-By: Jonas Schievink <jonasschievink@gmail.com>
2020-02-29 00:52:32 -05:00
Dylan MacKenzie
21cd1fe0bd Process RequiresStorage results in pre-order
Reverse post-order requires an allocation.
2020-02-28 21:29:21 -08:00
John Kåre Alsaker
98251d8fb2 Reduce visibility of get_module_parent_node and remove get_module_parent 2020-02-29 05:59:58 +01:00
John Kåre Alsaker
542d813475 Add a parent_module_from_def_id query 2020-02-29 05:59:38 +01:00
bors
55aee8d496 Auto merge of #69255 - estebank:e0599-details, r=varkor
Add more context to E0599 errors

Point at the intermediary unfulfilled trait bounds.

Fix #52523, fix #61661, cc #36513, fix #68131, fix #64417, fix #61768, cc #57457, cc #9082, fix #57994, cc #64934, cc #65149.
2020-02-29 03:52:53 +00:00
Matthias Krüger
de7c40c168 use .iter() instead of .into_iter() on references. 2020-02-29 03:14:01 +01:00
Matthias Krüger
a8a153b1a9 don't use question mark operator on Err(), return the Result directly instead. 2020-02-29 02:48:27 +01:00
Dylan DPC
bbfec7ca41
Rollup merge of #69567 - matthiaskrgr:useless_fmt, r=nagisa
use .to_string() instead of format!() macro to create strings

handles what is left after https://github.com/rust-lang/rust/pull/69541
2020-02-29 02:16:24 +01:00
Dylan DPC
1bb6760968
Rollup merge of #69563 - andre-richter:fix_no_std_match, r=Mark-Simulacrum
Fix no_std detection for target triples

The current check for wether a target is no_std or not is matching for the string `-none-` in a target triple. This doesn't work for triples that end in `-none`, like `aarch64-unknown-none`.

Fix this by matching for `-none` instead.

I checked for all the current target triples containing `none`, and this should not generate any false positives.

This fixes an issue encountered in https://github.com/rust-lang/rust/pull/68334
2020-02-29 02:16:23 +01:00
Dylan DPC
c8db7dcc1c
Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-Simulacrum
use is_empty() instead of len() == x  to determine if structs are empty.
2020-02-29 02:16:21 +01:00
Dylan DPC
ba2df27525
Rollup merge of #69546 - matthiaskrgr:slice_to_vec, r=davidtwco,nagisa
use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.
2020-02-29 02:16:20 +01:00
Dylan DPC
2774d48337
Rollup merge of #69504 - MichaelMcDonnell:hash_assert_ne, r=LukasKalbertodt
Use assert_ne in hash tests

The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.
2020-02-29 02:16:18 +01:00
Dylan DPC
222aa62008
Rollup merge of #69477 - Pulkit07:issue69298, r=cramertj
docs: add mention of async blocks in move keyword docs

Fixes #69298
2020-02-29 02:16:17 +01:00