Commit Graph

107145 Commits

Author SHA1 Message Date
John Kåre Alsaker
19170cd217 Fix cache hit stats 2020-02-19 16:03:21 +01:00
John Kåre Alsaker
52872ca1cb Add a stat for local DefId density 2020-02-19 16:03:21 +01:00
John Kåre Alsaker
d1a81c779d Split query stats into its own file 2020-02-19 16:03:21 +01:00
John Kåre Alsaker
8a2ad75a60 Add a storage query modifier to override the query cache 2020-02-19 16:03:19 +01:00
John Kåre Alsaker
e2a8589e01 Add an abstraction for custom query caches 2020-02-19 16:01:46 +01:00
John Kåre Alsaker
6bf014ec99 Make try_get_cached take closures 2020-02-19 16:01:46 +01:00
John Kåre Alsaker
545e290a93 Split query execution into hot and cold paths 2020-02-19 16:01:46 +01:00
bors
7710ae0e26 Auto merge of #69278 - matthiaskrgr:submodule_upd, r=Dylan-DPC
submodules: update clippy from b91ae16e to 2855b214

Changes:
````
Rustup to rust-lang/rust#69194
Rustup to rust-lang/rust#69181
Add `LOG2_10` and `LOG10_2` to `approx_const` lint
Clean up imports
Use `Vec::with_capacity()` as possible
needless_doctest_main: False positive for async fn
Remove use of `TyKind`.
Use `if_chain`.
Fix ICE.
Add tests and improve checks.
Add `Future` detection for `missing_errors_doc`.
````

Fixes #69269
2020-02-19 11:16:01 +00:00
Ralf Jung
58bb47ebe5 avoid excessive number of revisions 2020-02-19 11:25:41 +01:00
jumbatm
c899dc1401 Reword OpenOptions::{create, create_new} doc. 2020-02-19 19:57:32 +10:00
bors
ae5467826d Auto merge of #69265 - ehuss:update-cargo, r=Dylan-DPC
Update cargo

