Skip to content

Unify unsized types in type inference #17178

Closed
@nrc

Description

@nrc

In order not have a tonne of coherence errors, we currently do not unify unsized types with type variables in type inference. For example, [T] with U. This mimics our old behaviour where unsized types were not types.

This prevents us having an impl for &T which will use an impl for [T], i.e., we need a separate impl for &[T]. This is one of the primary benefits of DST. It also causes problems when the compiler needs to infer a DST for a type parameter, e.g., in function calls. See #17122 for one example.

Blocks #16918, #12938

Metadata

Metadata

Assignees

Labels

A-DSTsArea: Dynamically-sized types (DSTs)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions