# gpui: Fix \`Global\` trait \(\#11187\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d633a0da788047787c0b344cae721bf1ac48b64e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d633a0da788047787c0b344cae721bf1ac48b64e

Requested commit: d633a0da788047787c0b344cae721bf1ac48b64e

Commit: d633a0da788047787c0b344cae721bf1ac48b64e

Tree: 085f765aa533a77229bf34bfe004ace7ae6cd54b

Author: Marshall Bowers

Committer: GitHub

## Message

```
gpui: Fix `Global` trait (#11187)

This PR restores the `Global` trait's status as a marker trait.

This was the original intent from #7095, when it was added, that had
been lost in #9777.

The purpose of the `Global` trait is to statically convey what types can
and can't be accessed as `Global` state, as well as provide a way of
restricting access to said globals.

For example, in the case of the `ThemeRegistry` we have a private
`GlobalThemeRegistry` that is marked as `Global`:
https://github.com/zed-industries/zed/blob/91b3c24ed35d58438ae33970f07d1ff01d3acfc7/crates/theme/src/registry.rs#L25-L34

We're then able to permit reading the `ThemeRegistry` from the
`GlobalThemeRegistry` via a custom getter, while still restricting which
callers are able to mutate the global:
https://github.com/zed-industries/zed/blob/91b3c24ed35d58438ae33970f07d1ff01d3acfc7/crates/theme/src/registry.rs#L46-L61

Release Notes:

- N/A
```

## Parents

- [91b3c24ed35d58438ae33970f07d1ff01d3acfc7](https://git.cafe/gitcafe/zed/commit/91b3c24ed35d58438ae33970f07d1ff01d3acfc7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d633a0da788047787c0b344cae721bf1ac48b64e?format=markdown)
