File tree 2 files changed +8
-1
lines changed
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> {
3828
3828
/// for examples of where this comes up,.
3829
3829
fn rvalue_hint ( tcx : & ty:: ctxt < ' tcx > , ty : Ty < ' tcx > ) -> Expectation < ' tcx > {
3830
3830
match tcx. struct_tail ( ty) . sty {
3831
- ty:: TySlice ( _) | ty:: TyTrait ( ..) => {
3831
+ ty:: TySlice ( _) | ty:: TyStr | ty :: TyTrait ( ..) => {
3832
3832
ExpectRvalueLikeUnsized ( ty)
3833
3833
}
3834
3834
_ => ExpectHasType ( ty)
Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ pub fn main() {
44
44
let _: & Debug = & if true { false } else { true } ;
45
45
let _: & Debug = & match true { true => 'a' , false => 'b' } ;
46
46
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
+
47
54
let _: Box < [ isize ] > = Box :: new ( [ 1 , 2 , 3 ] ) ;
48
55
let _: Box < Fn ( isize ) -> _ > = Box :: new ( |x| ( x as u8 ) ) ;
49
56
You can’t perform that action at this time.
0 commit comments