Commit Graph

107419 Commits

Author SHA1 Message Date
Jonas Schievink
fd28614cb7 Add regression test for #26681 2020-02-21 19:41:22 +01:00
Jonas Schievink
1f61f36849 Add comment about the shallow subst rule 2020-02-21 19:41:22 +01:00
Jonas Schievink
485111c48e Add regression tests for issues 2020-02-21 19:41:22 +01:00
Jonas Schievink
fead45815c Fix tests after rebase 2020-02-21 19:41:22 +01:00
Jonas Schievink
07ad64f70f Add tests for #62211 2020-02-21 19:41:22 +01:00
Jonas Schievink
ff5d11e043 Add comments and tests explaining the shallow substitution rule 2020-02-21 19:41:22 +01:00
Jonas Schievink
5e9317a023 Put the check into its own function 2020-02-21 19:41:22 +01:00
Jonas Schievink
f403882927 Add a Self: Sized bound 2020-02-21 19:41:22 +01:00
Jonas Schievink
c73ee9861b Check suitability of the provided default 2020-02-21 19:41:21 +01:00
Jonas Schievink
d3be26d6a8 Improve test 2020-02-21 19:41:21 +01:00
Jonas Schievink
1e3c020063 Test interactions with specialization 2020-02-21 19:41:21 +01:00
Jonas Schievink
de447eb9f2 Add tests for assoc. const defaults 2020-02-21 19:41:21 +01:00
Jonas Schievink
37686edb85 Add comments and assertions to tests 2020-02-21 19:41:21 +01:00
Jonas Schievink
a549bbdc32 Add regression test for #54182 2020-02-21 19:41:21 +01:00
Jonas Schievink
a323ff2c86 Implement RFC 2532 – Associated Type Defaults 2020-02-21 19:41:21 +01:00
Mazdak Farrokhzad
14442e0ebb print vis & defaultness for nested items 2020-02-21 18:30:56 +01:00
bors
8aa9d2014f Auto merge of #69347 - matthiaskrgr:submodule_upd, r=Xanewok
submodules: update rls from 0100ac8 to 10bf331

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

r? @Xanewok
2020-02-21 16:57:24 +00:00
Michael Mc Donnell
e1c8c8cf63 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.
2020-02-21 08:04:16 -08:00
Mateusz Mikuła
4904b9c228 Detect Chocolatey MinGW installation 2020-02-21 16:47:04 +01:00
Mateusz Mikuła
b3b252b401 Fix MinGW detection for Cygwin 2020-02-21 15:36:29 +01:00
Santiago Pastorino
8893607a54
MIR is not an experiment anymore 2020-02-21 11:03:21 -03:00
bors
187f3d73ab 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
2020-02-21 13:33:23 +00:00
Guillaume Gomez
8f3fcec351 Clean up E0326 explanation 2020-02-21 13:34:10 +01:00
Guillaume Gomez
c3303c7b08 Clean up E0323, E0324 and E0325 explanations 2020-02-21 13:34:06 +01:00
Matthias Krüger
211fefc78c submodules: update rls from 0100ac8 to 10bf331
Changes:
````
Update cargo
````
2020-02-21 13:33:51 +01:00
Ralf Jung
821c4408f9 bump Miri 2020-02-21 11:50:15 +01:00
bors
212aa3ea28 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
2020-02-21 10:04:22 +00:00
flip1995
df11447ca8
Update Clippy 2020-02-21 10:32:57 +01:00
bors
01a8b5f26e 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
2020-02-21 06:43:40 +00:00
bors
2851e59a52 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
2020-02-21 03:14:55 +00:00
Wesley Wiser
5b7e6c0f3c Add documentation for the -Zself-profile-events flag 2020-02-20 21:32:15 -05:00
Wesley Wiser
ec980a21b0 Add test for #69312
This bug was fixed by #67501.

Closes #69312
2020-02-20 21:25:19 -05:00
Mark Rousskov
e7ee42baeb 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.
2020-02-20 19:46:09 -05:00
Dylan MacKenzie
16790ae1f9 Revert "Rollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov"
This reverts commit 61d3b6dedb, reversing
changes made to c6ad1e2c2a.
2020-02-20 16:00:39 -08:00
Nicholas Nethercote
100ff5a256 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`.
2020-02-21 10:11:35 +11:00
bors
d3ebd592d0 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.
2020-02-20 22:44:01 +00:00
Mazdak Farrokhzad
748dd455ad lit_to_const: gracefully bubble up type errors. 2020-02-20 23:43:16 +01:00
bors
2c462a2f77 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
2020-02-20 19:19:54 +00:00
Mazdak Farrokhzad
c1165ce786
Rollup merge of #69317 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Fix broken link to the rustc guide
2020-02-20 20:18:55 +01:00
Mazdak Farrokhzad
362f6501f0
Rollup merge of #69311 - GuillaumeGomez:clean-up-e0321-e0322, r=Dylan-DPC
Clean up E0321 and E0322

r? @Dylan-DPC
2020-02-20 20:18:53 +01:00
Mazdak Farrokhzad
1facbb8578
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
2020-02-20 20:18:52 +01:00
Mazdak Farrokhzad
d237e0fc6c
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.
2020-02-20 20:18:50 +01:00
Mazdak Farrokhzad
b680a5e7c2
Rollup merge of #68877 - estebank:point-at-params, r=petrochenkov
On mismatched argument count point at arguments
2020-02-20 20:18:48 +01:00
Esteban Küber
1cb555a1dc Backport only: avoid ICE on bad placeholder type
#69148 has a proper fix, but it is too big to backport.
This change avoids the ICE by actually emitting an appropriate error. The
output will be duplicated in some cases, but that's better than the
avoidable ICE.
2020-02-20 11:05:24 -08:00
LeSeulArtichaut
8e793ed649 Fix broken link to the rustc guide 2020-02-20 17:34:10 +01:00
bors
bfb96048b5 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
2020-02-20 15:52:57 +00:00
Guillaume Gomez
90ebf93bdf Greatly improve E0322 explanation 2020-02-20 14:26:56 +01:00
Guillaume Gomez
a6b5f875c1 clean up E0321 explanation 2020-02-20 14:26:43 +01:00
bors
93711d063b 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
2020-02-20 12:06:12 +00:00
Dylan DPC
941ce1a557
Rollup merge of #69287 - GuillaumeGomez:clean-e0317, r=Dylan-DPC
Clean up E0317 explanation

r? @Dylan-DPC
2020-02-20 10:49:14 +01:00