]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #68691 - nnethercote:rm-RefCell-from-ObligationForest, r=nikomatsakis
Dylan DPC [Thu, 6 Feb 2020 14:37:38 +0000 (15:37 +0100)]
Rollup merge of #68691 - nnethercote:rm-RefCell-from-ObligationForest, r=nikomatsakis

Remove `RefCell` usage from `ObligationForest`.

It's not needed.

This doesn't affect performance, it just simplifies the code a little.

r? @nikomatsakis

4 years agoAuto merge of #68664 - tspiteri:no_run-complete-build, r=nikomatsakis
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.

Fixes #67771.

4 years agoAuto merge of #68583 - estebank:hrlt, r=oli-obk
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.

4 years agoAuto merge of #68861 - Dylan-DPC:rollup-0m09hsg, r=Dylan-DPC
bors [Thu, 6 Feb 2020 01:46:46 +0000 (01:46 +0000)]
Auto merge of #68861 - Dylan-DPC:rollup-0m09hsg, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #68762 (Strip unnecessary subexpression)
 - #68790 (Improve `merge_from_succ`)
 - #68809 (Make more arithmetic functions unstably const)
 - #68832 (Clean up E0264, E0267 and E0268 explanations)
 - #68840 (On suggesting `#![recursion_limit = "X"]`, note current crate name)
 - #68846 (doc fix on doc attribute)
 - #68851 (Fix issue number of `capacity` method)
 - #68858 (Merge item id stable hashing functions)

Failed merges:

r? @ghost

4 years agoRemove `RefCell` usage from `ObligationForest`.
Nicholas Nethercote [Fri, 31 Jan 2020 02:39:34 +0000 (13:39 +1100)]
Remove `RefCell` usage from `ObligationForest`.

It's not needed.

4 years agoAuto merge of #68461 - cjgillot:split_infer_prelude, r=matthewjasper
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.

r? @Centril
cc @Zoxc

4 years agoAuto merge of #67429 - mati865:mingw-ultimate-fix, r=alexcrichton
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.

Fixes #47048
Fixes #49078
Fixes #53454
Fixes #60912

4 years agoFix test
Esteban Küber [Wed, 5 Feb 2020 18:59:14 +0000 (10:59 -0800)]
Fix test

4 years agoAccount for `impl Trait`
Esteban Küber [Thu, 30 Jan 2020 19:53:47 +0000 (11:53 -0800)]
Account for `impl Trait`

Address #49287

4 years agoMove code to `diagnostics.rs`
Esteban Küber [Tue, 28 Jan 2020 23:04:18 +0000 (15:04 -0800)]
Move code to `diagnostics.rs`

4 years agoreview comments
Esteban Küber [Tue, 28 Jan 2020 01:33:13 +0000 (17:33 -0800)]
review comments

4 years agoreview comments: wording
Esteban Küber [Tue, 28 Jan 2020 00:25:43 +0000 (16:25 -0800)]
review comments: wording

4 years agoAccount for `fn()` types in lifetime suggestions
Esteban Küber [Tue, 28 Jan 2020 00:13:45 +0000 (16:13 -0800)]
Account for `fn()` types in lifetime suggestions

4 years agoAccount for `'_` in suggestions
Esteban Küber [Mon, 27 Jan 2020 22:35:20 +0000 (14:35 -0800)]
Account for `'_` in suggestions

4 years agoreview comments
Esteban Küber [Mon, 27 Jan 2020 22:08:59 +0000 (14:08 -0800)]
review comments

4 years agoSuggest `'r` instead of `'lifetime`
Esteban Küber [Mon, 27 Jan 2020 20:49:12 +0000 (12:49 -0800)]
Suggest `'r` instead of `'lifetime`

4 years agoWhen suggesting lifetimes, propose adding the new lifetime to all arguments
Esteban Küber [Mon, 27 Jan 2020 20:41:49 +0000 (12:41 -0800)]
When suggesting lifetimes, propose adding the new lifetime to all arguments

4 years agoUse spans for input borrowed types unrelated to return type
Esteban Küber [Mon, 27 Jan 2020 19:48:52 +0000 (11:48 -0800)]
Use spans for input borrowed types unrelated to return type

4 years agoAccount for HKTB when suggesting introduction of named lifetime
Esteban Küber [Mon, 27 Jan 2020 19:26:06 +0000 (11:26 -0800)]
Account for HKTB when suggesting introduction of named lifetime

4 years agoRollup merge of #68858 - ljedrz:collapse_stable_hash_foos, r=michaelwoerister
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`.

r? @michaelwoerister

4 years agoRollup merge of #68851 - JohnTitor:fix-issue-number, r=Centril
Dylan DPC [Wed, 5 Feb 2020 12:14:34 +0000 (13:14 +0100)]
Rollup merge of #68851 - JohnTitor:fix-issue-number, r=Centril

Fix issue number of `capacity` method

Follow-up of https://github.com/rust-lang/rust/pull/68558#issuecomment-582117131

r? @alexcrichton

4 years agoRollup merge of #68846 - king6cong:doc-fix, r=GuillaumeGomez
Dylan DPC [Wed, 5 Feb 2020 12:14:33 +0000 (13:14 +0100)]
Rollup merge of #68846 - king6cong:doc-fix, r=GuillaumeGomez

doc fix on doc attribute

None

4 years agoRollup merge of #68840 - Centril:rec-lim-curr-crate, r=estebank
Dylan DPC [Wed, 5 Feb 2020 12:14:31 +0000 (13:14 +0100)]
Rollup merge of #68840 - Centril:rec-lim-curr-crate, r=estebank

On suggesting `#![recursion_limit = "X"]`, note current crate name

This would have saved me much confusion e.g. when reading the log output in https://github.com/rust-lang/rust/pull/68788#issuecomment-581852191.

r? @estebank

4 years agoRollup merge of #68832 - GuillaumeGomez:clean-up-3-err-codes, r=estebank
Dylan DPC [Wed, 5 Feb 2020 12:14:30 +0000 (13:14 +0100)]
Rollup merge of #68832 - GuillaumeGomez:clean-up-3-err-codes, r=estebank

Clean up E0264, E0267 and E0268 explanations

r? @Dylan-DPC

4 years agoRollup merge of #68809 - ecstatic-morse:const-int-functions, r=oli-obk
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.

This makes the following things unstably const.

- `feature = const_int_unchecked_arith`
  - `intrinsics::unchecked_add`
  - `intrinsics::unchecked_sub`
  - `intrinsics::unchecked_mul`
  - `intrinsics::unchecked_div`
  - `intrinsics::unchecked_rem`

- `feature = const_checked_int_methods`
  - `checked_add`
  - `checked_sub`
  - `checked_mul`
  - `checked_div` (Uses `intrinsics::unchecked_div` internally)
  - `checked_rem` (Uses `intrinsics::unchecked_rem` internally)
  - `checked_neg`
  - `checked_shl`
  - `checked_shr`
  - `checked_abs`

- `feature = const_saturating_int_methods`
  - `saturating_mul`
  - `saturating_neg`  (Uses `intrinsics::unchecked_sub` internally)
  - `saturating_abs` (Uses `intrinsics::unchecked_sub` internally)

- `feature = const_wrapping_int_methods`
  - `wrapping_div`
  - `wrapping_rem`

- `feature = const_overflowing_int_methods`
  - `overflowing_div`
  - `overflowing_rem`

- `feature = const_euclidean_int_methods`
  - `checked_div_euclid`
  - `checked_rem_euclid`
  - `wrapping_div_euclid`
  - `wrapping_rem_euclid`
  - `overflowing_div_euclid`
  - `overflowing_rem_euclid`

Exponentiation and operations on the `NonZero` types are left to a later PR.

r? @oli-obk
cc @rust-lang/wg-const-eval @rust-lang/libs

4 years agoRollup merge of #68790 - nnethercote:improve-merge_from_succ, r=nikomatsakis
Dylan DPC [Wed, 5 Feb 2020 12:14:25 +0000 (13:14 +0100)]
Rollup merge of #68790 - nnethercote:improve-merge_from_succ, r=nikomatsakis

Improve `merge_from_succ`

A couple of small performance wins.

r? @nikomatsakis

4 years agoRollup merge of #68762 - ForNeVeR:patch-1, r=alexcrichton
Dylan DPC [Wed, 5 Feb 2020 12:14:22 +0000 (13:14 +0100)]
Rollup merge of #68762 - ForNeVeR:patch-1, r=alexcrichton

Strip unnecessary subexpression

It became unnecessary since a06baa56b95674fc626b3c3fd680d6a65357fe60 reformatted the file. The comment is currently a bit misleading.

4 years agoMove EvaluationCache::clear.
Camille GILLOT [Wed, 22 Jan 2020 13:00:55 +0000 (14:00 +0100)]
Move EvaluationCache::clear.

4 years agoMove ExpectedFound::new to ty::error.
Camille GILLOT [Wed, 22 Jan 2020 12:55:05 +0000 (13:55 +0100)]
Move ExpectedFound::new to ty::error.

4 years agoMove specialization_graph definition in traits::types.
Camille GILLOT [Wed, 22 Jan 2020 12:44:59 +0000 (13:44 +0100)]
Move specialization_graph definition in traits::types.

4 years agoSplit traits::structural_impls in two.
Camille GILLOT [Wed, 22 Jan 2020 12:42:04 +0000 (13:42 +0100)]
Split traits::structural_impls in two.

4 years agoAuto merge of #68755 - Tyg13:update_stdarch, r=alexcrichton
bors [Wed, 5 Feb 2020 10:39:01 +0000 (10:39 +0000)]
Auto merge of #68755 - Tyg13:update_stdarch, r=alexcrichton

Update `rust-lang/stdarch` submodule

Update submodule [rust-lang/stdarch](https://github.com/rust-lang/stdarch/)

4 years agomove item reference comment
ljedrz [Wed, 5 Feb 2020 10:29:07 +0000 (11:29 +0100)]
move item reference comment

4 years agomerge item id stable hashing functions
ljedrz [Wed, 5 Feb 2020 10:11:34 +0000 (11:11 +0100)]
merge item id stable hashing functions

4 years agoMove implementation of UnifyKey to unify_key.rs.
Camille GILLOT [Wed, 22 Jan 2020 12:39:53 +0000 (13:39 +0100)]
Move implementation of UnifyKey to unify_key.rs.

4 years agoMove infer::canonical datatypes to infer::types.
Camille GILLOT [Wed, 22 Jan 2020 12:35:27 +0000 (13:35 +0100)]
Move infer::canonical datatypes to infer::types.

4 years agoMove infer::region_constraints::MemberConstraint to infer::types module.
Camille GILLOT [Wed, 22 Jan 2020 12:31:42 +0000 (13:31 +0100)]
Move infer::region_constraints::MemberConstraint to infer::types module.

4 years agoMove traits::query datatypes to traits::types.
Camille GILLOT [Wed, 22 Jan 2020 08:04:50 +0000 (09:04 +0100)]
Move traits::query datatypes to traits::types.

4 years agoMove traits::select datatypes to traits::types.
Camille GILLOT [Wed, 22 Jan 2020 08:01:22 +0000 (09:01 +0100)]
Move traits::select datatypes to traits::types.

4 years agoMove traits::Reveal to traits::types.
Camille GILLOT [Wed, 22 Jan 2020 07:54:46 +0000 (08:54 +0100)]
Move traits::Reveal to traits::types.

4 years agoMove rustc::traits datatypes to module traits::types.
Camille GILLOT [Wed, 22 Jan 2020 07:51:01 +0000 (08:51 +0100)]
Move rustc::traits datatypes to module traits::types.

4 years agoFix issue number of `capacity` method
Yuki Okushi [Wed, 5 Feb 2020 06:34:33 +0000 (15:34 +0900)]
Fix issue number of `capacity` method

4 years agodoc fix on doc attribute
king6cong [Wed, 5 Feb 2020 04:56:24 +0000 (12:56 +0800)]
doc fix on doc attribute

4 years agoImplement remaining `unchecked` arithmetic intrinsics
Dylan MacKenzie [Wed, 5 Feb 2020 01:09:22 +0000 (17:09 -0800)]
Implement remaining `unchecked` arithmetic intrinsics

4 years agoFix test
Dylan MacKenzie [Tue, 4 Feb 2020 19:46:13 +0000 (11:46 -0800)]
Fix test

4 years agoUse consistent feature naming
Dylan MacKenzie [Tue, 4 Feb 2020 19:46:03 +0000 (11:46 -0800)]
Use consistent feature naming

4 years agoAuto merge of #68831 - Dylan-DPC:rollup-j6x15y9, r=Dylan-DPC
bors [Wed, 5 Feb 2020 03:20:43 +0000 (03:20 +0000)]
Auto merge of #68831 - Dylan-DPC:rollup-j6x15y9, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #68282 (Instrument C / C++ in MemorySanitizer example)
 - #68758 (Fix 59191 - ICE when macro replaces crate root with non-module item)
 - #68805 (bootstrap: fix clippy warnings)
 - #68810 (Remove Copy impl from OnceWith)
 - #68815 (remove redundant imports (clippy::single_component_path_imports))
 - #68818 (fix couple of perf related clippy warnings)
 - #68819 (Suggest `split_at_mut` on multiple mutable index access)

Failed merges:

r? @ghost

4 years ago`#![recursion_limit = "X"]`: note current crate name.
Mazdak Farrokhzad [Wed, 5 Feb 2020 01:57:30 +0000 (02:57 +0100)]
`#![recursion_limit = "X"]`: note current crate name.

4 years agoAuto merge of #68544 - Aaron1011:remove-overlapping-traits, r=estebank
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`

4 years agoPrefer system MinGW libs when available
Mateusz Mikuła [Fri, 13 Dec 2019 18:45:04 +0000 (19:45 +0100)]
Prefer system MinGW libs when available

4 years agoClean up E0264, E0267 and E0268 explanations
Guillaume Gomez [Tue, 4 Feb 2020 21:03:54 +0000 (22:03 +0100)]
Clean up E0264, E0267 and E0268 explanations

4 years agoRollup merge of #68819 - estebank:split_at_mut, r=oli-obk
Dylan DPC [Tue, 4 Feb 2020 20:51:58 +0000 (21:51 +0100)]
Rollup merge of #68819 - estebank:split_at_mut, r=oli-obk

Suggest `split_at_mut` on multiple mutable index access

cc #58792.

4 years agoRollup merge of #68818 - matthiaskrgr:misc_perf, r=Mark-Simulacrum
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

4 years agoRollup merge of #68815 - matthiaskrgr:redundant_imports, r=alexcrichton
Dylan DPC [Tue, 4 Feb 2020 20:51:55 +0000 (21:51 +0100)]
Rollup merge of #68815 - matthiaskrgr:redundant_imports, r=alexcrichton

remove redundant imports (clippy::single_component_path_imports)

4 years agoRollup merge of #68810 - ollie27:once_with_copy, r=Dylan-DPC
Dylan DPC [Tue, 4 Feb 2020 20:51:53 +0000 (21:51 +0100)]
Rollup merge of #68810 - ollie27:once_with_copy, r=Dylan-DPC

Remove Copy impl from OnceWith

Iterators typically don't implement `Copy` and this shouldn't be an exception.

4 years agoRollup merge of #68805 - matthiaskrgr:cleanup_bootstrap, r=Mark-Simulacrum
Dylan DPC [Tue, 4 Feb 2020 20:51:52 +0000 (21:51 +0100)]
Rollup merge of #68805 - matthiaskrgr:cleanup_bootstrap, r=Mark-Simulacrum

bootstrap: fix clippy warnings

r? @oli-obk

4 years agoRollup merge of #68758 - daboross:fix-59191, r=petrochenkov
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.

4 years agoRollup merge of #68282 - tmiasko:sanitizer-example, r=steveklabnik
Dylan DPC [Tue, 4 Feb 2020 20:51:48 +0000 (21:51 +0100)]
Rollup merge of #68282 - tmiasko:sanitizer-example, r=steveklabnik

Instrument C / C++ in MemorySanitizer example

Modify the example to instrument C / C++ in addition to Rust, since it
will be generally required (e.g., when using libbacktrace for symbolication).

4 years agoAuto merge of #68558 - HeroicKatora:buf-writer-capacity, r=alexcrichton
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.

4 years agoAdd tests for newly const arithmetic fns
Dylan MacKenzie [Mon, 3 Feb 2020 22:23:21 +0000 (14:23 -0800)]
Add tests for newly const arithmetic fns

Co-Authored-By: 9999years <rbt@sent.as>
4 years agoMake saturating arithmetic using intrinsics `const`
Dylan MacKenzie [Mon, 3 Feb 2020 21:17:13 +0000 (13:17 -0800)]
Make saturating arithmetic using intrinsics `const`

4 years agoMake checked division `const`
Dylan MacKenzie [Mon, 3 Feb 2020 21:19:32 +0000 (13:19 -0800)]
Make checked division `const`

4 years agoConst-stabilize some arithmetic intrinsics
Dylan MacKenzie [Mon, 3 Feb 2020 20:49:31 +0000 (12:49 -0800)]
Const-stabilize some arithmetic intrinsics

4 years agoMake wrapping arithmetic `const`
Dylan MacKenzie [Mon, 3 Feb 2020 20:53:34 +0000 (12:53 -0800)]
Make wrapping arithmetic `const`

Co-Authored-By: 9999years <rbt@sent.as>
4 years agoMake `saturating_mul` a `const fn`
Dylan MacKenzie [Mon, 3 Feb 2020 21:16:38 +0000 (13:16 -0800)]
Make `saturating_mul` a `const fn`

Co-Authored-By: 9999years <rbt@sent.as>
4 years agoMake overflowing arithmetic `const`
Dylan MacKenzie [Mon, 3 Feb 2020 20:45:51 +0000 (12:45 -0800)]
Make overflowing arithmetic `const`

Co-Authored-By: 9999years <rbt@sent.as>
4 years agoMake checked arithmetic besides division `const`
Dylan MacKenzie [Mon, 3 Feb 2020 21:19:07 +0000 (13:19 -0800)]
Make checked arithmetic besides division `const`

Co-Authored-By: 9999years <rbt@sent.as>
4 years agoMake euclidean division `const`
Dylan MacKenzie [Mon, 3 Feb 2020 20:31:39 +0000 (12:31 -0800)]
Make euclidean division `const`

Co-Authored-By: 9999years <rbt@sent.as>
4 years agoRemove the `overlapping_marker_traits` feature
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`

4 years agoAuto merge of #68377 - estebank:fn-obligations-spans, r=oli-obk
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)

4 years agoAuto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbini
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.

4 years agoDrop unused extern crates
Mark Rousskov [Tue, 4 Feb 2020 13:14:08 +0000 (08:14 -0500)]
Drop unused extern crates

4 years agoAuto merge of #68804 - ecstatic-morse:qualif-cursor-lazy, r=estebank
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.

4 years agoAuto merge of #68601 - 0dvictor:split, r=tmandry
bors [Tue, 4 Feb 2020 05:48:54 +0000 (05:48 +0000)]
Auto merge of #68601 - 0dvictor:split, r=tmandry

Split `join_codegen_and_link()` into two steps

`join_codegen_and_link()` is split to `join_codegen()` and `link()`.

4 years agoSuggest `split_at_mut` on multiple mutable index access
Esteban Küber [Tue, 4 Feb 2020 01:58:28 +0000 (17:58 -0800)]
Suggest `split_at_mut` on multiple mutable index access

4 years agofix couple of perf related clipyp warnings
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

4 years agoSplit `join_codegen_and_link()` into two steps
Victor Ding [Tue, 28 Jan 2020 13:16:14 +0000 (00:16 +1100)]
Split `join_codegen_and_link()` into two steps

`join_codegen_and_link()` is split to `join_codegen()` and `link()`.

4 years agoremove redundant imports (clippy::single_component_path_imports)
Matthias Krüger [Tue, 4 Feb 2020 00:05:45 +0000 (01:05 +0100)]
remove redundant imports (clippy::single_component_path_imports)

