]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #69760 - Centril:parse-expr-improve, r=estebank
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:45 +0000 (14:03 +0100)]
Rollup merge of #69760 - Centril:parse-expr-improve, r=estebank

Improve expression & attribute parsing

This PR includes misc improvements to expression and attribute parsing.

1. Some code simplifications
2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.)
3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.)
4. ^--- These are done so that code sharing in block parsing is increased.
5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.)
6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.)
7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.)
8. Simplified attribute parsing code & slightly improved diagnostics.
9. Added recovery for e.g., `Box<('a) + Trait>`.
10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`.

r? @estebank

4 years agoRollup merge of #69603 - chrissimpkins:tidy-docs-update, r=petrochenkov
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:44 +0000 (14:03 +0100)]
Rollup merge of #69603 - chrissimpkins:tidy-docs-update, r=petrochenkov

tidy: replace `make check` with `./x.py test` in documentation

This PR includes a minor documentation update for tidy.  It replaces the `make check` approach with `./x.py test` and describes how to execute the tidy checks (only) with ~~`./x.py test src/tools/tidy`~~ `./x.py test tidy`.

4 years agoRollup merge of #66472 - GuillaumeGomez:show-coverage-json, r=ollie27
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:42 +0000 (14:03 +0100)]
Rollup merge of #66472 - GuillaumeGomez:show-coverage-json, r=ollie27

--show-coverage json

The purpose of this change is to be able to use it as a tool in docs.rs in order to provide some more stats to crates' owners. Eventually even create a badge or something along the line.

r? @QuietMisdreavus

4 years agoAuto merge of #69914 - Centril:rollup-wtmdinz, r=Centril
bors [Wed, 11 Mar 2020 09:37:19 +0000 (09:37 +0000)]
Auto merge of #69914 - Centril:rollup-wtmdinz, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #66059 (mem::zeroed/uninit: panic on types that do not permit zero-initialization)
 - #69373 (Stabilize const for integer {to,from}_{be,le,ne}_bytes methods)
 - #69591 (Use TypeRelating for instantiating query responses)
 - #69625 (Implement nth, last, and count for iter::Copied)
 - #69645 (const forget tests)
 - #69766 (Make Point `Copy` in arithmetic documentation)
 - #69825 (make `mem::discriminant` const)
 - #69859 (fix #62456)
 - #69891 (Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns)
 - #69896 (parse: Tweak the function parameter edition check)

Failed merges:

r? @ghost

4 years agoRollup merge of #69896 - petrochenkov:reqname2, r=Centril
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:33 +0000 (10:36 +0100)]
Rollup merge of #69896 - petrochenkov:reqname2, r=Centril

parse: Tweak the function parameter edition check

Follow-up to https://github.com/rust-lang/rust/pull/69801.

Edition of a code fragment is inferred from "the place where the code is written".
For individual tokens like edition-specific keywords it may be the span of the token itself ("uninterpolated" span), but for larger code fragments it's probably not, in the test example the trait method is obviously written in "2015 edition code".

r? @Centril

4 years agoRollup merge of #69891 - Centril:fix-69875, r=varkor
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:31 +0000 (10:36 +0100)]
Rollup merge of #69891 - Centril:fix-69875, r=varkor

Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns

> There's an implicit invariant that there should be no or-patterns directly in the first column of the matrix, but this invariant is broken exactly when an or-pattern has a child that is itself an or-pattern.

Here we preserve this broken invariant by recursively expanding `PatKind::Or`s in `Matrix::push`.
Fixes https://github.com/rust-lang/rust/issues/69875.

r? @varkor
cc @Nadrieril
cc https://github.com/rust-lang/rust/issues/54883

4 years agoRollup merge of #69859 - contrun:fix-62456, r=matthewjasper
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:29 +0000 (10:36 +0100)]
Rollup merge of #69859 - contrun:fix-62456, r=matthewjasper

fix #62456

closes https://github.com/rust-lang/rust/issues/62456

4 years agoRollup merge of #69825 - lcnr:discriminant, r=oli-obk
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:28 +0000 (10:36 +0100)]
Rollup merge of #69825 - lcnr:discriminant, r=oli-obk

make `mem::discriminant` const

implements #69821, which could be used as a tracking issue for `const_discriminant`.

Should this be added to the meta tracking issue #57563?
@Lokathor

4 years agoRollup merge of #69766 - skade:make-point-copy-in-add-documentation, r=shepmaster
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:26 +0000 (10:36 +0100)]
Rollup merge of #69766 - skade:make-point-copy-in-add-documentation, r=shepmaster

Make Point `Copy` in arithmetic documentation

Small composite types like `Point { x: i32, y: i32}` are plain
old data and we should encourage users to derive `Copy` on them.

This changes the semantics of the edited examples slightly: instead
of consuming the operands during addition, it will copy them. This
is desired behaviour.

4 years agoRollup merge of #69645 - DutchGhost:const-forget-tests, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:24 +0000 (10:36 +0100)]
Rollup merge of #69645 - DutchGhost:const-forget-tests, r=Dylan-DPC

const forget tests

Adds tests for https://github.com/rust-lang/rust/pull/69617

4 years agoRollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:22 +0000 (10:36 +0100)]
Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus

Implement nth, last, and count for iter::Copied

Implement nth, last and count for iter::Copied.

4 years agoRollup merge of #69591 - matthewjasper:query-response-relate, r=nikomatsakis
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:19 +0000 (10:36 +0100)]
Rollup merge of #69591 - matthewjasper:query-response-relate, r=nikomatsakis

Use TypeRelating for instantiating query responses

`eq` can add constraints to `RegionConstraintData`, which isn't allowed during borrow checking outside of a `CustomTypeOp`. Use `TypeRelating` instead to always push constraints to the obligations list.

closes #69490

4 years agoRollup merge of #69373 - tspiteri:const_int_conversion, r=oli-obk
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:18 +0000 (10:36 +0100)]
Rollup merge of #69373 - tspiteri:const_int_conversion, r=oli-obk

Stabilize const for integer {to,from}_{be,le,ne}_bytes methods

All of these functions can be implemented simply and naturally as const functions, e.g. `u32::from_le_bytes` can be implemented as
```rust
(bytes[0] as u32)
    | (bytes[1] as u32) << 8
    | (bytes[2] as u32) << 16
    | (bytes[3] as u32) << 24
```
So stabilizing the constness will not expose that internally they are implemented using transmute which is not const in stable.

4 years agoRollup merge of #66059 - RalfJung:panic-on-non-zero, r=eddyb
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:16 +0000 (10:36 +0100)]
Rollup merge of #66059 - RalfJung:panic-on-non-zero, r=eddyb

mem::zeroed/uninit: panic on types that do not permit zero-initialization

r? @eddyb @oli-obk

Cc https://github.com/rust-lang/rust/issues/62825

Also see [this summary comment](https://github.com/rust-lang/rust/pull/66059#issuecomment-586734747)

4 years agoparse: Tweak the function parameter edition check
Vadim Petrochenkov [Tue, 10 Mar 2020 18:02:15 +0000 (21:02 +0300)]
parse: Tweak the function parameter edition check

Move anon-params tests to ui/anon-params.

4 years agoAuto merge of #66364 - Centril:cleanup-macro-def, r=petrochenkov,eddyb
bors [Tue, 10 Mar 2020 17:12:48 +0000 (17:12 +0000)]
Auto merge of #66364 - Centril:cleanup-macro-def, r=petrochenkov,eddyb

Cleanup `rmeta::MacroDef`

Avoid using rountrip parsing in the encoder and in `fn load_macro_untracked`.

The main reason I was interested in this was to remove `rustc_parse` as a dependency of `rustc_metadata` but it seems like this had other benefits as well.

Fixes #49511.

r? @eddyb
cc @matthewjasper @estebank @petrochenkov

4 years agoMake Point `Copy` in arithmetic documentation
Florian Gilcher [Fri, 6 Mar 2020 09:37:23 +0000 (10:37 +0100)]
Make Point `Copy` in arithmetic documentation

Small composite types like `Point { x: i32, y: i32}` are plain
old data and we should encourage users to derive `Copy` on them.

This changes the semantics of the edited examples slightly: instead
of consuming the operands during addition, it will copy them. This
is desired behaviour.

Co-Authored-By: Jake Goulding <shepmaster@mac.com>
4 years agoMatrix::push: recursively expand or-patterns
Mazdak Farrokhzad [Tue, 10 Mar 2020 15:20:47 +0000 (16:20 +0100)]
Matrix::push: recursively expand or-patterns

4 years agoexplain the use of a custom identity function
Bastian Kauschke [Tue, 10 Mar 2020 11:46:22 +0000 (12:46 +0100)]
explain the use of a custom identity function

4 years agoparse_if_expr: recover on attributes
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:16:29 +0000 (17:16 +0100)]
parse_if_expr: recover on attributes

4 years agotrait-object-lifetime-parens: improve recovery.
Mazdak Farrokhzad [Sat, 7 Mar 2020 12:52:55 +0000 (13:52 +0100)]
trait-object-lifetime-parens: improve recovery.

4 years agouse check_path more
Mazdak Farrokhzad [Sat, 7 Mar 2020 12:15:58 +0000 (13:15 +0100)]
use check_path more

4 years agosimplify & improve parse_ty_tuple_or_parens
Mazdak Farrokhzad [Sat, 7 Mar 2020 11:54:31 +0000 (12:54 +0100)]
simplify & improve parse_ty_tuple_or_parens

4 years agoissue 68890: add more minimal repro
Mazdak Farrokhzad [Sat, 7 Mar 2020 11:14:39 +0000 (12:14 +0100)]
issue 68890: add more minimal repro

4 years agoerror_block_no_opening_brace: handle closures better
Mazdak Farrokhzad [Sat, 7 Mar 2020 10:00:40 +0000 (11:00 +0100)]
error_block_no_opening_brace: handle closures better

4 years agoblock-no-opening-brace: add another statement
Mazdak Farrokhzad [Sat, 7 Mar 2020 08:49:46 +0000 (09:49 +0100)]
block-no-opening-brace: add another statement

4 years agoparser: add note for `'label expr`.
Mazdak Farrokhzad [Sat, 7 Mar 2020 08:41:12 +0000 (09:41 +0100)]
parser: add note for `'label expr`.

