]> git.proxmox.com Git - rustc.git/blame - src/test/ui/default-associated-types.rs
New upstream version 1.40.0+dfsg1
[rustc.git] / src / test / ui / default-associated-types.rs
CommitLineData
416331ca
XL
1// run-pass
2
62682a34 3#![feature(associated_type_defaults)]
85aaf69f 4
54a0048b
SL
5trait Foo<T: Default + ToString> {
6 type Out: Default + ToString = T;
62682a34 7}
223e47cc 8
62682a34 9impl Foo<u32> for () {
62682a34
SL
10}
11
54a0048b
SL
12impl Foo<u64> for () {
13 type Out = bool;
62682a34
SL
14}
15
16fn main() {
54a0048b
SL
17 assert_eq!(
18 <() as Foo<u32>>::Out::default().to_string(),
19 "0");
20 assert_eq!(
21 <() as Foo<u64>>::Out::default().to_string(),
22 "false");
62682a34 23}