Skip to content

Add a derive! macro to utilise deriving sugar outside Struct/Enum definition #12409

Closed
@bharrisau

Description

@bharrisau

Not sure if this is the correct solution, but I'm looking at untangling libstd so it can be built freestanding.

The deriving syntax is good, but if you want to make part of it conditional you can't. Looking at #11968, Eq and Clone have to be done with the impl written out in full, be easier to do

derive!(marker::CovariantType<T>, (Eq, Clone))

And if libprim is replaced with #[cfg] tags, you can do

#[lang="covariant_type"]
pub struct CovariantType<T>;

#[cfg(with_alloc)] derive!(CovariantType<T>, (Eq, Clone))

Or maybe these should just be written out in full?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions