Commit Graph

9996 Commits

Author SHA1 Message Date
Esteban Kuber 0b8bbac3ff Fix typo in "new region bound" suggestion
The lifetime name shoud always appear in text surrounded by `.
2021-12-17 02:33:25 +00:00
Lucas Kent 97bf7b934e Improve suggestion to change struct field to &mut 2021-12-17 13:20:40 +11:00
bors 9b45f04414 Auto merge of #91672 - b-naber:merge-normalize-erasing-regions-queries, r=jackh726
Implement normalize_erasing_regions queries in terms of 'try' version

Attempt to lessen performance regression caused by https://github.com/rust-lang/rust/pull/91255

r? `@jackh726`
2021-12-17 02:03:10 +00:00
Caleb Cartwright 78a8e0092f builtin_macros: allow external consumers for AsmArgs parsing 2021-12-16 18:40:38 -06:00
Aaron Hill 00ce6dc718
Only cache local adt_def results on disk
An `AdtDef` contains `Span`s, and we don't appear
to actually encode the `SourceFile` for foreign
spans in the incremental cache in some cases.
2021-12-16 18:32:00 -05:00
LegionMammal978 4937a55dfb Remove `in_band_lifetimes` from `rustc_codegen_llvm`
See #91867 for more information.
2021-12-16 14:43:32 -05:00
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 a97384d94c
Rollup merge of #92001 - fee1-dead:dmbic-xcrate-fix, r=oli-obk
Fix default_method_body_is_const when used across crates

r? `@oli-obk`

unblocks #91439.
2021-12-16 17:23:13 +01:00
Matthias Krüger 7e5c0711e4
Rollup merge of #91879 - bugadani:in_band_borrowck, r=wesleywiser
Remove `in_band_lifetimes` from `rustc_borrowck`

See #91867 for more information.
2021-12-16 17:23:09 +01:00
Matthias Krüger 7407c4e37d
Rollup merge of #91172 - Ethiraric:ethiraric/fix90979, r=petrochenkov
Warn when a `#[test]`-like built-in attribute macro is present multiple times.

Fixes #90979.
2021-12-16 17:23:07 +01:00
Deadbeef 4bb65e1c79
Fix default_method_body_is_const when used across crates 2021-12-16 21:38:54 +08: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
Peter Jaszkowiak c4bafafac1 Remove `in_band_lifetimes` for `rustc_passes` 2021-12-15 20:12:53 -07:00
Takayuki Maeda 6f8ad6d83a suggest adding a `#[cfg(test)]` to test modules
remove a empty line

import `module_to_string`

use `contains("test")`

show a suggestion in case module starts_with/ends_with "test"

replace `parent` with `containing`
2021-12-16 11:48:58 +09: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
Aaron Hill a5b3dfe453
Run x.py fmt 2021-12-15 19:50:43 -05:00
Aaron Hill 070bf94a6f
Remove `in_band_lifetimes` from `rustc_middle`
See #91867

