Commit Graph

22579 Commits

Author SHA1 Message Date
bors
7c306f6dcd Auto merge of #108121 - aliemjay:resolve-var-region, r=lcnr
always resolve to universal regions if possible

`RegionConstraintCollector::opportunistic_resolve_var`, which is used in canonicalization and projection logic, doesn't resolve the region var to an equal universal region. So if we have equated `'static == '1 == '2`, it doesn't resolve `'1` or `'2` to `'static`. Now it does!

Addresses review comment https://github.com/rust-lang/rust/pull/107376#discussion_r1093233687.

r? `@lcnr`
2023-03-08 12:33:21 +00:00
Ali MJ Al-Nasrawy
0b232d022f prefer universal from lower universe
In case a variable is unified with two universal regions from different
universes, use the one with the lower universe as it has a higher chance
of being compatible with the variable.
2023-03-08 15:10:37 +03:00
Ali MJ Al-Nasrawy
228f40820d address review comment 2023-03-08 14:07:01 +03:00
bors
9b60e6c68f Auto merge of #108312 - michaelwoerister:hash-set-not-hash-stable, r=eholk
Do not implement HashStable for HashSet (MCP 533)

This PR removes all occurrences of `HashSet` in query results, replacing it either with `FxIndexSet` or with `UnordSet`, and then removes the `HashStable` implementation of `HashSet`. This is part of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), that is, removing the `HashStable` implementations of all collection types with unstable iteration order.

The changes are mostly mechanical. The only place where additional sorting is happening is in Miri's override implementation of the `exported_symbols` query.
2023-03-08 06:07:11 +00:00
bors
38b9655311 Auto merge of #108877 - matthiaskrgr:rollup-7gwgvgc, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #108460 (migrate `rustc_hir_analysis` to session diagnostic [Part Two])
 - #108581 (Add a new config flag, dist.include-mingw-linker.)
 - #108583 (Account for binders correctly when adding default RPITIT method assumption)
 - #108783 (Sync rustc_codegen_gcc 2023/03/04)
 - #108793 (Append to existing `PYTHONPATH` in compiletest instead of overwriting)
 - #108822 (Remove references to PassManagerBuilder)
 - #108866 (Force to use the stage 2 compiler  when config.download_rustc is set)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-07 22:07:56 +00:00
Matthias Krüger
85c475a839
Rollup merge of #108822 - nikic:legacy-pm-removal-2, r=cuviper
Remove references to PassManagerBuilder

This is a legacy PM concept that we no longer use.
2023-03-07 19:57:46 +01:00
Matthias Krüger
c21a640c5a
Rollup merge of #108783 - antoyo:sync-cg_gcc-2023-03-04, r=cjgillot
Sync rustc_codegen_gcc 2023/03/04

Hi.
This sync all the changes from rustc_codegen_gcc.
Thanks for the review.
2023-03-07 19:57:45 +01:00
Matthias Krüger
63635880f6
Rollup merge of #108583 - compiler-errors:rpitit-default-method-with-nested-rpitits, r=spastorino
Account for binders correctly when adding default RPITIT method assumption

As of #108203, we install extra projection predicates into the param-env of a default trait method when it has return-position `impl Trait` (or is async).

The implementation didn't account for the fact that it's walking into and out of binders, so we just need to shift all the debruijn indices accordingly when constructing the projection predicates.

Fixes #108579

r? types
2023-03-07 19:57:44 +01:00
Matthias Krüger
14260c83ac
Rollup merge of #108460 - obeis:hir-analysis-migrate-diagnostics-2, r=compiler-errors
migrate `rustc_hir_analysis` to session diagnostic [Part Two]

