107007 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
b864d23f34
Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkov
parse: fuse associated and extern items up to defaultness

Language changes:

- The grammar of extern `type` aliases is unified with associated ones, and becomes:
  ```rust
  TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ;
  ```

  Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`).

  (Work still remains to fuse this with free `type` aliases, but this can be done later.)

- The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes:

  ```rust
  GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ;
  ```

  - A semantic restriction is added to enforce the presence of the expression (the body).
  - A semantic restriction is added to reject `const _` in associated contexts.

Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR.

-----------------------

We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s.

r? @petrochenkov
2020-02-18 22:16:26 +01:00
Mazdak Farrokhzad
981acd9035
Rollup merge of #69159 - estebank:use-appropriate-lt-name, r=ecstatic-morse
Select an appropriate unused lifetime name in suggestion

Follow up to #69048.
2020-02-18 22:16:24 +01:00
Mazdak Farrokhzad
5e2a095ba0
Rollup merge of #69146 - matthewjasper:literal-qualif, r=eddyb
Always const qualify literals by type

r? @eddyb
2020-02-18 22:16:23 +01:00
bors
e620d0f337 Auto merge of #69262 - Dylan-DPC:rollup-m6dt9cn, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #69181 (Change const eval to just return the value )
 - #69192 (Add more regression tests)
 - #69200 (Fix printing of `Yield` terminator)
 - #69205 (Allow whitespaces in revision flags)
 - #69233 (Clean up E0310 explanation)

Failed merges:

r? @ghost
2020-02-18 17:51:29 +00:00
Dylan DPC
210b18118e
Rollup merge of #69233 - GuillaumeGomez:cleanup-e0310, r=Dylan-DPC
Clean up E0310 explanation

r? @Dylan-DPC
2020-02-18 16:07:29 +01:00
Dylan DPC
bea18c7673
Rollup merge of #69205 - JohnTitor:allow-whitespaces, r=Mark-Simulacrum
Allow whitespaces in revision flags

Allow whitespaces in revision flags, like `// [foo]`.

Fixes #69183
2020-02-18 16:07:27 +01:00
Dylan DPC
8b93e67c32
Rollup merge of #69200 - jonas-schievink:yield-print, r=eddyb,Zoxc
Fix printing of `Yield` terminator

Addresses the bug found in https://github.com/rust-lang/rust/issues/69039#issuecomment-586633495
2020-02-18 16:07:25 +01:00
Dylan DPC
d1f175b2ad
Rollup merge of #69192 - JohnTitor:add-tests, r=Centril
Add more regression tests

Closes #39618
Closes #51798
Closes #62894
Closes #63952
Closes #68653

r? @Centril
2020-02-18 16:07:24 +01:00
Dylan DPC
391e7e26ae
Rollup merge of #69181 - skinny121:const-eval-return, r=oli-obk
Change const eval to just return the value

As discussed in https://github.com/rust-lang/rust/pull/68505#discussion_r370956535, the type of consts shouldn't be returned from const eval queries.

r? @eddyb
cc @nikomatsakis
2020-02-18 16:07:22 +01:00
bors
b0d5813fd7 Auto merge of #69234 - JohnTitor:clippy-up, r=JohnTitor
Update Clippy

Fixes #69221

r? @ghost
2020-02-18 14:49:28 +00:00
Guillaume Gomez
73283f1b32 Clean up E0310 explanation 2020-02-18 13:07:49 +01:00
bors
6317721cd9 Auto merge of #69258 - JohnTitor:rollup-n2hljai, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #67272 (recursion_limit parsing handles overflows)
 - #68597 (Simplify `Skip::nth` and `Skip::last` implementations)
 - #68767 (macOS: avoid calling pthread_self() twice)
 - #69175 (Do not ICE when encountering `yield` inside `async` block)
 - #69223 (Ignore GDB versions with broken str printing.)
 - #69244 (configure: set LLVM flags with a value)
 - #69249 (Stabilize {f32, f64}::{LOG2_10, LOG10_2})
 - #69252 (Clean out unused directories for extra disk space)

Failed merges:

r? @ghost
2020-02-18 11:10:51 +00:00
Yuki Okushi
c1a05fbf00
Rollup merge of #69252 - Mark-Simulacrum:disk-try, r=pietroalbini
Clean out unused directories for extra disk space

This cleans out some of the unused (but large) directories on our linux builders to hopefully allow them to complete without running out of disk space.
2020-02-18 20:09:11 +09:00
Yuki Okushi
20c483506a
Rollup merge of #69249 - LeSeulArtichaut:stabilize-logs-consts, r=sfackler
Stabilize {f32, f64}::{LOG2_10, LOG10_2}

Following the decision to stabilize `LOG2_10` and `LOG10_2` in https://github.com/rust-lang/rust/issues/50540#issuecomment-536627588.

Closes #50540.
r? @sfackler
2020-02-18 20:09:09 +09:00
Yuki Okushi
6528b9f887
Rollup merge of #69244 - cuviper:llvm-flags, r=Mark-Simulacrum
configure: set LLVM flags with a value

Rather than a boolean `--enable-cflags` etc., these options should
reflect that they are for LLVM, and that they need a value. You would
now use `./configure --llvm-cflags="..."`.
2020-02-18 20:09:08 +09:00
Yuki Okushi
8b34f72b4f
Rollup merge of #69223 - spunit262:empty-string-gdb-version, r=Dylan-DPC
Ignore GDB versions with broken str printing.

https://sourceware.org/bugzilla/show_bug.cgi?id=22236
2020-02-18 20:09:06 +09:00
Yuki Okushi
35e7c783a2
Rollup merge of #69175 - estebank:shall-not-ice, r=petrochenkov
Do not ICE when encountering `yield` inside `async` block

Fix #67158.
2020-02-18 20:09:05 +09:00
Yuki Okushi
284acafe61
Rollup merge of #68767 - kubo39:patch-macos, r=shepmaster
macOS: avoid calling pthread_self() twice
2020-02-18 20:09:04 +09:00
Yuki Okushi
ae81241eae
Rollup merge of #68597 - ollie27:skip_nth_last, r=Amanieu
Simplify `Skip::nth` and `Skip::last` implementations

The main improvement is to make `last` no longer recursive.
2020-02-18 20:09:02 +09:00
Yuki Okushi
6c4f8598b9
Rollup merge of #67272 - fisherdarling:master, r=varkor,hellow554
recursion_limit parsing handles overflows

This PR adds overflow handling to `#![recursion_limit]` attribute parsing. If parsing the given value results in an `IntErrorKind::Overflow`, then the recursion_limit is set to `usize::max_value()`.

closes #67265
2020-02-18 20:08:59 +09:00
Mark Rousskov
c992ab23fa
Clean out some default-installed directories
This helps us have enough disk space for our builders to be able to complete
successfully. For now, the choices are ad-hoc and 'definitely not needed'. This
should never fail the build, as everything our build needs should be inside
Docker.
2020-02-18 11:34:59 +01:00
Josh Stone
3a55e8875e configure: set LLVM flags with a value
Rather than a boolean `--enable-cflags` etc., these options should
reflect that they are for LLVM, and that they need a value. You would
now use `./configure --llvm-cflags="..."`.
2020-02-17 11:01:52 -08:00
Yuki Okushi
3b431234e0 Update Clippy 2020-02-17 22:34:35 +09:00
bors
0176a9eef8 Auto merge of #69129 - Centril:macro-legacy-errors, r=petrochenkov
Transition macro_legacy_warnings into a hard error

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

r? @petrochenkov
2020-02-17 11:54:49 +00:00
Mazdak Farrokhzad
045b7d53a3 ast: add a FIXME 2020-02-17 11:16:28 +01:00
bors
75b98fbe77 Auto merge of #69226 - JohnTitor:rollup-syn03oj, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #68495 (Updating str.chars docs to mention crates.io.)
 - #68701 (Improve #Safety of various methods in core::ptr)
 - #69158 (Don't print block exit state in dataflow graphviz if unchanged)
 - #69179 (Rename `FunctionRetTy` to `FnRetTy`)
 - #69186 ([tiny] parser: `macro_rules` is a weak keyword)
 - #69188 (Clean up E0309 explanation)

Failed merges:

r? @ghost
2020-02-17 06:44:35 +00:00
Yuki Okushi
cc497c4c84
Rollup merge of #69188 - GuillaumeGomez:clean-up-e0309, r=Dylan-DPC
Clean up E0309 explanation

r? @Dylan-DPC
2020-02-17 13:46:59 +09:00
Yuki Okushi
3e7addccc6
Rollup merge of #69186 - petrochenkov:kwrules, r=Centril
[tiny] parser: `macro_rules` is a weak keyword

r? @Centril
2020-02-17 13:46:57 +09:00
Yuki Okushi
5f0c593386
Rollup merge of #69179 - JohnTitor:rename-to-fnretty, r=Centril
Rename `FunctionRetTy` to `FnRetTy`

As per FIXME comment

r? @Centril
2020-02-17 13:46:56 +09:00
Yuki Okushi
50ddda6949
Rollup merge of #69158 - ecstatic-morse:graphviz-diff, r=matthewjasper
Don't print block exit state in dataflow graphviz if unchanged

A small quality-of-life improvement I was using while working on #68528. It's pretty common to have a lot of zero-statement basic blocks, especially before a `SimplifyCfg` pass is run. When the dataflow state was dense, these blocks could take up a lot of vertical space since the full flow state was printed on both entry and exit. After this PR, we only print a block's exit state if it differs from that block's entry state. Take a look at the two basic blocks on the left.

Before:

![image](https://user-images.githubusercontent.com/29463364/74505395-e2d1dd00-4eab-11ea-8006-ec8f0dc9d1b6.png)

After:
![image](https://user-images.githubusercontent.com/29463364/74505277-98506080-4eab-11ea-8d95-5190bc378331.png)
2020-02-17 13:46:54 +09:00
Yuki Okushi
c3fed9fabd
Rollup merge of #68701 - amosonn:patch-2, r=RalfJung
Improve #Safety of various methods in core::ptr

For `read`, `read_unaligned`,`read_volatile`, `replace`, and `drop_in_place`:

- The value they point to must be properly initialized

For `replace`, additionally:

- The pointer must be readable
2020-02-17 13:46:52 +09:00
Yuki Okushi
5f818f94e7
Rollup merge of #68495 - sdegutis:patch-1, r=Mark-Simulacrum
Updating str.chars docs to mention crates.io.

This might spare someone else a little time searching the stdlib for unicode/grapheme support.
2020-02-17 13:46:48 +09:00
bors
3c4590facc Auto merge of #68781 - ssomers:btree_miri_relief, r=RalfJung
BTree: lighten the load on Miri

Reduce the amount of work Miri ploughs through in btree code, in particular on `test_clone_from` (which takes up 5 minutes on my machine).

r? @crgl
2020-02-17 03:24:53 +00:00
Esteban Küber
e5b2c66dea Do not ICE when encountering yield inside async block 2020-02-16 18:53:52 -08:00
Esteban Küber
8bafe883b6 Select an appropriate unused lifetime name in suggestion 2020-02-16 18:41:02 -08:00
Yuki Okushi
eb12ed889d Rename FunctionRetTy to FnRetTy 2020-02-17 11:24:29 +09:00
Fisher Darling
c53693d34d Handle recursion_limit parsing errors 2020-02-16 19:08:25 -07:00
spunit262
a9b5c692d9 Ignore GDB versions with broken str printing.
https://sourceware.org/bugzilla/show_bug.cgi?id=22236
2020-02-16 17:49:45 -07:00
bors
a643ee8d69 Auto merge of #67953 - cjgillot:split_infer, r=Zoxc
Split librustc::{traits,infer} to a separate crate rustc_infer

This is still very much work in progress.
Three functions are between dimensions (at the end of `rustc::traits`), waiting for some dependency breaking scheme.
Please tell me if the approach seems sound, and how you would like to split this PR up.

The formatting is deliberately off, to ease rebasing.

cc #65031
2020-02-16 22:24:54 +00:00
Stein Somers
da226dd9dc Lighten tests, in particular for Miri, yet test and explain more 2020-02-16 22:35:44 +01:00
Stein Somers
914b855f40 Fix comments outdated during #66648 2020-02-16 22:10:14 +01:00
LeSeulArtichaut
2ae493a767 Stabilize {f32, f64}::{LOG2_10, LOG10_2} 2020-02-16 18:53:02 +01:00
bors
5e7af4669f Auto merge of #67885 - tobithiel:fix_group_lint_allow_override, r=Mark-Simulacrum
rustc_session: allow overriding lint level of individual lints from a group

Fixes #58211 and fixes rust-lang/rust-clippy#4778 and fixes rust-lang/rust-clippy#4091

Instead of hard-coding the lint level preferences (from lowest to highest precedence: `lint::Allow -> lint::Warn -> lint::Deny -> lint::Forbid`), the position of the argument in the command line gets taken into account.

Examples:
1. Passing `-D unused -A unused-variables` denies everything in the lint group `unused` **except** `unused-variables` which is explicitly allowed.
1. Passing `-A unused-variables -D unused` denies everything in the lint group `unused` **including** `unused-variables` since the allow is specified before the deny (and therefore overridden by the deny).

This matches the behavior that is already being used when specifying `allow`/`deny` in the source code.
2020-02-16 15:28:41 +00:00
Yuki Okushi
d1a7ae7d16 Allow whitespaces in revision flags 2020-02-16 22:53:28 +09:00
bors
116dff95a3 Auto merge of #68997 - Zoxc:pure-node-id, r=petrochenkov
Panic if NodeIds are used for incremental compilation

r? @michaelwoerister
2020-02-16 12:16:49 +00:00
Amos Onn
943e65396d Improve #Safety of core::ptr::drop_in_place
Added missing conditions:
- Valid for writes
- Valid for destructing
2020-02-16 13:12:34 +01:00
Jonas Schievink
bb482ebf28 suspend -> yield 2020-02-16 13:08:36 +01:00
Camille GILLOT
e88500b5e1 Prune rustc dependencies. 2020-02-16 12:03:30 +01:00
Camille GILLOT
5d57208353 Gate macro use. 2020-02-16 12:03:13 +01:00
Camille GILLOT
0b93cfc1ee Prune features. 2020-02-16 12:02:51 +01:00