This was mostly straightforward. In several places, I take advantage
of the fact that lifetimes are non-hygenic: a macro declares the
'tcx' lifetime, which is then used in types passed in as macro
arguments.
2021-12-15 19:50:43 -05:00
Tomasz Miąsko fd47d247d8 miri: lift restriction on extern types being the only field in a struct 2021-12-15 23:44:51 +01:00
Ethiraric 2be94d4301 Add a lint for duplicated attributes. 2021-12-15 23:43:13 +01: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
Aaron Hill 70fba90412
Cache adt_def query result on disk 2021-12-15 17:01:09 -05:00
Sylvan Bowdler dd5717a6d6 Remove `in_band_lifetimes` from `rustc_trait_selection` 2021-12-15 21:52:30 +00:00
Aaron Hill f5f90540c9
Fully serialize AdtDef
This avoids needing to invoke the `adt_def` query during
the decoding of another query's result.
2021-12-15 16:32:16 -05:00
Camille GILLOT d48dbdc080 Move generator check earlier in inlining. 2021-12-15 19:45:40 +01: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
Dániel Buga e837101890 Remove in_band_lifetimes from borrowck 2021-12-15 08:39:21 +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
Michael Howell 6b7fcf720a fix(rustc_lint): better detect when parens are necessary
Fixes #90807
2021-12-15 00:00:17 -07:00
Nicholas Nethercote b1c934ebb8 Remove unnecessary sigils around `Ident::as_str()` calls. 2021-12-15 17:32:42 +11:00
Nicholas Nethercote 056d48a2c9 Remove unnecessary sigils around `Symbol::as_str()` calls. 2021-12-15 17:32:14 +11: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
Nicholas Nethercote 8cddcd39ba Remove `SymbolStr`.
By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-15 13:30:26 +11: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
Chase Wilson 2af02abd93
Minor cleanup 2021-12-14 13:40:16 -06:00
Michael Goulet f29fb4792b Make TyS::is_suggestable more structual 2021-12-14 11:32:06 -08:00
Chase Wilson 2b46c7c906
Added -Z layout_seed for allowing user-defined randomization seeds 2021-12-14 12:48:41 -06:00
LegionMammal978 29c56fef27 Remove `in_band_lifetimes` from `rustc_privacy`
See #91867 for more information.
2021-12-14 12:38:06 -05:00
Sylvan Bowdler 8679e17723 Remove `in_band_lifetimes` from `rustc_metadata` 2021-12-14 17:35:27 +00:00
LegionMammal978 77a0c65264 Remove `in_band_lifetimes` from `rustc_query_impl`
See #91867 for more information.
2021-12-14 12:13:07 -05: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
Peter Jaszkowiak f0b714258f Remove `in_band_lifetimes` for `rustc_monomorphize` 2021-12-13 22:00:50 -07:00
Peter Jaszkowiak 5e22500754 Remove `in_band_lifetimes` from `rustc_incremental` 2021-12-13 21:52:01 -07: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
Ellen 7175980ff5 awdawdawd 2021-12-14 03:32:58 +00:00
PFPoitras ae21dd00ac Remove in_band_lifetimes 2021-12-13 21:45:08 -04:00
bors a2d25b4ff7 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.
2021-12-14 01:39:01 +00:00
Amanieu d'Antras 6ab488af57 Fix lint examples on non-x86_64 2021-12-14 00:13:27 +00:00
LegionMammal978 375524014f Remove `in_band_lifetimes` from `rustc_infer`
This crate actually had a typo `'ctx` in one of its functions:
```diff
-pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool {
+pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
```
2021-12-13 17:53:27 -05:00
b-naber f3ecd64c61 use try_normalize_erasing_regions in RevealAllVisitor 2021-12-13 23:13:24 +01:00
b-naber 399ab40dbd get rid of normalize_generic_arg... queries 2021-12-13 23:05:25 +01:00
b-naber 8250eef685 normalize_generic_arg_after in terms of try version 2021-12-13 23:04:09 +01:00
Alexis Bourget be33ca7d5b Use Inherited Visibility instead of None when no vis is present 2021-12-13 22:41:42 +01:00
ouz-a b6c80985bd Add regression test and comment 2021-12-14 00:15:50 +03:00
Amanieu d'Antras d1204ac3b1 Remove invalid doc links. 2021-12-13 20:40:17 +00:00
Alexis Bourget b0806b2de9 Update test to new error message 2021-12-13 21:36:35 +01:00
Alexis Bourget 5c9950023b Suggest remove on const async const instead of const const async 2021-12-13 21:36:35 +01:00
Alexis Bourget 7bc8577d99 Fix broken span and related tests 2021-12-13 21:36:35 +01:00
Alexis Bourget b88a612d9a Change error for pub in fn decl if already present 2021-12-13 21:36:32 +01:00
Jakub Beránek 1f284b07ed
Add special case for length 1 2021-12-13 21:34:54 +01:00
Hans Kratz 3011154573 Revert "Set MACOSX_DEPLOYMENT_TARGET env var to default for linking if not set."
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.

Fixes #91372.
2021-12-13 21:31:48 +01:00
bors 8f117a77d0 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
2021-12-13 20:12:35 +00:00
Matthias Krüger ff214b745d
Rollup merge of #91855 - xfix:const_cstr_unchecked, r=dtolnay
Stabilize const_cstr_unchecked

Closes #90343

