Trying to play with feature(type_alias_impl_trait) without success

⚓ Rust    📅 2025-06-19    👤 surdeus    👁️ 3      

surdeus

Warning

This post was published 55 days ago. The information described in this article may have changed.

Hello,
Here is the problem:

#![feature(type_alias_impl_trait)]

use std::fmt::Display;

type SomeDisplay = impl Display;

fn make_it() -> SomeDisplay {
    2
}

struct Example {
    it: SomeDisplay,
}

impl Example {
    fn make() -> Self {
        Example { it: make_it() }
    }
}

The error tells:
SomeDisplay must be used in combination with a concrete type within the same crate

Thank you in advance for your help.

2 posts - 2 participants

Read full topic

🏷️ rust_feed