Commit graph

9839 commits

Author SHA1 Message Date
LegionMammal978
fed881aafc Remove in_band_lifetimes from rustc_mir_dataflow
See #91867 for more information.
2021-12-16 14:29:43 -05:00
Matthias Krüger
081493da7f
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
2021-12-16 10:12:42 +01:00
Matthias Krüger
02a4e7cad8
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
2021-12-16 10:12:42 +01:00
bors
9e1aff82e6 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.
2021-12-16 02:21:30 +00:00
bors
69ac533527 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 🤷
2021-12-15 22:32:56 +00:00
Sylvan Bowdler
6c4fd615df Remove in_band_lifetimes from rustc_symbol_mangling 2021-12-15 22:02:25 +00:00
Sylvan Bowdler
dd5717a6d6 Remove in_band_lifetimes from rustc_trait_selection 2021-12-15 21:52:30 +00:00
bors
c5ecc15704 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
2021-12-15 12:41:42 +00:00
Matthias Krüger
990cf5bca4
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
2021-12-15 10:57:04 +01:00
Matthias Krüger
b507174e82
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
2021-12-15 10:57:00 +01:00
Matthias Krüger
700670f3a7
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?
2021-12-15 10:56:59 +01:00
Matthias Krüger
9ca0bd518a
Rollup merge of #91880 - matthiaskrgr:clippy_perf_dec, r=jyn514
fix clippy::single_char_pattern perf findings
2021-12-15 10:56:58 +01:00
Matthias Krüger
6b00227666
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```
2021-12-15 08:36:23 +01:00
Matthias Krüger
d258e92900
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.
2021-12-15 08:36:19 +01:00
LegionMammal978
eaf39cbd9e Remove in_band_lifetimes from rustc_codegen_ssa
See #91867 for more information.
2021-12-15 00:41:41 -05:00
Jacob Pratt
d95f749f14
Stabilize destructuring_assignment 2021-12-14 22:38:51 -05:00
bors
195e931b02 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
2021-12-15 03:28:55 +00:00
Matthias Krüger
6abad4c438
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.
2021-12-15 01:28:09 +01:00
Matthias Krüger
4e7497bda0
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).
2021-12-15 01:28:08 +01:00
Matthias Krüger
2f270e47c6
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 b376f5621b, 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.
2021-12-15 01:28:07 +01:00
Matthias Krüger
ccfc22b6d8
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/..`.
2021-12-15 01:28:06 +01:00
Matthias Krüger
272188eecd
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.
2021-12-15 01:28:04 +01:00
bors
d594910a2d 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
2021-12-15 00:23:44 +00:00
PFPoitras
304ede6bcc Stabilize iter::zip. 2021-12-14 18:50:31 -04:00
bors
2f4da6243f 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`
2021-12-14 21:15:22 +00:00
Matthias Krüger
bae9270989
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 ?
2021-12-14 20:47:31 +01:00
Matthias Krüger
6a9491895f
Rollup merge of #91798 - bugadani:issue-91783, r=michaelwoerister
Avoid suggest adding `self` in visibility spec

Fixes #91783
2021-12-14 20:47:30 +01:00
Matthias Krüger
a38d668296
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`
2021-12-14 20:47:30 +01:00
Matthias Krüger
f608e519cc
Rollup merge of #91774 - surechen:fix_typo_1, r=wesleywiser
Fix typo for MutVisitor

Fix typo for MutVisitor.
2021-12-14 20:47:28 +01:00
Matthias Krüger
4b37cfc50c
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.
2021-12-14 20:47:27 +01:00
Michael Goulet
f29fb4792b Make TyS::is_suggestable more structual 2021-12-14 11:32:06 -08:00
r00ster91
f194c9b26a Recover on invalid operators <> and <=> 2021-12-14 18:05:02 +01:00
lcnr
095ad18f41 fmt 2021-12-14 18:03:15 +01:00
ouz-a
a5054e3858 comment update 2021-12-14 19:29:29 +03:00
Aaron Hill
4d1d66b812
Use tcx.def_path_hash in ExistentialPredicate.stable_cmp
This avoids a needless query invocation
2021-12-14 11:27:41 -05:00
Tomasz Miąsko
ffe067cdfc 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.
2021-12-14 17:09:00 +01:00
PFPoitras
a586e7d857 Make suggestions from @jackh726; run fmt 2021-12-14 09:26:57 -04:00
lcnr
023b56572f add some comments 2021-12-14 13:32:42 +01:00
lcnr
992efa68b7 replace DefId with D in SimplifiedType 2021-12-14 13:32:42 +01:00
lcnr
dcd716fee2 extend simplify_type 2021-12-14 13:32:42 +01:00
Amanieu d'Antras
d6f4da9871 Disable asm lint example tests since they only work on x86_64 2021-12-14 11:48:28 +00:00
Matthias Krüger
97e844a032 fix clippy::single_char_pattern perf findings 2021-12-14 12:40:28 +01:00
Matthias Krüger
1dde0dbbf5
Rollup merge of #91893 - pitaj:91867-hir, r=davidtwco
Remove `in_band_lifetimes` from `rustc_hir`

#91867
2021-12-14 10:21:07 +01:00
Matthias Krüger
d0e6bb7076
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
2021-12-14 10:21:07 +01:00
Matthias Krüger
3a42dc8be1
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.
2021-12-14 10:21:06 +01:00
Matthias Krüger
b50bb65c2a
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``
2021-12-14 10:21:05 +01:00
Matthias Krüger
dfec47fe91
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
2021-12-14 10:21:03 +01:00
Michael Goulet
75729afcc0 Fix HashStable implementation on InferTy 2021-12-13 20:36:17 -08:00
Peter Jaszkowiak
7085b4e117 Remove in_band_lifetimes from rustc_hir 2021-12-13 21:33:53 -07:00
LegionMammal978
a19eaf3542 Remove in_band_lifetimes from rustc_const_eval
See #91867 for more information.
2021-12-13 22:39:00 -05:00