Commit graph

9964 commits

Author SHA1 Message Date
Matthias Krüger
816cda7e1b
Rollup merge of #91975 - cjgillot:noinline-generator, r=jackh726
Move generator check earlier in inlining.

Inlining into generator may create references to other generators. For instance, inlining `Pin::<&mut from_generator::GenFuture<[generator1]>>::new_unchecked` into `generator2`. This cross reference can then create cycles when computing inlining for `generator1`.

In order to avoid this kind of surprises, we forbid all inlining into generators, and rely on LLVM to do the right thing. The existing `remove-zst-query-cycle` already ICEs in inline-mir mode, so we use it as test.

Split from #91743.
2021-12-18 08:16:30 +01:00
Matthias Krüger
fcc59794a7
Rollup merge of #91928 - fee1-dead:constification1, r=oli-obk
Constify (most) `Option` methods

r? ``@oli-obk``
2021-12-18 08:16:29 +01:00
Matthias Krüger
64ce698f74
Rollup merge of #91910 - tmiasko:miri-extern-type, r=RalfJung
miri: lift restriction on extern types being the only field in a struct

Fixes #91827.

r? ````@RalfJung````
2021-12-18 08:16:28 +01:00
Matthias Krüger
24b75e7113
Rollup merge of #91818 - camelid:unused-result-type, r=jackh726
Show the unused type for `unused_results` lint

I think it's helpful to know what type was unused when looking at these
warnings. The type will likely determine whether the result *should* be
used, or whether it should just be ignored.

Including the type also matches the behavior of the `must_use` lint:
unused `SomeType` that must be used.
2021-12-18 08:16:27 +01:00
Matthias Krüger
7a626cf7ce
Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726
Lint bare traits in AstConv.

Removing the lint from lowering allows to:
- make lowering querification easier;
- have the lint implementation in only one place.

r? `@estebank`
2021-12-18 08:16:26 +01:00
Matthias Krüger
54e7946d0f
Rollup merge of #87901 - poliorcetics:pub-pub-pub, r=jackh726
Fix suggestion of additional `pub` when using `pub pub fn ...`

Fix #87694.

Marked as draft to start with because I want to explore doing the same fix for `const const fn` and other repeated-but-valid keywords.

`@rustbot` label A-diagnostics D-invalid-suggestion T-compiler
2021-12-18 08:16:25 +01:00
Lucas Kent
e57307560e get_mut_span_in_struct_field uses span.between 2021-12-18 13:00:08 +11:00
Tomasz Miąsko
d0281bcb25 Implement StableHash for BitSet and BitMatrix via Hash
This fixes an issue where bit sets / bit matrices the same word
content but a different domain size would receive the same hash.
2021-12-18 00:00:00 +00:00
Tomasz Miąsko
d496cca3b1 Derive hash for BitSet and BitMatrix 2021-12-18 08:56:38 +01:00
bors
dde825db46 Auto merge of #89841 - cormacrelf:let-else-typed, r=nagisa
Implement let-else type annotations natively

Tracking issue: #87335

Fixes #89688, fixes #89807, edit: fixes  #89960 as well

As explained in https://github.com/rust-lang/rust/issues/89688#issuecomment-940405082, the previous desugaring moved the let-else scrutinee into a dummy variable, which meant if you wanted to refer to it again in the else block, it had moved.

This introduces a new hir type, ~~`hir::LetExpr`~~ `hir::Let`, which takes over all the fields of `hir::ExprKind::Let(...)` and adds an optional type annotation. The `hir::Let` is then treated like a `hir::Local` when type checking a function body, specifically:

* `GatherLocalsVisitor` overrides a new `Visitor::visit_let_expr` and does pretty much exactly what it does for `visit_local`, assigning a local type to the `hir::Let` ~~(they could be deduplicated but they are right next to each other, so at least we know they're the same)~~
* It reuses the code in `check_decl_local` to typecheck the `hir::Let`, simply returning 'bool' for the expression type after doing that.

* ~~`FnCtxt::check_expr_let` passes this local type in to `demand_scrutinee_type`, and then imitates check_decl_local's pattern checking~~
* ~~`demand_scrutinee_type` (the blindest change for me, please give this extra scrutiny) uses this local type instead of of creating a new one~~
    * ~~Just realised the `check_expr_with_needs` was passing NoExpectation further down, need to pass the type there too. And apparently this Expectation API already exists.~~

Some other misc notes:

* ~~Is the clippy code supposed to be autoformatted? I tried not to give huge diffs but maybe some rustfmt changes simply haven't hit it yet.~~
* in `rustc_ast_lowering/src/block.rs`, I noticed some existing `self.alias_attrs()` calls in `LoweringContext::lower_stmts` seem to be copying attributes from the lowered locals/etc to the statements. Is that right? I'm new at this, I don't know.
2021-12-17 22:12:34 +00:00
Aaron Hill
eee09ec426
Remove 'speculative evaluation' of predicates
Performing 'speculative evaluation' introduces caching bugs that
cannot be fixed without invasive changes to projection.

Hopefully, we can win back most of the performance lost by
re-adding 'cache completion'

Fixes #90662
2021-12-17 17:00:03 -05:00
Michael Howell
f4a0321c03 fix(rustc_lint): mark the parens around (1..loop {}) as unused 2021-12-17 14:12:31 -07:00
Chris Denton
391332c5d9
Rename has_elf_tls to has_thread_local 2021-12-17 20:56:38 +00:00
Chris Denton
9ca26f111a
Enable #[thread_local] for all windows-msvc targets 2021-12-17 15:47:44 +00:00
Deadbeef
2f555dec4a
Add a temporary hack before env fix lands in bootstrap 2021-12-17 20:46:48 +08:00
Deadbeef
a1f91aa410
Use a const ParamEnv when in default_method_body_is_const 2021-12-17 20:42:48 +08:00
Sébastien Marie
c3da28eade pass -Wl,-z,origin to set DF_ORIGIN when using rpath
DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string.

Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN pr

Set the flag inconditionally if rpath is wanted.
2021-12-17 11:27:14 +00:00
Patrick Walton
c41fd760db rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all
platforms, not just Apple ones.

To avoid breaking split DWARF, we need to ensure that each codegen unit has a
unique `DW_AT_name`. This is because there's a remote chance that different
codegen units for the same module will have entirely identical DWARF entries
for the purpose of the DWO ID, which would violate Appendix F ("Split Dwarf
Object Files") of the DWARF 5 specification. LLVM uses the algorithm specified
in section 7.32 "Type Signature Computation" to compute the DWO ID, which does
not include any fields that would distinguish compilation units. So we must
embed the codegen unit name into the `DW_AT_name`.

Closes #88521.
2021-12-16 20:40:04 -08:00
lzh
a995462f9a Eliminate duplicate codes of expected_found_bool 2021-12-17 11:17:43 +08:00
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