]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #70493 - 0xd4d:rustdoc-tab-size, r=GuillaumeGomez
Dylan DPC [Sat, 28 Mar 2020 14:22:01 +0000 (15:22 +0100)]
Rollup merge of #70493 - 0xd4d:rustdoc-tab-size, r=GuillaumeGomez

Fix rustdoc.css CSS tab-size property

This fixes the CSS tab size property names which are called `tab-size` / `-moz-tab-size` and not `tab-width`

Old issue https://github.com/rust-lang/rust/issues/49155 and related PR https://github.com/rust-lang/rust/pull/50947

tab-size: https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size

4 years agoRollup merge of #70486 - Mark-Simulacrum:unicode-shrink, r=dtolnay
Dylan DPC [Sat, 28 Mar 2020 14:22:00 +0000 (15:22 +0100)]
Rollup merge of #70486 - Mark-Simulacrum:unicode-shrink, r=dtolnay

Shrink Unicode tables (even more)

This shrinks the Unicode tables further, building upon the wins in #68232 (the previous counts differ due to an interim Unicode version update, see #69929.

The new data structure is slower by around 3x, on the benchmark of looking up every Unicode scalar value in each data set sequentially in every data set included. Note that for ASCII, the exposed functions on `char` optimize with direct branches, so ASCII will retain the same performance regardless of internal optimizations (or the reverse). Also, note that the size reduction due to the skip list (from where the performance losses come) is around 40%, and, as a result, I believe the performance loss is acceptable, as the routines are still quite fast. Anywhere where this is hot, should probably be using a custom data structure anyway (e.g., a raw bitset) or something optimized for frequently seen values, etc.

This PR updates both the bitset data structure, and introduces a new data structure similar to a skip list. For more details, see the [main.rs] of the table generator, which describes both. The commits mostly work individually and document size wins.

As before, this is tested on all valid chars to have the same results as nightly (and the canonical Unicode data sets), happily, no bugs were found.

[main.rs]: https://github.com/rust-lang/rust/blob/fb4a715e18b/src/tools/unicode-table-generator/src/main.rs

Set             | Previous |  New  |  % of old  | Codepoints | Ranges |
----------------|---------:|------:|-----------:|-----------:|-------:|
Alphabetic      |     3055 |  1599 |        52% |     132875 |    695 |
Case Ignorable  |     2136 |   949 |        44% |       2413 |    410 |
Cased           |      934 |   359 |        38% |       4286 |    141 |
Cc              |       43 |     9 |        20% |         65 |      2 |
Grapheme Extend |     1774 |   813 |        46% |       1979 |    344 |
Lowercase       |      985 |   867 |        88% |       2344 |    652 |
N               |     1266 |   419 |        33% |       1781 |    133 |
Uppercase       |      934 |   777 |        83% |       1911 |    643 |
White_Space     |      140 |    37 |        26% |         25 |     10 |
----------------|----------|-------|------------|------------|--------|
Total           |    11267 |  5829 |        51% |     -      |   -    |

4 years agoRollup merge of #70448 - TimotheeGerber:rustdoc-create-output-dir, r=GuillaumeGomez
Dylan DPC [Sat, 28 Mar 2020 14:21:58 +0000 (15:21 +0100)]
Rollup merge of #70448 - TimotheeGerber:rustdoc-create-output-dir, r=GuillaumeGomez

Create output dir in rustdoc markdown render

`rustdoc` command on a standalone markdown document fails because the output directory (which default to `doc/`) is not created, even when specified with the `--output` argument.

This PR adds the creation of the output directory before the file creation to avoid an unexpected error which is unclear.

I am not sure about the returned error code. I did not find a table explaining them. So I simply put the same error code that is returned when `File::create` fails because they are both related to file-system errors.

Resolve #70431

4 years agoRollup merge of #70418 - PankajChaudhary5:master, r=Dylan-DPC
Dylan DPC [Sat, 28 Mar 2020 14:21:57 +0000 (15:21 +0100)]
Rollup merge of #70418 - PankajChaudhary5:master, r=Dylan-DPC

Add long error explanation for E0703

Add long explanation for the E0703 error code
Part of #61137

r? @GuillaumeGomez

4 years agoAuto merge of #70261 - Centril:angle-args-partition, r=varkor
bors [Sat, 28 Mar 2020 11:13:09 +0000 (11:13 +0000)]
Auto merge of #70261 - Centril:angle-args-partition, r=varkor

Move arg/constraint partition check to validation & improve recovery

- In the first commit, we move the check rejecting e.g., `<'a, Item = u8, String>` from the parser into AST validation.
- We then use this to improve the code for parsing generic arguments.
- And we add recovery for e.g., `<Item = >` (missing), `<Item = 42>` (constant), and `<Item = 'a>` (lifetime).

This is also preparatory work for supporting https://github.com/rust-lang/rust/issues/70256.

r? @varkor

4 years agoFix rustdoc.css CSS tab-size property
0xd4d [Sat, 28 Mar 2020 10:49:12 +0000 (11:49 +0100)]
Fix rustdoc.css CSS tab-size property

4 years agoAuto merge of #70095 - jsgf:link-native, r=nagisa
bors [Sat, 28 Mar 2020 08:16:47 +0000 (08:16 +0000)]
Auto merge of #70095 - jsgf:link-native, r=nagisa

Implement -Zlink-native-libraries

This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).

If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).

Addresses issue #70093

4 years agoAuto merge of #70483 - Centril:rollup-slli4yf, r=Centril
bors [Sat, 28 Mar 2020 00:36:57 +0000 (00:36 +0000)]
Auto merge of #70483 - Centril:rollup-slli4yf, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #70345 (Remove `no_integrated_as` mode.)
 - #70434 (suggest `;` on expr `mac!()` which is good as stmt `mac!()`)
 - #70457 (non-exhastive diagnostic: add note re. scrutinee type)
 - #70478 (Refactor type_of for constants)
 - #70480 (clarify hir_id <-> node_id method names)

Failed merges:

r? @ghost

4 years agoUpdate the documentation comment
Mark Rousskov [Fri, 27 Mar 2020 22:13:22 +0000 (18:13 -0400)]
Update the documentation comment

4 years agoRemove separate encoding for a single nonzero-mapping byte
Mark Rousskov [Fri, 27 Mar 2020 22:01:14 +0000 (18:01 -0400)]
Remove separate encoding for a single nonzero-mapping byte

In practice, for the two data sets that still use the bitset encoding (uppercase
and lowercase) this is not a significant win, so just drop it entirely. It costs
us about 5 bytes, and the complexity is nontrivial.

4 years agoAdd skip list based implementation for smaller encoding
Mark Rousskov [Thu, 26 Mar 2020 01:00:01 +0000 (21:00 -0400)]
Add skip list based implementation for smaller encoding

This arranges for the sparser sets (everything except lower and uppercase) to be
encoded in a significantly smaller context. However, it is also a performance
trade-off (roughly 3x slower than the bitset encoding). The 40% size reduction
is deemed to be sufficiently important to merit this performance loss,
particularly as it is unlikely that this code is hot anywhere (and if it is,
paying the memory cost for a bitset that directly represents the data seems
worthwhile).

Alphabetic     : 1599 bytes     (- 937 bytes)
Case_Ignorable : 949 bytes      (- 822 bytes)
Cased          : 359 bytes      (- 429 bytes)
Cc             : 9 bytes        (-  15 bytes)
Grapheme_Extend: 813 bytes      (- 675 bytes)
Lowercase      : 863 bytes
N              : 419 bytes      (- 619 bytes)
Uppercase      : 776 bytes
White_Space    : 37 bytes       (-  46 bytes)
Total table sizes: 5824 bytes   (-3543 bytes)

4 years agoRollup merge of #70480 - lcnr:appayupyup, r=eddyb
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:42 +0000 (22:39 +0100)]
Rollup merge of #70480 - lcnr:appayupyup, r=eddyb

clarify hir_id <-> node_id method names

resolves 2 FIXME.

r? @eddyb

4 years agoRollup merge of #70478 - lcnr:refactor-type_of, r=varkor
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:41 +0000 (22:39 +0100)]
Rollup merge of #70478 - lcnr:refactor-type_of, r=varkor

Refactor type_of for constants

If I have to look at this function for a few hours I want it to at least look good.

r? @varkor

4 years agoRollup merge of #70457 - Centril:non-exhaustive-scrutinee-type, r=estebank
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:39 +0000 (22:39 +0100)]
Rollup merge of #70457 - Centril:non-exhaustive-scrutinee-type, r=estebank

non-exhastive diagnostic: add note re. scrutinee type

This fixes https://github.com/rust-lang/rust/issues/67259 by adding a note:
```
    = note: the matched value is of type &[i32]
```
to non-exhaustive pattern matching errors.

r? @varkor @estebank

4 years agoRollup merge of #70434 - Centril:fix-34421, r=estebank
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:38 +0000 (22:39 +0100)]
Rollup merge of #70434 - Centril:fix-34421, r=estebank

suggest `;` on expr `mac!()` which is good as stmt `mac!()`

Fixes https://github.com/rust-lang/rust/issues/34421 by implementing @jseyfried's suggestion in https://github.com/rust-lang/rust/issues/34421#issuecomment-301578683.

r? @petrochenkov

4 years agoRollup merge of #70345 - nnethercote:rm-no_integrated_as, r=alexcrichton
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:37 +0000 (22:39 +0100)]
Rollup merge of #70345 - nnethercote:rm-no_integrated_as, r=alexcrichton

Remove `no_integrated_as` mode.

Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.

r? @alexcrichton

4 years agoAuto merge of #70162 - cjgillot:split_query, r=Zoxc
bors [Fri, 27 Mar 2020 21:36:51 +0000 (21:36 +0000)]
Auto merge of #70162 - cjgillot:split_query, r=Zoxc

Move the query system to a dedicated crate

The query system `rustc::ty::query` is split out into the `rustc_query_system` crate.

Some commits are unformatted, to ease rebasing.

Based on #67761 and #69910.

r? @Zoxc

4 years agoadd the label back but make it shorter
Mazdak Farrokhzad [Fri, 27 Mar 2020 20:52:09 +0000 (21:52 +0100)]
add the label back but make it shorter

4 years agoImplement -Zlink-native-libraries
Jeremy Fitzhardinge [Wed, 18 Mar 2020 02:10:56 +0000 (19:10 -0700)]
Implement -Zlink-native-libraries

This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).

If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).

Addresses issue #70093

4 years agoAuto merge of #70474 - Dylan-DPC:rollup-0lsxmmk, r=Dylan-DPC
bors [Fri, 27 Mar 2020 16:09:48 +0000 (16:09 +0000)]
Auto merge of #70474 - Dylan-DPC:rollup-0lsxmmk, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #65222 (Proposal: `fold_self` and `try_fold_self` for Iterators)
 - #69887 (clean up E0404 explanation)
 - #70068 (use "gcc" instead of "cc" on *-sun-solaris systems when linking)
 - #70470 (Clean up E0463 explanation)

Failed merges:

r? @ghost

4 years agorefactor type_of for consts
Bastian Kauschke [Fri, 27 Mar 2020 15:44:40 +0000 (16:44 +0100)]
refactor type_of for consts

4 years agoclarify hir_id <-> node_id method names
Bastian Kauschke [Fri, 27 Mar 2020 15:43:20 +0000 (16:43 +0100)]
clarify hir_id <-> node_id method names

4 years agoRefactor changes
PankajChaudhary5 [Fri, 27 Mar 2020 14:30:49 +0000 (20:00 +0530)]
Refactor changes

4 years agoRollup merge of #70470 - GuillaumeGomez:cleanup-e0463, r=Dylan-DPC
Dylan DPC [Fri, 27 Mar 2020 14:09:59 +0000 (15:09 +0100)]
Rollup merge of #70470 - GuillaumeGomez:cleanup-e0463, r=Dylan-DPC

Clean up E0463 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70068 - jclulow:illumos-gcc, r=cramertj
Dylan DPC [Fri, 27 Mar 2020 14:09:57 +0000 (15:09 +0100)]
Rollup merge of #70068 - jclulow:illumos-gcc, r=cramertj

use "gcc" instead of "cc" on *-sun-solaris systems when linking

On illumos and Solaris systems, Rust will use GCC as the link editor.
Rust does this by invoking "cc", which on many (Linux and perhaps BSD)
systems is generally either GCC or a GCC-compatible front-end.  On
historical Solaris systems, "cc" was often the Sun Studio compiler.
This history casts a long shadow, and as such, even most modern
illumos-based operating systems tend to install GCC as "gcc", without
also making it available as "cc".

We should invoke GCC as "gcc" on such systems to ensure we get the right
compiler driver.

4 years agoRollup merge of #69887 - GuillaumeGomez:cleanup-e0404, r=Dylan-DPC
Dylan DPC [Fri, 27 Mar 2020 14:09:54 +0000 (15:09 +0100)]
Rollup merge of #69887 - GuillaumeGomez:cleanup-e0404, r=Dylan-DPC

clean up E0404 explanation

r? @Dylan-DPC

4 years agoRollup merge of #65222 - Lucretiel:fold_self, r=kodrAus
Dylan DPC [Fri, 27 Mar 2020 14:09:48 +0000 (15:09 +0100)]
Rollup merge of #65222 - Lucretiel:fold_self, r=kodrAus

Proposal: `fold_self` and `try_fold_self` for Iterators

This pull request proposes & implements two new methods on Iterators: `fold_self` and `try_fold_self`. These are variants of `fold` and `try_fold` that use the first element in the iterator as the initial accumulator.

Let me know if a public feature like this requires an RFC, or if this pull request is sufficient as place for discussion.

4 years agoclean up E0404 explanation
Guillaume Gomez [Tue, 10 Mar 2020 11:54:17 +0000 (12:54 +0100)]
clean up E0404 explanation

4 years agoRefactor changes
PankajChaudhary5 [Fri, 27 Mar 2020 13:46:32 +0000 (19:16 +0530)]
Refactor changes

4 years agoAuto merge of #69916 - oli-obk:mir_bless, r=eddyb
bors [Fri, 27 Mar 2020 12:58:34 +0000 (12:58 +0000)]
Auto merge of #69916 - oli-obk:mir_bless, r=eddyb

Enable blessing of mir opt tests

cc @rust-lang/wg-mir-opt
cc @RalfJung

Long overdue, but now you can finally just add a

```rust
// EMIT_MIR rustc.function_name.MirPassName.before.mir
```

(or `after.mir` since most of the time you want to know the MIR after a pass). A `--bless` invocation will automatically create the files for you.

I suggest we do this for all mir opt tests that have all of the MIR in their source anyway

If you use `rustc.function.MirPass.diff` you only get the diff that the MIR pass causes on the MIR.

Fixes #67865

4 years agoClean up E0463 explanation
Guillaume Gomez [Fri, 27 Mar 2020 12:35:00 +0000 (13:35 +0100)]
Clean up E0463 explanation

4 years agoAuto merge of #70282 - ssomers:btreemap_gdb_pretty_print, r=Mark-Simulacrum
bors [Fri, 27 Mar 2020 09:54:02 +0000 (09:54 +0000)]
Auto merge of #70282 - ssomers:btreemap_gdb_pretty_print, r=Mark-Simulacrum

Test and fix gdb pretty printing more

Over time I had oversimplified the test case for #68098: it does not have an internal node to print so it did not test what it pretended to test. And then I also realized not spotting the same mistake reviewing #70111, and more likely to occur in the wild. Now, both test cases fail if you put back the flawed python code.

r? @Mark-Simulacrum

4 years agoaddress some review comments
Mazdak Farrokhzad [Fri, 27 Mar 2020 06:39:10 +0000 (07:39 +0100)]
address some review comments

4 years agoImplement HashStable directly.
Camille GILLOT [Fri, 27 Mar 2020 07:33:37 +0000 (08:33 +0100)]
Implement HashStable directly.

4 years agoCleanups.
Camille GILLOT [Fri, 27 Mar 2020 06:50:28 +0000 (07:50 +0100)]
Cleanups.

4 years agoMove QueryContext to the parent module.
Camille GILLOT [Fri, 27 Mar 2020 06:43:11 +0000 (07:43 +0100)]
Move QueryContext to the parent module.

4 years agoparse: improve recovery for assoc eq constraints.
Mazdak Farrokhzad [Sun, 22 Mar 2020 05:09:24 +0000 (06:09 +0100)]
parse: improve recovery for assoc eq constraints.

4 years agoextract parse_generic_arg
Mazdak Farrokhzad [Sun, 22 Mar 2020 04:12:51 +0000 (05:12 +0100)]
extract parse_generic_arg

4 years agoparse_angle_arg: parse constraints first
Mazdak Farrokhzad [Sun, 22 Mar 2020 04:01:38 +0000 (05:01 +0100)]
parse_angle_arg: parse constraints first

4 years agosplit parse_angle_args into loop / single step
Mazdak Farrokhzad [Sun, 22 Mar 2020 03:54:46 +0000 (04:54 +0100)]
split parse_angle_args into loop / single step

4 years agoparse: move constraint/arg restriction to ast_validation.
Mazdak Farrokhzad [Sun, 22 Mar 2020 03:40:05 +0000 (04:40 +0100)]
parse: move constraint/arg restriction to ast_validation.

4 years agoRemove the QueryGetter trait.
Camille GILLOT [Fri, 27 Mar 2020 06:35:32 +0000 (07:35 +0100)]
Remove the QueryGetter trait.

4 years agoAuto merge of #69470 - mati865:deps, r=Mark-Simulacrum
bors [Fri, 27 Mar 2020 06:31:49 +0000 (06:31 +0000)]
Auto merge of #69470 - mati865:deps, r=Mark-Simulacrum

Upgrade rustc and bootstrap dependencies

4 years agosuggest semi on expr mac!() good as stmt mac!().
Mazdak Farrokhzad [Thu, 26 Mar 2020 14:54:47 +0000 (15:54 +0100)]
suggest semi on expr mac!()  good as stmt mac!().

4 years agonon-exhastive diagnostic: add note re. scrutinee type
Mazdak Farrokhzad [Fri, 27 Mar 2020 05:44:30 +0000 (06:44 +0100)]
non-exhastive diagnostic: add note re. scrutinee type

4 years agofix suggested changes
PankajChaudhary5 [Fri, 27 Mar 2020 04:23:16 +0000 (09:53 +0530)]
fix suggested changes

4 years agoAuto merge of #68404 - Amanieu:llvm-asm, r=estebank
bors [Fri, 27 Mar 2020 03:27:09 +0000 (03:27 +0000)]
Auto merge of #68404 - Amanieu:llvm-asm, r=estebank

Rename asm! to llvm_asm!

As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850.

This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.

4 years agoremove unused import
dylan_DPC [Fri, 27 Mar 2020 02:21:15 +0000 (03:21 +0100)]
remove unused import

4 years agosimplify test
dylan_DPC [Fri, 27 Mar 2020 01:45:56 +0000 (02:45 +0100)]
simplify test

4 years agoRemove `no_integrated_as` mode.
Nicholas Nethercote [Tue, 24 Mar 2020 03:06:47 +0000 (14:06 +1100)]
Remove `no_integrated_as` mode.

Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.

4 years agoAuto merge of #70451 - Dylan-DPC:rollup-2g9oyht, r=Dylan-DPC
bors [Fri, 27 Mar 2020 00:25:26 +0000 (00:25 +0000)]
Auto merge of #70451 - Dylan-DPC:rollup-2g9oyht, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69644 (Remove framework in `dataflow/mod.rs` in favor of "generic" one)
 - #69936 (Fix cycle error when emitting suggestion for mismatched `fn` type)
 - #70048 (Allow obtaining &mut OsStr)
 - #70344 (Decouple `rustc_hir::print` into `rustc_hir_pretty`)
 - #70435 (Add regression test for #66706)

Failed merges:

r? @ghost

4 years agoRollup merge of #70435 - Alexendoo:test-66706, r=Centril
Dylan DPC [Fri, 27 Mar 2020 00:23:55 +0000 (01:23 +0100)]
Rollup merge of #70435 - Alexendoo:test-66706, r=Centril

Add regression test for #66706

