Rollup merge of #103704 - xxchan:xxchan/applicable-bug, r=compiler-errors
Add a test for TAIT used with impl/dyn Trait inside RPIT close https://github.com/rust-lang/rust/issues/101750
This commit is contained in:
commit
cc8040e734
1 changed files with 37 additions and 0 deletions
37
src/test/ui/type-alias-impl-trait/issue-101750.rs
Normal file
37
src/test/ui/type-alias-impl-trait/issue-101750.rs
Normal file
|
@ -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() {}
|
Loading…
Add table
Add a link
Reference in a new issue