summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits
AgeCommit message (Collapse)AuthorLines
2023-07-05Add some extra information to opaque type cycle errorsOli Scherer-0/+4
2023-07-03Remove chalk from the compilerMichael Goulet-401/+0
2023-06-28Rollup merge of #112867 - compiler-errors:more-impl-source-nits, r=lcnrDylan DPC-37/+2
More `ImplSource` nits Even more clean-ups, I'll put this up in parallel with the `select_in_new_trait_solver` PR. r? ``@lcnr``
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-4/+2
2023-06-20yeet upcast_trait_def_id from ImplSourceObjectDataMichael Goulet-6/+2
2023-06-20yeet ImplSource::TraitAlias tooMichael Goulet-31/+0
2023-06-20cleanup importslcnr-8/+12
2023-06-19move to nested moduleBoxy-130/+134
2023-06-19show normalizes-to hack and response instantiation goalsBoxy-2/+28
2023-06-19introduce a separate set of types for finalized proof treesBoxy-28/+39
2023-06-19say what kind of cache hitBoxy-3/+10
2023-06-19initial info dumpBoxy-11/+181
2023-06-17Remove even more redundant builtin candidatesMichael Goulet-45/+4
2023-06-17Simplify even more candidatesMichael Goulet-111/+26
2023-06-17Simplify an ObjectData fieldMichael Goulet-6/+6
2023-06-17Simplify some impl source candidatesMichael Goulet-57/+0
2023-06-17Remove some ImplSource candidatesMichael Goulet-31/+10
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-0/+3
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-02Rollup merge of #112165 - fee1-dead-contrib:rn-defualtness, r=compiler-errorsMatthias Krüger-1/+1
Rename `impl_defaultness` to `defaultness` Since this isn't just about the `impl`.
2023-06-01Implement custom diagnostic for ConstParamTyMichael Goulet-0/+3
2023-06-01Rename `impl_defaultness` to `defaultness`Deadbeef-1/+1
2023-05-25Fallible<_> -> Result<_, NoSolution>Michael Goulet-2/+0
2023-05-25Prepopulate opaques in canonical inputMichael Goulet-3/+64
2023-05-25Move DefiningAnchorMichael Goulet-0/+11
2023-05-22Auto merge of #111754 - lcnr:recursion-depth, r=matthewjasperbors-3/+20
fix recursion depth handling after confirmation fixes #111729 I think having to use `Obligation::with_depth` correctly everywhere is very hard because e.g. the nested obligations from `eq` currently do not have the correct obligation depth. The new solver [completely removes `recursion_depth` from obligations](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/traits/solve/struct.Goal.html) and instead tracks the depth in the solver itself which is far easier to get right. Moving the old solver towards this shouldn't be that hard but is probably somewhat annoying. r? `@matthewjasper`
2023-05-20Rollup merge of #111450 - compiler-errors:opaque-ty-key, r=oli-obkGuillaume Gomez-1/+1
Use `OpaqueTypeKey` in query response Makes it a bit clearer that at least one of the types being returned from a canonical query is an opaque.
2023-05-19update recursion depth in `confirm_candidate`lcnr-3/+20
2023-05-12Note base types of coercionMichael Goulet-3/+0
2023-05-10Use OpaqueTypeKey in query responseMichael Goulet-1/+1
2023-05-09Shrink `SelectionError` a lotNilstrieb-5/+8
`SelectionError` used to be 80 bytes (on 64 bit). That's quite big. Especially because the selection cache contained `Result<_, SelectionError>. The Ok type is only 32 bytes, so the 80 bytes significantly inflate the size of the cache. Most variants of the `SelectionError` seem to be hard errors, only `Unimplemented` shows up in practice (for cranelift-codegen, it occupies 23.4% of all cache entries). We can just box away the biggest variant, `OutputTypeParameterMismatch`, to get the size down to 16 bytes, well within the size of the Ok type inside the cache.
2023-05-04Use fulfillment to check Drop impl compatibilityMichael Goulet-0/+4
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-5/+2
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-04-28Rollup merge of #110927 - nnethercote:Encoder-Decoder-cleanups, r=scottmcmMatthias Krüger-7/+7
Encoder/decoder cleanups Best reviewed one commit at a time. r? ``@scottmcm``
2023-04-28Remove some unnecessary derives.Nicholas Nethercote-7/+7
I was curious about how many `Encodable`/`Decodable` derives we have. Some grepping revealed that it's over 500 of each, but the number of `Encodable` ones was higher, which was weird. Most of the `Encodable`-only ones were in `hir.rs`. This commit removes them all, plus some other unnecessary derives in that file and others that I found via trial and error.
2023-04-26Remove unused `TypeFoldable`/`TypeVisitable` impls.Nicholas Nethercote-3/+3
2023-04-10Rollup merge of #110124 - Nilstrieb:📎-told-me-so, r=compiler-errorsDylan DPC-2/+2
Some clippy fixes in the compiler Best reviewed commit-by-commit 📎.
2023-04-10review + some small stufflcnr-3/+13
2023-04-09Fix some clippy::complexityNilstrieb-2/+2
2023-04-05Tweak debug outputs to make debugging new solver easierMichael Goulet-2/+2
2023-03-21woopslcnr-1/+1
2023-03-21new solver cleanup + coherencelcnr-6/+5
2023-03-20Enforce non-lifetime-binders in supertrait preds are not object safeMichael Goulet-2/+11
2023-03-14Remove box expressions from HIRclubby789-2/+0
2023-03-10Move some solver stuff to middleMichael Goulet-2/+94
2023-03-03canonicalizationlcnr-5/+11
2023-02-24Rename many interner functions.Nicholas Nethercote-11/+9
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-22Remove type-traversal trait aliasesAlan Egerton-10/+12
2023-02-17Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstriebbors-6/+2
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref r? `@ghost`
2023-02-17Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwUbors-1/+1
Switch to `EarlyBinder` for `type_of` query Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-3/+1
in metadata