Commit Graph

105705 Commits

Author SHA1 Message Date
Matthias Krüger
14c002edb6 tidy: fix most clippy warnings 2020-01-21 15:33:17 +01:00
bors
ce361fb24f Auto merge of #68267 - estebank:lt-sugg, r=petrochenkov
Tweak lifetime definition errors

Taking inspiration from the narrative in @fasterthanlime's https://fasterthanli.me/blog/2019/declarative-memory-management/, add suggestions to some lifetime definition errors.
2020-01-21 06:28:33 +00:00
bors
8c73fa70f3 Auto merge of #68154 - ssomers:btreemap_navigation_benches, r=Mark-Simulacrum
Add more BTreeMap/BTreeSet benchmarks regarding iteration

Serving #67073 or other developments
2020-01-21 03:07:01 +00:00
bors
06b945049b Auto merge of #68405 - JohnTitor:rollup-kj0x4za, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #67734 (Remove appendix from Apache license)
 - #67795 (Cleanup formatting code)
 - #68290 (Fix some tests failing in `--pass check` mode)
 - #68297 ( Filter and test predicates using `normalize_and_test_predicates` for const-prop)
 - #68302 (Fix #[track_caller] and function pointers)
 - #68339 (Add `riscv64gc-unknown-linux-gnu` into target list in build-manifest)
 - #68381 (Added minor clarification to specification of GlobalAlloc::realloc.)
 - #68397 (rustdoc: Correct order of `async` and `unsafe` in `async unsafe fn`s)

Failed merges:

r? @ghost
2020-01-20 23:35:50 +00:00
Yuki Okushi
f6406f7f68
Rollup merge of #68397 - ollie27:rustdoc_async_unsafe, r=Centril
rustdoc: Correct order of `async` and `unsafe` in `async unsafe fn`s

The order was swapped in #61319 but rustdoc was never updated to match.

r? @GuillaumeGomez
2020-01-21 07:32:50 +09:00
Yuki Okushi
32ecb6f1f2
Rollup merge of #68381 - mjp41:master, r=Dylan-DPC
Added minor clarification to specification of GlobalAlloc::realloc.

The specification of `realloc` is slightly unclear:

```
    /// * `layout` must be the same layout that was used
    ///   to allocate that block of memory,
```
https://github.com/rust-lang/rust/blob/master/src/libcore/alloc.rs#L541-L542

In the case of an `alloc` or `alloc_zeroed` this is fairly evidently the `layout` parameter passed into the original call.  In the case of a `realloc`, this I assume is `layout` modified to contain `new_size`.  However, I could not find this case specified in the documentation.  Thus technically in a sequence of calls to `realloc`, it would be valid to provide the second call to `realloc` the same `layout` as the first call to `realloc`, which is almost certainly not going to be handled correctly.

This PR attempts to clarify the specification.
2020-01-21 07:32:48 +09:00
Yuki Okushi
67b87c8ba8
Rollup merge of #68339 - msizanoen1:patch-1, r=pietroalbini
Add `riscv64gc-unknown-linux-gnu` into target list in build-manifest

Missed in #68037

r? @alexcrichton
2020-01-21 07:32:47 +09:00
Yuki Okushi
8d2bac8dff
Rollup merge of #68302 - anp:caller-fn-ptr, r=eddyb,oli-obk
Fix #[track_caller] and function pointers

Starting with failing tests, fix the miscompilation and ICE caused by `ReifyShim` bug.

Fixes #68178.
2020-01-21 07:32:45 +09:00
Yuki Okushi
bff216c56f
Rollup merge of #68297 - Aaron1011:fix/new-const-prop-bounds, r=oli-obk
Filter and test predicates using `normalize_and_test_predicates` for const-prop

Fixes #68264

Previously, I attempted to use
`substitute_normalize_and_test_predicates` to detect unsatisfiable
bounds. Unfortunately, since const-prop runs in a generic environment
(we don't have any of the function's generic parameters substituted),
this could lead to cycle errors when attempting to normalize predicates.

This check is replaced with a more precise check. We now only call
`normalize_and_test_predicates` on predicates that have the possibility
of being proved unsatisfiable - that is, predicates that don't depend
on anything local to the function (e.g. generic parameters). This
ensures that we don't hit cycle errors when we normalize said
predicates, while still ensuring that we detect unsatisfiable
predicates.

