@@ -30,11 +30,9 @@ use std::ops::ControlFlow;
3030
3131const CRATE_NAME : & str = "input" ;
3232
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 < ( ) > {
3635 let items = stable_mir:: all_local_items ( ) ;
37-
3836 let body = get_item ( & items, ( DefKind :: Fn , "projections" ) ) . unwrap ( ) . body ( ) ;
3937 assert_eq ! ( body. blocks. len( ) , 4 ) ;
4038 // 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<()> {
4745 // We can't match on vecs, only on slices. Comparing statements for equality wouldn't be
4846 // any easier since we'd then have to add in the expected local and region values
4947 // instead of matching on wildcards.
50- assert_matches ! ( local_proj[ .. ] , [ ] ) ;
48+ assert ! ( local_proj. is_empty ( ) ) ;
5149 match & r_proj[ ..] {
5250 // Similarly we can't match against a type, only against its kind.
5351 [ ProjectionElem :: Deref , ProjectionElem :: Field ( 2 , ty) ] => assert_matches ! (
@@ -80,7 +78,7 @@ fn test_projections(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
8078 // We can't match on vecs, only on slices. Comparing for equality wouldn't be any easier
8179 // since we'd then have to add in the expected local values instead of matching on
8280 // wildcards.
83- assert_matches ! ( local_proj[ .. ] , [ ] ) ;
81+ assert ! ( local_proj. is_empty ( ) ) ;
8482 assert_matches ! ( r_proj[ ..] , [ ProjectionElem :: Deref , ProjectionElem :: Index ( _) ] ) ;
8583 }
8684 other => panic ! (
@@ -108,8 +106,8 @@ fn test_projections(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
108106 projection : arg2_proj,
109107 } ) ,
110108 ] => {
111- assert_matches ! ( arg1_proj[ .. ] , [ ] ) ;
112- assert_matches ! ( arg2_proj[ .. ] , [ ] ) ;
109+ assert ! ( arg1_proj. is_empty ( ) ) ;
110+ assert ! ( arg2_proj. is_empty ( ) ) ;
113111 }
114112 other => {
115113 panic ! (
0 commit comments