4 years agoparser/attr: adjust indentation.
Mazdak Farrokhzad [Sat, 7 Mar 2020 08:31:00 +0000 (09:31 +0100)]
parser/attr: adjust indentation.

4 years agoparse_labeled_expr: add a suggestion on missing colon.
Mazdak Farrokhzad [Fri, 6 Mar 2020 02:43:59 +0000 (03:43 +0100)]
parse_labeled_expr: add a suggestion on missing colon.

4 years agoparse_block_tail: reduce visibility
Mazdak Farrokhzad [Thu, 5 Mar 2020 23:32:05 +0000 (00:32 +0100)]
parse_block_tail: reduce visibility

4 years agounify/improve/simplify attribute parsing
Mazdak Farrokhzad [Thu, 5 Mar 2020 10:42:56 +0000 (11:42 +0100)]
unify/improve/simplify attribute parsing

4 years agoparse: recover on `fn foo() = expr;`
Mazdak Farrokhzad [Thu, 5 Mar 2020 08:08:09 +0000 (09:08 +0100)]
parse: recover on `fn foo() = expr;`

4 years agoparse: simplify parse_fn_body
Mazdak Farrokhzad [Thu, 5 Mar 2020 07:08:07 +0000 (08:08 +0100)]
parse: simplify parse_fn_body

4 years agoparse: recover on `&'lt $expr` / `'lt $expr`.
Mazdak Farrokhzad [Thu, 5 Mar 2020 06:54:22 +0000 (07:54 +0100)]
parse: recover on `&'lt $expr` / `'lt $expr`.

4 years agomore reuse in block parsing & improve diagnostics.
Mazdak Farrokhzad [Thu, 5 Mar 2020 04:49:30 +0000 (05:49 +0100)]
more reuse in block parsing & improve diagnostics.

4 years agosimplify parse_inner_attributes
Mazdak Farrokhzad [Thu, 5 Mar 2020 02:24:58 +0000 (03:24 +0100)]
simplify parse_inner_attributes

4 years agouse error_block_no_opening_brace more
Mazdak Farrokhzad [Thu, 5 Mar 2020 01:46:13 +0000 (02:46 +0100)]
use error_block_no_opening_brace more

4 years agoparse_labeled_expr: simplify
Mazdak Farrokhzad [Thu, 5 Mar 2020 00:47:15 +0000 (01:47 +0100)]
parse_labeled_expr: simplify

4 years agomacros/unknown-builtin: use hack for musl problems
Mazdak Farrokhzad [Tue, 10 Mar 2020 07:30:07 +0000 (08:30 +0100)]
macros/unknown-builtin: use hack for musl problems

4 years agospan-api-tests: leave FIXME
Mazdak Farrokhzad [Fri, 6 Mar 2020 13:35:21 +0000 (14:35 +0100)]
span-api-tests: leave FIXME

4 years agorustc_errors: Use ensure_source_file_source_present where necessary.
Ana-Maria Mihalache [Thu, 5 Mar 2020 15:31:11 +0000 (15:31 +0000)]
rustc_errors: Use ensure_source_file_source_present where necessary.

4 years ago--bless some tests
Mazdak Farrokhzad [Mon, 10 Feb 2020 16:37:12 +0000 (17:37 +0100)]
--bless some tests

4 years agoadjust span-api-tests.rs
Mazdak Farrokhzad [Mon, 10 Feb 2020 16:38:51 +0000 (17:38 +0100)]
adjust span-api-tests.rs

4 years agopacify rustdoc by using better url
Mazdak Farrokhzad [Thu, 14 Nov 2019 10:40:01 +0000 (11:40 +0100)]
pacify rustdoc by using better url

4 years agoStore `TokenStream` in `rmeta::MacroDef`.
Mazdak Farrokhzad [Wed, 13 Nov 2019 12:01:43 +0000 (13:01 +0100)]
Store `TokenStream` in `rmeta::MacroDef`.
This removes a hack from `load_macro_untracked` in which parsing is used.

4 years agoAuto merge of #69879 - Centril:rollup-ryea91j, r=Centril
bors [Tue, 10 Mar 2020 05:48:27 +0000 (05:48 +0000)]
Auto merge of #69879 - Centril:rollup-ryea91j, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #69475 (Remove the `no_force` query attribute)
 - #69514 (Remove spotlight)
 - #69677 (rustc_metadata: Give decoder access to whole crate store)
 - #69714 (Make PlaceRef take just one lifetime)
 - #69799 (Allow ZSTs in `AllocRef`)
 - #69817 (test(patterns): add patterns feature tests to borrowck test suite)
 - #69836 (Check if output is immediate value)
 - #69847 (clean up E0393 explanation)
 - #69861 (Add note about localization to std::fmt docs)
 - #69877 (Vec::new is const stable in 1.39 not 1.32)

Failed merges:

r? @ghost

4 years agoRollup merge of #69877 - CAD97:patch-1, r=dtolnay
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:59 +0000 (06:47 +0100)]
Rollup merge of #69877 - CAD97:patch-1, r=dtolnay

Vec::new is const stable in 1.39 not 1.32

Changelog: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1390-2019-11-07

This really surprised me when a MSRV check for 1.35 failed with `Vec::new is not yet stable as a const fn` and the docs said that it was const stabilized in 1.32.

4 years agoRollup merge of #69861 - Dylnuge:dylnuge/locale-doc, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:58 +0000 (06:47 +0100)]
Rollup merge of #69861 - Dylnuge:dylnuge/locale-doc, r=Mark-Simulacrum

Add note about localization to std::fmt docs

Closes #69681

4 years agoRollup merge of #69847 - GuillaumeGomez:cleanup-e0393, r=Dylan-DPC
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:56 +0000 (06:47 +0100)]
Rollup merge of #69847 - GuillaumeGomez:cleanup-e0393, r=Dylan-DPC

clean up E0393 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69836 - JohnTitor:immediate-outputs, r=nagisa
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:55 +0000 (06:47 +0100)]
Rollup merge of #69836 - JohnTitor:immediate-outputs, r=nagisa

Check if output is immediate value

Fixes #62046

r? @nagisa

4 years agoRollup merge of #69817 - thekuom:test/borrow-checking-pattern-features, r=Centril
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:53 +0000 (06:47 +0100)]
Rollup merge of #69817 - thekuom:test/borrow-checking-pattern-features, r=Centril

test(patterns): add patterns feature tests to borrowck test suite

Addresses request here: https://github.com/rust-lang/rust/pull/69690#issuecomment-595763571

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

r? @Centril

4 years agoRollup merge of #69799 - TimDiekmann:zst, r=Amanieu
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:52 +0000 (06:47 +0100)]
Rollup merge of #69799 - TimDiekmann:zst, r=Amanieu

Allow ZSTs in `AllocRef`

Allows ZSTs in all `AllocRef` methods. The implementation of `AllocRef` for `Global` and `System` were adjusted to reflect those changes.

This is the second item on the roadmap to support ZSTs in `AllocRef`: https://github.com/rust-lang/wg-allocators/issues/38#issuecomment-595861542
After this has landed, I will adapt `RawVec`, but since this will be a pretty big overhaul, it makes sense to do a different PR for it.

~~Requires #69794 to land first~~

r? @Amanieu

4 years agoRollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obk
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:50 +0000 (06:47 +0100)]
Rollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obk

Make PlaceRef take just one lifetime

r? @eddyb

4 years agoRollup merge of #69677 - petrochenkov:spancode, r=eddyb
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:49 +0000 (06:47 +0100)]
Rollup merge of #69677 - petrochenkov:spancode, r=eddyb

rustc_metadata: Give decoder access to whole crate store

Pre-requisite for https://github.com/rust-lang/rust/pull/68941.
r? @eddyb

4 years agoRollup merge of #69514 - GuillaumeGomez:remove-spotlight, r=kinnison
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:47 +0000 (06:47 +0100)]
Rollup merge of #69514 - GuillaumeGomez:remove-spotlight, r=kinnison

Remove spotlight

I had a few comments saying that this feature was at best misunderstood or not even used so I decided to organize a poll about on [twitter](https://twitter.com/imperioworld_/status/1232769353503956994). After 87 votes, the result is very clear: it's not useful. Considering the amount of code we have just to run it, I think it's definitely worth it to remove it.

r? @kinnison

cc @ollie27

4 years agoRollup merge of #69475 - Zoxc:no-no-force, r=michaelwoerister
Mazdak Farrokhzad [Tue, 10 Mar 2020 05:47:46 +0000 (06:47 +0100)]
Rollup merge of #69475 - Zoxc:no-no-force, r=michaelwoerister

Remove the `no_force` query attribute

This removes the `no_force` query attribute and instead uses the `DepNodeParams` trait to find out if a query can be forced.

Also the `analysis` query is moved to the query macro.

r? @eddyb

4 years agoVec::new is const tstable in 1.39 not 1.32
Christopher Durham [Tue, 10 Mar 2020 03:07:04 +0000 (23:07 -0400)]
Vec::new is const tstable in 1.39 not 1.32

4 years agoupdate x.py tidy testing command
Chris Simpkins [Tue, 10 Mar 2020 03:00:41 +0000 (23:00 -0400)]
update x.py tidy testing command

4 years agofix test failure due to earlier emitted error
YI [Tue, 10 Mar 2020 02:54:48 +0000 (10:54 +0800)]
fix test failure due to earlier emitted error

4 years agoremove trailing whitespace (tidy)
Chris Simpkins [Tue, 10 Mar 2020 02:15:41 +0000 (22:15 -0400)]
remove trailing whitespace (tidy)

4 years agoAdd documentation of tool testing with x.py script
Chris Simpkins [Tue, 10 Mar 2020 02:04:59 +0000 (22:04 -0400)]
Add documentation of tool testing with x.py script

4 years agoadd documentation of x.py tool testing
Chris Simpkins [Tue, 10 Mar 2020 01:55:56 +0000 (21:55 -0400)]
add documentation of x.py tool testing

4 years agoupdate tidy documentation to recommend ./x.py test tidy
Chris Simpkins [Tue, 10 Mar 2020 01:40:00 +0000 (21:40 -0400)]
update tidy documentation to recommend ./x.py test tidy

4 years agofix #62456
YI [Mon, 9 Mar 2020 17:51:08 +0000 (01:51 +0800)]
fix #62456

4 years agoAdd note about localization to std::fmt docs
Dylan Nugent [Mon, 9 Mar 2020 16:31:33 +0000 (12:31 -0400)]
Add note about localization to std::fmt docs

4 years agoAdd a comment to `recover`.
John Kåre Alsaker [Mon, 9 Mar 2020 13:50:09 +0000 (14:50 +0100)]
Add a comment to `recover`.

4 years agoRemove the `no_force` query attribute
John Kåre Alsaker [Wed, 26 Feb 2020 01:39:18 +0000 (02:39 +0100)]
Remove the `no_force` query attribute

4 years agoRemove the need for `no_force`
John Kåre Alsaker [Wed, 26 Feb 2020 01:20:33 +0000 (02:20 +0100)]
Remove the need for `no_force`

4 years agoMove `analysis` to the query macro
John Kåre Alsaker [Tue, 25 Feb 2020 23:26:38 +0000 (00:26 +0100)]
Move `analysis` to the query macro

4 years agotest(patterns): add borrowck tests for combination of pattern features
Matthew Kuo [Sun, 8 Mar 2020 04:01:11 +0000 (22:01 -0600)]
test(patterns): add borrowck tests for combination of pattern features

Adds borrowck tests for the following features:
- bindings_after_at
- or_patterns
- slice_patterns
- box_patterns

4 years agoAuto merge of #69851 - Centril:rollup-iivxvah, r=Centril
bors [Mon, 9 Mar 2020 11:58:17 +0000 (11:58 +0000)]
Auto merge of #69851 - Centril:rollup-iivxvah, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #69201 (Permit attributes on 'if' expressions)
 - #69685 (unix: Don't override existing SIGSEGV/BUS handlers)
 - #69762 (Ensure that validity only raises validity errors)
 - #69779 (librustc_codegen_llvm: Use slices in preference to 0-terminated strings)
 - #69801 (rustc_parse: Remove `Parser::normalized(_prev)_token`)
 - #69842 (Add more regression tests)

Failed merges:

r? @ghost

4 years agoRollup merge of #69842 - JohnTitor:more-tests, r=Centril
Mazdak Farrokhzad [Mon, 9 Mar 2020 11:57:54 +0000 (12:57 +0100)]
Rollup merge of #69842 - JohnTitor:more-tests, r=Centril

Add more regression tests

Closes #54239
Closes #57200
Closes #57201
Closes #60473
Closes #64620
Closes #67166

r? @Centril

4 years agoRollup merge of #69801 - petrochenkov:nonorm, r=Centril
Mazdak Farrokhzad [Mon, 9 Mar 2020 11:57:53 +0000 (12:57 +0100)]
Rollup merge of #69801 - petrochenkov:nonorm, r=Centril

rustc_parse: Remove `Parser::normalized(_prev)_token`

Perform the "normalization" (renamed to "uninterpolation") on the fly when necessary.

The final part of https://github.com/rust-lang/rust/pull/69579 https://github.com/rust-lang/rust/pull/69384 https://github.com/rust-lang/rust/pull/69376 https://github.com/rust-lang/rust/pull/69211 https://github.com/rust-lang/rust/pull/69034 https://github.com/rust-lang/rust/pull/69006.
r? @Centril

4 years agoRollup merge of #69779 - tmiasko:di-cstr, r=nagisa
Mazdak Farrokhzad [Mon, 9 Mar 2020 11:57:51 +0000 (12:57 +0100)]
Rollup merge of #69779 - tmiasko:di-cstr, r=nagisa

librustc_codegen_llvm: Use slices in preference to 0-terminated strings

Additionally whenever possible match C API provided by the LLVM.

4 years agoRollup merge of #69762 - RalfJung:validity-errors, r=oli-obk
Mazdak Farrokhzad [Mon, 9 Mar 2020 11:57:50 +0000 (12:57 +0100)]
Rollup merge of #69762 - RalfJung:validity-errors, r=oli-obk

Ensure that validity only raises validity errors

For now, only as a debug-assertion (similar to const-prop detecting errors that allocate).

Now includes https://github.com/rust-lang/rust/pull/69646.
[Relative diff](https://github.com/RalfJung/rust/compare/layout-visitor...RalfJung:validity-errors).

r? @oli-obk

4 years agoRollup merge of #69685 - cuviper:soft-segv, r=sfackler
Mazdak Farrokhzad [Mon, 9 Mar 2020 11:57:48 +0000 (12:57 +0100)]
Rollup merge of #69685 - cuviper:soft-segv, r=sfackler

unix: Don't override existing SIGSEGV/BUS handlers

Although `stack_overflow::init` runs very early in the process, even
before `main`, there may already be signal handlers installed for things
like the address sanitizer. In that case, just leave it alone, and don't
bother trying to allocate our own signal stacks either.

Fixes #69524.

4 years agoRollup merge of #69201 - Aaron1011:feature/permit-if-attr, r=Centril
Mazdak Farrokhzad [Mon, 9 Mar 2020 11:57:44 +0000 (12:57 +0100)]
Rollup merge of #69201 - Aaron1011:feature/permit-if-attr, r=Centril

Permit attributes on 'if' expressions

Previously, attributes on 'if' expressions (e.g. `#[attr] if true {}`)
were disallowed during parsing. This made it impossible for macros to
perform any custom handling of such attributes (e.g. stripping them
away), since a compilation error would be emitted before they ever had a
chance to run.

This PR permits attributes on 'if' expressions ('if-attrs' from here on).
Both built-in attributes (e.g. `#[allow]`, `#[cfg]`) and proc-macro attributes are supported.

We still do *not* accept attributes on 'other parts' of an if-else
chain. That is, the following code snippet still fails to parse:

```rust
if true {} #[attr] else if false {} else #[attr] if false {} #[attr]
else {}
```

Closes https://github.com/rust-lang/rust/issues/68618

4 years agoAddress review comments
Vadim Petrochenkov [Mon, 9 Mar 2020 09:42:33 +0000 (12:42 +0300)]
Address review comments

4 years agoUse `Token::uninterpolate` in couple more places matching on `(Nt)Ident`
Vadim Petrochenkov [Sat, 7 Mar 2020 12:58:27 +0000 (15:58 +0300)]
Use `Token::uninterpolate` in couple more places matching on `(Nt)Ident`

4 years agorustc_parse: Remove `Parser::normalized(_prev)_token`
Vadim Petrochenkov [Sat, 7 Mar 2020 13:34:29 +0000 (16:34 +0300)]
rustc_parse: Remove `Parser::normalized(_prev)_token`

4 years agorustc_ast: Introduce `Token::uninterpolate`
Vadim Petrochenkov [Sat, 7 Mar 2020 11:37:38 +0000 (14:37 +0300)]
rustc_ast: Introduce `Token::uninterpolate`

4 years agorustc_ast: Introduce `Token::uninterpolated_span`
Vadim Petrochenkov [Wed, 4 Mar 2020 21:34:57 +0000 (00:34 +0300)]
rustc_ast: Introduce `Token::uninterpolated_span`

4 years agorustc_parse: Use `Token::ident` where possible
Vadim Petrochenkov [Wed, 4 Mar 2020 20:37:52 +0000 (23:37 +0300)]
rustc_parse: Use `Token::ident` where possible

4 years agodiscrimant test must not be inlined!
Bastian Kauschke [Mon, 9 Mar 2020 09:12:44 +0000 (10:12 +0100)]
discrimant test must not be inlined!

4 years agoclean up E0393 explanation
Guillaume Gomez [Mon, 9 Mar 2020 08:31:15 +0000 (09:31 +0100)]
clean up E0393 explanation

4 years agoAdd FIXMEs
Yuki Okushi [Mon, 9 Mar 2020 07:50:46 +0000 (16:50 +0900)]
Add FIXMEs

4 years agounix: Don't override existing SIGSEGV/BUS handlers
Josh Stone [Tue, 3 Mar 2020 23:04:57 +0000 (15:04 -0800)]
unix: Don't override existing SIGSEGV/BUS handlers

Although `stack_overflow::init` runs very early in the process, even
before `main`, there may already be signal handlers installed for things
like the address sanitizer. In that case, just leave it alone, and don't
bother trying to allocate our own signal stacks either.

4 years agoAvoid unnecessary interning of enum variant part id
Tomasz Miąsko [Fri, 6 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Avoid unnecessary interning of enum variant part id

4 years agoUse slices in preference to 0-terminated strings
Tomasz Miąsko [Fri, 6 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Use slices in preference to 0-terminated strings

Additionally whenever possible match C API provided by the LLVM.

4 years agoAdd test for issue-67166
Yuki Okushi [Mon, 9 Mar 2020 00:12:53 +0000 (09:12 +0900)]
Add test for issue-67166

4 years agoAdd test for issue-64620
Yuki Okushi [Mon, 9 Mar 2020 00:12:41 +0000 (09:12 +0900)]
Add test for issue-64620

4 years agoAdd test for issue-60473
Yuki Okushi [Mon, 9 Mar 2020 00:12:25 +0000 (09:12 +0900)]
Add test for issue-60473

4 years agoAdd test for issue-57201
Yuki Okushi [Mon, 9 Mar 2020 00:12:06 +0000 (09:12 +0900)]
Add test for issue-57201

4 years agoAdd test for issue-57200
Yuki Okushi [Mon, 9 Mar 2020 00:11:58 +0000 (09:11 +0900)]
Add test for issue-57200

4 years agoAdd test for issue-54239
Yuki Okushi [Mon, 9 Mar 2020 00:11:40 +0000 (09:11 +0900)]
Add test for issue-54239

4 years agoCheck if output is immediate value
Yuki Okushi [Sun, 8 Mar 2020 20:00:03 +0000 (05:00 +0900)]
Check if output is immediate value

4 years agouse static strings instead of tcx
Ralf Jung [Fri, 6 Mar 2020 17:14:41 +0000 (18:14 +0100)]
use static strings instead of tcx

4 years agoFix typo
Ralf Jung [Fri, 6 Mar 2020 10:30:57 +0000 (11:30 +0100)]
Fix typo

Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>
4 years agofix some cases of unexpected exceptions leaving validation
Ralf Jung [Thu, 5 Mar 2020 22:31:39 +0000 (23:31 +0100)]
fix some cases of unexpected exceptions leaving validation

4 years agomiri validation: debug-complain about unexpected errors
Ralf Jung [Wed, 4 Mar 2020 07:43:03 +0000 (08:43 +0100)]
miri validation: debug-complain about unexpected errors