]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoEagerly instantiate opaque types
Oli Scherer [Thu, 16 Dec 2021 15:26:01 +0000 (15:26 +0000)]
Eagerly instantiate opaque types

2 years agoRemove some noise from opaque type errors around associated types
Oli Scherer [Thu, 16 Dec 2021 15:17:16 +0000 (15:17 +0000)]
Remove some noise from opaque type errors around associated types

2 years agoAuto merge of #91996 - matthiaskrgr:rollup-8pdt8x7, r=matthiaskrgr
bors [Thu, 16 Dec 2021 11:35:37 +0000 (11:35 +0000)]
Auto merge of #91996 - matthiaskrgr:rollup-8pdt8x7, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #91901 (Remove `in_band_lifetimes` from `rustc_symbol_mangling`)
 - #91904 (Remove `in_band_lifetimes` from `rustc_trait_selection`)
 - #91951 (update stdarch)
 - #91958 (Apply rust-logo class only on default logo)
 - #91972 (link to pref_align_of tracking issue)
 - #91986 (Bump compiler-builtins to 0.1.66)

Failed merges:

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

2 years agoRollup merge of #91986 - ayrtonm:bump-builtins, r=Amanieu
Matthias Krüger [Thu, 16 Dec 2021 09:12:47 +0000 (10:12 +0100)]
Rollup merge of #91986 - ayrtonm:bump-builtins, r=Amanieu

Bump compiler-builtins to 0.1.66

Adds intrinsics for truncdfsf2 and truncdfsf2vsp on ARM.

r? `@Amanieu`

2 years agoRollup merge of #91972 - RalfJung:pref-align-of, r=Mark-Simulacrum
Matthias Krüger [Thu, 16 Dec 2021 09:12:46 +0000 (10:12 +0100)]
Rollup merge of #91972 - RalfJung:pref-align-of, r=Mark-Simulacrum

link to pref_align_of tracking issue

