about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-02-19Implement an insertion-order preserving, efficient multi-mapDylan MacKenzie-1/+249
2020-02-19Auto merge of #69278 - matthiaskrgr:submodule_upd, r=Dylan-DPCbors-9/+7
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-19Auto merge of #69265 - ehuss:update-cargo, r=Dylan-DPCbors-0/+0
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-19Auto merge of #69113 - ecstatic-morse:unified-dataflow-borrowed, r=wesleywiserbors-280/+304
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-19submodules: update clippy from b91ae16e to 2855b214Matthias Krüger-9/+7
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-19Auto merge of #69241 - shahn:checked_add_revert, r=Mark-Simulacrum,lqdbors-5/+38
Revert "Remove `checked_add` in `Layout::repeat`" This fixes a a segfault in safe code, a stable regression. Reported in #69225. This reverts commit a983e0590a43ed8b0f60417828efd4e79b51f494.
2020-02-18Revert "Remove `checked_add` in `Layout::repeat`"Sebastian Hahn-5/+38
This fixes a a segfault in safe code, a stable regression. Reported in \#69225. This reverts commit a983e0590a43ed8b0f60417828efd4e79b51f494. Also adds a test for the expected behaviour.
2020-02-18Rollup merge of #69236 - Centril:mut-parens-at-recovery, r=estebankMazdak Farrokhzad-27/+34
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-18Rollup merge of #69217 - LeSeulArtichaut:remove-lint-impl-op, r=estebankMazdak Farrokhzad-77/+17
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-18Rollup merge of #69211 - petrochenkov:prevtok, r=CentrilMazdak Farrokhzad-82/+88
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-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-714/+1314
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-18Rollup merge of #69159 - estebank:use-appropriate-lt-name, r=ecstatic-morseMazdak Farrokhzad-13/+71
Select an appropriate unused lifetime name in suggestion Follow up to #69048.
2020-02-18Rollup merge of #69146 - matthewjasper:literal-qualif, r=eddybMazdak Farrokhzad-23/+52
Always const qualify literals by type r? @eddyb
2020-02-18Auto merge of #69262 - Dylan-DPC:rollup-m6dt9cn, r=Dylan-DPCbors-137/+358
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-18Update cargoEric Huss-0/+0
2020-02-18Rollup merge of #69233 - GuillaumeGomez:cleanup-e0310, r=Dylan-DPCDylan DPC-4/+9
Clean up E0310 explanation r? @Dylan-DPC
2020-02-18Rollup merge of #69205 - JohnTitor:allow-whitespaces, r=Mark-SimulacrumDylan DPC-9/+2
Allow whitespaces in revision flags Allow whitespaces in revision flags, like `// [foo]`. Fixes #69183
2020-02-18Rollup merge of #69200 - jonas-schievink:yield-print, r=eddyb,ZoxcDylan DPC-9/+9
Fix printing of `Yield` terminator Addresses the bug found in https://github.com/rust-lang/rust/issues/69039#issuecomment-586633495
2020-02-18Rollup merge of #69192 - JohnTitor:add-tests, r=CentrilDylan DPC-0/+159
Add more regression tests Closes #39618 Closes #51798 Closes #62894 Closes #63952 Closes #68653 r? @Centril
2020-02-18Rollup merge of #69181 - skinny121:const-eval-return, r=oli-obkDylan DPC-115/+179
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-18Auto merge of #69234 - JohnTitor:clippy-up, r=JohnTitorbors-8/+8
Update Clippy Fixes #69221 r? @ghost
2020-02-18Clean up E0310 explanationGuillaume Gomez-4/+9
2020-02-18Rollup merge of #69252 - Mark-Simulacrum:disk-try, r=pietroalbiniYuki Okushi-0/+19
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-18Rollup merge of #69249 - LeSeulArtichaut:stabilize-logs-consts, r=sfacklerYuki Okushi-4/+4
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-18Rollup merge of #69244 - cuviper:llvm-flags, r=Mark-SimulacrumYuki Okushi-3/+3
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-18Rollup merge of #69223 - spunit262:empty-string-gdb-version, r=Dylan-DPCYuki Okushi-0/+1
Ignore GDB versions with broken str printing. https://sourceware.org/bugzilla/show_bug.cgi?id=22236
2020-02-18Rollup merge of #69175 - estebank:shall-not-ice, r=petrochenkovYuki Okushi-3/+18
Do not ICE when encountering `yield` inside `async` block Fix #67158.
2020-02-18Rollup merge of #68767 - kubo39:patch-macos, r=shepmasterYuki Okushi-2/+3
macOS: avoid calling pthread_self() twice
2020-02-18Rollup merge of #68597 - ollie27:skip_nth_last, r=AmanieuYuki Okushi-13/+7
Simplify `Skip::nth` and `Skip::last` implementations The main improvement is to make `last` no longer recursive.
2020-02-18Rollup merge of #67272 - fisherdarling:master, r=varkor,hellow554Yuki Okushi-6/+112
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-18Clean out some default-installed directoriesMark Rousskov-0/+19
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-17Fix typo in commentDylan MacKenzie-1/+1
2020-02-17Use doc comment for explanation of `shared_borrow_allows_mutation`Dylan MacKenzie-9/+9
2020-02-17Add a test for proc macro generating `$ IDENT`Vadim Petrochenkov-0/+35
2020-02-17parser: Remove `Option`s from unnormalized tokensVadim Petrochenkov-43/+26
They are always set synchronously with normalized tokens now
2020-02-17parser: Set previous and unnormalized tokens in couple more placesVadim Petrochenkov-7/+9
2020-02-17parser: Do not call `bump` recursivelyVadim Petrochenkov-52/+38
Token normalization is merged directly into `bump`. Special "unknown macro variable" diagnostic for unexpected `$`s is removed as preventing legal code from compiling.
2020-02-17configure: set LLVM flags with a valueJosh Stone-3/+3
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-17parse: recover `mut (x @ y)` as `(mut x @ mut y)`.Mazdak Farrokhzad-27/+34
2020-02-17Do not emit note suggesting to implement trait to foreign typeLeSeulArtichaut-77/+17
Update tests Extend to other operations Refractor check in a separate function Fix more tests
2020-02-17Update ClippyYuki Okushi-8/+8
2020-02-17Auto merge of #69129 - Centril:macro-legacy-errors, r=petrochenkovbors-97/+35
Transition macro_legacy_warnings into a hard error Fixes https://github.com/rust-lang/rust/issues/67098. r? @petrochenkov
2020-02-17ast: add a FIXMEMazdak Farrokhzad-0/+2
2020-02-17Auto merge of #69226 - JohnTitor:rollup-syn03oj, r=JohnTitorbors-158/+185
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-17Rollup merge of #69188 - GuillaumeGomez:clean-up-e0309, r=Dylan-DPCYuki Okushi-9/+13
Clean up E0309 explanation r? @Dylan-DPC
2020-02-17Rollup merge of #69186 - petrochenkov:kwrules, r=CentrilYuki Okushi-6/+9
[tiny] parser: `macro_rules` is a weak keyword r? @Centril
2020-02-17Rollup merge of #69179 - JohnTitor:rename-to-fnretty, r=CentrilYuki Okushi-118/+111
Rename `FunctionRetTy` to `FnRetTy` As per FIXME comment r? @Centril
2020-02-17Rollup merge of #69158 - ecstatic-morse:graphviz-diff, r=matthewjasperYuki Okushi-20/+35
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-17Rollup merge of #68701 - amosonn:patch-2, r=RalfJungYuki Okushi-4/+15
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-17Rollup merge of #68495 - sdegutis:patch-1, r=Mark-SimulacrumYuki Okushi-1/+2
Updating str.chars docs to mention crates.io. This might spare someone else a little time searching the stdlib for unicode/grapheme support.