about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2023-06-22Expect clause moreMichael Goulet-1/+1
2023-06-22Migrate item_bounds to ty::ClauseMichael Goulet-33/+22
2023-06-22Move `opaque_type_origin_unchecked` onto `TyCtxt` and re-use it where it was ↵Oli Scherer-4/+4
open coded
2023-06-21Rollup merge of #112868 - compiler-errors:liberate-afit-sugg, r=WaffleLapkinGuillaume Gomez-13/+10
Liberate bound vars properly when suggesting missing async-fn-in-trait Fixes #112848
2023-06-21Liberate bound vars properly when suggesting missing AFITMichael Goulet-13/+10
2023-06-21Rollup merge of #112853 - GuillaumeGomez:type_alias_type, r=oli-obkGuillaume Gomez-1/+1
Add `lazy_type_alias` feature gate Add the `type_alias_type` to be able to have the weak alias used without restrictions. Part of #112792. cc `@compiler-errors` r? `@oli-obk`
2023-06-21Add `lazy_type_alias` feature gateGuillaume Gomez-1/+1
2023-06-21Rollup merge of #112772 - compiler-errors:clauses-1, r=lcnrNilstrieb-115/+119
Add a fully fledged `Clause` type, rename old `Clause` to `ClauseKind` Does two basic things before I put up a more delicate set of PRs (along the lines of #112714, but hopefully much cleaner) that migrate existing usages of `ty::Predicate` to `ty::Clause` (`predicates_of`/`item_bounds`/`ParamEnv::caller_bounds`). 1. Rename `Clause` to `ClauseKind`, so it's parallel with `PredicateKind`. 2. Add a new `Clause` type which is parallel to `Predicate`. * This type exposes `Clause::kind(self) -> Binder<'tcx, ClauseKind<'tcx>>` which is parallel to `Predicate::kind` 😸 The new `Clause` type essentially acts as a newtype wrapper around `Predicate` that asserts that it is specifically a `PredicateKind::Clause`. Turns out from experimentation[^1] that this is not negative performance-wise, which is wonderful, since this a much simpler design than something that requires encoding the discriminant into the alignment bits of a predicate kind, or something else like that... r? ``@lcnr`` or ``@oli-obk`` [^1]: https://github.com/rust-lang/rust/pull/112714#issuecomment-1595653910
2023-06-20Auto merge of #112320 - compiler-errors:do-not-impl-via-obj, r=lcnrbors-2/+47
Add `implement_via_object` to `rustc_deny_explicit_impl` to control object candidate assembly Some built-in traits are special, since they are used to prove facts about the program that are important for later phases of compilation such as codegen and CTFE. For example, the `Unsize` trait is used to assert to the compiler that we are able to unsize a type into another type. It doesn't have any methods because it doesn't actually *instruct* the compiler how to do this unsizing, but this is later used (alongside an exhaustive match of combinations of unsizeable types) during codegen to generate unsize coercion code. Due to this, these built-in traits are incompatible with the type erasure provided by object types. For example, the existence of `dyn Unsize<T>` does not mean that the compiler is able to unsize `Box<dyn Unsize<T>>` into `Box<T>`, since `Unsize` is a *witness* to the fact that a type can be unsized, and it doesn't actually encode that unsizing operation in its vtable as mentioned above. The old trait solver gets around this fact by having complex control flow that never considers object bounds for certain built-in traits: https://github.com/rust-lang/rust/blob/2f896da247e0ee8f0bef7cd7c54cfbea255b9f68/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L61-L132 However, candidate assembly in the new solver is much more lovely, and I'd hate to add this list of opt-out cases into the new solver. Instead of maintaining this complex and hard-coded control flow, instead we can make this a property of the trait via a built-in attribute. We already have such a build attribute that's applied to every single trait that we care about: `rustc_deny_explicit_impl`. This PR adds `implement_via_object` as a meta-item to that attribute that allows us to opt a trait out of object-bound candidate assembly as well. r? `@lcnr`
2023-06-20Merge attrs, better validationMichael Goulet-2/+44
2023-06-20Make rustc_deny_explicit_impl only local as wellMichael Goulet-3/+4
2023-06-20Add rustc_do_not_implement_via_objectMichael Goulet-0/+2
2023-06-19Rollup merge of #112596 - compiler-errors:missing-sig-with-rpitit, r=b-naberMichael Goulet-2/+29
Suggest correct signature on missing fn returning RPITIT/AFIT Add `async` and unpeel the future's output type if the function is async Fixes #108195
2023-06-19Fully fledged Clause typeMichael Goulet-43/+34
2023-06-19s/Clause/ClauseKindMichael Goulet-82/+95
2023-06-18Rollup merge of #112734 - dswij:bounds-predicates-clause, r=compiler-errorsMatthias Krüger-21/+47
Make `Bound::predicates` use `Clause` Part of #107250 `Bound::predicates` returns an iterator over `Binder<_, Clause>` instead of `Predicate`. I tried updating `explicit_predicates_of` as well, but it seems that it needs a lot more change than I thought. Will do it in a separate PR instead.
2023-06-17Move some bounds computation out of astconv into its own fileMichael Goulet-567/+585
2023-06-17Move ConstEvaluatable to ClauseMichael Goulet-7/+7
2023-06-17Move WF goal to clauseMichael Goulet-11/+16
2023-06-17`Bound::predicates` to return `Clause`dswij-21/+47
2023-06-16Pacify tidyOli Scherer-116/+128
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-12/+50
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-16Merge the orphan logic for all alias kindsOli Scherer-29/+23
2023-06-15Auto merge of #104455 - the8472:dont-drain-on-drop, r=Amanieubors-2/+0
Don't drain-on-drop in DrainFilter impls of various collections. This removes drain-on-drop behavior from various unstable DrainFilter impls (not yet for HashSet/Map) because that behavior [is problematic](https://github.com/rust-lang/rust/issues/43244#issuecomment-641638196) (because it can lead to panic-in-drop when user closures panic) and may become forbidden if [this draft RFC passes](https://github.com/rust-lang/rfcs/pull/3288). closes #101122 [ACP](https://github.com/rust-lang/libs-team/issues/136) affected tracking issues * #43244 * #70530 * #59618 Related hashbrown update: https://github.com/rust-lang/hashbrown/pull/374
2023-06-14Auto merge of #112625 - matthiaskrgr:rollup-jcobj3g, r=matthiaskrgrbors-23/+53
Rollup of 7 pull requests Successful merges: - #112584 (loongarch64-none*: Remove environment component from llvm target) - #112600 (Introduce a `Stable` trait to translate MIR to SMIR) - #112605 (Improve docs/clean up negative overlap functions) - #112611 (Error on unconstrained lifetime in RPITIT) - #112612 (Fix explicit-outlives-requirements lint span) - #112613 (Fix rustdoc-gui tests on Windows) - #112620 (Fix small typo) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-14Rollup merge of #112506 - compiler-errors:const-infer-ice, r=b-naberMatthias Krüger-13/+30
Properly check associated consts for infer placeholders We only reported an error if it was in a "suggestable" position (according to `is_suggestable_infer_ty`) -- this isn't correct for infer tys that can show up in other places in the constant's type, like behind a dyn trait. fixes #112491
2023-06-14remove hash_drain_filter feature usesThe 8472-1/+0
2023-06-14s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedListThe 8472-1/+0
2023-06-14Error on unconstrained lifetime in RPITITMichael Goulet-23/+53
2023-06-13Suggest correct signature on missing fn returning RPITIT/AFITMichael Goulet-2/+29
2023-06-13Rollup merge of #111885 - compiler-errors:rust-call-abi-sized, r=eholkMatthias Krüger-1/+7
Don't ICE on unsized `extern "rust-call"` call Conceptually builds on #111864, but doesn't depend on it.
2023-06-11properly check associated consts for infer placeholdersMichael Goulet-13/+30
2023-06-11iat selection: normalize self ty & completely erase bound varsLeón Orell Valerian Liehr-19/+57
2023-06-08Rollup merge of #109953 - thomcc:thomcc/typeid128, r=WaffleLapkinMatthias Krüger-1/+1
Use 128 bits for TypeId hash Preliminary/Draft impl of https://github.com/rust-lang/compiler-team/issues/608 Prior art (probably incomplete list) - https://github.com/rust-lang/rust/pull/75923 - https://github.com/rust-lang/rust/pull/95845
2023-06-07Rollup merge of #112122 - compiler-errors:next-coherence, r=lcnrDylan DPC-4/+3
Add `-Ztrait-solver=next-coherence` Flag that conditionally uses the trait solver *only* during coherence, for more testing and/or eventual partial-migration onto the trait solver (in the medium- to long-term). * This still uses the selection context in some of the coherence methods I think, so it's not "complete". Putting this up for review and/or for further work in-tree. * I probably need to spend a bit more time making sure that we don't sneakily create any other infcx's during coherence that also need the new solver enabled. r? `@lcnr`
2023-06-07Auto merge of #111047 - compiler-errors:rtn-no-ty-ct-params, r=spastorinobors-39/+42
Emit an error when return-type-notation is used with type/const params These are not intended to be supported initially, even though the compiler supports them internally...
2023-06-06Don't ICE on unsized rust-call abi callMichael Goulet-1/+7
2023-06-06Make TraitEngine::new use the right solver, add compare modeMichael Goulet-3/+2
2023-06-06New trait solver is a property of inference contextMichael Goulet-1/+1
2023-06-06remove `has_error_field` helper methodlcnr-3/+5
2023-06-05Rollup merge of #112322 - ↵Matthias Krüger-1/+1
compiler-errors:no-IMPLIED_BOUNDS_ENTAILMENT-if-errs, r=eholk Don't mention `IMPLIED_BOUNDS_ENTAILMENT` if signatures reference error Fixes #112321
2023-06-05Don't mention IMPLIED_BOUNDS_ENTAILMENT if signatures reference errorMichael Goulet-1/+1
2023-06-05Remove redundant InferCtxtExt::fresh_item_substsMichael Goulet-36/+1
2023-06-05Emit an error when RTN is used with ty/ct paramsMichael Goulet-3/+41
2023-06-05Merge method, type and const object safety checksOli Scherer-0/+4
2023-06-05Avoid going through queries if a value of type `AssocItem` is already availableOli Scherer-4/+4
2023-06-04Use 128 bits for TypeId hashThom Chiovoloni-1/+1
- Switch TypeId to 128 bits - Hack around the fact that tracing-subscriber dislikes how TypeId is hashed - Remove lowering of type_id128 from rustc_codegen_llvm - Remove unnecessary `type_id128` intrinsic (just change return type of `type_id`) - Only hash the lower 64 bits of the TypeId - Reword comment
2023-06-02Rollup merge of #112183 - compiler-errors:new-solver-anon-ct, r=BoxyUwUMichael Goulet-3/+4
Normalize anon consts in new solver We don't do any of that `expand_abstract_consts` stuff so this isn't sufficient to make GCE work, but it does allow, e.g. `[(); 1]: Default`, to solve. r? `@BoxyUwU`
2023-06-02No more TyCtxt::lazy_normalizationMichael Goulet-3/+4
2023-06-02Separate AnonConst from ConstBlock in HIR.Camille GILLOT-22/+16