Custom elements previously had to hand-write an `IntoElement` impl that
just returned `self`. Replace that boilerplate with a blanket `impl<T:
Element> IntoElement for T`, and relax the `Element` supertrait bound
from `IntoElement` to `Sized`. Any type implementing `Element` is now
usable as a child element without extra code.
`AnyElement` overrides `into_any` to return `self`, so converting one
does not nest a boxed element inside another. To make that easy to
notice, the private `AnyElement::new` is renamed to
`new_please_call_into_any_to_avoid_double_box`.
Remove the now-redundant `IntoElement` impls across gpui and its
consumers.
## Testing
Manually test your changes; report results, mention platforms if
relevant.
How can reviewers test this easily? Include setup and steps.
## Self-review
- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [ ] Tests cover the new or changed behavior.
Release Notes:
- [GPUI] (breaking) Added blanket impl for `IntoElement` trait with
`ElementType = Self` when `Self` implements `Element`.
---------
Co-authored-by: Amp <amp@ampcode.com>
This allows us to build powerful and flexible Input and TextArea
components
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>