Skip to content

For types which implement Deref, change some methods to associated functions? #210

@joshlf

Description

@joshlf

We have some types (such as Ref and Unalign) which implement Deref, and which provide methods (such as into_ref). This conflicts with the standard library's pattern of preferring associated functions over methods on types which implement Deref (e.g., Box::into_raw). This pattern is well-motivated: When a method is called on a Deref type, it is resolved on both the type itself and the target type (e.g., on both Box<T> and on T), and so methods on the type itself (Box<T>) can conflict with those on the target type (T). We should consider adopting this pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocking-next-releaseThis issue should be resolved before we release on crates.iocompatibility-breakingChanges that are (likely to be) breaking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions