Commit Graph

315 Commits

Author SHA1 Message Date
Michael Goulet 8fbd78ccea Detect cycle errors hidden by opaques during monomorphization 2023-09-13 17:35:44 +00:00
klensy 6950689030 remove some unused crate deps 2023-09-01 19:13:09 +03:00
Mahdi Dibaiee e55583c4b8 refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
Michael Goulet 3f8919c09b get rid of a bit more calls to poly_select 2023-07-06 16:50:12 +00:00
Michael Goulet 52f7384995 Separate select calls that don't need a binder 2023-07-06 16:50:12 +00:00
Michael Goulet 0c73b41cd6 remove TypeWellFormedFromEnv 2023-07-03 21:40:04 +00:00
Michael Goulet 810fbf086d Remove chalk from the compiler 2023-07-03 21:40:04 +00:00
Nilstrieb e43ec03968 Update chalk 2023-07-01 18:03:36 +02:00
Michael Goulet 75a8f68183 Remove unnecessary DefineOpaqueTypes::Bubble from codegen 2023-06-27 21:36:15 +00:00
Michael Goulet 374173cd99 TypeWellFormedInEnv 2023-06-26 23:12:04 +00:00
Michael Goulet fbdef58414 Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
Michael Goulet fdce450eb5
Rollup merge of #112963 - oli-obk:tait_solver_decoupling, r=compiler-errors
Stop bubbling out hidden types from the eval obligation queries

r? `@compiler-errors`

I don't know why these were added, but they are not needed anymore. The relevant test is unaffected and I didn't see anything interesting in logging that would have justified it.

This PR has no effect on the new solver behaviour of cf2dff2b1e/tests/ui/impl-trait/issue-99642.rs (which is overflow) and cf2dff2b1e/tests/ui/impl-trait/issue-99642-2.rs (which is "unstable certainty ICE")
2023-06-23 19:47:20 -07:00
Oli Scherer c996cfec80 Stop bubbling out hidden types from the eval obligation queries 2023-06-23 14:53:31 +00:00
Michael Goulet 46a650f4e0 Migrate item_bounds to ty::Clause 2023-06-22 18:34:23 +00:00
Michael Goulet fca56a8d2c s/Clause/ClauseKind 2023-06-19 14:57:42 +00:00
Michael Goulet 6594c75449 Move ConstEvaluatable to Clause 2023-06-17 21:27:13 +00:00
Michael Goulet 52d3fc93f2 Move WF goal to clause 2023-06-17 21:20:20 +00:00
Oli Scherer f3b7dd6388 Add `AliasKind::Weak` for type aliases.
Only use it when the type alias contains an opaque type.

Also does wf-checking on such type aliases.
2023-06-16 19:39:48 +00:00
The 8472 114d5f221c s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
Michael Goulet 3d4da98273 Make TraitEngine::new use the right solver, add compare mode 2023-06-06 18:43:20 +00:00
Michael Goulet e0acff796a New trait solver is a property of inference context 2023-06-06 18:43:06 +00:00
Maybe Waffle e33e20824f Rename `tcx.mk_re_*` => `Region::new_*` 2023-05-29 17:54:53 +00:00
Kyle Matsuda c40e9cc7ca Make EarlyBinder's inner value private; and fix all of the resulting errors 2023-05-28 10:44:53 -06:00
Michael Goulet d7a2fdd4db Uplift complex type ops back into typeck so we can call them locally 2023-05-27 04:13:44 +00:00
Michael Goulet 0a35db5e0d Fallible<_> -> Result<_, NoSolution> 2023-05-25 17:29:22 +00:00
Michael Goulet f3c9c21658 Prepopulate opaques in canonical input 2023-05-25 03:21:22 +00:00
Michael Goulet a2d7ffc635 Move DefiningAnchor 2023-05-25 03:21:21 +00:00
Michael Goulet 4d80b8090c Pull out logic from #111131, plus some new logic in EvalCtxt::normalize_opaque_type
Co-authored-by: lcnr <rust@lcnr.de>
2023-05-25 03:19:15 +00:00
John Kåre Alsaker fff20a703d Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
León Orell Valerian Liehr e8139dfd5a
IAT: Introduce AliasKind::Inherent 2023-05-04 16:59:10 +02:00
Nicholas Nethercote 6b62f37402 Restrict `From<S>` for `{D,Subd}iagnosticMessage`.
Currently a `{D,Subd}iagnosticMessage` can be created from any type that
impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static,
str>`, which are reasonable. It also includes `&String`, which is pretty
weird, and results in many places making unnecessary allocations for
patterns like this:
```
self.fatal(&format!(...))
```
This creates a string with `format!`, takes a reference, passes the
reference to `fatal`, which does an `into()`, which clones the
reference, doing a second allocation. Two allocations for a single
string, bleh.

This commit changes the `From` impls so that you can only create a
`{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static,
str>`. This requires changing all the places that currently create one
from a `&String`. Most of these are of the `&format!(...)` form
described above; each one removes an unnecessary static `&`, plus an
allocation when executed. There are also a few places where the existing
use of `&String` was more reasonable; these now just use `clone()` at
the call site.

As well as making the code nicer and more efficient, this is a step
towards possibly using `Cow<'static, str>` in
`{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing
the `From<&'a str>` impls to `From<&'static str>`, which is doable, but
I'm not yet sure if it's worthwhile.
2023-05-03 08:44:39 +10:00
Boxy f04b8fe0af rename `needs_infer` to `has_infer` 2023-04-27 08:35:19 +01:00
Matthias Krüger 297b222066
Rollup merge of #110556 - kylematsuda:earlybinder-explicit-item-bounds, r=compiler-errors
Switch to `EarlyBinder` for `explicit_item_bounds`

Part of the work to finish https://github.com/rust-lang/rust/issues/105779.

This PR adds `EarlyBinder` to the return type of the `explicit_item_bounds` query and removes `bound_explicit_item_bounds`.

r? `@compiler-errors` (hope it's okay to request you, since you reviewed #110299 and #110498 😃)
2023-04-25 21:06:32 +02:00
klensy 3338ee3ca7 drop unused deps, gate libc under unix for one crate 2023-04-22 15:22:21 +03:00
Kyle Matsuda 5a69b5d0f9 Changes from review 2023-04-21 09:57:37 -06:00
Kyle Matsuda f3b279fcc5 add EarlyBinder to output of explicit_item_bounds; replace bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query 2023-04-20 12:36:50 -06:00
Maybe Waffle 10ec03c3fb Don't transmute `&List<GenericArg>` <-> `&List<Ty>` 2023-04-18 17:42:30 +00:00
fee1-dead eba419195c
Rollup merge of #110345 - nnethercote:rm-Super-impls-for-Region, r=compiler-errors
Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.

These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial.

This commit inlines and removes those trivial methods.

r? `@compiler-errors`
2023-04-16 18:55:38 +08:00
fee1-dead a5136f14ae
Rollup merge of #109665 - fee1-dead-contrib:rm-remap-queries, r=oli-obk
Remove `remap_env_constness` in queries

This removes some of the complexities with const traits. #88119 used to be caused by this but was fixed by `param_env = param_env.without_const()`.
2023-04-16 18:55:38 +08:00
Nicholas Nethercote 4460a1dc28 Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.
These traits exist so that folders/visitors can recurse into types of
interest: binders, types, regions, predicates, and consts. But `Region`
is non-recursive and cannot contain other types of interest, so its
methods in these traits are trivial.

This commit inlines and removes those trivial methods.
2023-04-16 09:11:43 +10:00
lcnr 64fbdc3779 explicit adt_dtorck_constraint for ManuallyDrop 2023-04-14 15:44:05 +02:00
Deadbeef 886c0e6388 fix ICE 2023-04-08 10:18:48 +00:00
Jack Huey b15195a304 Remove u32 on BoundTyKind::Anon 2023-04-06 23:08:04 -04:00
Jack Huey f0edcc8a6f Remove index from BrAnon 2023-04-06 23:01:40 -04:00
Jack Huey 167b70692b Remove expect_anon and expect_anon_placeholder in favor of var 2023-04-06 23:01:38 -04:00
Jack Huey 4646b3df6a Use BoundTy and BoundRegion instead of kind of PlaceholderTy and PlaceholderRegion 2023-04-06 23:01:35 -04:00
Matthias Krüger ac229c2819 fix clippy::iter_kv_map 2023-04-01 23:44:16 +02:00
Michael Goulet 3a36a093dd Rename AliasEq -> AliasRelate 2023-03-23 05:56:40 +00:00
Nicholas Nethercote c09f5b6a6b Add `mk_canonical_var_infos_from_iter`.
It's missing, and is useful in two places.
2023-02-24 07:33:02 +11:00
Nicholas Nethercote 11c2c596e4 Rename `mk_{ty,region}` as `mk_{ty,region}_from_kind`.
To discourage accidental use -- there are more specific `mk_*` functions
for all `Ty` and `Region` kinds.
2023-02-24 07:33:00 +11:00