Adds the two cases that no longer ICE (https://github.com/rust-lang/rust/issues/66706#issuecomment-604098436)

4 years agoRollup merge of #70344 - Centril:hir-pretty, r=eddyb
Dylan DPC [Fri, 27 Mar 2020 00:23:53 +0000 (01:23 +0100)]
Rollup merge of #70344 - Centril:hir-pretty, r=eddyb

Decouple `rustc_hir::print` into `rustc_hir_pretty`

High level summary:
- The HIR pretty printer, `rustc_hir::print` is moved into a new crate `rustc_hir_pretty`.
- `rustc_ast_pretty` and `rustc_errors` are dropped as `rustc_hir` dependencies.
- The dependence on HIR pretty is generally reduced, leaving `rustc_save_analysis`, `rustdoc`, `rustc_metadata`, and `rustc_driver` as the remaining clients.

The main goal here is to reduce `rustc_hir`'s dependencies and its size such that it can start and finish earlier, thereby working towards https://github.com/rust-lang/rust/issues/65031.

r? @Zoxc

4 years agoRollup merge of #70048 - TyPR124:mutable_osstr, r=dtolnay
Dylan DPC [Fri, 27 Mar 2020 00:23:51 +0000 (01:23 +0100)]
Rollup merge of #70048 - TyPR124:mutable_osstr, r=dtolnay

Allow obtaining &mut OsStr

```rust
impl DerefMut for OsString {...}              // type Target = OsStr
impl IndexMut<RangeFull> for OsString {...}   // type Output = OsStr
```

---

This change is pulled out of #69937 per @dtolnay

This implements `DerefMut for OsString` to allow obtaining a `&mut OsStr`. This also implements `IndexMut for OsString`, which is used by `DerefMut`. This pattern is the same as is used by `Deref`.

This is necessary to for methods like `make_ascii_lowercase` which need to mutate the underlying value.

4 years agoRollup merge of #69936 - Aaron1011:fix/suggestion-cycle, r=varkor
Dylan DPC [Fri, 27 Mar 2020 00:23:49 +0000 (01:23 +0100)]
Rollup merge of #69936 - Aaron1011:fix/suggestion-cycle, r=varkor

Fix cycle error when emitting suggestion for mismatched `fn` type

Fixes #66667

Previously, we called `tcx.typeck_tables_of` when determining whether or
not to emit a suggestion for a type error. However, we might already be
type-checking the `DefId` we pass to `typeck_tables_of` (it could be
anywhere in the query stack).

Fortunately, we only need the function signature, not the entire
`TypeckTables`. By using `tcx.fn_sig`, we avoid the possibility of cycle
errors while retaining the ability to emit a suggestion.

4 years agoRollup merge of #69644 - ecstatic-morse:unified-dataflow-cleanup, r=eddyb
Dylan DPC [Fri, 27 Mar 2020 00:23:47 +0000 (01:23 +0100)]
Rollup merge of #69644 - ecstatic-morse:unified-dataflow-cleanup, r=eddyb

Remove framework in `dataflow/mod.rs` in favor of "generic" one

This is the culmination of the work described in rust-lang/compiler-team#202. All dataflow analyses (including the one in `clippy`) have been ported to use the framework in `dataflow/generic`, which can efficiently handle both gen/kill and generic problems. This PR moves the framework in `dataflow/generic` to `dataflow/framework`, and removes the gen/kill framework in `dataflow/mod.rs`.

More comprehensive documentation for the new framework is tracked in rust-lang/rustc-guide#564.

`clippy` will need to change the path it uses to import the dataflow analysis traits.

4 years agoMake `framework` a private module
Dylan MacKenzie [Mon, 2 Mar 2020 17:43:18 +0000 (09:43 -0800)]
Make `framework` a private module

4 years agoUpdate `framework` module docs
Dylan MacKenzie [Mon, 2 Mar 2020 17:40:58 +0000 (09:40 -0800)]
Update `framework` module docs

4 years agoMove `BottomValue` into `framework/mod.rs`
Dylan MacKenzie [Mon, 2 Mar 2020 17:32:12 +0000 (09:32 -0800)]
Move `BottomValue` into `framework/mod.rs`

4 years agoUpdate imports from `dataflow::generic` to `dataflow`
Dylan MacKenzie [Sat, 29 Feb 2020 06:02:20 +0000 (22:02 -0800)]
Update imports from `dataflow::generic` to `dataflow`

4 years agoUpdate use statements in `dataflow/mod.rs`
Dylan MacKenzie [Sat, 29 Feb 2020 05:55:41 +0000 (21:55 -0800)]
Update use statements in `dataflow/mod.rs`

4 years agoRename `dataflow::generic` to `dataflow::framework`
Dylan MacKenzie [Sat, 29 Feb 2020 05:49:33 +0000 (21:49 -0800)]
Rename `dataflow::generic` to `dataflow::framework`

4 years agoMove `MoveDataParamEnv` to beginning of module
Dylan MacKenzie [Sat, 29 Feb 2020 05:47:36 +0000 (21:47 -0800)]
Move `MoveDataParamEnv` to beginning of module

4 years agoRemove `BitDenotation` framework
Dylan MacKenzie [Sat, 29 Feb 2020 05:42:20 +0000 (21:42 -0800)]
Remove `BitDenotation` framework

4 years agoTest and fix gdb pretty printing again
Stein Somers [Sun, 22 Mar 2020 20:10:48 +0000 (20:10 +0000)]
Test and fix gdb pretty printing again

4 years agofix docs
dylan_DPC [Thu, 26 Mar 2020 22:18:37 +0000 (23:18 +0100)]
fix docs

4 years agoCreate output dir in rustdoc markdown render
Timothée Gerber [Thu, 26 Mar 2020 21:57:33 +0000 (22:57 +0100)]
Create output dir in rustdoc markdown render

4 years agoAuto merge of #70441 - Dylan-DPC:rollup-qv7h2ph, r=Dylan-DPC
bors [Thu, 26 Mar 2020 20:45:47 +0000 (20:45 +0000)]
Auto merge of #70441 - Dylan-DPC:rollup-qv7h2ph, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70384 (Refactor object file handling)
 - #70397 (add 'fn write_u16s' to Memory)
 - #70413 (Fix incorrect pattern warning "unreachable pattern")
 - #70428 (`error_bad_item_kind`: add help text)
 - #70429 (Clean up E0459 explanation)
 - #70437 (Miri float->int casts: be explicit that this is saturating)

Failed merges:

r? @ghost

4 years agoRollup merge of #70437 - RalfJung:miri-saturate, r=hanna-kruppe
Dylan DPC [Thu, 26 Mar 2020 20:44:09 +0000 (21:44 +0100)]
Rollup merge of #70437 - RalfJung:miri-saturate, r=hanna-kruppe

Miri float->int casts: be explicit that this is saturating

r? @hanna-kruppe
Cc https://github.com/rust-lang/miri/issues/1264

4 years agoRollup merge of #70429 - GuillaumeGomez:cleanup-e0459, r=Dylan-DPC
Dylan DPC [Thu, 26 Mar 2020 20:44:08 +0000 (21:44 +0100)]
Rollup merge of #70429 - GuillaumeGomez:cleanup-e0459, r=Dylan-DPC

Clean up E0459 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70428 - Centril:move-to-mod, r=petrochenkov
Dylan DPC [Thu, 26 Mar 2020 20:44:06 +0000 (21:44 +0100)]
Rollup merge of #70428 - Centril:move-to-mod, r=petrochenkov

`error_bad_item_kind`: add help text

For example, this adds:
```
    = help: consider moving the `use` import out to a nearby module scope
```
r? @petrochenkov @estebank

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

4 years agoRollup merge of #70413 - AminArria:match-pattern-incorrect-warning, r=Centril,Nadrier...
Dylan DPC [Thu, 26 Mar 2020 20:44:05 +0000 (21:44 +0100)]
Rollup merge of #70413 - AminArria:match-pattern-incorrect-warning, r=Centril,Nadrieril,varkor

Fix incorrect pattern warning "unreachable pattern"

Fixes #70372

Added `is_under_guard` parameter to `_match::is_useful` and only add it to the matrix if `false`

Tested with:
```rust
#![feature(or_patterns)]
fn main() {
    match (3,42) {
        (a,_) | (_,a) if a > 10 => {println!("{}", a)}
        _ => ()
    }

    match Some((3,42)) {
        Some((a, _)) | Some((_, a)) if a > 10 => {println!("{}", a)}
        _ => ()

    }

    match Some((3,42)) {
        Some((a, _) | (_, a)) if a > 10 => {println!("{}", a)}
        _ => ()
    }
}
```

4 years agoRollup merge of #70397 - JOE1994:write_wide_str, r=RalfJung
Dylan DPC [Thu, 26 Mar 2020 20:44:03 +0000 (21:44 +0100)]
Rollup merge of #70397 - JOE1994:write_wide_str, r=RalfJung

add 'fn write_u16s' to Memory

Added new function `Memory::write_u16s`. Needed in `MIRI` for implementing helper function to write wide_str to memory (for Windows).

4 years agoRollup merge of #70384 - nnethercote:refactor-object-file-handling, r=alexcrichton
Dylan DPC [Thu, 26 Mar 2020 20:44:02 +0000 (21:44 +0100)]
Rollup merge of #70384 - nnethercote:refactor-object-file-handling, r=alexcrichton

Refactor object file handling

Some preliminary clean-ups that grease the path to #66961.

r? @alexcrichton

4 years agoAdd fold_self
Nathan West [Mon, 6 Jan 2020 22:06:19 +0000 (17:06 -0500)]
Add fold_self

- Added `Iterator::fold_first`, which is like `fold`, but uses the first element in the iterator as the initial accumulator
- Includes doc and doctest
- Rebase commit; see #65222 for details

Co-Authored-By: Tim Vermeulen <tvermeulen@me.com>
4 years agoMiri float->int casts: be explicit that this is saturating
Ralf Jung [Thu, 26 Mar 2020 18:09:31 +0000 (19:09 +0100)]
Miri float->int casts: be explicit that this is saturating

4 years agoAdd regression test for #66706
Alex Macleod [Thu, 26 Mar 2020 16:10:58 +0000 (16:10 +0000)]
Add regression test for #66706

4 years agoUpdate tests to use llvm_asm!
Amanieu d'Antras [Fri, 14 Feb 2020 16:54:40 +0000 (16:54 +0000)]
Update tests to use llvm_asm!

4 years agoRename asm! to llvm_asm!
Amanieu d'Antras [Tue, 14 Jan 2020 13:40:42 +0000 (13:40 +0000)]
Rename asm! to llvm_asm!

asm! is left as a wrapper around llvm_asm! to maintain compatibility.

4 years agoAdd tests based on issue #70372 comments
Amin Arria [Thu, 26 Mar 2020 01:34:24 +0000 (22:34 -0300)]
Add tests based on issue #70372 comments

4 years agoFix incorrect pattern warning "unreachable pattern"
Amin Arria [Wed, 25 Mar 2020 23:07:01 +0000 (20:07 -0300)]
Fix incorrect pattern warning "unreachable pattern"

- Added is_under_guard parameter to _match::is_useful and
  only add to the matrix if false
- Added comments explaining behavior

4 years agoadd 'fn write_u16s'(rustc_mir::interpret::Memory)
JOE1994 [Wed, 25 Mar 2020 17:07:08 +0000 (13:07 -0400)]
add 'fn write_u16s'(rustc_mir::interpret::Memory)

4 years agoEnable `--bless`ing of MIR dumps
Oliver Scherer [Wed, 11 Mar 2020 10:49:00 +0000 (11:49 +0100)]
Enable `--bless`ing of MIR dumps

4 years agoClean up E0459 explanation
Guillaume Gomez [Thu, 26 Mar 2020 13:21:05 +0000 (14:21 +0100)]
Clean up E0459 explanation

4 years agoerror_bad_item_kind: add help text
Mazdak Farrokhzad [Thu, 26 Mar 2020 13:13:50 +0000 (14:13 +0100)]
error_bad_item_kind: add help text

4 years agoUpgrade rustc and bootstrap dependencies
Mateusz Mikuła [Thu, 26 Mar 2020 13:10:35 +0000 (14:10 +0100)]
Upgrade rustc and bootstrap dependencies

4 years agorustc_hir_pretty: bump recursion_limit
Mazdak Farrokhzad [Thu, 26 Mar 2020 12:50:02 +0000 (13:50 +0100)]
rustc_hir_pretty: bump recursion_limit

4 years agoAuto merge of #70427 - Centril:rollup-lrcad2c, r=Centril
bors [Thu, 26 Mar 2020 12:33:18 +0000 (12:33 +0000)]
Auto merge of #70427 - Centril:rollup-lrcad2c, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #68004 (permit negative impls for non-auto traits)
 - #70385 (Miri nits: comment and var name improvement)
 - #70411 (Fix for #62691: use the largest niche across all fields)
 - #70417 (parser: recover on `...` as a pattern, suggesting `..`)
 - #70424 (simplify match stmt)

Failed merges:

r? @ghost

4 years agoRollup merge of #70424 - lcnr:nit, r=Centril
Mazdak Farrokhzad [Thu, 26 Mar 2020 12:32:20 +0000 (13:32 +0100)]
Rollup merge of #70424 - lcnr:nit, r=Centril

simplify match stmt

We actually have a surprising amount of
```rust
match expr {
    $($p:pat)|+ => true,
    _ => false,
}
```
While I would prefer this to be replaced with `matches!`, most cases are
fairly readable anyway so we can just let them be for now.

4 years agoRollup merge of #70417 - rakshith-ravi:master, r=Centril
Mazdak Farrokhzad [Thu, 26 Mar 2020 12:32:18 +0000 (13:32 +0100)]
Rollup merge of #70417 - rakshith-ravi:master, r=Centril

parser: recover on `...` as a pattern, suggesting `..`

Fixes #70388

My first PR to rust. So please let me know if I'm doing something wrong.

4 years agoRollup merge of #70411 - ogoffart:fix-62691, r=eddyb
Mazdak Farrokhzad [Thu, 26 Mar 2020 12:32:17 +0000 (13:32 +0100)]
Rollup merge of #70411 - ogoffart:fix-62691, r=eddyb

Fix for #62691: use the largest niche across all fields

fixes #62691

(The second commit is a small optimization but it makes the code less pretty and i don't know if it is worth it.)

4 years agoRollup merge of #70385 - RalfJung:miri-nits, r=eddyb
Mazdak Farrokhzad [Thu, 26 Mar 2020 12:32:15 +0000 (13:32 +0100)]
Rollup merge of #70385 - RalfJung:miri-nits, r=eddyb

Miri nits: comment and var name improvement

r? @eddyb

4 years agoRollup merge of #68004 - nikomatsakis:negative-impls, r=varkor
Mazdak Farrokhzad [Thu, 26 Mar 2020 12:32:14 +0000 (13:32 +0100)]
Rollup merge of #68004 - nikomatsakis:negative-impls, r=varkor

permit negative impls for non-auto traits

This is a prototype impl that extends `impl !Trait` beyond auto traits. It is not integrated with coherence or anything else, and hence only serves to prevent downstream impls (but not to allow downstream crates to rely on the absence of such impls for coherence purposes).

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

TODO:

- [x] need a test that you can't rely on negative impls for coherence purposes
- [x] test that negative impls cannot specialize positive ones
- [x] test that positive impls cannot specialize negative ones
- [x] extend negative impl to `Clone` in order to fully fix #66544
- [x] and maybe make `CoerceUnsized` unsafe? -- that problem is now split out into https://github.com/rust-lang/rust/issues/68015
- [x] introduce feature flag and prepare a write-up
- [x] improve diagnostics?

4 years agoReorganize a bit the code and add a comment
Olivier Goffart [Thu, 26 Mar 2020 12:14:25 +0000 (13:14 +0100)]
Reorganize a bit the code and add a comment

4 years agowip pacify the merciless ui tests
Niko Matsakis [Thu, 26 Mar 2020 11:41:26 +0000 (07:41 -0400)]
wip pacify the merciless ui tests

4 years agoRemove unused argument
Oliver Scherer [Thu, 9 Jan 2020 17:36:55 +0000 (18:36 +0100)]
Remove unused argument

4 years agopacify the merciless x.py fmt
Niko Matsakis [Thu, 19 Mar 2020 17:55:46 +0000 (13:55 -0400)]
pacify the merciless x.py fmt

4 years agouse slice pattern instead of calling `is_empty()` and `[0]`
Niko Matsakis [Thu, 19 Mar 2020 17:51:00 +0000 (13:51 -0400)]
use slice pattern instead of calling `is_empty()` and `[0]`

4 years agoadd test for negative specializes negative
Niko Matsakis [Fri, 13 Mar 2020 18:43:34 +0000 (14:43 -0400)]
add test for negative specializes negative

4 years agomove stderr file too
Niko Matsakis [Fri, 13 Mar 2020 18:43:23 +0000 (14:43 -0400)]
move stderr file too