``@rustbot`` modify labels: +T-libs-api
2021-12-13 18:15:17 +01:00
Matthias Krüger 84878336b0
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``
2021-12-13 18:15:16 +01:00
Matthias Krüger f8de2f56e8
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
2021-12-13 18:15:15 +01:00
Esteban Kuber 1a7f2d5cd9 review comment: change wording of suggestion 2021-12-13 17:09:16 +00:00
Esteban Kuber 64dea33a3d review comments 2021-12-13 17:09:16 +00:00
Esteban Kuber d59f74aeaf Simplify diagnostic logic
The spans no longer overlap, so we no longer need to specialize the
output depending on whether they would.
2021-12-13 17:09:16 +00:00
Esteban Kuber b825b0fe63 Fix rebase and clippy tests 2021-12-13 17:09:16 +00:00
Esteban Kuber f640438b40 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`.
2021-12-13 17:09:16 +00:00
Esteban Kuber d45e030c04 Fix mistake 2021-12-13 17:09:15 +00:00
Esteban Kuber 4f2b1c0650 Remove unnecessary argument 2021-12-13 17:09:15 +00:00
Esteban Kuber 79749d64fa Remove yet more output from `for`-loop and `?` errors 2021-12-13 17:09:15 +00:00
Esteban Kuber 81a3b90afd Further silence `?` errors 2021-12-13 17:09:15 +00:00
Esteban Kuber caf0c1bb1c Reduce verbosity for `?` on non-`Try` expressions 2021-12-13 17:09:15 +00:00
Esteban Kuber 75b62757e4 Reduce verbosity when calling `for`-loop on non-`Iterator` expression 2021-12-13 17:09:15 +00:00
Esteban Kuber 7227a87371 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.
2021-12-13 17:09:15 +00:00
pierwill 535278aa51 Add run-make-fulldeps test
Implement RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER

Also makes minor docs edits.
2021-12-13 10:24:06 -06:00
pierwill 7d7dfba350 Include rustc version in `rustc_span::StableCrateId`
Normalize symbol hashes in compiletest.

Remove DefId sorting
2021-12-13 10:24:05 -06:00
Jakub Beránek ac08f13948
Remove sort from hashing hashset, treeset and treemap 2021-12-13 16:11:28 +01:00
Jack Huey 48974158f1 Adjust wording for review 2021-12-13 10:06:57 -05:00
Alan Egerton 5920a1d948
Avoid cloning refcounted types during folding 2021-12-13 14:27:26 +00:00
Lucas Kent fae40c5070 Suggest to specify a target triple when eh_personality lang item is missing 2021-12-14 00:04:15 +11:00
Andy Wang 5e481d07d2
Provide object files to llvm-dwp instead of .dwo 2021-12-13 12:09:10 +00:00
Andy Wang 707f72c1df
Revert "Produce .dwo file for Packed as well"
This reverts commit 32810223c6.
2021-12-13 11:40:59 +00:00
bors a737592a3d 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`
2021-12-13 10:35:28 +00:00
ouz-a a01b13dede formatting 2021-12-13 12:59:31 +03:00
ouz-a 01948e2f45 Looser check for binary_op_overflow 2021-12-13 12:35:55 +03:00
Konrad Borowski 23e4aeb140 Stabilize const_cstr_unchecked 2021-12-13 08:43:19 +01:00
bors 6d6d0899c8 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
2021-12-13 07:30:38 +00:00
Jack Huey 7cbd0dcf93 I wrote these functions, I should use them dang it 2021-12-13 01:10:39 -05:00
Jack Huey 8a28c172a1 Instead of checking for exact bounds, try to prove them 2021-12-13 00:48:46 -05:00
bors 4a7fb971c9 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: 772d51f887/compiler/rustc_middle/src/ty/vtable.rs (L68-L90) and is nonzero because [`Align::bytes()`](772d51f887/compiler/rustc_target/src/abi/mod.rs (L547-L549)) is always nonzero.
2021-12-13 04:29:20 +00:00
Ellen 5ab1329b58 hurray for portable simd finding a nice test for this FIXME 2021-12-13 03:16:00 +00:00
Cormac Relf 9b45713b6c let-else: fix attribute aliasing + add test for issue 89807 2021-12-13 14:02:41 +11:00
Cormac Relf af2f0e6b7c let-else: add hir::Let and type check it like a hir::Local
unify typeck of hir::Local and hir::Let
remove extraneous pub(crate/super)
2021-12-13 14:02:19 +11:00
Tomasz Miąsko 3f2a1c9c17 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-13 00:00:00 +00:00
Jakub Beránek 6e33d3ecc2
Use modular arithmetic 2021-12-12 23:48:11 +01:00
bors 22f8bde876 Auto merge of #91549 - fee1-dead:const_env, r=spastorino
Eliminate ConstnessAnd again