If we are not going to remove this intrinsic (https://github.com/rust-lang/rust/pull/90877), I think we should at least have a place to centralize discussion around it, so here we go. Intrinsics don't have their own separate features and usually we instead use the public method for tracking it, but this one does not have such a method... so the tracking issue is just a regular link. (And then we sue it for the const part as well.)

2 years agoRollup merge of #91958 - jsha:rust-logo, r=GuillaumeGomez
Matthias Krüger [Thu, 16 Dec 2021 09:12:45 +0000 (10:12 +0100)]
Rollup merge of #91958 - jsha:rust-logo, r=GuillaumeGomez

Apply rust-logo class only on default logo

Fixes #91653.

![image](https://user-images.githubusercontent.com/220205/146138145-a7a62ea6-3205-4bc7-8460-e985284d93ea.png)

Demo: https://rustdoc.crud.net/jsha/hashes/sha2/

r? ``@GuillaumeGomez``

2 years agoRollup merge of #91951 - SparrowLii:master, r=Amanieu
Matthias Krüger [Thu, 16 Dec 2021 09:12:43 +0000 (10:12 +0100)]
Rollup merge of #91951 - SparrowLii:master, r=Amanieu

update stdarch

2 commits in d219ad63c5075098fc224a57deb4852b9734327d..0716b22e902207efabe46879cbf28d0189ab7924
2021-12-9 23:50:37 +0000 to 2021-12-14 16:17:57 +0100
 * Fix a bunch of typos ([Fix a bunch of typos stdarch#1267](https://github.com/rust-lang/stdarch/pull/1267))
 * Stabilize armv8 neon instruction set on aarch64 ([Stabilize armv8 neon instruction set on aarch64 stdarch#1266](https://github.com/rust-lang/stdarch/pull/1266))

The update stabilizes armv8 neon instructions on aarch64. #90972

2 years agoRollup merge of #91904 - SylvanB:remove_in_band_lifetimes_rustc_trait_selection,...
Matthias Krüger [Thu, 16 Dec 2021 09:12:42 +0000 (10:12 +0100)]
Rollup merge of #91904 - SylvanB:remove_in_band_lifetimes_rustc_trait_selection, r=petrochenkov

Remove `in_band_lifetimes` from `rustc_trait_selection`

Another one for #91867

2 years agoRollup merge of #91901 - SylvanB:remove_in_band_lifetimes_rustc_symbol_mangling,...
Matthias Krüger [Thu, 16 Dec 2021 09:12:42 +0000 (10:12 +0100)]
Rollup merge of #91901 - SylvanB:remove_in_band_lifetimes_rustc_symbol_mangling, r=jackh726

Remove `in_band_lifetimes` from `rustc_symbol_mangling`

Helping out with  #91867

2 years agoAuto merge of #91527 - the8472:retain-opt, r=dtolnay
bors [Thu, 16 Dec 2021 07:58:36 +0000 (07:58 +0000)]
Auto merge of #91527 - the8472:retain-opt, r=dtolnay

Optimize `vec::retain` performance

This simply moves the loops into the inner function which leads to better results.

```
old:

test vec::bench_retain_100000                            ... bench:     203,828 ns/iter (+/- 2,101)
test vec::bench_retain_iter_100000                       ... bench:      63,324 ns/iter (+/- 12,305)
test vec::bench_retain_whole_100000                      ... bench:      42,989 ns/iter (+/- 291)

new:

test vec::bench_retain_100000                            ... bench:      42,180 ns/iter (+/- 451)
test vec::bench_retain_iter_100000                       ... bench:      65,167 ns/iter (+/- 11,971)
test vec::bench_retain_whole_100000                      ... bench:      33,736 ns/iter (+/- 12,404)
```

Measured on x86_64-unknown-linux-gnu, Zen2

Fixes #91497

2 years agoAuto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiser
bors [Thu, 16 Dec 2021 02:21:30 +0000 (02:21 +0000)]
Auto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiser

Include rustc version in `rustc_span::StableCrateId`

`rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design.

In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable.

In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See https://github.com/rust-lang/rust/issues/90116.)

Closes #85142.

2 years agoBump compiler-builtins to 0.1.66
Ayrton [Thu, 16 Dec 2021 02:00:06 +0000 (21:00 -0500)]
Bump compiler-builtins to 0.1.66

Adds intrinsics for truncdfsf2 and truncdfsf2vsp on ARM.

2 years agoAuto merge of #86986 - lcnr:simplify_type, r=nikomatsakis,oli-obk
bors [Wed, 15 Dec 2021 22:32:56 +0000 (22:32 +0000)]
Auto merge of #86986 - lcnr:simplify_type, r=nikomatsakis,oli-obk

extend `simplify_type`

might cause a slight perf inprovement and imo more accurately represents what types there are.

considering that I was going to use this in #85048 it seems like we might need this in the future anyways :shrug:

2 years agoRemove `in_band_lifetimes` from `rustc_symbol_mangling`
Sylvan Bowdler [Tue, 14 Dec 2021 08:01:32 +0000 (08:01 +0000)]
Remove `in_band_lifetimes` from `rustc_symbol_mangling`

2 years agoRemove `in_band_lifetimes` from `rustc_trait_selection`
Sylvan Bowdler [Tue, 14 Dec 2021 09:44:49 +0000 (09:44 +0000)]
Remove `in_band_lifetimes` from `rustc_trait_selection`

2 years agoApply rust-logo class only on default logo
Jacob Hoffman-Andrews [Wed, 15 Dec 2021 06:54:42 +0000 (22:54 -0800)]
Apply rust-logo class only on default logo

Also replace ' with " in rustdoc template

2 years agolink to pref_align_of tracking issue
Ralf Jung [Wed, 15 Dec 2021 17:38:51 +0000 (18:38 +0100)]
link to pref_align_of tracking issue

2 years agoAuto merge of #91962 - matthiaskrgr:rollup-2g082jw, r=matthiaskrgr
bors [Wed, 15 Dec 2021 12:41:42 +0000 (12:41 +0000)]
Auto merge of #91962 - matthiaskrgr:rollup-2g082jw, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91880 (fix clippy::single_char_pattern perf findings)
 - #91885 (Remove `in_band_lifetimes` from `rustc_codegen_ssa`)
 - #91898 (Make `TyS::is_suggestable` check for non-suggestable types structually)
 - #91915 (Add another regression test for unnormalized fn args with Self)
 - #91916 (Fix a bunch of typos)
 - #91918 (Constify `bool::then{,_some}`)
 - #91920 (Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`)

Failed merges:

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

2 years agoRollup merge of #91920 - Aaron1011:pred-stable-cmp, r=oli-obk
Matthias Krüger [Wed, 15 Dec 2021 09:57:04 +0000 (10:57 +0100)]
Rollup merge of #91920 - Aaron1011:pred-stable-cmp, r=oli-obk

Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`

This avoids a needless query invocation

2 years agoRollup merge of #91918 - fee1-dead:constification0-the-great-constification-begins...
Matthias Krüger [Wed, 15 Dec 2021 09:57:03 +0000 (10:57 +0100)]
Rollup merge of #91918 - fee1-dead:constification0-the-great-constification-begins, r=oli-obk

Constify `bool::then{,_some}`

Note on `~const Drop`: it has no effect when called from runtime functions, when called from const contexts, the trait system ensures that the type can be dropped in const contexts.

2 years agoRollup merge of #91916 - steffahn:fix-typos, r=dtolnay
Matthias Krüger [Wed, 15 Dec 2021 09:57:02 +0000 (10:57 +0100)]
Rollup merge of #91916 - steffahn:fix-typos, r=dtolnay

Fix a bunch of typos

I hope that none of these files is not supposed to be modified.

FYI, I opened separate PRs for typos in submodules, in the respective repositories
* https://github.com/rust-lang/stdarch/pull/1267
* https://github.com/rust-lang/backtrace-rs/pull/455

2 years agoRollup merge of #91915 - jackh726:issue-91899, r=Mark-Simulacrum
Matthias Krüger [Wed, 15 Dec 2021 09:57:01 +0000 (10:57 +0100)]
Rollup merge of #91915 - jackh726:issue-91899, r=Mark-Simulacrum

Add another regression test for unnormalized fn args with Self

Closes #91899

2 years agoRollup merge of #91898 - compiler-errors:dont_suggest_closure_return_type, r=lcnr
Matthias Krüger [Wed, 15 Dec 2021 09:57:00 +0000 (10:57 +0100)]
Rollup merge of #91898 - compiler-errors:dont_suggest_closure_return_type, r=lcnr

Make `TyS::is_suggestable` check for non-suggestable types structually

Not sure if I went overboard checking substs in dyn types, etc. Let me know if I should simplify this function.

Fixes #91832

2 years agoRollup merge of #91885 - LegionMammal978:less-inband-codegen_ssa, r=workingjubilee
Matthias Krüger [Wed, 15 Dec 2021 09:56:59 +0000 (10:56 +0100)]
Rollup merge of #91885 - LegionMammal978:less-inband-codegen_ssa, r=workingjubilee

Remove `in_band_lifetimes` from `rustc_codegen_ssa`

See #91867 for more information.

In `compiler/rustc_codegen_ssa/src/coverageinfo/map.rs`, there are several functions with an explicit `'a` lifetime but only a single `&'a self` parameter. These lifetimes should be redundant given lifetime elision, unless the existential `impl Iterator` has weird issues regarding that. Should the redundant lifetimes be removed?

2 years agoRollup merge of #91880 - matthiaskrgr:clippy_perf_dec, r=jyn514
Matthias Krüger [Wed, 15 Dec 2021 09:56:58 +0000 (10:56 +0100)]
Rollup merge of #91880 - matthiaskrgr:clippy_perf_dec, r=jyn514

fix clippy::single_char_pattern perf findings

2 years agoAuto merge of #91959 - matthiaskrgr:rollup-rhajuvw, r=matthiaskrgr
bors [Wed, 15 Dec 2021 09:31:59 +0000 (09:31 +0000)]
Auto merge of #91959 - matthiaskrgr:rollup-rhajuvw, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90521 (Stabilize `destructuring_assignment`)
 - #91479 (Add `[T]::as_simd(_mut)`)
 - #91584 (Improve code for rustdoc-gui tester)
 - #91886 (core: minor `Option` doc correction)
 - #91888 (Handle unordered const/ty generics for object lifetime defaults)
 - #91905 (Fix source code page sidebar on mobile)
 - #91906 (Removed `in_band_lifetimes` from `library\proc_macro`)

Failed merges:

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

2 years agoupdate tests
lcnr [Wed, 15 Dec 2021 08:54:27 +0000 (09:54 +0100)]
update tests

2 years agoRollup merge of #91906 - anuvratsingh:remove_in_band_lifetimes_library_proc_macro...
Matthias Krüger [Wed, 15 Dec 2021 07:36:25 +0000 (08:36 +0100)]
Rollup merge of #91906 - anuvratsingh:remove_in_band_lifetimes_library_proc_macro, r=petrochenkov

Removed `in_band_lifetimes` from `library\proc_macro`

Issue [#91867](https://github.com/rust-lang/rust/issues/91867)

This is my first try, I followed the instructions given. Fixed all the errors that were thrown while compiling.
Compiled with stage 0,1, and 2 all of them compiled successfully.

2 years agoRollup merge of #91905 - GuillaumeGomez:source-code-page-sidebar, r=jsha
Matthias Krüger [Wed, 15 Dec 2021 07:36:24 +0000 (08:36 +0100)]
Rollup merge of #91905 - GuillaumeGomez:source-code-page-sidebar, r=jsha

Fix source code page sidebar on mobile

Current broken behaviour:

https://user-images.githubusercontent.com/3050060/145984316-35c82353-5bab-4dc6-9ac6-63ea7e5c27d8.mp4

Fixed:

https://user-images.githubusercontent.com/3050060/145984329-8be1127b-d707-424d-ac3c-c1fb3c48a093.mp4

r? `@jsha`

2 years agoRollup merge of #91888 - BoxyUwU:generic_arg_infer_aaaa, r=lcnr
Matthias Krüger [Wed, 15 Dec 2021 07:36:23 +0000 (08:36 +0100)]
Rollup merge of #91888 - BoxyUwU:generic_arg_infer_aaaa, r=lcnr

Handle unordered const/ty generics for object lifetime defaults

*feel like I should have a PR description but cant think of what to put here*

r? ```@lcnr```

2 years agoRollup merge of #91886 - euclio:option-doc, r=dtolnay
Matthias Krüger [Wed, 15 Dec 2021 07:36:22 +0000 (08:36 +0100)]
Rollup merge of #91886 - euclio:option-doc, r=dtolnay

core: minor `Option` doc correction

2 years agoRollup merge of #91584 - GuillaumeGomez:improve-rustdoc-gui-tester-code, r=jsha
Matthias Krüger [Wed, 15 Dec 2021 07:36:21 +0000 (08:36 +0100)]
Rollup merge of #91584 - GuillaumeGomez:improve-rustdoc-gui-tester-code, r=jsha

Improve code for rustdoc-gui tester

Following advice given in #91391.

It nicely improves the code readability. :)

r? `@jsha`

2 years agoRollup merge of #91479 - scottmcm:slice-as-simd, r=workingjubilee
Matthias Krüger [Wed, 15 Dec 2021 07:36:20 +0000 (08:36 +0100)]
Rollup merge of #91479 - scottmcm:slice-as-simd, r=workingjubilee

Add `[T]::as_simd(_mut)`

SIMD-style optimizations are the most common use for `[T]::align_to(_mut)`, but that's `unsafe`.  So these are *safe* wrappers around it, now that we have the `Simd` type available, to make it easier to use.

```rust
impl [T] {
    pub fn as_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T]);
    pub fn as_simd_mut<const LANES: usize>(&mut self) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T]);
}
```

They're `cfg`'d out for miri because the `simd` module as a whole is unavailable there.

2 years agoRollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, r=jackh726,pnkfelix
Matthias Krüger [Wed, 15 Dec 2021 07:36:19 +0000 (08:36 +0100)]
Rollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, r=jackh726,pnkfelix

Stabilize `destructuring_assignment`

Closes #71126

- [Stabilization report](https://github.com/rust-lang/rust/issues/71126#issuecomment-941148058)
- [Completed FCP](https://github.com/rust-lang/rust/issues/71126#issuecomment-954914819)

`@rustbot` label +F-destructuring-assignment +T-lang
Also needs +relnotes but I don't have permission to add that tag.

2 years agoAuto merge of #91752 - yaahc:track-caller-result, r=cuviper
bors [Wed, 15 Dec 2021 06:34:00 +0000 (06:34 +0000)]
Auto merge of #91752 - yaahc:track-caller-result, r=cuviper

Readd track_caller to Result::from_residual

This is a followup on https://github.com/rust-lang/rust/issues/87401 in and an attempt to move the issue towards resolution.

As part of the overhaul of the Try trait we removed the ability for errors to grab location information during propagation via `?` with the builtin `std::result::Result`. The previously linked issue has a fair bit of discussion into the reasons for and against the usage of `#[track_caller]` on the `FromResidual` impl on `Result` that I will do my best to summarize.

---
### For

- https://github.com/rust-lang/rust/issues/87401#issuecomment-915053533: Difficulties with using non `std::result::Result` like types
- https://github.com/rust-lang/rust/issues/87401#issuecomment-978355102: Inconsistency with functionality provided for recoverable (Result) and non-recoverable errors (panic), where panic provides a location and Result does not, pushing some users towards using panic

### Against

- https://github.com/rust-lang/rust/issues/84277#issuecomment-885322833: concern that this will bloat callers that never use this data

---

Personally, I want to quantify the performance / bloat impact of re-adding this attribute, and fully evaluate the pros and cons before deciding if I need to switch `eyre` to have a custom `Result` type, which would also mean I need `try_trait_v2` to be stabilized, cc `@scottmcm.` If the performance impact is minor enough in the general case I think I would prefer that the default `Result` type has the ability to track location information for consistency with `panic` error reporting, and leave it to applications that need particularly high performance to handle the micro optimizations of introducing their own efficient custom Result type or matching manually.

Alternatively, I wonder if the performance penalty on code that doesn't use the location information on `FromResidual` could be mitigated via new optimizations.

2 years agoRemove `in_band_lifetimes` from `rustc_codegen_ssa`
LegionMammal978 [Tue, 14 Dec 2021 02:52:35 +0000 (21:52 -0500)]
Remove `in_band_lifetimes` from `rustc_codegen_ssa`

See #91867 for more information.

2 years agoStabilize `destructuring_assignment`
Jacob Pratt [Wed, 3 Nov 2021 06:50:57 +0000 (02:50 -0400)]
Stabilize `destructuring_assignment`

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 agoupdate stdarch
SparrowLii [Wed, 15 Dec 2021 02:22:03 +0000 (10:22 +0800)]
update stdarch

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 &lt;alias&gt;` (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 comments per review feedback
Scott McMurray [Tue, 14 Dec 2021 23:48:46 +0000 (15:48 -0800)]
Update comments per review feedback

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 agoMake TyS::is_suggestable more structual
Michael Goulet [Tue, 14 Dec 2021 05:22:02 +0000 (21:22 -0800)]
Make TyS::is_suggestable more structual

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 agofmt
lcnr [Tue, 14 Dec 2021 17:03:15 +0000 (18:03 +0100)]
fmt

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

2 years agoUse `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`
Aaron Hill [Tue, 14 Dec 2021 16:27:41 +0000 (11:27 -0500)]
Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`

This avoids a needless query invocation

2 years agoConstify `bool::then{,_some}`
Deadbeef [Tue, 14 Dec 2021 16:11:23 +0000 (00:11 +0800)]
Constify `bool::then{,_some}`

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 agoFix a bunch of typos
Frank Steffahn [Tue, 14 Dec 2021 14:23:34 +0000 (15:23 +0100)]
Fix a bunch of typos

2 years agoAdd another regression test for unnormalized fn args with Self
Jack Huey [Tue, 14 Dec 2021 15:35:31 +0000 (10:35 -0500)]
Add another regression test for unnormalized fn args with Self

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 agoadd some comments
lcnr [Fri, 19 Nov 2021 13:21:21 +0000 (14:21 +0100)]
add some comments

2 years agoreplace `DefId` with `D` in `SimplifiedType`
lcnr [Mon, 12 Jul 2021 19:57:30 +0000 (21:57 +0200)]
replace `DefId` with `D` in `SimplifiedType`

2 years agoextend `simplify_type`
lcnr [Fri, 7 May 2021 18:00:02 +0000 (20:00 +0200)]
extend `simplify_type`

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 agofix clippy::single_char_pattern perf findings
Matthias Krüger [Mon, 13 Dec 2021 21:58:58 +0000 (22:58 +0100)]
fix clippy::single_char_pattern perf findings

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 agomade compiler happy
Anuvrat [Tue, 14 Dec 2021 11:12:16 +0000 (16:42 +0530)]
made compiler happy

2 years agoAdd GUI test for source code page sidebar
Guillaume Gomez [Tue, 14 Dec 2021 10:48:49 +0000 (11:48 +0100)]
Add GUI test for source code page sidebar

2 years agoFix sidebar in source code page
Guillaume Gomez [Tue, 14 Dec 2021 10:48:30 +0000 (11:48 +0100)]
Fix sidebar in source code page

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 agotest
Ellen [Mon, 13 Dec 2021 19:47:10 +0000 (19:47 +0000)]
test

2 years agoawdawdawd
Ellen [Mon, 13 Dec 2021 19:14:35 +0000 (19:14 +0000)]
awdawdawd

2 years agocore: minor `Option` doc correction
Andy Russell [Tue, 14 Dec 2021 03:23:55 +0000 (22:23 -0500)]
core: minor `Option` doc correction

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.