9 commits in 3c53211c3d7fee4f430f170115af5baad17a3da9..e02974078a692d7484f510eaec0e88d1b6cc0203
2020-02-07 15:35:03 +0000 to 2020-02-18 15:24:43 +0000
- Set an environment variable for tests to find executables. (rust-lang/cargo#7697)
- Rework internal errors. (rust-lang/cargo#7896)
- Improvements to StringList config handling. (rust-lang/cargo#7891)
- Add new/old rustflags to fingerprint log. (rust-lang/cargo#7890)
- Fix inaccurate doc comment on `env_args`. (rust-lang/cargo#7889)
- Add some extra fingerprint debug information. (rust-lang/cargo#7888)
- Link the licenses into crates/cargo-platform (rust-lang/cargo#7886)
- Modify test to make `rustc` PR mergeable (rust-lang/cargo#7883)
- Keep environment variables in a BTreeMap to preserve sort order (rust-lang/cargo#7877)
2020-02-19 08:07:42 +00:00
Dylan MacKenzie
b43dc806ae Add #[rustc_args_required_const] to simd_shuffle tests 2020-02-18 23:36:09 -08:00
Nicholas Nethercote
139c3cab28 Inline some encoding and decoding methods.
This is a small performance win.
2020-02-19 16:54:36 +11:00
Dylan MacKenzie
f581b559a3 Remove mention of simd_shuffle promotion from comments 2020-02-18 21:32:38 -08:00
Dylan MacKenzie
d194676667 Remove special case for simd_shuffle arg promotion
After rust-lang/stdarch#825, these intrinsics are now defined with
`#[rustc_args_required_const(2)]`, so the special-case is no longer
necessary.
2020-02-18 21:29:06 -08:00
Dylan MacKenzie
5f06ce2c0f Prevent const trait methods from being marked stable 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
cb81712d10 Make fn_queries helpers module-private 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
160e6304e8 Add passing test for Add on generic struct 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
9a3682438d Remove outdated FIXME 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
c8f0abb51c Add ignored test for associated types in const impl 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
4992eb2c6f Test rustc_const_unstable on trait fns 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
8e7609b9fe Propagate rustc_const_unstable to children 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
0a5abcac7f Use early return when forbidding unstable attrs 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
70f78797d5 Ensure const impl cannot coexist with non-const impl 2020-02-18 21:03:29 -08:00
Dylan MacKenzie
d6d6d25c34 Split const trait method test and impl ops::Add 2020-02-18 21:03:28 -08:00
Dylan MacKenzie
323ff193b8 Add tests for calling trait methods on concrete types 2020-02-18 21:03:28 -08:00
Dylan MacKenzie
7a019b1bd2 Check for trait methods on concrete types in const checking 2020-02-18 21:03:28 -08:00
Dylan MacKenzie
5e422efba1 Remove "not yet implemented" warning 2020-02-18 21:03:28 -08:00
bors
3a8108d8e5 Auto merge of #69113 - ecstatic-morse:unified-dataflow-borrowed, r=wesleywiser
Combine `HaveBeenBorrowedLocals` and `IndirectlyMutableLocals` into one dataflow analysis

This PR began as an attempt to port `HaveBeenBorrowedLocals` to the new dataflow framework (see #68241 for prior art). Along the way, I noticed that it could share most of its code with `IndirectlyMutableLocals` and then found a few bugs in the two analyses:
- Neither one marked locals as borrowed after an `Rvalue::AddressOf`.
- `IndirectlyMutableLocals` was missing a minor fix that `HaveBeenBorrowedLocals` got in #61069. This is not a problem today since it is only used during const-checking, where custom drop glue is forbidden. However, this may change some day.

I decided to combine the two analyses so that they wouldn't diverge in the future while ensuring that they remain distinct types (called `MaybeBorrowedLocals` and `MaybeMutBorrowedLocals` to be consistent with the `Maybe{Un,}InitializedPlaces` naming scheme). I fixed the bugs and switched to exhaustive matching where possible to make them less likely in the future. Finally, I added comments explaining some of the finer points of the transfer function for these analyses (see #61069 and #65006).
2020-02-19 04:57:10 +00:00
Dylan MacKenzie
3e0b0605a0 Const-check functions in a const impl 2020-02-18 19:27:58 -08:00
Dylan MacKenzie
62ff11f1a4 Add is_const_impl_raw query 2020-02-18 19:27:58 -08:00
Matthias Krüger
076cd9eabd submodules: update clippy from b91ae16e to 2855b214
Changes:
````
Rustup to rust-lang/rust#69194
Rustup to rust-lang/rust#69181
Add `LOG2_10` and `LOG10_2` to `approx_const` lint
Clean up imports
Use `Vec::with_capacity()` as possible
needless_doctest_main: False positive for async fn
Remove use of `TyKind`.
Use `if_chain`.
Fix ICE.
Add tests and improve checks.
Add `Future` detection for `missing_errors_doc`.
````

Fixes #69269
2020-02-19 03:46:10 +01:00
bors
a2fb0c28be Auto merge of #69241 - shahn:checked_add_revert, r=Mark-Simulacrum,lqd
Revert "Remove `checked_add` in `Layout::repeat`"

This fixes a a segfault in safe code, a stable regression. Reported in #69225.

This reverts commit a983e0590a.
2020-02-19 01:36:31 +00:00
Sebastian Hahn
3e17d191fa Revert "Remove checked_add in Layout::repeat"
This fixes a a segfault in safe code, a stable regression. Reported in
\#69225.

This reverts commit a983e0590a.

Also adds a test for the expected behaviour.
2020-02-18 23:57:48 +01:00
bors
e0e5d82e16 Auto merge of #69271 - Centril:rollup-iupsol6, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #69146 (Always const qualify literals by type)
 - #69159 (Select an appropriate unused lifetime name in suggestion)
 - #69194 (parse: fuse associated and extern items up to defaultness)
 - #69211 (parser: Simplify treatment of macro variables in `Parser::bump`)
 - #69217 (Do not emit note suggesting to implement operation trait to foreign type)
 - #69236 (parse: recover `mut (x @ y)` as `(mut x @ mut y)`.)

Failed merges:

r? @ghost
2020-02-18 22:29:06 +00:00
Ralf Jung
5e19350a4c better lint names 2020-02-18 22:49:47 +01:00
John Kåre Alsaker
437f56edf4 Fix race condition when allocating source files in SourceMap 2020-02-18 22:29:23 +01:00
Mazdak Farrokhzad
6c6d45c6e7
Rollup merge of #69236 - Centril:mut-parens-at-recovery, r=estebank
parse: recover `mut (x @ y)` as `(mut x @ mut y)`.

Follow up to https://github.com/rust-lang/rust/pull/68992#discussion_r376829749 and https://github.com/rust-lang/rust/pull/63945.

Specifically, when given `let mut (x @ y)` we recover with `let (mut x @ mut y)` as the suggestion:

```rust
error: `mut` must be attached to each individual binding
  --> $DIR/mut-patterns.rs:12:9
   |
LL |     let mut (x @ y) = 0;
   |         ^^^^^^^^^^^ help: add `mut` to each binding: `(mut x @ mut y)`
   |
   = note: `mut` may be followed by `variable` and `variable @ pattern`
```

r? @matthewjasper @estebank
2020-02-18 22:16:31 +01:00
Mazdak Farrokhzad
c499570b5d
Rollup merge of #69217 - LeSeulArtichaut:remove-lint-impl-op, r=estebank
Do not emit note suggesting to implement operation trait to foreign type

When a binary operation isn't valid, you will get a lint proposing to add a trait implementation to make the operation possible. However, this cannot be done for foreign types, such as types from `core` or `std`.

For example:
```
= note: an implementation of `std::ops::Add` might be missing for `std::option::Option<i8>`
```
As mentioned in https://github.com/rust-lang/rust/issues/60497#issuecomment-562665539:
> The note suggesting implementing Add<i8> should only be emitted if Option<i8> were local to the current crate, which it isn't, so in this case it shouldn't be emitted.

(I will use the CI to check tests for me, or my computer will just burn... and running IDEs is not possible on a pile of ashes)

r? @estebank
2020-02-18 22:16:29 +01:00
Mazdak Farrokhzad
1cf0194b46
Rollup merge of #69211 - petrochenkov:prevtok, r=Centril
parser: Simplify treatment of macro variables in `Parser::bump`

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

Token normalization for `$ident` and `$lifetime` is merged directly into `bump`.
Special "unknown macro variable" diagnostic for unexpected `$`s is removed as preventing legal code from compiling (as a result `bump` also doesn't call itself recursively anymore and can't make `prev_token` inconsistent).

r? @Centril
2020-02-18 22:16:28 +01:00
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
Eric Huss
597b4f743e Update cargo 2020-02-18 09:21:34 -08: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