File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
tests/ui/associated-types Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 1- // Make sure that users can construct structs through associated types
2- // in both expressions and patterns
1+ // Check that fully qualified syntax can be used in struct expressions in patterns.
2+ // In other words, check that structs can constructed and destructed via an associated type.
33
44#![ feature( more_qualified_paths) ]
55
6- //@ check-pass
76fn main ( ) {
8- let <Foo as A >:: Assoc { br } = <Foo as A >:: Assoc { br : 2 } ;
9- assert ! ( br == 2 ) ;
7+ let <Type as Trait >:: Assoc { field } = <Type as Trait >:: Assoc { field : 2 } ;
8+ assert_eq ! ( field , 2 ) ;
109}
1110
12- struct StructStruct {
13- br : i8 ,
11+ struct Struct {
12+ field : i8 ,
1413}
1514
16- struct Foo ;
15+ struct Type ;
1716
18- trait A {
17+ trait Trait {
1918 type Assoc ;
2019}
2120
22- impl A for Foo {
23- type Assoc = StructStruct ;
21+ impl Trait for Type {
22+ type Assoc = Struct ;
2423}
You can’t perform that action at this time.
0 commit comments