4 years agoRemove Copy impl from OnceWith
Oliver Middleton [Mon, 3 Feb 2020 22:30:17 +0000 (22:30 +0000)]
Remove Copy impl from OnceWith

Iterators typically don't implement `Copy` and this shouldn't be an exception.

4 years agoAuto merge of #67668 - matthewjasper:or-patterns, r=pnkfelix
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.

cc #54883
closes #60350
closes #67514

cc @Centril
r? @pnkfelix

4 years agoAvoid scheduling repeated `StorageDead`s
Matthew Jasper [Sat, 25 Jan 2020 00:10:40 +0000 (00:10 +0000)]
Avoid scheduling repeated `StorageDead`s

Also add some comments

4 years agoMake use of `Place: Copy`
Matthew Jasper [Sat, 11 Jan 2020 20:30:42 +0000 (20:30 +0000)]
Make use of `Place: Copy`

4 years agoApply suggestions from code review
matthewjasper [Mon, 30 Dec 2019 17:47:10 +0000 (17:47 +0000)]
Apply suggestions from code review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoAddress review comments
Matthew Jasper [Sun, 29 Dec 2019 17:28:41 +0000 (17:28 +0000)]
Address review comments

4 years agoMake `Candidate` private
Matthew Jasper [Sun, 29 Dec 2019 17:00:23 +0000 (17:00 +0000)]
Make `Candidate` private

