-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #103704 - xxchan:xxchan/applicable-bug, r=compiler-er…
…rors Add a test for TAIT used with impl/dyn Trait inside RPIT close #101750
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |