bors [Thu, 6 Feb 2020 08:48:01 +0000 (08:48 +0000)]
Auto merge of #68664 - tspiteri:no_run-complete-build, r=nikomatsakis
rustdoc: attempt full build for compile_fail test
Some code fails when doing a full build but does not fail when only emitting metadata. This commit makes sure compile_fail tests for such code behave as expected, that is, the test succeeds because the compilation fails.
bors [Thu, 6 Feb 2020 05:19:52 +0000 (05:19 +0000)]
Auto merge of #68583 - estebank:hrlt, r=oli-obk
Account for HR lifetimes when suggesting introduction of named lifetime
```
error[E0106]: missing lifetime specifier
--> src/test/ui/suggestions/fn-missing-lifetime-in-item.rs:2:32
|
2 | struct S2<F: Fn(&i32, &i32) -> &i32>(F);
| ---- ---- ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
2 | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F);
| ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^
help: consider introducing a named lifetime parameter
|
2 | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);=
| ^^^ ^^^^^^^ ^^^^^^^ ^^^
```
Follow up to #68267. Addresses the diagnostics part of #49287.
bors [Wed, 5 Feb 2020 22:41:54 +0000 (22:41 +0000)]
Auto merge of #68461 - cjgillot:split_infer_prelude, r=matthewjasper
Move datatypes definitions in specific modules inside rustc::{traits, infer}
Prelude to #67953
Some data types inside `rustc::traits` and `rustc::infer` are used in other parts of `librustc`. These cannot go to a separate crate `librustc_infer`.
This PR moves those data types to `traits::types` and `infer::types` modules, from where everything is reexported.
Note for review: some imports feature the `crate -> rustc` substitution. This is cruft from the splitting out of #67953. This can be reverted, but are bound to be put back by #67953.
bors [Wed, 5 Feb 2020 19:11:04 +0000 (19:11 +0000)]
Auto merge of #67429 - mati865:mingw-ultimate-fix, r=alexcrichton
windows-gnu: prefer system crt libraries if they are available
The origin of the issue is the fact Rust ships mingw-w64 libraries but no headers and prefers own libraries over the system ones.
This leads to situation when headers aren't compatible with libraries (mingw-w64 doesn't provide any forward compatibility and AFAIK backwards compatibility is guaranteed only within major release series).
It's easier to understand how this PR works when looking at the linker invocation before and with this PR: https://www.diffchecker.com/GEuYFmzo
It adds system libraries path before Rust libraries so the linker will prefer them.
It has potential issue when system has files with the same names as Rust but that could be avoided by moving Rust shipped mingw-w64 libraries from `lib/rustlib/x86_64-pc-windows-gnu/lib` to say `lib/rustlib/x86_64-pc-windows-gnu/lib/mingw`. Then adding linker paths in this order: Rust libraries, system libraries, Rust shipped mingw-w64 libraries.
Dylan DPC [Wed, 5 Feb 2020 12:14:37 +0000 (13:14 +0100)]
Rollup merge of #68858 - ljedrz:collapse_stable_hash_foos, r=michaelwoerister
Merge item id stable hashing functions
Supersedes https://github.com/rust-lang/rust/pull/67999 splitting out the pure cleanup bits, i.e. merging `hash_item_id`, `hash_impl_item_id` and `hash_trait_item_id` into a common `hash_reference_to_item`.
Dylan DPC [Wed, 5 Feb 2020 12:14:28 +0000 (13:14 +0100)]
Rollup merge of #68809 - ecstatic-morse:const-int-functions, r=oli-obk
Make more arithmetic functions unstably const
This is a smaller version of #66884 (thanks @9999years) that constifies many of the arithmetic functions on integer primitives from #53718 that were blocked on #49146.
bors [Tue, 4 Feb 2020 23:56:49 +0000 (23:56 +0000)]
Auto merge of #68544 - Aaron1011:remove-overlapping-traits, r=estebank
Remove the `overlapping_marker_traits` feature
See #29864
This has been replaced by `#[feature(marker_trait_attr)]`
A few notes:
* Due to PR #68057 not yet being in the bootstrap compiler, it's
necessary to continue using `#![feature(overlapping_marker_traits)]`
under `#[cfg(bootstrap)]` to work around type inference issues.
* I've updated tests that used `overlapping_marker_traits` to now use
`marker_trait_attr` where applicable
The test `src/test/ui/overlap-marker-trait.rs` doesn't make any sense
now that `overlapping_marker_traits`, so I removed it.
The test `src/test/ui/traits/overlap-permitted-for-marker-traits-neg.rs`
now fails, since it's no longer possible to have multiple overlapping
negative impls of `Send`. I believe that this is the behavior we want
(assuming that `Send` is not going to become a `#[marker]` trait, so I
renamed the test to `overlap-permitted-for-marker-traits-neg`
Dylan DPC [Tue, 4 Feb 2020 20:51:56 +0000 (21:51 +0100)]
Rollup merge of #68818 - matthiaskrgr:misc_perf, r=Mark-Simulacrum
fix couple of perf related clippy warnings
librustc: don't clone a type that is copy
librustc_incremental: use faster vector initialization
librustc_typeck: don't clone a type that is copy
librustdoc: don't create a vector where a slice will do
Dylan DPC [Tue, 4 Feb 2020 20:51:50 +0000 (21:51 +0100)]
Rollup merge of #68758 - daboross:fix-59191, r=petrochenkov
Fix 59191 - ICE when macro replaces crate root with non-module item
Hi,
This should fix #59191! My friend and I are working on learning the rustc codebase through contributions, so please feel free to mention anything amiss or that could be done better.
The code adds an explicit case for when a macro applied to the crate root (via an inner attribute) replaces it with something nonsensical, like a function. The crate root must be a module, and the error message reflects this.
---
I should note that there are a few other weird edge cases here, like if they do output a module, it succeeds but uses that module's name as a prefix for all names in the crate. I'm assuming that's an issue for stabilizing #54726, though.
bors [Tue, 4 Feb 2020 20:30:53 +0000 (20:30 +0000)]
Auto merge of #68558 - HeroicKatora:buf-writer-capacity, r=alexcrichton
Add a method to query the capacity of a BufWriter and BufReader
Besides the obvious of retrieving the parameter used to construct the writer, this method allows consumers to control the number of `flush` calls during write operations. For `BufReader` it gives an upper bound on the returned buffer in `fill_buf` which might influence the allocation behaviour of a consumer.
Aaron Hill [Sat, 25 Jan 2020 20:30:19 +0000 (15:30 -0500)]
Remove the `overlapping_marker_traits` feature
See #29864
This has been replaced by `#[feature(marker_trait_attr)]`
A few notes:
* Due to PR #68057 not yet being in the bootstrap compiler, it's
necessary to continue using `#![feature(overlapping_marker_traits)]`
under `#[cfg(bootstrap)]` to work around type inference issues.
* I've updated tests that used `overlapping_marker_traits` to now use
`marker_trait_attr` where applicable
The test `src/test/ui/overlap-marker-trait.rs` doesn't make any sense
now that `overlapping_marker_traits`, so I removed it.
The test `src/test/ui/traits/overlap-permitted-for-marker-traits-neg.rs`
now fails, since it's no longer possible to have multiple overlapping
negative impls of `Send`. I believe that this is the behavior we want
(assuming that `Send` is not going to become a `#[marker]` trait, so I
renamed the test to `overlap-permitted-for-marker-traits-neg`
bors [Tue, 4 Feb 2020 17:17:55 +0000 (17:17 +0000)]
Auto merge of #68377 - estebank:fn-obligations-spans, r=oli-obk
Tweak obligation error output
- Point at arguments or output when fn obligations come from them, or ident when they don't
- Point at `Sized` bound (fix #47990)
- When object unsafe trait uses itself in associated item suggest using `Self` (fix #66424, fix #33375, partially address #38376, cc #61525)
- Point at reason in object unsafe trait with `Self` in supertraits or `where`-clause (cc #40533, cc #68377)
- On implicit type parameter `Sized` obligations, suggest `?Sized` (fix #57744, fix #46683)
bors [Tue, 4 Feb 2020 14:16:18 +0000 (14:16 +0000)]
Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbini
Step stage0 to bootstrap from 1.42
This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
bors [Tue, 4 Feb 2020 10:58:45 +0000 (10:58 +0000)]
Auto merge of #68804 - ecstatic-morse:qualif-cursor-lazy, r=estebank
Always use lazy qualif getters during const-checking
`has_mut_interior_eager_seek` was needed to work around an overly restrictive bound on the `per_local` argument to the `Qualif` trait. This PR makes that bound `FnMut` instead of `Fn` so we can seek cursors inside of it, resolving a FIXME in the const-checking code.
Matthias Krüger [Tue, 4 Feb 2020 01:28:11 +0000 (02:28 +0100)]
fix couple of perf related clipyp warnings
librustc: don't clone a type that is copy
librustc_incremental: use faster vector initialization
librustc_typeck: don't clone a type that is copy
librustdoc: don't create a vector where a slice will do
bors [Mon, 3 Feb 2020 22:02:26 +0000 (22:02 +0000)]
Auto merge of #67668 - matthewjasper:or-patterns, r=pnkfelix
Implement MIR lowering for or-patterns
This is the last thing needed to get meaningful run-pass tests for or-patterns. There probably need to be more tests before stabilizing this, but the most important cases should have been covered.
Note: we can generate exponentially large MIR CFGs when using or-patterns containing bindings, type ascriptions, or that are for a match arm with a guard. `src/test/mir-opt/exponential-or.rs` shows the best case for what we currently do.
bors [Mon, 3 Feb 2020 18:40:54 +0000 (18:40 +0000)]
Auto merge of #68803 - Dylan-DPC:rollup-b4x6ghj, r=Dylan-DPC
Rollup of 8 pull requests
Successful merges:
- #68678 (Install robots.txt into rust-docs tarballs)
- #68711 (Added upper bound of what vecs and boxes can allocate)
- #68744 (Do not ICE in `type-alias-impl-trait` with save-analysis)
- #68777 (Clean up E0263 explanation)
- #68787 (Optimize core::ptr::align_offset (part 1))
- #68797 (Fix links to types instead of modules)
- #68798 (Test that `#[track_caller]` as `fn()` respects RT / CTFE equivalence)
- #68800 (Stabilize `core::iter::once_with()`)
Dylan DPC [Mon, 3 Feb 2020 17:58:27 +0000 (18:58 +0100)]
Rollup merge of #68711 - hman523:fix-68593, r=Dylan-DPC
Added upper bound of what vecs and boxes can allocate
Fixed issue #68593
I added a line of documentation to these two files to reflect that vectors and boxes ensure that they never allocate more than `isize::MAX` bytes.
r? @steveklabnik