Commit Graph

8516 Commits

Author SHA1 Message Date
bors bdfdbcd44d Auto merge of #60352 - Centril:const-incomplete-features, r=oli-obk
Float 'incomplete_features' out to a const for visibility

Float `let incomplete_features` out to a `const INCOMPLETE_FEATURES` and colocate near `active` features so that it is easier to find and edit.

r? @oli-obk

(use rollup)
2019-04-28 15:40:00 +00:00
Mazdak Farrokhzad 3f30082625 Float 'incomplete_features' out to a const for visibility. 2019-04-28 15:13:35 +02:00
Mazdak Farrokhzad dfe802b929 Document ast::ExprKind::Type. 2019-04-27 12:06:02 +02:00
bors e8310a7714 Auto merge of #60167 - varkor:tidy-filelength, r=matthewjasper
Add a tidy check for files with over 3,000 lines

Files with a large number of lines can cause issues in GitHub (e.g. https://github.com/rust-lang/rust/issues/60015) and also tend to be indicative of opportunities to refactor into less monolithic structures.

This adds a new check to tidy to warn against files that have more than 3,000 lines, as suggested in https://github.com/rust-lang/rust/issues/60015#issuecomment-483868594. (This number was chosen fairly arbitrarily as a reasonable indicator of size.) This check can be ignored with `// ignore-tidy-filelength`.

Existing files with greater than 3,000 lines currently ignore the check, but this helps us spot when files are getting too large. (We might try to split up all files larger than this in the future, as in https://github.com/rust-lang/rust/issues/60015).
2019-04-26 04:42:10 +00:00
Mazdak Farrokhzad a133caab36 Rollup merge of #60289 - tmandry:allow-features-include-std, r=cramertj
Make `-Z allow-features` work for stdlib features

r? @cramertj
2019-04-26 03:50:26 +02:00
Mazdak Farrokhzad 4387f99fc5 Rollup merge of #60267 - gnzlbg:f16c_target_feature, r=alexcrichton
Add feature-gate for f16c target feature

r? @alexcrichton
2019-04-26 03:50:22 +02:00
Tyler Mandry 0a26789af9 Make -Z allow-features work for stdlib features 2019-04-25 14:03:45 -07:00
varkor aa388f1d11 ignore-tidy-filelength on all files with greater than 3000 lines 2019-04-25 21:39:09 +01:00
gnzlbg d37f3fc1ec Add feature-gate for f16c target feature 2019-04-25 15:44:22 +02:00
Esteban Küber 0e505d427a Add guard for missing comma in macro call suggestion 2019-04-24 16:45:29 -07:00
Mazdak Farrokhzad eb4860c77c Rollup merge of #60186 - estebank:accept-suffix, r=nikomatsakis
Temporarily accept [i|u][32|size] suffixes on a tuple index and warn

Fix #60138.

#59553 will need to be kept open to track the change back to rejecting this code a few versions down thee line.
2019-04-24 05:16:22 +02:00
Taylor Cramer e617025e96 Add rustc_allow_const_fn_ptr 2019-04-23 15:55:31 -07:00
Esteban Küber 4c015739ea review comment: change linked ticket 2019-04-23 14:31:42 -07:00
Mazdak Farrokhzad 62d1574876 Rollup merge of #59823 - davidtwco:issue-54716, r=cramertj
[wg-async-await] Drop `async fn` arguments in async block

Fixes #54716.

This PR modifies the HIR lowering (and some other places to make this work) so that unused arguments to a async function are always dropped inside the async move block and not at the end of the function body.

```
async fn foo(<pattern>: <type>) {
  async move {
  }
} // <-- dropped as you "exit" the fn

// ...becomes...
fn foo(__arg0: <ty>) {
  async move {
    let <pattern>: <ty> = __arg0;
  } // <-- dropped as you "exit" the async block
}
```

However, the exact ordering of drops is not the same as a regular function, [as visible in this playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=be39af1a58e5d430be1eb3c722cb1ec3) - I believe this to be an unrelated issue. There is a [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-t-compiler.2Fwg-async-await/topic/.2354716.20drop.20order) for this.

r? @cramertj
cc @nikomatsakis
2019-04-23 21:50:52 +02:00
Esteban Küber e3fb331695 Temporarily accept [i|u][32|size] suffixes on a tuple index and warn 2019-04-22 16:02:53 -07:00
varkor 7f0f0e31ec Remove double trailing newlines 2019-04-22 16:57:01 +01:00
Matthew Jasper aa6fb6caf9 Enable migrate mode by default on the 2015 edition
This also fully stabilizes two-phase borrows on all editions
2019-04-21 20:50:02 +01:00
David Wood 9d7da824d6 Introduce ArgSource for diagnostics.
This commit introduces an `ArgSource` enum that is lowered into the HIR
so that diagnostics can correctly refer to the argument pattern's
original name rather than the generated pattern.
2019-04-21 16:46:32 +01:00
David Wood 92e72df2c1 Do not specify type in generated let bindings.
This avoids issues with `impl_trait_in_bindings` as the type from the
argument is normally used as the let binding, but `impl Trait` is
unstable in binding position.
2019-04-21 16:46:32 +01:00
David Wood 879abb1641 Add AsyncArgument to AST.
This commit adds an `AsyncArgument` struct to the AST that contains the
generated argument and statement that will be used in HIR lowering, name
resolution and def collection.
2019-04-21 16:46:32 +01:00
bors 31a75a1728 Auto merge of #60124 - petrochenkov:stanomut, r=eddyb
Remove mutability from `Def::Static`

Querify `TyCtxt::is_static`.
Use `Mutability` instead of bool in foreign statics in AST/HIR.

cc https://github.com/rust-lang/rust/pull/60110
r? @eddyb
2019-04-21 13:40:22 +00:00
Vadim Petrochenkov 4eb94b4407 AST/HIR: Use Mutability instead of bool in foreign statics 2019-04-21 15:29:58 +03:00
bors 06a271a6eb Auto merge of #60119 - estebank:bad-recovery, r=davidtwco
Remove assumption from recovery code

Fix #60115.
2019-04-21 10:13:27 +00:00
David Wood 41c6bb1096 Introduce LocalSource into the AST.
This will be used to keep track of the origin of a local in the AST. In
particular, it will be used by `async fn` lowering for the locals in
`let <pat>: <ty> = __arg0;` statements.
2019-04-21 09:48:11 +01:00
bors 4d9c6cd722 Auto merge of #60132 - davidtwco:issue-60075, r=estebank
Fix fn front matter parsing ICE from invalid code.

Fixes #60075.

This PR fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.

r? @estebank (thanks for the minimized test case)
2019-04-21 07:20:14 +00:00
varkor 98c71c36d6 Check async in trait methods 2019-04-20 22:03:39 +01:00
varkor 93c4b1f491 Fix additional variadic typos 2019-04-20 22:03:39 +01:00
varkor fb2af77763 Fix typo in variadic C function warning 2019-04-20 22:03:39 +01:00
varkor 47a558ed7c Feature gate async fn methods 2019-04-20 22:03:39 +01:00
bors 4530c528ba Auto merge of #59700 - matklad:simplify, r=eddyb
Simplify doc comment lexing

is_doc_comment function checks the first four chars, but this is
redundant, `doc_comment` local var has the same info.
2019-04-20 17:59:15 +00:00
David Wood 60c6ed9664 Fix fn front matter parsing ICE from invalid code.
This commit fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.
2019-04-20 11:36:04 +01:00
Esteban Küber 30b779f398 Remove assumption from recovery code 2019-04-19 11:04:41 -07:00
Vadim Petrochenkov aa393b0cde Some cleanup to maybe_parse_struct_expr 2019-04-19 10:32:44 -07:00
Esteban Küber 4c4ca60edd remove duplicated code and simplify logic 2019-04-19 10:13:45 -07:00
Esteban Küber f1be8d16c5 Identify missing ambiguous case with best effort suggestion 2019-04-19 10:13:45 -07:00
Esteban Küber 2f36b54f0f Emit specific error for struct literal in conditions 2019-04-19 10:13:44 -07:00
Mazdak Farrokhzad dd9f9b4b9d Rollup merge of #60060 - mtak-:rtm-x86-feature, r=petrochenkov
whitelist RTM x86 target cpu feature

This PR adds support for intels restricted transactional memory cpu feature. I mostly copied what was done for the [movbe](https://github.com/rust-lang/rust/pull/57999) feature.

https://github.com/rust-lang-nursery/stdsimd/issues/718
2019-04-19 06:03:20 +02:00
bors d6f513ec7d Auto merge of #60025 - JohnTitor:rename-files, r=petrochenkov
Rename files about error codes

fixes #60017

This PR will be failed in tidy.

<details>
<summary>The log is here:</summary>

```
tidy check
tidy error: duplicate error code: 411
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:83:             __diagnostic_used!(E0411);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:84:             err.code(DiagnosticId::Error("E0411".to_owned()));
tidy error: duplicate error code: 424
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:90:             debug!("smart_resolve_path_fragment: E0424, source={:?}", source);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:92:             __diagnostic_used!(E0424);
tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:93:             err.code(DiagnosticId::Error("E0424".to_owned()));
some tidy checks failed
```

</details>

I'd like to fix this but I don't know what to do.
I will work on later. Please let me know if you have any solutions.

r? @petrochenkov
2019-04-18 14:52:45 +00:00
tyler 365a48a8bf whitelist rtm x86 cpu feature 2019-04-17 17:10:24 -07:00
Yuki OKUSHI a1d2f7222c Rename module 2019-04-18 06:27:30 +09:00
Yuki OKUSHI 53084ff92e Rename diagnositc_list into error_codes 2019-04-18 06:21:30 +09:00
bors 6ed6f1461d Auto merge of #60034 - rasendubi:fix-comments, r=Centril
Small comments fix

- Fix comments around test harness generation
- Promote regular comments to rustdoc comments
2019-04-17 13:26:29 +00:00
Alexey Shmalko 7bf33f00bf Fix comments around test harness generation 2019-04-17 12:02:04 +03:00
Mazdak Farrokhzad c89bc54d4f Rollup merge of #59128 - oli-obk:colorful_json, r=mark-i-m,eddyb
Emit ansi color codes in the `rendered` field of json diagnostics

cc @ljedrz

Implemented for https://github.com/rust-lang/rust/pull/56595#issuecomment-447645115 (x.py clippy)
2019-04-17 10:31:30 +02:00
Mateusz Mikuła 87e4b43d51 Deny internal in stage0 2019-04-17 05:15:00 +02:00
John Kåre Alsaker b82ab24bbf Preallocate BUILTIN_ATTRIBUTES symbols and use a hash map instead of looping 2019-04-15 15:20:05 +02:00
John Kåre Alsaker afeda72dad Ensure the symbols are pure strings 2019-04-15 07:23:02 +02:00
John Kåre Alsaker 61a7a60d45 Make check_name generic 2019-04-15 07:23:02 +02:00
John Kåre Alsaker 10855a36b5 Use a proc macro to declare preallocated symbols 2019-04-15 07:23:01 +02:00
bors 60076bb8f7 Auto merge of #59693 - nnethercote:64-bit-Spans, r=petrochenkov
Increase `Span` from 4 bytes to 8 bytes.

This increases the size of some important types, such as `ast::Expr` and
`mir::Statement`. However, it drastically reduces how much the interner
is used, and the fields are more natural sizes that don't require bit
operations to extract.

As a result, instruction counts drop across a range of workloads, by as
much as 10% for `script-servo` incremental builds.

Peak memory usage goes up a little for some cases, but down by more for
some other cases -- as much as 18% for non-incremental builds of
`packed-simd`.

The commit also:
- removes the `repr(packed)`, because it has negligible effect, but can
  cause undefined behaviour;
- replaces explicit impls of common traits (`Copy`, `PartialEq`, etc.)
  with derived ones.

r? @petrochenkov
2019-04-14 08:55:16 +00:00