4 years agoAdd more tests for or-patterns
Matthew Jasper [Fri, 27 Dec 2019 18:11:20 +0000 (18:11 +0000)]
Add more tests for or-patterns

4 years agobootstrap: fix clippy warnings
Matthias Krüger [Mon, 3 Feb 2020 19:13:30 +0000 (20:13 +0100)]
bootstrap: fix clippy warnings

4 years agoChange wording for object unsafe because of assoc const
Esteban Küber [Mon, 3 Feb 2020 18:43:45 +0000 (10:43 -0800)]
Change wording for object unsafe because of assoc const

4 years agoAuto merge of #68803 - Dylan-DPC:rollup-b4x6ghj, r=Dylan-DPC
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()`)

Failed merges:

r? @ghost

4 years agoTreat `Rvalue::AddressOf` the same as `Rvalue::Ref`
Dylan MacKenzie [Mon, 3 Feb 2020 18:37:36 +0000 (10:37 -0800)]
Treat `Rvalue::AddressOf` the same as `Rvalue::Ref`

4 years agoEliminate "eager" qualif getter
Dylan MacKenzie [Mon, 3 Feb 2020 18:33:29 +0000 (10:33 -0800)]
Eliminate "eager" qualif getter

All qualif getters are now lazy

4 years agoPass correct closure type to `Qualif` methods
Dylan MacKenzie [Mon, 3 Feb 2020 18:32:54 +0000 (10:32 -0800)]
Pass correct closure type to `Qualif` methods

4 years agoTake `FnMut` instead of `Fn` in `Qualif` methods
Dylan MacKenzie [Mon, 3 Feb 2020 18:27:38 +0000 (10:27 -0800)]
Take `FnMut` instead of `Fn` in `Qualif` methods

4 years agoRollup merge of #68800 - JohnTitor:stabilize-once-with, r=Centril
Dylan DPC [Mon, 3 Feb 2020 17:58:37 +0000 (18:58 +0100)]
Rollup merge of #68800 - JohnTitor:stabilize-once-with, r=Centril

Stabilize `core::iter::once_with()`

Fixes #57581

FCP: https://github.com/rust-lang/rust/issues/57581#issuecomment-576178031

r? @SimonSapin

4 years agoRollup merge of #68798 - Centril:caller-loc-ctfe-rt-equiv, r=RalfJung
Dylan DPC [Mon, 3 Feb 2020 17:58:36 +0000 (18:58 +0100)]
Rollup merge of #68798 - Centril:caller-loc-ctfe-rt-equiv, r=RalfJung

Test that `#[track_caller]` as `fn()` respects RT / CTFE equivalence

r? @RalfJung cc @anp @eddyb

4 years agoRollup merge of #68797 - GuillaumeGomez:link-to-types, r=Dylan-DPC
Dylan DPC [Mon, 3 Feb 2020 17:58:35 +0000 (18:58 +0100)]
Rollup merge of #68797 - GuillaumeGomez:link-to-types, r=Dylan-DPC

Fix links to types instead of modules

r? @Dylan-DPC

4 years agoRollup merge of #68787 - amosonn:patch-1, r=nagisa
Dylan DPC [Mon, 3 Feb 2020 17:58:33 +0000 (18:58 +0100)]
Rollup merge of #68787 - amosonn:patch-1, r=nagisa

Optimize core::ptr::align_offset (part 1)

r? @nagisa
See #68616 for main discussion.

4 years agoRollup merge of #68777 - GuillaumeGomez:clean-up-e0263, r=Dylan-DPC
Dylan DPC [Mon, 3 Feb 2020 17:58:32 +0000 (18:58 +0100)]
Rollup merge of #68777 - GuillaumeGomez:clean-up-e0263, r=Dylan-DPC

Clean up E0263 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68744 - JohnTitor:fix-ice-save-analysis, r=cramertj
Dylan DPC [Mon, 3 Feb 2020 17:58:30 +0000 (18:58 +0100)]
Rollup merge of #68744 - JohnTitor:fix-ice-save-analysis, r=cramertj

Do not ICE in `type-alias-impl-trait` with save-analysis

FIxes #68621
Fixes #68750

4 years agoRollup merge of #68711 - hman523:fix-68593, r=Dylan-DPC
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