Document some builtin impls in the next solver#122238
Conversation
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
| /// ```rust,ignore (not valid rust syntax) | ||
| /// impl Sized for u*, i*, bool, f*, FnPtr, FnDef, *(const/mut) T, char, &mut? T, [T; N], dyn* Trait, ! | ||
| /// | ||
| /// impl Sized for (T1, T2, .., Tn) where T1: Sized, T2: Sized, .. Tn: Sized | ||
| /// | ||
| /// impl Sized for Adt where T: Sized forall T in field types | ||
| /// ``` | ||
| /// | ||
| /// note that `[T; N]` is unconditionally sized since `T: Sized` is required for the array type to be | ||
| /// well-formed. |
There was a problem hiding this comment.
My initial reaction was that I would prefer moving the comment for each builtin impl to the most specific place possible, having only a single impl per comment. This would mostly correspond to commenting the match arms on the self_ty matches in most cases.
I worry that these comments here can easily get out of date. E.g. When changing instantiate_constituent_tys_for_sized_trait we likely won't remember updating this function 🤔 E.g. this function currently diverges from the old solver by checking that all tuple fields are sized, not only the last one
There was a problem hiding this comment.
Sure, that would work. I will move these.
|
@bors r+ rollup |
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#119029 (Avoid closing invalid handles) - rust-lang#122238 (Document some builtin impls in the next solver) - rust-lang#122247 (rustdoc-search: depth limit `T<U>` -> `U` unboxing) - rust-lang#122287 (add test ensuring simd codegen checks don't run when a static assertion failed) - rust-lang#122368 (chore: remove repetitive words) - rust-lang#122397 (Various cleanups around the const eval query providers) - rust-lang#122406 (Fix WF for `AsyncFnKindHelper` in new trait solver) - rust-lang#122477 (Change some attribute to only_local) - rust-lang#122482 (Ungate the `UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES` lint) - rust-lang#122490 (Update build instructions for OpenHarmony) Failed merges: - rust-lang#122471 (preserve span when evaluating mir::ConstOperand) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122238 - fee1-dead-contrib:builtin-impl-next-solver-dox, r=lcnr Document some builtin impls in the next solver This does not cover all builtin impls, but ones that I were able to go over within a cycle. r? `@lcnr` Let me know if the place isn't correct for these, or if you'd like me to change how the impls are presented ^^
This does not cover all builtin impls, but ones that I were able to go over within a cycle.
r? @lcnr
Let me know if the place isn't correct for these, or if you'd like me to change how the impls are presented ^^