Skip to content

Interactions in type_alias_impl_trait and associated_type_defaults #71083

Open
@Centril

Description

@Centril

A question about impl Trait in trait type aliases: has any thought been given about how they should handle defaults?

I'm trying to do something like this, without success:

#![feature(type_alias_impl_trait, associated_type_defaults)]

use std::fmt::Debug;

struct Foo {
}

trait Bar {
    type T: Debug = impl Debug;
    fn bar() -> Self::T {
        ()
    }
}

impl Bar for Foo {
    type T = impl Debug;
    fn bar() -> Self::T {
        ()
    }
}

(playground link)

I'd guess this just hasn't been RFC'd yes, but does someone know if thought on the topic have already started?

Originally posted by @Ekleog in #63063 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.F-associated_type_defaults`#![feature(associated_type_defaults)]`F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`T-langRelevant to the language teamneeds-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    Status

    Can do after stabilization

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions