]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPC
Dylan DPC [Sun, 23 Feb 2020 08:57:44 +0000 (09:57 +0100)]
Rollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPC

Rename CodeMap to SourceMap follow up

See https://github.com/rust-lang/rust/issues/51574

4 years agoRollup merge of #69361 - Centril:free-ty-alias, r=petrochenkov
Dylan DPC [Sun, 23 Feb 2020 08:57:43 +0000 (09:57 +0100)]
Rollup merge of #69361 - Centril:free-ty-alias, r=petrochenkov

parse: allow `type Foo: Ord` syntactically

This addresses:
> (Work still remains to fuse this with free type aliases, but this can be done later.)

in https://github.com/rust-lang/rust/pull/69194.

r? @petrochenkov

4 years agoRollup merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
Dylan DPC [Sun, 23 Feb 2020 08:57:40 +0000 (09:57 +0100)]
Rollup merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj

Improve external MinGW detection

Fixes #68872

4 years agoRollup merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC
Dylan DPC [Sun, 23 Feb 2020 08:57:38 +0000 (09:57 +0100)]
Rollup merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC

Do not ping the infrastructure team on toolstate changes

To my knowledge, there is essentially never any particular action that the infra team needs to take on these pings, and they are currently relatively annoying.

cc rust-lang/infra -- does anyone *want* these notifications?

4 years agoAuto merge of #69358 - ehuss:update-cargo, r=ehuss
bors [Sat, 22 Feb 2020 18:07:03 +0000 (18:07 +0000)]
Auto merge of #69358 - ehuss:update-cargo, r=ehuss

Update cargo