migrate `rustc_hir_analysis` to session diagnostic (part two)
files list:
- rustc_hir_analysis/variance/*
- rustc_hir_analysis/missing_cast_for_variadic_arg.rs
- rustc_hir_analysis/sized_unsized_cast.rs

Updates #100717
2023-03-07 19:57:43 +01:00
bors
e3dfeeaa45 Auto merge of #108167 - Zoxc:query-config-instance-slim, r=cjgillot
Make `rustc_query_system` take `QueryConfig` by instance.

This allows for easy switching between virtual tables and specialized instances for queries. It also has the benefit of less turbofish. `QueryStorage` has also been merged with `QueryCache`.

Split out from https://github.com/rust-lang/rust/pull/107937.

r? `@cjgillot`
2023-03-07 18:55:36 +00:00
Yuki Okushi
fddd861a7d
Rollup merge of #108855 - cbeuw:mir-cast, r=tmiasko
Custom MIR: Support `as` casts

Small changes to support this low hanging fruit

r? `@oli-obk` or `@tmiasko` or `@JakobDegen`
2023-03-07 23:06:25 +09:00
Yuki Okushi
8f775dc7a6
Rollup merge of #108731 - Ezrashaw:pin-suggestion-on-impl-future, r=petrochenkov
feat: impl better help for `.poll()` not found on `impl Future`

Partially address #108572

I'd like to also address suggestions for generalized `Self` parameters as well. That'll be a separate PR.
2023-03-07 23:06:22 +09:00
Yuki Okushi
2a196db1f2
Rollup merge of #108728 - tshepang:fix-and-improve, r=michaelwoerister
infer: fix and improve comments
2023-03-07 23:06:22 +09:00
Andy Wang
7281cd0c21
Custom MIR: Support as casts 2023-03-07 11:42:34 +01:00
bors
0a3b557d52 Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, r=pnkfelix,m-ou-se,scottmcm
Add `round_ties_even` to `f32` and `f64`

Tracking issue: #96710

Redux of #82273. See also #55107

Adds a new method, `round_ties_even`, to `f32` and `f64`, that rounds the float to the nearest integer , rounding halfway cases to the number with an even least significant bit. Uses the `roundeven` LLVM intrinsic to do this.

Of the five IEEE 754 rounding modes, this is the only one that doesn't already have a round-to-integer function exposed by Rust (others are `round`, `floor`, `ceil`, and `trunc`).  Ties-to-even is also the rounding mode used for int-to-float and float-to-float `as` casts, as well as float arithmentic operations. So not having an explicit rounding method for it seems like an oversight.

Bikeshed: this PR currently uses `round_ties_even` for the name of the method. But maybe `round_ties_to_even` is better, or `round_even`, or `round_to_even`?
2023-03-07 09:43:12 +00:00
bors
8f9e09ac3e Auto merge of #108735 - clubby789:borrowck-unstable, r=Nilstrieb
Remove `allow(potential_query_instability)` from `borrowck`

cc #84447

Replace uses of `FxHash*` with `FxIndex*`. One `#[allow]` for a HashMap in an external crate but the output is sorted afterwards.
2023-03-07 07:01:57 +00:00
bors
8824994ccd Auto merge of #108691 - aliemjay:closure-subject, r=jackh726
fix multiple issues when promoting type-test subject

Multiple interdependent fixes.  See linked issues for a short description of each.

When Promoting a type-test `T: 'a` from within the closure back to its parent function, there are a couple pre-existing bugs and limitations. They were exposed by the recent changes to opaque types because the type-test subject (`T`) is no longer a simple ParamTy.

Commit 1:
Fixes #108635
Fixes #107426

Commit 2:
Fixes #108639

Commit 3:
Fixes #107516
2023-03-07 03:50:22 +00:00
bors
81be7b86d3 Auto merge of #108821 - matthiaskrgr:rollup-cmkbgpr, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #107801 (const_eval: `implies_by` in `rustc_const_unstable`)
 - #108750 (Fix `ObligationCtxt::sub`)
 - #108780 (Add regression tests for issue 70919)
 - #108786 (Check for free regions in MIR validation)
 - #108790 (Do not ICE when interpreting a cast between non-monomorphic types)
 - #108803 (Do not ICE when failing to normalize in ConstProp.)
 - #108807 (Emit the suspicious_auto_trait_impls for negative impls as well)
 - #108812 (Add regression test for #98444)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-06 22:15:55 +00:00
Nikita Popov
2c7beeda90 Remove references to PassManagerBuilder
This is a legacy PM concept that we no longer use.
2023-03-06 16:55:52 +01:00
Matthias Krüger
3279f7ed77
Rollup merge of #108807 - MU001999:lint/suspicious_auto_trait_impls, r=lcnr
Emit the suspicious_auto_trait_impls for negative impls as well

Fixes #108804
2023-03-06 16:42:00 +01:00
Matthias Krüger
ab7dd09fc2
Rollup merge of #108803 - cjgillot:const-prop-normalize, r=oli-obk
Do not ICE when failing to normalize in ConstProp.

There is no reason to delay a bug there, as we bubble up the failure as TooGeneric.

Fixes https://github.com/rust-lang/rust/issues/97728
2023-03-06 16:41:59 +01:00
Matthias Krüger
3ae047b8f1
Rollup merge of #108790 - cjgillot:mono-cast, r=oli-obk
Do not ICE when interpreting a cast between non-monomorphic types

Fixes https://github.com/rust-lang/rust/issues/101596
2023-03-06 16:41:59 +01:00
Matthias Krüger
4bd6f7fe16
Rollup merge of #108786 - saethlin:free-regions-check, r=oli-obk
Check for free regions in MIR validation

This turns https://github.com/rust-lang/rust/issues/108720 into a MIR validation failure that will reproduce without debug-assertions enabled.

```
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:296 ~ futures_util[3805]::future::future::remote_handle::{impl#3}::poll), const_param_did: None }) (after pass ScalarReplacementOfAggregates) at bb0[0]:
                                Free regions in optimized runtime-post-cleanup MIR
  --> /home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.26/src/future/future/remote_handle.rs:96:13
   |
96 |         let this = self.project();
   |             ^^^^
```
2023-03-06 16:41:58 +01:00
Matthias Krüger
6240b54966
Rollup merge of #108750 - compiler-errors:aaaaaaaa, r=lcnr
Fix `ObligationCtxt::sub`

typo it seems
2023-03-06 16:41:57 +01:00
Matthias Krüger
9c99a4ca2b
Rollup merge of #107801 - davidtwco:stability-implies-const, r=Nilstrieb
const_eval: `implies_by` in `rustc_const_unstable`

Fixes #107605.

Extend support for `implies_by` (from `#[stable]` and `#[unstable]`) to `#[rustc_const_stable]` and `#[rustc_const_unstable]`.

cc ``@steffahn``
2023-03-06 16:41:56 +01:00
bors
f63ccaf25f Auto merge of #108402 - clubby789:diag-bool-not-unit, r=davidtwco
Allow using `bool` instead of `Option<()>` in diagnostics

~~Disallow the unit type for `#[help]`, `#[note]` etc, instead using `bool` to express optional annotations without a span which I believe is more intuitive.~~

~~Test output ordering has changed in a few places, where a field was of type `()` and the annotation has been moved to the struct itself. If any of these changes are an issue, this can be restricted to allowing specifically `()`, and not `Option<()>`~~

~~Actual changes here: https://github.com/rust-lang/rust/pull/108402/files#diff-815b1d8debfc564112bd51093791d7c3f2ee288a37a8f5c0e89c11d1f609b4c0~~

Allows using `bool` in derive diagnostics to indicate an optional subdiagnostic without a span, where previously `Option<()>` had to be used

`@rustbot` label +A-diagnostics
2023-03-06 13:00:32 +00:00
Mu42
2fe288fd29 emit the suspicious_auto_trait_impls for negative impls as well 2023-03-06 20:04:33 +08:00
Camille GILLOT
8c0cbd8767 Do not ICE when failing to normalize in ConstProp. 2023-03-06 09:28:49 +00:00
bors
ac4379fea9 Auto merge of #108787 - cjgillot:sroa-lifetime, r=compiler-errors
Erase regions even when failing to normalize type in MIR opts

The first commit just moves the tests around.

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

cc `@saethlin`
2023-03-06 08:31:28 +00:00
Camille GILLOT
858eab6391 Do not ICE when casting polymorphic values. 2023-03-05 20:55:32 +00:00
Matthias Krüger
5c49f0885e
Rollup merge of #108775 - cjgillot:issue-107860, r=compiler-errors
Use the correct bound vars in return type suggestion.

Fixes https://github.com/rust-lang/rust/issues/107860
2023-03-05 20:57:23 +01:00
Matthias Krüger
970f263156
Rollup merge of #108770 - GuillaumeGomez:improve-doc-and-naming, r=cjgillot
Improve documentation and argument naming of some TyCtxt methods

I got bit by this recently so better prevent others to end up the same as me.
2023-03-05 20:57:22 +01:00
Matthias Krüger
1c2f641e15
Rollup merge of #108764 - cjgillot:dpm-adapt, r=compiler-errors
Tweaks to -Zdrop-tracking-mir

Split from https://github.com/rust-lang/rust/pull/107421

3 commits: 1 diagnostic improvement and 2 ICEs.
2023-03-05 20:57:21 +01:00
Matthias Krüger
b8762321a2
Rollup merge of #108746 - compiler-errors:rpitit-dont-project-default-w-no-valu, r=cjgillot
Don't project to RPITIT that has no default value

Replicates this behavior, but for RPITIT projection logic (which currently is separate)

b1719530f4/compiler/rustc_trait_selection/src/traits/project.rs (L2105-L2115)

Fixes #108738
2023-03-05 20:57:20 +01:00
clubby789
3eeb3fd05a Remove allow(potential_query_instability) from borrowck 2023-03-05 18:59:19 +00:00
Ben Kimock
cb4ebc1453 Check for free regions in MIR validation 2023-03-05 13:46:20 -05:00
Camille GILLOT
fc1a861558 Erase lifetimes in SROA. 2023-03-05 18:35:30 +00:00
Antoni Boucher
2c0c25dcc1 Fix for diagnostics 2023-03-05 12:31:16 -05:00
Antoni Boucher
fce7053567 Update gccjit 2023-03-05 12:16:33 -05:00
Antoni Boucher
6bb2af0e6d Merge commit '08a6d6e16b5efe217123e780398969946266268f' into sync-cg_gcc-2023-03-04 2023-03-05 12:03:19 -05:00
Camille GILLOT
1e9b58bdf8 Use the correct bound vars in return type suggestion. 2023-03-05 16:08:06 +00:00
Matthias Krüger
ec162703dc
Rollup merge of #108744 - compiler-errors:non_lifetime_binders-bad-copy-clone, r=jackh726
Don't ICE when encountering bound var in builtin copy/clone bounds

Fixes #108742
2023-03-05 14:29:10 +01:00
Guillaume Gomez
1836fe44b5 Improve documentation and argument naming of some TyCtxt methods 2023-03-05 13:35:13 +01:00
bors
0d439f8181 Auto merge of #108351 - petrochenkov:rmdit, r=cjgillot
rustc_middle: Remove trait `DefIdTree`

This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-05 10:37:02 +00:00
Ali MJ Al-Nasrawy
bfd35016e4 fix the new unsoundness 2023-03-05 12:49:01 +03:00
Ali MJ Al-Nasrawy
79dca7b7ba s/unification_table/unification_table_mut
Give a more clear name.
2023-03-05 12:49:01 +03:00
Ali MJ Al-Nasrawy
f3dfa52fd1 resolve to universal regions when possible 2023-03-05 12:00:22 +03:00
Camille GILLOT
fba5d3dd03 drop_tracking_mir: support new solver. 2023-03-05 08:29:35 +00:00
Camille GILLOT
135db79bc8 drop_tracking_mir: avoid good path bug. 2023-03-05 08:29:35 +00:00
Camille GILLOT
0916616fec drop_tracking_mir: diagnose recursive generator. 2023-03-05 08:29:35 +00:00