I haven't been able to come up with a minimization of the Diesel issue - however, I've verified that it compiles successfully.
2020-01-21 07:32:44 +09:00
Yuki Okushi
eff6381c32
Rollup merge of #68290 - petrochenkov:passcheck, r=oli-obk
Fix some tests failing in `--pass check` mode

Warnings reported at codegen or linking time either have to be converted to errors (preferable), or the tests for them need to be marked with `// ignore-pass` (as a last resort).

ecd5852194 turned them from errors to warnings, but that shouldn't be necessary because it's still clear from the `.stderr` output that the errors are lints and not hard-coded.
2020-01-21 07:32:42 +09:00
Yuki Okushi
e1bd9b3396
Rollup merge of #67795 - Mark-Simulacrum:fmt-argument, r=dtolnay
Cleanup formatting code

This removes a few leftover positional enum variants that were no longer used.

All details that are changed are unstable (and `#[doc(hidden)]`), so this should
not impact downstream code.
2020-01-21 07:32:40 +09:00
Yuki Okushi
ec7f209ad4
Rollup merge of #67734 - XAMPPRocky:master, r=skade
Remove appendix from Apache license

Looking at the codebase I noticed an oddity, in that the appendix of how use the Apache licence is still contained in the licence file. We don't put licence headers at the top of all of our files so I don't think we need to keep this. Alternatively we could delete everything above line 191 to have a shorter licence file.
2020-01-21 07:32:39 +09:00
bors
b5a3341f1b Auto merge of #68066 - CAD97:stabilize-manuallydrop-take, r=Amanieu,Mark-Simulacrum
Stabilize ManuallyDrop::take

Tracking issue: closes #55422
FCP merge: https://github.com/rust-lang/rust/issues/55422#issuecomment-572653619

Reclaims the doc improvements from closed #62198.

-----

Stable version is a simple change if necessary.

Proposal: [relnotes] (this changes how to best take advantage of `ManuallyDrop`, esp. wrt. `Drop::drop` and finalize-by-value members)
2020-01-20 20:11:20 +00:00
Oliver Middleton
3e0bfe1238 rustdoc: Correct order of async and unsafe in async unsafe fns 2020-01-20 18:14:51 +00:00
Mark Rousskov
a804a45528 Fix UI test
fmt::Formatter is still not Send/Sync, but the UI test emitted two errors, for
the dyn Write and the Void inside Formatter. As of this PR, the Void is now
gone, but the dyn Write remains.
2020-01-20 12:17:12 -05:00
Mark Rousskov
9ae32c9b27 Drop args from Formatter
These are no longer used by Formatter methods.
2020-01-20 11:57:27 -05:00
Mark Rousskov
4919b96f81 Move run/getcount to functions
These are only called from one place and don't generally support being called
from other places; furthermore, they're the only formatter functions that look
at the `args` field (which a future commit will remove).
2020-01-20 11:57:27 -05:00
Mark Rousskov
fdef4f185e Delete unused "next" variants from formatting infrastructure
The formatting infrastructure stopped emitting these a while back, and in
removing them we can simplify related code.
2020-01-20 11:57:27 -05:00
bors
66b0c97070 Auto merge of #68277 - michaelwoerister:re-export-dylib-instances, r=alexcrichton
Make sure that all upstream generics get re-exported from Rust dylibs.

This PR contains a fix for #67276. Rust dylibs would not re-export all generic instances when compiling with `-Zshare-generics=on` (=default for debug builds) which could lead to situations where the compiler expected certain generic instances to be available but then the linker would not find them.

### TODO
- [x] Write a regression test based on the description [here](https://github.com/rust-lang/rust/issues/67276#issuecomment-574613457).
- [x] Find out if this also fixes other issues related to https://github.com/rust-lang/rust/issues/64319.

r? @alexcrichton ~~(once the TODOs are done)~~
cc @pnkfelix @AlexKornitzer
2020-01-20 13:37:03 +00:00
Michael Woerister
0a9bcb0adf Add regression test for #64319 back in.
The regression test is originally from #64324 but was removed again
after the fix in there turned out to break other things.
2020-01-20 12:00:43 +01:00
Michael Woerister
ce6995f98e Add regression test for shared-generics x dylibs (#67276). 2020-01-20 12:00:43 +01:00
Michael Woerister
31095d7e37 Make sure that all upstream generics get re-exported from Rust dylibs. 2020-01-20 12:00:43 +01:00
Matthew Parkinson
6be3446f92 Added minor clarification to specification of realloc.
The `layout` for the returned allocation of a `realloc` is
only implicitly specified.  This change makes it explicit.
2020-01-20 10:09:51 +00:00
bors
900811e430 Auto merge of #68380 - Dylan-DPC:rollup-a7moqmr, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #68326 (rustdoc: Catch fatal errors when syntax highlighting)
 - #68335 (Remove real_drop_in_place)
 - #68353 (Remove `rustc_error_codes` deps except in `rustc_driver`)
 - #68357 (rustdoc: Fix handling of compile errors when running `rustdoc --test`)
 - #68365 (Clean up error codes)

Failed merges:

r? @ghost
2020-01-20 05:56:53 +00:00
Dylan DPC
0259c10385
Rollup merge of #68365 - GuillaumeGomez:clean-up-err-codes-2, r=Dylan-DPC
Clean up error codes

r? @Dylan-DPC
2020-01-20 11:14:51 +05:30
Dylan DPC
cd4652a195
Rollup merge of #68357 - ollie27:rustdoc_test_errors, r=GuillaumeGomez
rustdoc: Fix handling of compile errors when running `rustdoc --test`

 * Call `abort_if_errors` so all errors actually stop rustdoc.
* Don't panic with "compiler aborted in rustdoc!", instead just exit to avoid the ugly panic message.
* Use rlib as the crate type when searching for doctests matching what is used for doc generation so `#[no_std]` crates don't create "no global memory allocator" errors.

Fixes #52243
Fixes #54010

r? @GuillaumeGomez
2020-01-20 11:14:49 +05:30
Dylan DPC
fb86b820bb
Rollup merge of #68353 - Centril:code-liberation, r=petrochenkov
Remove `rustc_error_codes` deps except in `rustc_driver`

Remove dependencies on `rustc_error_codes` in all crates except for `rustc_driver`.

This has some benefits:

1. Adding a new error code when hacking on the compiler only requires rebuilding at most `rustc_error_codes`, `rustc_driver`, and the reflexive & transitive closure of the crate where the new error code is being added and its reverse dependencies. This improves time-to-UI-tests (TTUT).

2. Adding an error description to an error code only requires rebuilding `rustc_error_codes` and `rustc_driver`. This should substantially improve TTUT.

r? @petrochenkov
cc @rust-lang/wg-diagnostics
2020-01-20 11:14:48 +05:30
Dylan DPC
5d8edc99aa
Rollup merge of #68335 - RalfJung:drop-in-place, r=Mark-Simulacrum
Remove real_drop_in_place

In af9b057156, I added `real_drop_in_place` because Stacked Borrows at the time couldn't handle transmuting of mutable references to raw pointers and back. Stacked Borrows 2, however, doesn't have any issue with these transmutes, so it is time to remove this hack again.
2020-01-20 11:14:46 +05:30
Dylan DPC
0dc2557c12
Rollup merge of #68326 - ollie27:rustdoc_hightlight_fatal_errors, r=GuillaumeGomez
rustdoc: Catch fatal errors when syntax highlighting

For some errors the lexer will unwind so we need to handle that in addition to handling `token::Unknown`.

Fixes #56885

r? @GuillaumeGomez
2020-01-20 11:14:42 +05:30
Esteban Küber
03d7fed165 review comments 2020-01-19 17:59:01 -08:00
Esteban Küber
0a6b5538ad Deal with stabilization of feature(slice_patterns) 2020-01-19 17:31:34 -08:00
Esteban Küber
12ff4d0bd6 review comments: use closures 2020-01-19 17:31:34 -08:00
Esteban Küber
2102723887 review comments 2020-01-19 17:31:34 -08:00
Esteban Küber
78d3ea5484 When encountering an expected named lifetime and none are present, suggest adding one 2020-01-19 17:31:33 -08:00
Esteban Küber
6ba08755df When encountering an undefined named lifetime, point to where it can be
This doesn't mention that using an existing lifetime is possible, but
that would hopefully be clear as always being an option. The intention
of this is to teach newcomers what the lifetime syntax is.
2020-01-19 17:31:33 -08:00
bors
29b854fb74 Auto merge of #68057 - Aaron1011:fix/marker-trait-selection, r=matthewjasper
Don't discard marker trait impls when inference variables are present

Fixes #61651

Previously, we would unconditionally discard impl candidates for marker
traits during trait selection. However, if the predicate had inference
variables, this could have the effect of constrainting inference
variables (due to a successful trait selection) when we would have
otherwise failed due to mutliple applicable impls,

This commit prevents marker trait impls from being discarded while the
obligation predicate has any inference variables, ensuring that
discarding impls will never cause us to incorrectly constraint inference
variables.
2020-01-20 00:10:48 +00:00
Adam Perry
72dffac6cf Test that ReifyShim + caller_location return the def site. 2020-01-19 14:26:28 -08:00
Eduard-Mihai Burtescu
19d8527890 rustc_mir: don't require a self argument for ReifyShim. 2020-01-19 14:26:28 -08:00
Adam Perry
0ee922123f InstanceDef::requires_caller_location limited to items. 2020-01-19 14:26:28 -08:00
Adam Perry
fd90e56120 Add failing #[track_caller] test with fn pointers. 2020-01-19 14:26:28 -08:00
bors
7da653f669 Auto merge of #68343 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy from a8d90f6a to 7ae24429

Changes:
````
Downgrade range_plus_one to pedantic
Rustup to rust-lang/rust#68204
Add lifetimes to `LateLintPass`
Fix rustc lint import paths generated by `new_lint`
Add lint for default lint description
Update documentation for adding new lints
Generate new lints easily
````
Fixes #68331
2020-01-19 20:37:44 +00:00
Ralf Jung
95934937bb fix real_drop_in_place in comments 2020-01-19 10:11:16 -06:00
Ralf Jung
b77a7997a8 adjust codegen-units tests 2020-01-19 10:09:52 -06:00
Guillaume Gomez
a9aa2dfe84 clean up E0204 explanation 2020-01-19 15:35:55 +01:00
Guillaume Gomez
0c7f40f3b2 clean up E0201 explanation 2020-01-19 15:35:44 +01:00
bors
c0e02ad724 Auto merge of #68363 - Dylan-DPC:rollup-33enndv, r=Dylan-DPC
Rollup of 3 pull requests

Successful merges:

 - #67682 ([const-prop] Remove useless typedef)
 - #68247 (Clean up err codes)
 - #68348 (Make iter::Empty<T> Send and Sync for any T)

Failed merges:

r? @ghost
2020-01-19 14:06:57 +00:00
Matthias Krüger
188f0bbe7f submodules: update clippy from a8d90f6a to fd0428f6
Changes:
````
Treat more strange pattern
Split up `if_same_then_else` ui test
Apply review comments
Run `update_lints`
Reduce span range
Rename `ok_if_let` to `if_let_some_result`
Apply review comments
Add suggestion in `if_let_some_result`
rustup https://github.com/rust-lang/rust/pull/67712
Allow `unused_self` lint at the function level
Downgrade range_plus_one to pedantic
Rustup to rust-lang/rust#68204
Add lifetimes to `LateLintPass`
Fix rustc lint import paths generated by `new_lint`
Add lint for default lint description
Update documentation for adding new lints
Generate new lints easily
Split up `booleans` ui test
Fix the ordering on `nonminimal_bool`
````
2020-01-19 14:01:52 +01:00
Dylan DPC
d276e6942e
Rollup merge of #68348 - xfix:patch-14, r=nagisa
Make iter::Empty<T> Send and Sync for any T

Continuing from #57682

It's quite funny, when I initially submitted this pull request, I said "Likely nobody will be using that property of `iter::empty`", but then a year later I got a compilation error because it wasn't `Send` and `Sync`.

Unfortunately, `PhantomData<fn() -> T>` still errors out. Oh well. I proposed `
struct PhantomFnWorkaround<T>(fn() -> T);`, but dtolnay did not like it, so using explicit implementations.
2020-01-19 17:22:09 +05:30
Dylan DPC
a29ba00107
Rollup merge of #68247 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC
Clean up err codes

r? @Dylan-DPC
2020-01-19 17:22:07 +05:30
Dylan DPC
cba48b8af3
Rollup merge of #67682 - wesleywiser:remove_opty_const_typedef, r=Dylan-DPC
[const-prop] Remove useless typedef

It's confusing because it conflicts with `ty::Const` and just isn't
generally useful.
2020-01-19 17:22:06 +05:30