File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -3828,7 +3828,7 @@ impl<'tcx> Expectation<'tcx> {
38283828 /// for examples of where this comes up,.
38293829 fn rvalue_hint ( tcx : & ty:: ctxt < ' tcx > , ty : Ty < ' tcx > ) -> Expectation < ' tcx > {
38303830 match tcx. struct_tail ( ty) . sty {
3831- ty:: TySlice ( _) | ty:: TyTrait ( ..) => {
3831+ ty:: TySlice ( _) | ty:: TyStr | ty :: TyTrait ( ..) => {
38323832 ExpectRvalueLikeUnsized ( ty)
38333833 }
38343834 _ => ExpectHasType ( ty)
Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ pub fn main() {
4444 let _: & Debug = & if true { false } else { true } ;
4545 let _: & Debug = & match true { true => 'a' , false => 'b' } ;
4646
47+ let _: & str = & { String :: new ( ) } ;
48+ let _: & str = & if true { String :: from ( "..." ) } else { 5 . to_string ( ) } ;
49+ let _: & str = & match true {
50+ true => format ! ( "{}" , false ) ,
51+ false => [ "x" , "y" ] . join ( "+" )
52+ } ;
53+
4754 let _: Box < [ isize ] > = Box :: new ( [ 1 , 2 , 3 ] ) ;
4855 let _: Box < Fn ( isize ) -> _ > = Box :: new ( |x| ( x as u8 ) ) ;
4956
You can’t perform that action at this time.
0 commit comments