@@ -30,11 +30,9 @@ use std::ops::ControlFlow;
30
30
31
31
const CRATE_NAME : & str = "input" ;
32
32
33
- /// This function uses the Stable MIR APIs to get information about the test crate.
34
- fn test_projections ( _tcx : TyCtxt < ' _ > ) -> ControlFlow < ( ) > {
35
- // Find items in the local crate.
33
+ /// Tests projections within Place objects
34
+ fn test_place_projections ( _tcx : TyCtxt < ' _ > ) -> ControlFlow < ( ) > {
36
35
let items = stable_mir:: all_local_items ( ) ;
37
-
38
36
let body = get_item ( & items, ( DefKind :: Fn , "projections" ) ) . unwrap ( ) . body ( ) ;
39
37
assert_eq ! ( body. blocks. len( ) , 4 ) ;
40
38
// The first statement assigns `&s.c` to a local. The projections include a deref for `s`, since
@@ -47,7 +45,7 @@ fn test_projections(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
47
45
// We can't match on vecs, only on slices. Comparing statements for equality wouldn't be
48
46
// any easier since we'd then have to add in the expected local and region values
49
47
// instead of matching on wildcards.
50
- assert_matches ! ( local_proj[ .. ] , [ ] ) ;
48
+ assert ! ( local_proj. is_empty ( ) ) ;
51
49
match & r_proj[ ..] {
52
50
// Similarly we can't match against a type, only against its kind.
53
51
[ ProjectionElem :: Deref , ProjectionElem :: Field ( 2 , ty) ] => assert_matches ! (
@@ -80,7 +78,7 @@ fn test_projections(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
80
78
// We can't match on vecs, only on slices. Comparing for equality wouldn't be any easier
81
79
// since we'd then have to add in the expected local values instead of matching on
82
80
// wildcards.
83
- assert_matches ! ( local_proj[ .. ] , [ ] ) ;
81
+ assert ! ( local_proj. is_empty ( ) ) ;
84
82
assert_matches ! ( r_proj[ ..] , [ ProjectionElem :: Deref , ProjectionElem :: Index ( _) ] ) ;
85
83
}
86
84
other => panic ! (
@@ -108,8 +106,8 @@ fn test_projections(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
108
106
projection : arg2_proj,
109
107
} ) ,
110
108
] => {
111
- assert_matches ! ( arg1_proj[ .. ] , [ ] ) ;
112
- assert_matches ! ( arg2_proj[ .. ] , [ ] ) ;
109
+ assert ! ( arg1_proj. is_empty ( ) ) ;
110
+ assert ! ( arg2_proj. is_empty ( ) ) ;
113
111
}
114
112
other => {
115
113
panic ! (
0 commit comments