about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2023-06-28Auto merge of #112629 - compiler-errors:atb-imply, r=jackh726bors-101/+84
Make associated type bounds in supertrait position implied `trait A: B<Assoc: C> {}` should be able to imply both `Self: B` and `<Self as B>::Assoc: C`. Adjust the way that we collect implied predicates to do so. Fixes #112573 Fixes #112568
2023-06-28Auto merge of #111269 - clubby789:validate-fluent-variables, r=davidtwcobors-1/+1
Validate fluent variable references in tests Closes #101109 Under `cfg(test)`, the `fluent_messages` macro will emit a list of variables referenced by each message and its attributes. The derive attribute will now emit a `#[test]` that checks that each referenced variable exists in the structure it's applied to.
2023-06-27Rollup merge of #113084 - WaffleLapkin:less_map_or, r=NilstriebMatthias Krüger-5/+5
Simplify some conditions r? `@Nilstrieb` Some things taken out of my `is_none_or` pr.
2023-06-27pass PredicateFilter to compute_boundsMichael Goulet-72/+51
2023-06-27Make associated type bounds in supertrait position impliedMichael Goulet-50/+54
2023-06-27Simplify some conditionsMaybe Waffle-5/+5
2023-06-26TypeWellFormedInEnvMichael Goulet-3/+5
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-196/+139
2023-06-26migrate lifetime tooMichael Goulet-6/+14
2023-06-26Account for late-bound vars from parent arg-position impl traitMichael Goulet-0/+69
2023-06-25Rollup merge of #113036 - TaKO8Ki:fix-112094, r=compiler-errorsMatthias Krüger-1/+1
Accept `ReStatic` for RPITIT Fixes #112094 Regression in https://github.com/rust-lang/rust/commit/8216b7f22934cea2422c79565df9c30ac8db93e0 If there is a better suggestion, I will go with that.
2023-06-26accept `ReStatic` for RPITITTakayuki Maeda-1/+1
add an ui test for #112094
2023-06-23Rollup merge of #112983 - spastorino:new-rpitit-23, r=compiler-errorsMichael Goulet-6/+14
Fix return type notation associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty This avoid suggesting the associated types generated for RPITITs when the one the code refers to doesn't exist and rustc looks for a suggestion. r? `@compiler-errors`
2023-06-23Rollup merge of #112981 - spastorino:new-rpitit-22, r=compiler-errorsMichael Goulet-1/+1
Fix return type notation errors with -Zlower-impl-trait-in-trait-to-assoc-ty This just adjust the way we check for RPITITs and uses the new helper method to do the "old" and "new" check at once. r? `@compiler-errors`
2023-06-23Auto merge of #112891 - oli-obk:impl_trait_in_assoc_tys_cleanup, ↵bors-4/+4
r=compiler-errors Various impl trait in assoc tys cleanups r? `@compiler-errors` All commits except for the last are pure refactorings. 274dab5bd658c97886a8987340bf50ae57900c39 allows struct fields to participate in deciding whether a function has an opaque in its signature. best reviewed commit by commit
2023-06-23Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-tySantiago Pastorino-6/+14
2023-06-23Fix return type notation errors with -Zlower-impl-trait-in-trait-to-assoc-tySantiago Pastorino-1/+1
2023-06-22migrate inferred_outlives_of to ClauseMichael Goulet-5/+7
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