Closes #91489.
Closes #89432.

Reverts #91491.
Reverts #89450.

r? `@spastorino`
2021-12-12 22:15:32 +00:00
Jakub Beránek a5f5f6b689
Avoid sorting in hash map stable hashing 2021-12-12 20:57:24 +01:00
bors 6bda5b331c Auto merge of #90716 - euclio:libloading, r=cjgillot
replace dynamic library module with libloading

This PR deletes the `rustc_metadata::dynamic_lib` module in favor of the popular and better tested [`libloading` crate](https://github.com/nagisa/rust_libloading/).

We don't benefit from `libloading`'s symbol lifetimes since we end up leaking the loaded library in all cases, but the call-sites look much nicer by improving error handling and abstracting away some transmutes. We also can remove `rustc_metadata`'s direct dependencies on `libc` and `winapi`.

This PR also adds an exception for `libloading` (and its license) to tidy, so this will need sign-off from the compiler team.
2021-12-12 17:28:52 +00:00
bors 753e569c9c Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnr
Stabilise `feature(const_generics_defaults)`

`feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation.

needs stabilisation report and maybe an RFC 😅

r? `@lcnr`
cc `@rust-lang/project-const-generics`
2021-12-12 14:24:23 +00:00
Amanieu d'Antras 1c48025685 Address review feedback 2021-12-12 11:26:59 +00:00
bors 4c9bdf4cbb Auto merge of #90423 - Aaron1011:deduplicate-projection, r=jackh726
Deduplicate projection sub-obligations
2021-12-12 11:24:20 +00:00
Amanieu d'Antras 44a3a66ee8 Stabilize asm! and global_asm!
They are also removed from the prelude as per the decision in
https://github.com/rust-lang/rust/issues/87228.

stdarch and compiler-builtins are updated to work with the new, stable
asm! and global_asm! macros.
2021-12-12 11:20:03 +00:00
Amanieu d'Antras b3a55371a7 Remove automatic rustfix of asm! to llvm_asm!
This no longer works now that asm! needs an explicit import. Also, it's
been over a year since asm! landed, everyone should have transitioned by
now.
2021-12-12 11:20:03 +00:00
Dániel Buga f3a08fd8e7 Avoid suggesting self in visibility spec
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-12-12 11:14:10 +01:00
bors a0a4c7d1e4 Auto merge of #91825 - matthiaskrgr:rollup-e4s8lwp, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #91746 (Btree: assert more API compatibility)
 - #91748 (rustdoc: Add regression test for Iterator as notable trait on &mut T)
 - #91811 (bootstrap: Change unwrap() to expect() for WIX path)
 - #91814 (doc: fix typo in comments)
 - #91815 (better span for unexpected normalization failure in CTFE engine)
 - #91817 (rustbot: Add autolabeling for `T-rustdoc`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-12 06:54:28 +00:00
Matthias Krüger 6d9d8de029
Rollup merge of #91815 - RalfJung:span, r=oli-obk
better span for unexpected normalization failure in CTFE engine

No reason to use `DUMMY_SP` here.
2021-12-12 07:45:31 +01:00
Matthias Krüger 955e552d31
Rollup merge of #91814 - japm48:spelling-fix, r=RalfJung
doc: fix typo in comments

`dereferencable -> dereferenceable`

Fixes #91802.
2021-12-12 07:45:30 +01:00
Deadbeef ffc9082d97
Remove function from rebase 2021-12-12 12:52:30 +08:00
Deadbeef 83587e8d30
Small performance tweaks 2021-12-12 12:35:01 +08:00
Deadbeef 17b53b9645
Remap more env constness for queries 2021-12-12 12:35:00 +08:00