]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRemove in_band_lifetimes from borrowck
Dániel Buga [Wed, 15 Dec 2021 07:38:12 +0000 (08:38 +0100)]
Remove in_band_lifetimes from borrowck

2 years agoAuto merge of #91945 - matthiaskrgr:rollup-jszf9zp, r=matthiaskrgr
bors [Wed, 15 Dec 2021 03:28:55 +0000 (03:28 +0000)]
Auto merge of #91945 - matthiaskrgr:rollup-jszf9zp, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring)
 - #91859 (Iterator::cycle() — document empty iterator special case)
 - #91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`)
 - #91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking)
 - #91881 (Stabilize `iter::zip`)
 - #91882 (Remove `in_band_lifetimes` from `rustc_typeck`)
 - #91940 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #91940 - ehuss:update-cargo, r=ehuss
Matthias Krüger [Wed, 15 Dec 2021 00:28:10 +0000 (01:28 +0100)]
Rollup merge of #91940 - ehuss:update-cargo, r=ehuss

Update cargo

14 commits in 40dc281755137ee804bc9b3b08e782773b726e44..a359ce16073401f28b84840da85b268aa3d37c88
2021-12-06 21:54:44 +0000 to 2021-12-14 18:40:22 +0000
- Support `term.quiet` configuration (rust-lang/cargo#10152)
- Display alias target on 'cargo help <alias>` (rust-lang/cargo#10193)
- delete --host command and message (rust-lang/cargo#10145)
- Improve I/O error message for fingerprint of build script (rust-lang/cargo#10191)
- Explicitly mark aliases in `cargo list`. (rust-lang/cargo#10177)
- Don't emit "executable" JSON field for non-executables. (rust-lang/cargo#10171)
- Move scrape-examples docs to correct section. (rust-lang/cargo#10166)
- Do not suggest source config if nothing to vendor (rust-lang/cargo#10161)
- Bump versions of local deps. (rust-lang/cargo#10155)
- Bump to 0.60.0, update changelog (rust-lang/cargo#10154)
- Fix some profile documentation. (rust-lang/cargo#10153)
- Document lib before bin. (rust-lang/cargo#10172)
- Sync cargo-the-cli version with rustc. (rust-lang/cargo#10178)
- Remove `-Z future-incompat-report` from message displayed to user (rust-lang/cargo#10185)

2 years agoRollup merge of #91882 - Patrick-Poitras:remove-in-band-lifetimes-from-rustc-typeck...
Matthias Krüger [Wed, 15 Dec 2021 00:28:09 +0000 (01:28 +0100)]
Rollup merge of #91882 - Patrick-Poitras:remove-in-band-lifetimes-from-rustc-typeck, r=jackh726

Remove `in_band_lifetimes` from `rustc_typeck`

Joining in on the effort to remove the `in_band_lifetimes` features, as described in issue #91867.

2 years agoRollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcm
Matthias Krüger [Wed, 15 Dec 2021 00:28:08 +0000 (01:28 +0100)]
Rollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcm

Stabilize `iter::zip`

Hello all!

As the tracking issue (#83574) for `iter::zip` completed the final commenting period without any concerns being raised, I hereby submit this stabilization PR on the issue.

As the pull request that introduced the feature (#82917) states, the `iter::zip` function is a shorter way to zip two iterators. As it's generally a quality-of-life/ergonomic improvement, it has been integrated into the codebase without any trouble, and has been
used in many places across the rust compiler and standard library since March without any issues.

For more details, I would refer to `@cuviper's` original PR, or the [function's documentation](https://doc.rust-lang.org/std/iter/fn.zip.html).

2 years agoRollup merge of #91870 - rusticstuff:macosx_min_version_revert, r=Mark-Simulacrum
Matthias Krüger [Wed, 15 Dec 2021 00:28:07 +0000 (01:28 +0100)]
Rollup merge of #91870 - rusticstuff:macosx_min_version_revert, r=Mark-Simulacrum

Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking

This reverts commit b376f5621b801460b911a75048a70698021bbc69, which is the main part of #90499, because it turns out that this causes a good amount of breakage in crates relying on the old behavior. In particular `winit`, `coreaudio` and crates that depend on them are affected. Fixes #91372.

Background:
Before #90499 the behavior was the following: If MACOSX_DEPLOYMENT_TARGET is not set,  we pass the minimum supported OS version to LLVM but not to the linker. The linker default depends on the Xcode version and the version of the OS it is running on. That caused one known problem in libcurl with the most recent Xcode versions. #90499 passed the minumum supported version (10.7 for Macos x86-64) to the linker instead. This has shown to be problematic because some crates such as winit, coreaudio implicitly expect a newer minimum OS version. The libcurl issue has been fixed independently (see https://github.com/alexcrichton/curl-rust/issues/417), so a revert should not really be problematic.

Eventually we should probably mimic clang's behavior and fall back to the default of the currently configured Macos SDK for both the LLVM min os target version and MACOSX_DEPLOYMENT_TARGET for linking. That would entail looking at the `Version` property of the `SDKSettings.json` in the currently configured SDK.

2 years agoRollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk
Matthias Krüger [Wed, 15 Dec 2021 00:28:06 +0000 (01:28 +0100)]
Rollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk

Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`

The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.

2 years agoRollup merge of #91859 - xkr47:patch-2, r=yaahc
Matthias Krüger [Wed, 15 Dec 2021 00:28:05 +0000 (01:28 +0100)]
Rollup merge of #91859 - xkr47:patch-2, r=yaahc

Iterator::cycle() — document empty iterator special case

2 years agoRollup merge of #90939 - estebank:wg-af-polish, r=tmandry
Matthias Krüger [Wed, 15 Dec 2021 00:28:04 +0000 (01:28 +0100)]
Rollup merge of #90939 - estebank:wg-af-polish, r=tmandry

Tweak errors coming from `for`-loop, `?` and `.await` desugaring

 * Suggest removal of `.await` on non-`Future` expression
 * Keep track of obligations introduced by desugaring
 * Remove span pointing at method for obligation errors coming from desugaring
 * Point at called local sync `fn` and suggest making it `async`

```
error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:9:10
   |
LL |     boo().await;
   |     -----^^^^^^ `()` is not a future
   |     |
   |     this call returns `()`
   |
   = help: the trait `Future` is not implemented for `()`
help: do not `.await` the expression
   |
LL -     boo().await;
LL +     boo();
   |
help: alternatively, consider making `fn boo` asynchronous
   |
LL | async fn boo () {}
   | +++++
```

Fix #66731.

2 years agoAuto merge of #91933 - matthiaskrgr:rollup-cw9qolb, r=matthiaskrgr
bors [Wed, 15 Dec 2021 00:23:44 +0000 (00:23 +0000)]
Auto merge of #91933 - matthiaskrgr:rollup-cw9qolb, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #89825 (Make split_inclusive() on an empty slice yield an empty output)
 - #91239 (regression test for issue 87490)
 - #91597 (Recover on invalid operators `<>` and `<=>`)
 - #91774 (Fix typo for MutVisitor)
 - #91786 (Return an error when `eval_rvalue_with_identities` fails)
 - #91798 (Avoid suggest adding `self` in visibility spec)
 - #91856 (Looser check for overflowing_binary_op)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoUpdate cargo
Eric Huss [Tue, 14 Dec 2021 23:24:41 +0000 (15:24 -0800)]
Update cargo

2 years agoRemove iter::zip feature gate from clippy
PFPoitras [Tue, 14 Dec 2021 22:10:57 +0000 (18:10 -0400)]
Remove iter::zip feature gate from clippy

2 years agoStabilize iter::zip.
PFPoitras [Mon, 13 Dec 2021 23:18:50 +0000 (19:18 -0400)]
Stabilize iter::zip.

2 years agoAuto merge of #91728 - Amanieu:stable_asm, r=joshtriplett
bors [Tue, 14 Dec 2021 21:15:22 +0000 (21:15 +0000)]
Auto merge of #91728 - Amanieu:stable_asm, r=joshtriplett

Stabilize asm! and global_asm!

Tracking issue: #72016

It's been almost 2 years since the original [RFC](https://github.com/rust-lang/rfcs/pull/2850) was posted and we're finally ready to stabilize this feature!

The main changes in this PR are:
- Removing `asm!` and `global_asm!` from the prelude as per the decision in #87228.
- Stabilizing the `asm` and `global_asm` features.
- Removing the unstable book pages for `asm` and `global_asm`. The contents are moved to the [reference](https://github.com/rust-lang/reference/pull/1105) and [rust by example](https://github.com/rust-lang/rust-by-example/pull/1483).
  - All links to these pages have been removed to satisfy the link checker. In a later PR these will be replaced with links to the reference or rust by example.
- Removing the automatic suggestion for using `llvm_asm!` instead of `asm!` if you're still using the old syntax, since it doesn't work anymore with `asm!` no longer being in the prelude. This only affects code that predates the old LLVM-style `asm!` being renamed to `llvm_asm!`.
- Updating `stdarch` and `compiler-builtins`.
- Updating all the tests.

r? `@joshtriplett`

2 years agoRollup merge of #91856 - ouz-a:master, r=oli-obk
Matthias Krüger [Tue, 14 Dec 2021 19:47:31 +0000 (20:47 +0100)]
Rollup merge of #91856 - ouz-a:master, r=oli-obk

Looser check for overflowing_binary_op

Fix for issue #91636 tight check resulted in ICE, this makes the check a little looser. It seems `eq` allows comparing of `supertype` and `subtype` if `lhs = supertype` and `rhs = subtype` but not vice versa, is this intended behavior ?

2 years agoRollup merge of #91798 - bugadani:issue-91783, r=michaelwoerister
Matthias Krüger [Tue, 14 Dec 2021 19:47:30 +0000 (20:47 +0100)]
Rollup merge of #91798 - bugadani:issue-91783, r=michaelwoerister

Avoid suggest adding `self` in visibility spec

Fixes #91783

2 years agoRollup merge of #91786 - tmiasko:const-prop, r=oli-obk
Matthias Krüger [Tue, 14 Dec 2021 19:47:30 +0000 (20:47 +0100)]
Rollup merge of #91786 - tmiasko:const-prop, r=oli-obk

Return an error when `eval_rvalue_with_identities` fails

Previously some code paths would fail to evaluate the rvalue, while
incorrectly indicating success with `Ok`. As a result the previous value
of lhs could have been incorrectly const propagated.

Fixes #91725.

r? `@oli-obk`

2 years agoRollup merge of #91774 - surechen:fix_typo_1, r=wesleywiser
Matthias Krüger [Tue, 14 Dec 2021 19:47:28 +0000 (20:47 +0100)]
Rollup merge of #91774 - surechen:fix_typo_1, r=wesleywiser

Fix typo for MutVisitor

Fix typo for MutVisitor.

2 years agoRollup merge of #91597 - r00ster91:lessthangreaterthan, r=oli-obk
Matthias Krüger [Tue, 14 Dec 2021 19:47:27 +0000 (20:47 +0100)]
Rollup merge of #91597 - r00ster91:lessthangreaterthan, r=oli-obk

Recover on invalid operators `<>` and `<=>`

Thanks to #89871 for showing me how to do this.
Next, I think it'd be nice to recover on `<=>` too, like #89871 intended, if this even works.

2 years agoRollup merge of #91239 - cameron1024:issue-87490-regression, r=jackh726
Matthias Krüger [Tue, 14 Dec 2021 19:47:26 +0000 (20:47 +0100)]
Rollup merge of #91239 - cameron1024:issue-87490-regression, r=jackh726

regression test for issue 87490

Closes #87490

2 years agoRollup merge of #89825 - martinvonz:split-inclusive-empty, r=m-ou-se
Matthias Krüger [Tue, 14 Dec 2021 19:47:26 +0000 (20:47 +0100)]
Rollup merge of #89825 - martinvonz:split-inclusive-empty, r=m-ou-se

Make split_inclusive() on an empty slice yield an empty output

`[].split_inclusive()` currently yields a single, empty slice. That's
different from `"".split_inslusive()`, which yields no output at
all. I think that makes the slice version harder to use.

The case where I ran into this bug was when writing code for
generating a diff between two slices of bytes. I wanted to prefix
removed lines with "-" and a added lines with "+". Due to
`split_inclusive()`'s current behavior, that means that my code prints
just a "-" or "+" for empty files. I suspect most existing callers
have similar "bugs" (which would be fixed by this patch).

Closes #89716.

2 years agoRecover on invalid operators <> and <=>
r00ster91 [Mon, 6 Dec 2021 17:55:58 +0000 (18:55 +0100)]
Recover on invalid operators <> and <=>

2 years agocomment update
ouz-a [Tue, 14 Dec 2021 16:29:29 +0000 (19:29 +0300)]
comment update

2 years agoReturn an error when `eval_rvalue_with_identities` fails
Tomasz Miąsko [Sat, 11 Dec 2021 00:00:00 +0000 (00:00 +0000)]
Return an error when `eval_rvalue_with_identities` fails

Previously some code paths would fail to evaluate the rvalue, while
incorrectly indicating success with `Ok`. As a result the previous value
of lhs could have been incorrectly const propagated.

2 years agoMake suggestions from @jackh726; run fmt
PFPoitras [Tue, 14 Dec 2021 13:26:57 +0000 (09:26 -0400)]
Make suggestions from @jackh726; run fmt

2 years agoDisable asm lint example tests since they only work on x86_64
Amanieu d'Antras [Tue, 14 Dec 2021 11:48:28 +0000 (11:48 +0000)]
Disable asm lint example tests since they only work on x86_64

2 years agoAuto merge of #91902 - matthiaskrgr:rollup-hjjyhow, r=matthiaskrgr
bors [Tue, 14 Dec 2021 11:30:17 +0000 (11:30 +0000)]
Auto merge of #91902 - matthiaskrgr:rollup-hjjyhow, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91529 (add BinaryHeap::try_reserve and BinaryHeap::try_reserve_exact)
 - #91820 (Suggest to specify a target triple when lang item is missing)
 - #91851 (Make `MaybeUninit::zeroed` `const`)
 - #91875 (Use try_normalize_erasing_regions in RevealAllVisitor)
 - #91887 (Remove `in_band_lifetimes` from `rustc_const_eval`)
 - #91892 (Fix HashStable implementation on InferTy)
 - #91893 (Remove `in_band_lifetimes` from `rustc_hir`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #91893 - pitaj:91867-hir, r=davidtwco
Matthias Krüger [Tue, 14 Dec 2021 09:21:07 +0000 (10:21 +0100)]
Rollup merge of #91893 - pitaj:91867-hir, r=davidtwco

Remove `in_band_lifetimes` from `rustc_hir`

#91867

2 years agoRollup merge of #91892 - compiler-errors:fix-inferty-hashtable, r=dtolnay
Matthias Krüger [Tue, 14 Dec 2021 09:21:07 +0000 (10:21 +0100)]
Rollup merge of #91892 - compiler-errors:fix-inferty-hashtable, r=dtolnay

Fix HashStable implementation on InferTy

HashStable impl forgot to hash the discriminant.

Fixes #91807

2 years agoRollup merge of #91887 - LegionMammal978:less-inband-const_eval, r=oli-obk
Matthias Krüger [Tue, 14 Dec 2021 09:21:06 +0000 (10:21 +0100)]
Rollup merge of #91887 - LegionMammal978:less-inband-const_eval, r=oli-obk

Remove `in_band_lifetimes` from `rustc_const_eval`

See #91867 for more information.

2 years agoRollup merge of #91875 - b-naber:mir-transform-norm-erase-reg, r=Aaron1011
Matthias Krüger [Tue, 14 Dec 2021 09:21:05 +0000 (10:21 +0100)]
Rollup merge of #91875 - b-naber:mir-transform-norm-erase-reg, r=Aaron1011

Use try_normalize_erasing_regions in RevealAllVisitor

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

Thanks to ``@Aaron1011`` for [pointing out the problem](https://github.com/rust-lang/rust/issues/91745#issuecomment-991996008).

r? ``@Aaron1011``

2 years agoRollup merge of #91851 - woppopo:const_maybeuninit_zeroed, r=yaahc
Matthias Krüger [Tue, 14 Dec 2021 09:21:04 +0000 (10:21 +0100)]
Rollup merge of #91851 - woppopo:const_maybeuninit_zeroed, r=yaahc

Make `MaybeUninit::zeroed` `const`

Tracking issue: #91850

```rust
// core::mem
impl<T> MaybeUninit<T> {
    pub const fn zeroed() -> MaybeUninit<T>;
}
```

2 years agoRollup merge of #91820 - rukai:help_with_personality_issues, r=davidtwco
Matthias Krüger [Tue, 14 Dec 2021 09:21:03 +0000 (10:21 +0100)]
Rollup merge of #91820 - rukai:help_with_personality_issues, r=davidtwco

Suggest to specify a target triple when lang item is missing

It is very common for newbies to embedded to hit this confusing error when forgetting to specify the target.
Source: me googling this error many times.

## Possible changes
* We could possibly restrict the note+help to only be included on eh_personality lang item if that helped reduce false positives, but its also possible doing so would just increase false negatives
* Open to any suggestions on rewriting the messages
* We could possibly remove the `.cargo/config` alternative to avoid the message getting too noisy but I think its valuable to have as its the correct approach for most embedded projects so that `cargo build` just works.

r? rust-lang/diagnostics

2 years agoRollup merge of #91529 - TennyZhuang:try_reserve_binary_heap, r=yaahc
Matthias Krüger [Tue, 14 Dec 2021 09:21:02 +0000 (10:21 +0100)]
Rollup merge of #91529 - TennyZhuang:try_reserve_binary_heap, r=yaahc

add BinaryHeap::try_reserve and BinaryHeap::try_reserve_exact

`try_reserve` of many collections were stablized in https://github.com/rust-lang/rust/pull/87993 in 1.57.0. Add `try_reserve` for the rest collections such as `BinaryHeap` should be not controversial.

2 years agoAuto merge of #91766 - scottmcm:more-array-raw-eq, r=yaahc
bors [Tue, 14 Dec 2021 08:22:31 +0000 (08:22 +0000)]
Auto merge of #91766 - scottmcm:more-array-raw-eq, r=yaahc

Allow `memcmp` for more array comparisons

This way comparing `[NonZeroU8; 8]` is just as fast as comparing `[u8; 8]`.

2 years agoFix HashStable implementation on InferTy
Michael Goulet [Tue, 14 Dec 2021 04:36:17 +0000 (20:36 -0800)]
Fix HashStable implementation on InferTy

2 years agoRemove `in_band_lifetimes` from `rustc_hir`
Peter Jaszkowiak [Tue, 14 Dec 2021 04:33:53 +0000 (21:33 -0700)]
Remove `in_band_lifetimes` from `rustc_hir`

2 years agoAuto merge of #91680 - saethlin:spare_capacity_mut-in-join, r=dtolnay
bors [Tue, 14 Dec 2021 04:29:54 +0000 (04:29 +0000)]
Auto merge of #91680 - saethlin:spare_capacity_mut-in-join, r=dtolnay

Use spare_capacity_mut instead of invalid unchecked indexing when joining str

This is a fix for https://github.com/rust-lang/rust/issues/91574

I think in general I'd prefer to see this code implemented with raw pointers or `MaybeUninit::write_slice`, but there's existing code in here based on copying from slice to slice, so converting everything from `&[T]` to `&[MaybeUninit<T>]` is less disruptive.

2 years agoRemove `in_band_lifetimes` from `rustc_const_eval`
LegionMammal978 [Tue, 14 Dec 2021 03:34:51 +0000 (22:34 -0500)]
Remove `in_band_lifetimes` from `rustc_const_eval`

See #91867 for more information.

2 years agoRemove in_band_lifetimes
PFPoitras [Tue, 14 Dec 2021 01:45:08 +0000 (21:45 -0400)]
Remove in_band_lifetimes

2 years agoAuto merge of #91660 - llogiq:make-a-hash-of-def-ids, r=nnethercote
bors [Tue, 14 Dec 2021 01:39:01 +0000 (01:39 +0000)]
Auto merge of #91660 - llogiq:make-a-hash-of-def-ids, r=nnethercote

manually implement `Hash` for `DefId`

This might speed up hashing for hashers that can work on individual u64s. Just as an experiment, suggested in a reddit thread on `FxHasher`. cc `@nnethercote`

Note that this should not be merged as is without cfg-ing the code path for 64 bits.

2 years agoFix lint examples on non-x86_64
Amanieu d'Antras [Tue, 14 Dec 2021 00:13:27 +0000 (00:13 +0000)]
Fix lint examples on non-x86_64

2 years agotest should pass :sweat_smile:
ouz-a [Mon, 13 Dec 2021 22:19:10 +0000 (01:19 +0300)]
test should pass :sweat_smile:

2 years agouse try_normalize_erasing_regions in RevealAllVisitor
b-naber [Mon, 13 Dec 2021 21:24:08 +0000 (22:24 +0100)]
use try_normalize_erasing_regions in RevealAllVisitor

2 years agoAdd regression test and comment
ouz-a [Mon, 13 Dec 2021 21:15:50 +0000 (00:15 +0300)]
Add regression test and comment

2 years agoRemove invalid doc links.
Amanieu d'Antras [Mon, 13 Dec 2021 20:40:17 +0000 (20:40 +0000)]
Remove invalid doc links.

2 years agoRevert "Set MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set."
Hans Kratz [Mon, 13 Dec 2021 20:31:48 +0000 (21:31 +0100)]
Revert "Set MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set."

This reverts commit b376f5621b801460b911a75048a70698021bbc69, which is
the main part of #90499, because it turns out that this causes a good
amount of breakage in crates relying on the old behavior.

Fixes #91372.

2 years agoAuto merge of #91865 - matthiaskrgr:rollup-rai9ecq, r=matthiaskrgr
bors [Mon, 13 Dec 2021 20:12:35 +0000 (20:12 +0000)]
Auto merge of #91865 - matthiaskrgr:rollup-rai9ecq, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #91699 (Add `-webkit-appearance: none` to search input)
 - #91846 (rustdoc: Reduce number of arguments for `run_test` a bit)
 - #91847 (Fix FIXME for `generic_arg_infer` in `create_substs_for_ast_path`)
 - #91849 (GATs outlives lint: Try to prove bounds)
 - #91855 (Stabilize const_cstr_unchecked)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agofix coverage report test
Esteban Kuber [Mon, 13 Dec 2021 17:22:48 +0000 (17:22 +0000)]
fix coverage report test

2 years agoRollup merge of #91855 - xfix:const_cstr_unchecked, r=dtolnay
Matthias Krüger [Mon, 13 Dec 2021 17:15:17 +0000 (18:15 +0100)]
Rollup merge of #91855 - xfix:const_cstr_unchecked, r=dtolnay

Stabilize const_cstr_unchecked

Closes #90343

``@rustbot`` modify labels: +T-libs-api

2 years agoRollup merge of #91849 - jackh726:gats-outlives-lint-part2, r=nikomatsakis
Matthias Krüger [Mon, 13 Dec 2021 17:15:16 +0000 (18:15 +0100)]
Rollup merge of #91849 - jackh726:gats-outlives-lint-part2, r=nikomatsakis

GATs outlives lint: Try to prove bounds

Fixes #91036
Fixes #90888
Fixes #91348 (better error + documentation to be added to linked issue)

Instead of checking for bounds directly, try to prove them in the associated type environment.

Also, add a bit of extra information to the error, including a link to the relevant discussion issue (#87479). That should be edited to include a brief summary of the current state of the outlives lint, including a brief background. It also might or might not be worth it to bump this to a full error code at some point.

r? ``@nikomatsakis``

2 years agoRollup merge of #91847 - BoxyUwU:generic_arg_infer_fixme, r=lcnr
Matthias Krüger [Mon, 13 Dec 2021 17:15:15 +0000 (18:15 +0100)]
Rollup merge of #91847 - BoxyUwU:generic_arg_infer_fixme, r=lcnr

Fix FIXME for `generic_arg_infer` in `create_substs_for_ast_path`

Fixes a FIXME, does some general refactoring of this fn, and also fixes a bug where we would use a const params defaults instead of an inference var ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=19456f65ea5dc3fcaa9b696f842ab380))
(lot of stuff in one PR but it was all so close together...)

r? `@lcnr`

Fixes #91614

2 years agoRollup merge of #91846 - camelid:doctest-cleanup, r=GuillaumeGomez
Matthias Krüger [Mon, 13 Dec 2021 17:15:14 +0000 (18:15 +0100)]
Rollup merge of #91846 - camelid:doctest-cleanup, r=GuillaumeGomez

rustdoc: Reduce number of arguments for `run_test` a bit

- rustdoc: Coalesce some `run_test` args as one `LangString` arg
- Rename `TestOptions` to `GlobalTestOptions`
- doctest: Rename `options` to `rustdoc_options`

2 years agoRollup merge of #91699 - jsha:webkit-appearance-search-input, r=GuillaumeGomez
Matthias Krüger [Mon, 13 Dec 2021 17:15:13 +0000 (18:15 +0100)]
Rollup merge of #91699 - jsha:webkit-appearance-search-input, r=GuillaumeGomez

Add `-webkit-appearance: none` to search input

This fixes an issue when displaying on iPad, where the search box had no borders.

r? ``@GuillaumeGomez``

Demo https://rustdoc.crud.net/jsha/webkit-appearance-search-input/std/string/struct.String.html

2 years agofix clippy tests
Esteban Kuber [Fri, 10 Dec 2021 17:20:57 +0000 (17:20 +0000)]
fix clippy tests

2 years agoreview comment: change wording of suggestion
Esteban Kuber [Fri, 10 Dec 2021 03:01:37 +0000 (03:01 +0000)]
review comment: change wording of suggestion

2 years agoreview comments
Esteban Kuber [Thu, 2 Dec 2021 23:41:45 +0000 (23:41 +0000)]
review comments

2 years agoSimplify diagnostic logic
Esteban Kuber [Wed, 17 Nov 2021 17:33:15 +0000 (17:33 +0000)]
Simplify diagnostic logic

The spans no longer overlap, so we no longer need to specialize the
output depending on whether they would.

2 years agotidy fix
Esteban Kuber [Tue, 16 Nov 2021 23:04:15 +0000 (23:04 +0000)]
tidy fix

2 years agoFix rebase and clippy tests
Esteban Kuber [Tue, 16 Nov 2021 22:06:25 +0000 (22:06 +0000)]
Fix rebase and clippy tests

2 years agoFix clippy uses of QPath::LangItem
Esteban Kuber [Tue, 16 Nov 2021 20:44:25 +0000 (20:44 +0000)]
Fix clippy uses of QPath::LangItem

2 years agoKeep info on pre-desugaring expression for better "incorrect `.await`" suggestion
Esteban Kuber [Tue, 16 Nov 2021 20:07:23 +0000 (20:07 +0000)]
Keep info on pre-desugaring expression for better "incorrect `.await`" suggestion

Keep the `HirId` of `.await`ed expressions so in the case of a `fn` call
on on a sync `fn`, we can suggest maybe turning it into an `async fn`.

2 years agoFix mistake
Esteban Kuber [Tue, 16 Nov 2021 03:04:36 +0000 (03:04 +0000)]
Fix mistake

2 years agoRemove unnecessary argument
Esteban Kuber [Tue, 16 Nov 2021 03:03:00 +0000 (03:03 +0000)]
Remove unnecessary argument

2 years agoRemove yet more output from `for`-loop and `?` errors
Esteban Kuber [Tue, 16 Nov 2021 02:50:30 +0000 (02:50 +0000)]
Remove yet more output from `for`-loop and `?` errors

2 years agoFurther silence `?` errors
Esteban Kuber [Tue, 16 Nov 2021 02:27:18 +0000 (02:27 +0000)]
Further silence `?` errors

2 years agoReduce verbosity for `?` on non-`Try` expressions
Esteban Kuber [Tue, 16 Nov 2021 02:17:57 +0000 (02:17 +0000)]
Reduce verbosity for `?` on non-`Try` expressions

2 years agoReduce verbosity when calling `for`-loop on non-`Iterator` expression
Esteban Kuber [Tue, 16 Nov 2021 01:46:28 +0000 (01:46 +0000)]
Reduce verbosity when calling `for`-loop on non-`Iterator` expression

2 years agoWhen `.await` is called on a non-`Future` expression, suggest removal
Esteban Kuber [Tue, 16 Nov 2021 00:57:53 +0000 (00:57 +0000)]
When `.await` is called on a non-`Future` expression, suggest removal

Keep track of the origin of a `T: Future` obligation when caused by an
`.await` expression.

Address #66731.

2 years agoAuto merge of #91353 - eggyal:reuse-rcs-during-folding, r=lcnr
bors [Mon, 13 Dec 2021 17:05:40 +0000 (17:05 +0000)]
Auto merge of #91353 - eggyal:reuse-rcs-during-folding, r=lcnr

Avoid cloning refcounted types during folding

Addresses FIXME comment created in #78313

r? `@lcnr`

2 years agoAdjust wording for review
Jack Huey [Mon, 13 Dec 2021 15:06:57 +0000 (10:06 -0500)]
Adjust wording for review

2 years agoAvoid cloning refcounted types during folding
Alan Egerton [Mon, 29 Nov 2021 12:55:00 +0000 (12:55 +0000)]
Avoid cloning refcounted types during folding

2 years agoAuto merge of #91657 - nikic:update-llvm, r=cuviper
bors [Mon, 13 Dec 2021 13:37:53 +0000 (13:37 +0000)]
Auto merge of #91657 - nikic:update-llvm, r=cuviper

Update LLVM submodule

Update LLVM submodule with recent cherry-picks. In particular:
 * https://github.com/rust-lang/llvm-project/pull/123
 * https://github.com/rust-lang/llvm-project/pull/124

2 years agoSuggest to specify a target triple when eh_personality lang item is missing
Lucas Kent [Sun, 12 Dec 2021 02:04:00 +0000 (13:04 +1100)]
Suggest to specify a target triple when eh_personality lang item is missing

2 years ago[ReviewFix] Linguistics
Jonas Berlin [Mon, 13 Dec 2021 11:52:17 +0000 (13:52 +0200)]
[ReviewFix] Linguistics

2 years agoIterator::cycle() — document empty iterator special case
Jonas Berlin [Mon, 13 Dec 2021 11:23:33 +0000 (13:23 +0200)]
Iterator::cycle() — document empty iterator special case

2 years agoAuto merge of #91654 - nikic:llvmbc-section-flags, r=nagisa
bors [Mon, 13 Dec 2021 10:35:28 +0000 (10:35 +0000)]
Auto merge of #91654 - nikic:llvmbc-section-flags, r=nagisa

Use module inline assembly to embed bitcode

In LLVM 14, our current method of setting section flags to avoid
embedding the `.llvmbc` section into final compilation artifacts
will no longer work, see issue #90326. The upstream recommendation
is to instead embed the entire bitcode using module-level inline
assembly, which is what this change does.

I've kept the existing code for platforms where we do not need to
set section flags, but possibly we should always be using the
inline asm approach (which would have to look a bit different for MachO).

r? `@nagisa`

2 years agoformatting
ouz-a [Mon, 13 Dec 2021 09:59:31 +0000 (12:59 +0300)]
formatting

2 years agoLooser check for binary_op_overflow
ouz-a [Mon, 13 Dec 2021 09:35:55 +0000 (12:35 +0300)]
Looser check for binary_op_overflow

2 years agoStabilize const_cstr_unchecked
Konrad Borowski [Mon, 13 Dec 2021 07:43:19 +0000 (08:43 +0100)]
Stabilize const_cstr_unchecked

2 years agoAuto merge of #91626 - klensy:json-less-alloc, r=petrochenkov
bors [Mon, 13 Dec 2021 07:30:38 +0000 (07:30 +0000)]
Auto merge of #91626 - klensy:json-less-alloc, r=petrochenkov

rustc_serialize: don't allocate `String`s as key for `BTreeMap`, when `str` is enough

2 years agoI wrote these functions, I should use them dang it
Jack Huey [Mon, 13 Dec 2021 06:10:39 +0000 (01:10 -0500)]
I wrote these functions, I should use them dang it

2 years agoInstead of checking for exact bounds, try to prove them
Jack Huey [Mon, 13 Dec 2021 04:23:55 +0000 (23:23 -0500)]
Instead of checking for exact bounds, try to prove them

2 years agoMake `MaybeUninit::zeroed` `const`
woppopo [Mon, 13 Dec 2021 05:17:35 +0000 (14:17 +0900)]
Make `MaybeUninit::zeroed` `const`

2 years agoAdd -webkit-appearance: none to search input
Jacob Hoffman-Andrews [Thu, 9 Dec 2021 07:39:42 +0000 (23:39 -0800)]
Add -webkit-appearance: none to search input

This fixes an issue when displaying on iPad, where the search box had no
borders.

2 years agoAuto merge of #91569 - erikdesjardins:vt-align, r=nikic
bors [Mon, 13 Dec 2021 04:29:20 +0000 (04:29 +0000)]
Auto merge of #91569 - erikdesjardins:vt-align, r=nikic

Attach range metadata to alignment loads from vtables

...because alignment is always nonzero[0].

This helps eliminate redundant runtime alignment checks, when a DST
is a field of a struct whose remaining fields have alignment 1.

Fixes #91438.

---
[0]:

The [reference](https://doc.rust-lang.org/reference/type-layout.html) says that alignment must be at least 1.

And in practice, the alignment field for all vtables is generated here: https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_middle/src/ty/vtable.rs#L68-L90 and is nonzero because [`Align::bytes()`](https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_target/src/abi/mod.rs#L547-L549) is always nonzero.

2 years agoextra test for bug i found
Ellen [Mon, 13 Dec 2021 03:33:14 +0000 (03:33 +0000)]
extra test for bug i found

2 years agohurray for portable simd finding a nice test for this FIXME
Ellen [Mon, 13 Dec 2021 03:16:00 +0000 (03:16 +0000)]
hurray for portable simd finding a nice test for this FIXME

2 years agodoctest: Rename `options` to `rustdoc_options`
Noah Lev [Sat, 4 Dec 2021 03:54:38 +0000 (19:54 -0800)]
doctest: Rename `options` to `rustdoc_options`

These are the rustdoc-wide options. It's easy to confuse them with
options for doctests in particular, so this change should help.

2 years agoRename `TestOptions` to `GlobalTestOptions`
Noah Lev [Sat, 4 Dec 2021 03:49:31 +0000 (19:49 -0800)]
Rename `TestOptions` to `GlobalTestOptions`

It seems to apply to all doctests in the crate.

2 years agorustdoc: Coalesce some `run_test` args as one `LangString` arg
Noah Lev [Sat, 4 Dec 2021 03:43:50 +0000 (19:43 -0800)]
rustdoc: Coalesce some `run_test` args as one `LangString` arg

2 years agoAuto merge of #91841 - matthiaskrgr:rollup-zlhsg5a, r=matthiaskrgr
bors [Mon, 13 Dec 2021 00:56:18 +0000 (00:56 +0000)]
Auto merge of #91841 - matthiaskrgr:rollup-zlhsg5a, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #91086 (Implement `TryFrom<&'_ mut [T]>` for `[T; N]`)
 - #91091 (Stabilize `ControlFlow::{is_break, is_continue}`)
 - #91749 (BTree: improve public descriptions and comments)
 - #91819 (rustbot: Add autolabeling for `T-compiler`)
 - #91824 (Make `(*mut T)::write_bytes` `const`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix clippy tests
Amanieu d'Antras [Mon, 13 Dec 2021 00:00:51 +0000 (00:00 +0000)]
Fix clippy tests

2 years agoUse `OutputFilenames` to generate output file for `-Zllvm-time-trace`
Tomasz Miąsko [Mon, 13 Dec 2021 00:00:00 +0000 (00:00 +0000)]
Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`

The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.

2 years agoRollup merge of #91824 - woppopo:const_ptr_write_bytes, r=oli-obk
Matthias Krüger [Sun, 12 Dec 2021 23:20:10 +0000 (00:20 +0100)]
Rollup merge of #91824 - woppopo:const_ptr_write_bytes, r=oli-obk

Make `(*mut T)::write_bytes` `const`

Tracking issue: #86302

2 years agoRollup merge of #91819 - rust-lang:compiler-autolabel, r=jackh726
Matthias Krüger [Sun, 12 Dec 2021 23:20:09 +0000 (00:20 +0100)]
Rollup merge of #91819 - rust-lang:compiler-autolabel, r=jackh726

rustbot: Add autolabeling for `T-compiler`

This commit adds autolabeling for the `T-compiler` label, for PRs that
modify rustc's source code or tests (currently only `src/test/ui`).

This is possible now that rust-lang/triagebot#1321 has landed.

2 years agoRollup merge of #91749 - ssomers:btree_comments, r=Mark-Simulacrum
Matthias Krüger [Sun, 12 Dec 2021 23:20:08 +0000 (00:20 +0100)]
Rollup merge of #91749 - ssomers:btree_comments, r=Mark-Simulacrum

BTree: improve public descriptions and comments

BTreeSet has always used the term "value" next to and meaning the same thing as "elements" (in the mathematical sense but also used for key-value pairs in BTreeMap), while in the BTreeMap sense these "values" are known as "keys" and definitely not "values". Today I had enough of that.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #91091 - ecstatic-morse:control-flow-enum-is, r=m-ou-se
Matthias Krüger [Sun, 12 Dec 2021 23:20:07 +0000 (00:20 +0100)]
Rollup merge of #91091 - ecstatic-morse:control-flow-enum-is, r=m-ou-se

Stabilize `ControlFlow::{is_break, is_continue}`

The type itself was stabilized in 1.55, but using it is not ergonomic without these helper functions. Stabilize them.

r? rust-lang/libs-api

2 years agoRollup merge of #91086 - rhysd:issue-91085, r=m-ou-se
Matthias Krüger [Sun, 12 Dec 2021 23:20:06 +0000 (00:20 +0100)]
Rollup merge of #91086 - rhysd:issue-91085, r=m-ou-se

Implement `TryFrom<&'_ mut [T]>` for `[T; N]`

Fixes #91085.

2 years agoAuto merge of #91549 - fee1-dead:const_env, r=spastorino
bors [Sun, 12 Dec 2021 22:15:32 +0000 (22:15 +0000)]
Auto merge of #91549 - fee1-dead:const_env, r=spastorino

Eliminate ConstnessAnd again

Closes #91489.
Closes #89432.

Reverts #91491.
Reverts #89450.

r? `@spastorino`