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.
3
3
4
4
#![ feature( more_qualified_paths) ]
5
5
6
- //@ check-pass
7
6
fn 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 ) ;
10
9
}
11
10
12
- struct StructStruct {
13
- br : i8 ,
11
+ struct Struct {
12
+ field : i8 ,
14
13
}
15
14
16
- struct Foo ;
15
+ struct Type ;
17
16
18
- trait A {
17
+ trait Trait {
19
18
type Assoc ;
20
19
}
21
20
22
- impl A for Foo {
23
- type Assoc = StructStruct ;
21
+ impl Trait for Type {
22
+ type Assoc = Struct ;
24
23
}
You can’t perform that action at this time.
0 commit comments