Skip to content

Add a test for TAIT used with impl/dyn Trait inside RPIT #103704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-101750.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#![feature(type_alias_impl_trait)]

// check-pass

trait Trait {}

type TAIT = impl Trait;

struct Concrete;
impl Trait for Concrete {}

fn tait() -> TAIT {
Concrete
}

trait OuterTrait {
type Item;
}
struct Dummy<T> {
t: T,
}
impl<T> OuterTrait for Dummy<T> {
type Item = T;
}

fn tait_and_impl_trait() -> impl OuterTrait<Item = (TAIT, impl Trait)> {
Dummy {
t: (tait(), Concrete),
}
}

fn tait_and_dyn_trait() -> impl OuterTrait<Item = (TAIT, Box<dyn Trait>)> {
let b: Box<dyn Trait> = Box::new(Concrete);
Dummy { t: (tait(), b) }
}

fn main() {}