File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use std::cell::RefCell;
66use std:: rc:: Rc ;
77
88fn t1 ( ) -> Vec < i8 > {
9- Vec :: new ( )
9+ vec ! [ 0 ]
1010}
1111
1212fn t2 ( ) -> Ptr < i8 > {
Original file line number Diff line number Diff line change 22// Distributed under the MIT license that can be found in the LICENSE file.
33
44fn t1 ( ) -> Vec < libc:: c_char > {
5- Vec :: new ( )
5+ vec ! [ 0 ]
66}
77
88fn t2 ( ) -> * mut libc:: c_char {
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ pub fn main() {
1111 std:: process:: exit ( main_0 ( ) ) ;
1212}
1313fn main_0 ( ) -> i32 {
14+ let mut empty: Vec < i8 > = vec ! [ 0 ] ;
15+ assert ! ( ( ( empty. len( ) - 1 ) == 0_usize ) ) ;
1416 let s1: Value < Vec < i8 > > = Rc :: new ( RefCell :: new ( {
1517 let mut __bytes = Ptr :: < i8 > :: from_string_literal ( b"hello" ) . to_c_bytes ( ) ;
1618 __bytes. push ( 0 ) ;
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ pub fn main() {
1313 }
1414}
1515unsafe fn main_0 ( ) -> i32 {
16+ let mut empty: Vec < libc:: c_char > = vec ! [ 0 ] ;
17+ assert ! ( ( ( empty. len( ) - 1 ) == ( 0_usize ) ) ) ;
1618 let mut s1: Vec < libc:: c_char > = {
1719 let s = c"hello" . as_ptr ( ) ;
1820 std:: slice:: from_raw_parts ( s, ( 0 ..) . take_while ( |& i| * s. add ( i) != 0 ) . count ( ) + 1 ) . to_vec ( )
Original file line number Diff line number Diff line change 33#include < string>
44
55int main () {
6+ std::string empty;
7+ assert (empty.length () == 0 );
68 std::string s1 = " hello" ;
79 assert (s1.length () == 5 );
810 assert (s1.size () == s1.length ());
You can’t perform that action at this time.
0 commit comments