You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#126069 - nnethercote:Ty-kind-ret-ty, r=<try>
Change the return type of `Ty::kind` from `&TyKind` to `TyKind`.
This is valid because `TyKind` impls `Copy`, and makes `Ty` consistent with `Predicate` and `Region`, both of which have `kind` methods that return a non-reference.
The change removes more than one thousand `&` and `*` sigils, while requiring the addition of just five! It's clearly moving with the grain of the existing code.
Almost all of the removed sigils fit one of the following three patterns.
- Remove the dereference in the match expression:
`match *ty.kind() { ... }` ->
`match ty.kind() { ... }`
- Remove the dereference in the match pattern:
`match ty.kind() { &ty::Foo(foo) => { ... foo ... }` ->
`match ty.kind() { ty::Foo(foo) => { ... foo ... }`
- Remove the derefernce in the match arm:
`match ty.kind() { ty::Foo(foo) => { ... *foo ... }` ->
`match ty.kind() { ty::Foo(foo) => { ... foo ... }`
A couple of other methods had their signatures changed.
- `TypeErrCtxt::cmp_fn_sig`: `&` removed from two args.
- `EncodableWithShorthand::variant`: `&` removed from return type.
r? `@ghost`
0 commit comments