11 commits in e02974078a692d7484f510eaec0e88d1b6cc0203..e57bd02999c9f40d52116e0beca7d1dccb0643de
2020-02-18 15:24:43 +0000 to 2020-02-21 20:20:10 +0000
- fix most remaining clippy findings (mostly redundant imports) (rust-lang/cargo#7912)
- Add -Zfeatures tracking issues. (rust-lang/cargo#7917)
- Use rust-lang/rust linkchecker on CI. (rust-lang/cargo#7913)
- Clean up code mostly based on clippy suggestions (rust-lang/cargo#7911)
- Add an option to include crate versions to the generated docs (rust-lang/cargo#7903)
- Better support for license-file. (rust-lang/cargo#7905)
- Add new feature resolver. (rust-lang/cargo#7820)
- Switch azure to macOS 10.15. (rust-lang/cargo#7906)
- Modified the help information of cargo-rustc (rust-lang/cargo#7892)
- Update for nightly rustfmt. (rust-lang/cargo#7904)
- Support `--config path_to_config.toml` cli syntax. (rust-lang/cargo#7901)

4 years agoAuto merge of #69374 - Dylan-DPC:rollup-x7mjd5z, r=Dylan-DPC
bors [Sat, 22 Feb 2020 14:36:14 +0000 (14:36 +0000)]
Auto merge of #69374 - Dylan-DPC:rollup-x7mjd5z, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #68984 (Make `u8::is_ascii` a stable `const fn`)
 - #69339 (Add test for #69312)
 - #69346 (Clean up E0323, E0324, E0325 and E0326 explanations)
 - #69348 (Wrong error message for move_ref_pattern)
 - #69349 (MIR is not an experiment anymore)
 - #69354 (Test `Duration::new` panics on overflow)
 - #69370 (move const_eval.rs into the module folder)

Failed merges:

r? @ghost

4 years agoRename CodeMap to SourceMap follow up
Maxim Zholobak [Sat, 22 Feb 2020 14:07:05 +0000 (16:07 +0200)]
Rename CodeMap to SourceMap follow up

4 years agoRollup merge of #69370 - RalfJung:const-eval-mod, r=oli-obk
Dylan DPC [Sat, 22 Feb 2020 13:13:08 +0000 (18:43 +0530)]
Rollup merge of #69370 - RalfJung:const-eval-mod, r=oli-obk

move const_eval.rs into the module folder

This groups the file together with the other `const_eval` files in editors, diff views, etc.

r? @oli-obk

4 years agoRollup merge of #69354 - MichaelMcDonnell:duration_overflow_test, r=Centril
Dylan DPC [Sat, 22 Feb 2020 13:13:07 +0000 (18:43 +0530)]
Rollup merge of #69354 - MichaelMcDonnell:duration_overflow_test, r=Centril

Test `Duration::new` panics on overflow

A `Duration` is created from a second and nanoseconds variable. The
documentation says: "This constructor will panic if the carry from the
nanoseconds overflows the seconds counter". This was, however, not tested
in the tests. I doubt the behavior will ever regress, but it is usually a
good idea to test all documented behavior.

4 years agoRollup merge of #69349 - spastorino:mir-not-an-experiment, r=Dylan-DPC
Dylan DPC [Sat, 22 Feb 2020 13:13:05 +0000 (18:43 +0530)]
Rollup merge of #69349 - spastorino:mir-not-an-experiment, r=Dylan-DPC

MIR is not an experiment anymore

At least I hope is not :stuck_out_tongue_closed_eyes:

r? @oli-obk

4 years agoRollup merge of #69348 - LeSeulArtichaut:patch-1, r=Centril
Dylan DPC [Sat, 22 Feb 2020 13:13:04 +0000 (18:43 +0530)]
Rollup merge of #69348 - LeSeulArtichaut:patch-1, r=Centril

Wrong error message for move_ref_pattern

The current error message states that move occurs *because of `Copy`*:
```Rust
"move occurs because `{}` has type `{}` which does implement the `Copy` trait."
```
I found this randomly when surfing through the sources. This means, I don't have any context and might be completely wrong.

r? @Centril

4 years agoRollup merge of #69346 - GuillaumeGomez:clean-up-e032x-explanations, r=Dylan-DPC
Dylan DPC [Sat, 22 Feb 2020 13:13:03 +0000 (18:43 +0530)]
Rollup merge of #69346 - GuillaumeGomez:clean-up-e032x-explanations, r=Dylan-DPC

Clean up E0323, E0324, E0325 and E0326 explanations

r? @Dylan-DPC

4 years agoRollup merge of #69339 - wesleywiser:test_for_69312, r=Centril
Dylan DPC [Sat, 22 Feb 2020 13:13:01 +0000 (18:43 +0530)]
Rollup merge of #69339 - wesleywiser:test_for_69312, r=Centril

Add test for #69312

This bug was fixed by #67501.

Closes #69312

4 years agoRollup merge of #68984 - ecstatic-morse:const-u8-is-ascii, r=sfackler
Dylan DPC [Sat, 22 Feb 2020 13:12:59 +0000 (18:42 +0530)]
Rollup merge of #68984 - ecstatic-morse:const-u8-is-ascii, r=sfackler

Make `u8::is_ascii` a stable `const fn`

`char::is_ascii` was already stabilized as `const fn` in #55278, so there is no reason for `u8::is_ascii` to go through an unstable period.

cc @rust-lang/libs

4 years agomove const_eval.rs into the module folder
Ralf Jung [Sat, 22 Feb 2020 11:24:05 +0000 (12:24 +0100)]
move const_eval.rs into the module folder

4 years agoAuto merge of #69333 - ecstatic-morse:revert-simd-shuffle, r=petrochenkov
bors [Sat, 22 Feb 2020 11:11:47 +0000 (11:11 +0000)]
Auto merge of #69333 - ecstatic-morse:revert-simd-shuffle, r=petrochenkov

Revert #69280

Resolves #69313 by reverting #69280.

After #69280, `#[rustc_args_required_const(2)]` is required on the declaration of `simd_shuffle` intrinsics. This is allowed breakage, since you can't define platform intrinsics on stable. However, the latest release of the widely used `packed_simd` crate defines these intrinsics without the requisite attribute. Since there's no urgency to merge #69280, let's revert it. We can reconsider when rust-lang/packed_simd#278 is included in a point release of `packed_simd`.

r? @petrochenkov

4 years agoAuto merge of #69332 - nnethercote:revert-u8to64_le-changes, r=michaelwoerister
bors [Sat, 22 Feb 2020 07:26:58 +0000 (07:26 +0000)]
Auto merge of #69332 - nnethercote:revert-u8to64_le-changes, r=michaelwoerister

Revert `u8to64_le` changes from #68914.

`SipHasher128`'s `u8to64_le` function was simplified in #68914.
Unfortunately, the new version is slower, because it introduces `memcpy`
calls with non-statically-known lengths.

This commit reverts the change, and adds an explanatory comment (which
is also added to `libcore/hash/sip.rs`). This barely affects
`SipHasher128`'s speed because it doesn't use `u8to64_le` much, but it
does result in `SipHasher128` once again being consistent with
`libcore/hash/sip.rs`.

r? @michaelwoerister

4 years agoAuto merge of #67330 - golddranks:split_inclusive, r=kodraus
bors [Sat, 22 Feb 2020 03:54:50 +0000 (03:54 +0000)]
Auto merge of #67330 - golddranks:split_inclusive, r=kodraus

Implement split_inclusive for slice and str

# Overview
* Implement `split_inclusive` for `slice` and `str` and `split_inclusive_mut` for `slice`
* `split_inclusive` is a substring/subslice splitting iterator that includes the matched part in the iterated substrings as a terminator.
* EDIT: The behaviour has now changed, as per @KodrAus 's input, to the same semantics with the `split_terminator` function. I updated the examples below.
* Two examples below:
```Rust
    let data = "\nMäry häd ä little lämb\nLittle lämb\n";
    let split: Vec<&str> = data.split_inclusive('\n').collect();
    assert_eq!(split, ["\n", "Märy häd ä little lämb\n", "Little lämb\n"]);
```

```Rust
    let uppercase_separated = "SheePSharKTurtlECaT";
    let mut first_char = true;
    let split: Vec<&str> = uppercase_separated.split_inclusive(|c: char| {
        let split = !first_char && c.is_uppercase();
        first_char = split;
        split
    }).collect();
    assert_eq!(split, ["SheeP", "SharK", "TurtlE", "CaT"]);
```

# Justification for the API
* I was surprised to find that stdlib currently only has splitting iterators that leave out the matched part. In my experience, wanting to leave a substring terminator as a part of the substring is a pretty common usecase.
* This API is strictly more expressive than the standard `split` API: it's easy to get the behaviour of `split` by mapping a subslicing operation that drops the terminator. On the other hand it's impossible to derive this behaviour from `split` without using hacky and brittle `unsafe` code. The normal way to achieve this functionality would be implementing the iterator yourself.
* Especially when dealing with mutable slices, the only way currently is to use `split_at_mut`. This API provides an ergonomic alternative that plays to the strengths of the iterating capabilities of Rust. (Using `split_at_mut` iteratively used to be a real pain before NLL, fortunately the situation is a bit better now.)

# Discussion items
* <s>Does it make sense to mimic `split_terminator` in that the final empty slice would be left off in case of the string/slice ending with a terminator? It might do, as this use case is naturally geared towards considering the matching part as a terminator instead of a separator.</s>
  * EDIT: The behaviour was changed to mimic `split_terminator`.
* Does it make sense to have `split_inclusive_mut` for `&mut str`?

4 years agoAuto merge of #69302 - jonas-schievink:yield-needs-storage, r=Zoxc
bors [Sat, 22 Feb 2020 00:10:57 +0000 (00:10 +0000)]
Auto merge of #69302 - jonas-schievink:yield-needs-storage, r=Zoxc

Fix generator miscompilations

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

r? @Zoxc

4 years agoparse: allow `type Foo: Ord` syntactically.
Mazdak Farrokhzad [Fri, 21 Feb 2020 22:00:27 +0000 (23:00 +0100)]
parse: allow `type Foo: Ord` syntactically.

4 years agoFix error message
LeSeulArtichaut [Fri, 21 Feb 2020 13:49:51 +0000 (14:49 +0100)]
Fix error message

Bless tests

4 years agoUpdate cargo
Eric Huss [Fri, 21 Feb 2020 21:17:19 +0000 (13:17 -0800)]
Update cargo

4 years agoAuto merge of #69242 - cjgillot:object_violations, r=Zoxc
bors [Fri, 21 Feb 2020 20:25:50 +0000 (20:25 +0000)]
Auto merge of #69242 - cjgillot:object_violations, r=Zoxc

Querify object_safety_violations.

Split from #69076

r? @Zoxc

4 years agoprint vis & defaultness for nested items
Mazdak Farrokhzad [Fri, 21 Feb 2020 00:21:17 +0000 (01:21 +0100)]
print vis & defaultness for nested items

4 years agoAuto merge of #69347 - matthiaskrgr:submodule_upd, r=Xanewok
bors [Fri, 21 Feb 2020 16:57:24 +0000 (16:57 +0000)]
Auto merge of #69347 - matthiaskrgr:submodule_upd, r=Xanewok

submodules: update rls from 0100ac8 to 10bf331

Changes:
````
Update cargo
````

r? @Xanewok

4 years agoTest `Duration::new` panics on overflow
Michael Mc Donnell [Fri, 21 Feb 2020 00:01:08 +0000 (16:01 -0800)]
Test `Duration::new` panics on overflow

A `Duration` is created from a second and nanoseconds variable. The
documentation says: "This constructor will panic if the carry from the
nanoseconds overflows the seconds counter". This was, however, not tested
in the tests. I doubt the behavior will ever regress, but it is usually a
good idea to test all documented behavior.

4 years agoDetect Chocolatey MinGW installation
Mateusz Mikuła [Fri, 21 Feb 2020 15:47:04 +0000 (16:47 +0100)]
Detect Chocolatey MinGW installation

4 years agoFix MinGW detection for Cygwin
Mateusz Mikuła [Fri, 21 Feb 2020 14:35:31 +0000 (15:35 +0100)]
Fix MinGW detection for Cygwin

4 years agoMIR is not an experiment anymore
Santiago Pastorino [Fri, 21 Feb 2020 14:03:21 +0000 (11:03 -0300)]
MIR is not an experiment anymore

4 years agoAuto merge of #69342 - flip1995:clippyup, r=Dylan-DPC
bors [Fri, 21 Feb 2020 13:33:23 +0000 (13:33 +0000)]
Auto merge of #69342 - flip1995:clippyup, r=Dylan-DPC

Update Clippy from 2855b21 to 8fbb23f

```
Fix ICE in `missing_errors_doc`
Update License
Migrate Clippy to GitHub Actions
redundant_clone: Migrate to new dataflow framework
Move unneeded_field_pattern to pedantic group
Rustup to rust-lang/rust#69325
Rustup to rust-lang/rust#69072
```

Fixes #69338

r? @Manishearth

4 years agoClean up E0326 explanation
Guillaume Gomez [Fri, 21 Feb 2020 12:32:04 +0000 (13:32 +0100)]
Clean up E0326 explanation

4 years agoClean up E0323, E0324 and E0325 explanations
Guillaume Gomez [Fri, 21 Feb 2020 12:31:21 +0000 (13:31 +0100)]
Clean up E0323, E0324 and E0325 explanations

4 years agosubmodules: update rls from 0100ac8 to 10bf331
Matthias Krüger [Fri, 21 Feb 2020 12:33:51 +0000 (13:33 +0100)]
submodules: update rls from 0100ac8 to 10bf331

Changes:
````
Update cargo
````

4 years agoAuto merge of #69330 - Centril:literally-melting-ice, r=eddyb
bors [Fri, 21 Feb 2020 10:04:22 +0000 (10:04 +0000)]
Auto merge of #69330 - Centril:literally-melting-ice, r=eddyb

`lit_to_const`: gracefully bubble up type errors.

Fixes https://github.com/rust-lang/rust/issues/69310 which was injected by https://github.com/rust-lang/rust/pull/68118.

r? @pnkfelix @varkor @eddyb
cc @skinny121

4 years agoUpdate Clippy
flip1995 [Fri, 21 Feb 2020 09:32:57 +0000 (10:32 +0100)]
Update Clippy

4 years agoAuto merge of #69290 - wesleywiser:speed_up_ctfe_stress_4, r=RalfJung
bors [Fri, 21 Feb 2020 06:43:40 +0000 (06:43 +0000)]
Auto merge of #69290 - wesleywiser:speed_up_ctfe_stress_4, r=RalfJung

Check `RUSTC_CTFE_BACKTRACE` much less by generating fewer errors

Before this change, `get_size_and_align()`  calls `get_fn_alloc()` *a
lot* in CTFE heavy code. This previously returned an `Error` which would
check if `RUSTC_CTFE_BACKTRACE` was set on construction. Doing this
turned out to be a performance hotspot as @nnethercote discovered in
#68792.

This is an alternate take on that PR which resolves the performance
issue by generating *many* fewer errors. Previously, `ctfe-stress-4`
would generate over 5,000,000 errors each of which would check for the
presence of the environment variable. With these changes, that number is
reduced to 30.

r? @RalfJung

4 years agoAuto merge of #69281 - nnethercote:inline-some-encoding-decoding-methods, r=Centril
bors [Fri, 21 Feb 2020 03:14:55 +0000 (03:14 +0000)]
Auto merge of #69281 - nnethercote:inline-some-encoding-decoding-methods, r=Centril

Inline some encoding and decoding methods.

This is a small performance win.

r? @Centril

4 years agoAdd test for #69312
Wesley Wiser [Fri, 21 Feb 2020 02:25:19 +0000 (21:25 -0500)]
Add test for #69312

This bug was fixed by #67501.

Closes #69312

4 years agoDo not ping the infrastructure team on toolstate changes
Mark Rousskov [Fri, 21 Feb 2020 00:46:09 +0000 (19:46 -0500)]
Do not ping the infrastructure team on toolstate changes

To my knowledge, there is essentially never any particular action that the
infra team needs to take on these pings, and they are currently relatively
annoying.

4 years agoRevert "Rollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case,...
Dylan MacKenzie [Fri, 21 Feb 2020 00:00:39 +0000 (16:00 -0800)]
Revert "Rollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov"

This reverts commit 61d3b6dedb1ec1f3e3cbd3d66b1a3453225bc37c, reversing
changes made to c6ad1e2c2a0c7e48537617d36085f866fa6a65a3.

4 years agoRevert `u8to64_le` changes from #68914.
Nicholas Nethercote [Fri, 7 Feb 2020 00:53:07 +0000 (11:53 +1100)]
Revert `u8to64_le` changes from #68914.

`SipHasher128`'s `u8to64_le` function was simplified in #68914.
Unfortunately, the new version is slower, because it introduces `memcpy`
calls with non-statically-known lengths.

This commit reverts the change, and adds an explanatory comment (which
is also added to `libcore/hash/sip.rs`). This barely affects
`SipHasher128`'s speed because it doesn't use `u8to64_le` much, but it
does result in `SipHasher128` once again being consistent with
`libcore/hash/sip.rs`.

4 years agoAuto merge of #69072 - ecstatic-morse:associated-items, r=petrochenkov
bors [Thu, 20 Feb 2020 22:44:01 +0000 (22:44 +0000)]
Auto merge of #69072 - ecstatic-morse:associated-items, r=petrochenkov

O(log n) lookup of associated items by name

Resolves #68957, in which compile time is quadratic in the number of associated items. This PR makes name lookup use binary search instead of a linear scan to improve its asymptotic performance. As a result, the pathological case from that issue now runs in 8 seconds on my local machine, as opposed to many minutes on the current stable.

Currently, method resolution must do a linear scan through all associated items of a type to find one with a certain name. This PR changes the result of the `associated_items` query to a data structure that preserves the definition order of associated items (which is used, e.g., for the layout of trait object vtables) while adding an index of those items sorted by (unhygienic) name. When doing name lookup, we first find all items with the same `Symbol` using binary search, then run hygienic comparison to find the one we are looking for. Ideally, this would be implemented using an insertion-order preserving, hash-based multi-map, but one is not readily available.

Someone who is more familiar with identifier hygiene could probably make this better by auditing the uses of the `AssociatedItems` interface. My goal was to preserve the current behavior exactly, even if it seemed strange (I left at least one FIXME to this effect). For example, some places use comparison with `ident.modern()` and some places use `tcx.hygienic_eq` which requires the `DefId` of the containing `impl`. I don't know whether those approaches are equivalent or which one should be preferred.

4 years agolit_to_const: gracefully bubble up type errors.
Mazdak Farrokhzad [Thu, 20 Feb 2020 22:23:22 +0000 (23:23 +0100)]
lit_to_const: gracefully bubble up type errors.

4 years agoAuto merge of #69325 - Centril:rollup-vce2ko2, r=Centril
bors [Thu, 20 Feb 2020 19:19:54 +0000 (19:19 +0000)]
Auto merge of #69325 - Centril:rollup-vce2ko2, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #68877 (On mismatched argument count point at arguments)
 - #69185 (Unify and improve const-prop lints)
 - #69305 (Tweak binding lifetime suggestion text)
 - #69311 (Clean up E0321 and E0322)
 - #69317 (Fix broken link to the rustc guide)

Failed merges:

r? @ghost

4 years agoRollup merge of #69317 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:55 +0000 (20:18 +0100)]
Rollup merge of #69317 - LeSeulArtichaut:patch-1, r=Dylan-DPC

Fix broken link to the rustc guide

4 years agoRollup merge of #69311 - GuillaumeGomez:clean-up-e0321-e0322, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:53 +0000 (20:18 +0100)]
Rollup merge of #69311 - GuillaumeGomez:clean-up-e0321-e0322, r=Dylan-DPC

Clean up E0321 and E0322

r? @Dylan-DPC

4 years agoRollup merge of #69305 - estebank:consider-lt, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:52 +0000 (20:18 +0100)]
Rollup merge of #69305 - estebank:consider-lt, r=Dylan-DPC

Tweak binding lifetime suggestion text

We already have a structured suggestion, but the wording made it seem like that wasn't the case.

Fix #65286. r? @varkor

4 years agoRollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obk
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:50 +0000 (20:18 +0100)]
Rollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obk

Unify and improve const-prop lints

Add a single helper method for all lints emitted by const-prop, and make that lint different from the CTFE `const_err` lint. Also consistently check overflow on *arithmetic*, not on the assertion, to make behavior the same for debug and release builds.

See [this summary comment](https://github.com/rust-lang/rust/pull/69185#issuecomment-587924754) for details and the latest status.

In terms of lint formatting, I went for what seems to be the better style: have a general message above the code, and then a specific message at the span:
```
error: this arithmetic operation will overflow
  --> $DIR/const-err2.rs:21:18
   |
LL |     let a_i128 = -std::i128::MIN;
   |                  ^^^^^^^^^^^^^^^ attempt to negate with overflow
```
We could also just have the specific message above and no text at the span if that is preferred.

I also converted some of the existing tests to use compiletest revisions, so that the same test can check a bunch of different compile flags.

Fixes https://github.com/rust-lang/rust/issues/69020.
Helps with https://github.com/rust-lang/rust/issues/69021: debug/release are now consistent, but the assoc-const test in that issue still fails (there is a FIXME in the PR for this). The reason seems to be that const-prop notices the assoc const in `T::N << 42` and does not even bother calling `const_prop` on that operation.
Has no effect on https://github.com/rust-lang/rust/issues/61821; the duplication there has entirely different reasons.

4 years agoRollup merge of #68877 - estebank:point-at-params, r=petrochenkov
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:48 +0000 (20:18 +0100)]
Rollup merge of #68877 - estebank:point-at-params, r=petrochenkov

On mismatched argument count point at arguments

4 years agoFix broken link to the rustc guide
LeSeulArtichaut [Thu, 20 Feb 2020 16:20:31 +0000 (17:20 +0100)]
Fix broken link to the rustc guide

4 years agoAuto merge of #69145 - matthewjasper:mir-typeck-static-ty, r=nikomatsakis
bors [Thu, 20 Feb 2020 15:52:57 +0000 (15:52 +0000)]
Auto merge of #69145 - matthewjasper:mir-typeck-static-ty, r=nikomatsakis

Fix MIR typeck soundness holes

* Check types of static items
* Always check lifetime bounds of `Copy` impls

r? @nikomatsakis
closes #69114

4 years agoGreatly improve E0322 explanation
Guillaume Gomez [Thu, 20 Feb 2020 13:26:56 +0000 (14:26 +0100)]
Greatly improve E0322 explanation

4 years agoclean up E0321 explanation
Guillaume Gomez [Thu, 20 Feb 2020 13:26:43 +0000 (14:26 +0100)]
clean up E0321 explanation

4 years agoAuto merge of #69309 - Dylan-DPC:rollup-gjdqx7l, r=Dylan-DPC
bors [Thu, 20 Feb 2020 12:06:12 +0000 (12:06 +0000)]
Auto merge of #69309 - Dylan-DPC:rollup-gjdqx7l, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #68705 (Add LinkedList::remove())
 - #68945 (Stabilize Once::is_completed)
 - #68978 (Make integer exponentiation methods unstably const)
 - #69266 (Fix race condition when allocating source files in SourceMap)
 - #69287 (Clean up E0317 explanation)

Failed merges:

r? @ghost

4 years agoRollup merge of #69287 - GuillaumeGomez:clean-e0317, r=Dylan-DPC
Dylan DPC [Thu, 20 Feb 2020 09:49:14 +0000 (10:49 +0100)]
Rollup merge of #69287 - GuillaumeGomez:clean-e0317, r=Dylan-DPC

Clean up E0317 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69266 - Zoxc:fix-source-map-race, r=wesleywiser
Dylan DPC [Thu, 20 Feb 2020 09:49:13 +0000 (10:49 +0100)]
Rollup merge of #69266 - Zoxc:fix-source-map-race, r=wesleywiser

Fix race condition when allocating source files in SourceMap

This makes allocating address space in the source map an atomic operation. `rustc` does not currently do this in parallel, so this bug can't trigger, but parsing files in parallel could trigger it, and that is something we want to do.

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

r? @wesleywiser

4 years agoRollup merge of #68978 - ecstatic-morse:const-int-pow, r=oli-obk
Dylan DPC [Thu, 20 Feb 2020 09:49:12 +0000 (10:49 +0100)]
Rollup merge of #68978 - ecstatic-morse:const-int-pow, r=oli-obk

Make integer exponentiation methods unstably const

cc #53718

This makes the following inherent methods on integer primitives into unstable `const fn`:
- `pow`
- `checked_pow`
- `wrapping_pow`
- `overflowing_pow`
- `saturating_pow`
- `next_power_of_two`
- `checked_next_power_of_two`
- `wrapping_next_power_of_two`

Only two changes were made to the implementation of these methods. First, I had to switch from the `?` operator, which is not yet implemented in a const context, to a `try_opt` macro. Second, `next_power_of_two` was using `ops::Add::add` (see the first commit) to "get overflow checks", so I switched to `#[rustc_inherit_overflow_checks]`. I'm not quite sure why the attribute wasn't used in the first place.

4 years agoRollup merge of #68945 - mjbshaw:once_is_completed, r=LukasKalbertodt
Dylan DPC [Thu, 20 Feb 2020 09:49:10 +0000 (10:49 +0100)]
Rollup merge of #68945 - mjbshaw:once_is_completed, r=LukasKalbertodt

Stabilize Once::is_completed

Closes #54890

This function has been around for some time. I haven't seen anyone raise any objections to it. I've personally found it useful myself. It would be nice to finally stabilize it and

4 years agoRollup merge of #68705 - BijanT:ll_remove, r=Mark-Simulacrum
Dylan DPC [Thu, 20 Feb 2020 09:49:08 +0000 (10:49 +0100)]
Rollup merge of #68705 - BijanT:ll_remove, r=Mark-Simulacrum

Add LinkedList::remove()

LinkedList::remove() removes the element at the specified index and returns it.

I added this because I think having a remove function would be useful to have, and similar functions are in other containers, like Vec and HashMap.

I'm not sure if adding a feature like this requires an RFC or not, so I'm sorry if this PR is premature.

4 years agoAuto merge of #68847 - ecstatic-morse:const-impl, r=oli-obk
bors [Thu, 20 Feb 2020 08:41:17 +0000 (08:41 +0000)]
Auto merge of #68847 - ecstatic-morse:const-impl, r=oli-obk

Allow trait methods to be called on concrete types in a const context

This partially implements [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) by const-checking methods inside an `impl const` block and allowing those methods to be called on concrete types. Calling trait methods on type parameters in a const context is not yet allowed. Implementing this will require much more work. Since we are only concerned with methods on concrete types, we are able to take advantage of the machinery in `Instance::resolve`, which is doing most of the work.

This also propagates `#[rustc_const_unstable]` from parent items to child items, making that attribute behave like `#[stable]` and `#[unstable]` do. This allows trait methods to be marked as unstably const.

cc #67792 #57563
cc @rust-lang/wg-const-eval
r? @oli-obk

4 years agoAuto merge of #67925 - petertodd:2020-fromstr-infallible, r=LukasKalbertodt
bors [Thu, 20 Feb 2020 05:18:18 +0000 (05:18 +0000)]
Auto merge of #67925 - petertodd:2020-fromstr-infallible, r=LukasKalbertodt

Change FromStr for String to use Infallible directly

Fixes the confusing documentation on `ParseError` by making it irrelevant.

It might be fine to mark it as depreciated right now too - I can't imagine much code uses `ParseError` directly.

4 years agoTweak binding lifetime suggestion text
Esteban Küber [Thu, 20 Feb 2020 02:04:03 +0000 (18:04 -0800)]
Tweak binding lifetime suggestion text

We already have a structured suggestion, but the wording made it seem
like that wasn't the case.
Fix #65286. r? @varkor

4 years agoAuto merge of #69256 - nnethercote:misc-inlining, r=Centril
bors [Thu, 20 Feb 2020 02:00:31 +0000 (02:00 +0000)]
Auto merge of #69256 - nnethercote:misc-inlining, r=Centril

Miscellaneous inlining improvements

These commits inline some hot functions that aren't currently inlined, for some speed wins.

r? @Centril

4 years agoCheck `RUSTC_CTFE_BACKTRACE` much less by generating fewer errors
Wesley Wiser [Wed, 19 Feb 2020 12:59:21 +0000 (07:59 -0500)]
Check `RUSTC_CTFE_BACKTRACE` much less by generating fewer errors

Before this change, `get_size_and_align()`  calls `get_fn_alloc()` *a
lot* in CTFE heavy code. This previously returned an `Error` which would
check if `RUSTC_CTFE_BACKTRACE` was set on construction. Doing this
turned out to be a performance hotspot as @nnethercote discovered in
#68792.

This is an alternate take on that PR which resolves the performance
issue by generating *many* fewer errors. Previously, `ctfe-stress-4`
would generate over 5,000,000 errors each of which would check for the
presence of the environment variable. With these changes, that number is
reduced to 30.

4 years agoAdd regression test
Jonas Schievink [Wed, 19 Feb 2020 22:44:53 +0000 (23:44 +0100)]
Add regression test

4 years agoAdd more comments to `SuspensionPoint`
Jonas Schievink [Wed, 19 Feb 2020 22:39:00 +0000 (23:39 +0100)]
Add more comments to `SuspensionPoint`

4 years agoRemap the resume place if necessary
Jonas Schievink [Wed, 19 Feb 2020 22:38:31 +0000 (23:38 +0100)]
Remap the resume place if necessary

4 years agoAuto merge of #68988 - Zoxc:query-caches, r=eddyb
bors [Wed, 19 Feb 2020 22:29:07 +0000 (22:29 +0000)]
Auto merge of #68988 - Zoxc:query-caches, r=eddyb

Add an abstraction for custom query caches

r? @eddyb

4 years agoReorder yield visitation order to match call
Jonas Schievink [Mon, 17 Feb 2020 20:20:48 +0000 (21:20 +0100)]
Reorder yield visitation order to match call

4 years agoHandle resume args in `RequiresStorage` analysis
Jonas Schievink [Sun, 16 Feb 2020 21:18:26 +0000 (22:18 +0100)]
Handle resume args in `RequiresStorage` analysis

4 years agoUse match ergonomics to simplify match
Jonas Schievink [Sun, 16 Feb 2020 20:36:50 +0000 (21:36 +0100)]
Use match ergonomics to simplify match

4 years agoMatch MIR statements exhaustively
Jonas Schievink [Sun, 16 Feb 2020 20:12:46 +0000 (21:12 +0100)]
Match MIR statements exhaustively

4 years agoChange FromStr for String to use Infallible directly
Peter Todd [Wed, 19 Feb 2020 21:37:58 +0000 (16:37 -0500)]
Change FromStr for String to use Infallible directly

Fixes the confusing documentation on `ParseError` by making it
irrelevant.

4 years agoConstruct `AssociatedItems` from an iterator instead of a `Vec`
Dylan MacKenzie [Wed, 19 Feb 2020 20:55:59 +0000 (12:55 -0800)]
Construct `AssociatedItems` from an iterator instead of a `Vec`

4 years agofix 32bit-only test
Ralf Jung [Wed, 19 Feb 2020 19:12:01 +0000 (20:12 +0100)]
fix 32bit-only test

4 years agoAuto merge of #69293 - Dylan-DPC:rollup-imcbvgo, r=Dylan-DPC
bors [Wed, 19 Feb 2020 19:10:58 +0000 (19:10 +0000)]
Auto merge of #69293 - Dylan-DPC:rollup-imcbvgo, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #68863 (ci: switch macOS builders to 10.15)
 - #69142 (Add shared script for linkchecking books.)
 - #69248 (Don't eliminate frame pointers on thumb targets)
 - #69280 (Remove special case for `simd_shuffle` arg promotion)
 - #69284 (Reword OpenOptions::{create, create_new} doc.)

Failed merges:

r? @ghost

4 years agoReplace FIXME with explanation
Dylan MacKenzie [Mon, 17 Feb 2020 21:35:49 +0000 (13:35 -0800)]
Replace FIXME with explanation

4 years agoMake lookup of associated item by name O(log n)
Dylan MacKenzie [Mon, 17 Feb 2020 21:09:01 +0000 (13:09 -0800)]
Make lookup of associated item by name O(log n)

4 years agoReplace `rustc_typeck::Namespace` with `rustc_hir::def::Namespace`
Dylan MacKenzie [Tue, 11 Feb 2020 18:41:28 +0000 (10:41 -0800)]
Replace `rustc_typeck::Namespace` with `rustc_hir::def::Namespace`

4 years agoImplement an insertion-order preserving, efficient multi-map
Dylan MacKenzie [Sun, 16 Feb 2020 22:40:12 +0000 (14:40 -0800)]
Implement an insertion-order preserving, efficient multi-map

4 years agoUpdate tests
Dylan MacKenzie [Tue, 18 Feb 2020 23:45:54 +0000 (15:45 -0800)]
Update tests

4 years agoRollup merge of #69284 - jumbatm:openoptions-create-doc, r=Dylan-DPC
Dylan DPC [Wed, 19 Feb 2020 17:12:13 +0000 (18:12 +0100)]
Rollup merge of #69284 - jumbatm:openoptions-create-doc, r=Dylan-DPC

Reword OpenOptions::{create, create_new} doc.

Closes #69254.

Currently, the doc comment for `fs::OpenOptions::create` doesn't mention its behaviour when opening an existing file, and `fs::OpenOptions::create_new`'s doc comment is worded in a way that doesn't make it clear that it actually _fails_ if the file already exists, not overwrite the existing file with a new one.

This PR addresses addresses this by rewording the doc comments to be more explicit.

r? @GuillaumeGomez

4 years agoRollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov
Dylan DPC [Wed, 19 Feb 2020 17:12:11 +0000 (18:12 +0100)]
Rollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov

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.

4 years agoRollup merge of #69248 - jonas-schievink:thumb-fp, r=japaric
Dylan DPC [Wed, 19 Feb 2020 17:12:10 +0000 (18:12 +0100)]
Rollup merge of #69248 - jonas-schievink:thumb-fp, r=japaric

Don't eliminate frame pointers on thumb targets

This should hopefully fix issues https://github.com/rust-lang/rust/issues/69231 and https://github.com/rust-embedded/cortex-m-rt/issues/139.

~~I couldn't test this locally as the rustc I produced does not create binaries (no idea why).~~ Resolved.

4 years agoRollup merge of #69142 - ehuss:linkcheck-script, r=alexcrichton
Dylan DPC [Wed, 19 Feb 2020 17:12:09 +0000 (18:12 +0100)]
Rollup merge of #69142 - ehuss:linkcheck-script, r=alexcrichton

Add shared script for linkchecking books.

This adds a script that can be used on each book's CI to ensure they don't break local links.

I've been running something similar on the reference CI.  The intent here is to add this to all the external books' CI scripts. This will help avoid dealing with broken links when updating submodules on rust-lang/rust.

4 years agoRollup merge of #68863 - pietroalbini:azure-macos-10.15, r=Mark-Simulacrum
Dylan DPC [Wed, 19 Feb 2020 17:12:07 +0000 (18:12 +0100)]
Rollup merge of #68863 - pietroalbini:azure-macos-10.15, r=Mark-Simulacrum

ci: switch macOS builders to 10.15

Azure Pipelines is deprecating the macOS 10.13 image we're currently running, [and they plan to remove them](https://devblogs.microsoft.com/devops/removing-older-images-in-azure-pipelines-hosted-pools/) on March 23, 2020. This PR switches our macOS builders to macOS 10.15.

r? @Mark-Simulacrum

4 years agoMake is_object_safe a method.
Camille GILLOT [Wed, 19 Feb 2020 16:59:24 +0000 (17:59 +0100)]
Make is_object_safe a method.

4 years agoAdd LinkedList::remove()
Bijan Tabatabai [Fri, 31 Jan 2020 16:16:55 +0000 (10:16 -0600)]
Add LinkedList::remove()

LinkedList::remove() removes the element at the specified index and returns it.

Signed-off-by: Bijan Tabatabai <bijan311@yahoo.com>
4 years agoAuto merge of #69198 - ollie27:rustbuild_rustdoc-js, r=Mark-Simulacrum
bors [Wed, 19 Feb 2020 15:55:57 +0000 (15:55 +0000)]
Auto merge of #69198 - ollie27:rustbuild_rustdoc-js, r=Mark-Simulacrum

Fix running rustdoc-js test suite individually

Without `Compiletest.path` set running `x.py test src/test/rustdoc-js` would run the `rustdoc-js` test suite with everything filtered out.

As this was the only place setting `Compiletest.path` to `None` this removes the `Option` wrapper as well.

4 years agoClean up E0317 explanation
Guillaume Gomez [Wed, 19 Feb 2020 11:59:35 +0000 (12:59 +0100)]
Clean up E0317 explanation

4 years agoUse a constructor function per dep node instead of an enum and a single function
John Kåre Alsaker [Mon, 17 Feb 2020 18:04:06 +0000 (19:04 +0100)]
Use a constructor function per dep node instead of an enum and a single function

4 years agoRemove support for dep node structs
John Kåre Alsaker [Mon, 17 Feb 2020 17:41:21 +0000 (18:41 +0100)]
Remove support for dep node structs

4 years agoTune inlining
John Kåre Alsaker [Mon, 17 Feb 2020 17:38:30 +0000 (18:38 +0100)]
Tune inlining

4 years agoFix cache hit stats
John Kåre Alsaker [Sat, 15 Feb 2020 11:00:31 +0000 (12:00 +0100)]
Fix cache hit stats

4 years agoAdd a stat for local DefId density
John Kåre Alsaker [Sat, 15 Feb 2020 09:44:27 +0000 (10:44 +0100)]
Add a stat for local DefId density

4 years agoSplit query stats into its own file
John Kåre Alsaker [Sat, 15 Feb 2020 08:48:10 +0000 (09:48 +0100)]
Split query stats into its own file

4 years agoAdd a `storage` query modifier to override the query cache
John Kåre Alsaker [Fri, 14 Feb 2020 17:29:20 +0000 (18:29 +0100)]
Add a `storage` query modifier to override the query cache

4 years agoAdd an abstraction for custom query caches
John Kåre Alsaker [Sat, 8 Feb 2020 06:38:00 +0000 (07:38 +0100)]
Add an abstraction for custom query caches

4 years agoMake `try_get_cached` take closures
John Kåre Alsaker [Thu, 13 Feb 2020 11:18:57 +0000 (12:18 +0100)]
Make `try_get_cached` take closures

4 years agoSplit query execution into hot and cold paths
John Kåre Alsaker [Wed, 12 Feb 2020 20:04:36 +0000 (21:04 +0100)]
Split query execution into hot and cold paths