auto merge of #19027 : nick29581/rust/coercions-4, r=alexcrichton
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
This commit is contained in:
@@ -177,10 +177,10 @@ fn test_encode_utf8() {
|
||||
assert_eq!(buf[..n], expect);
|
||||
}
|
||||
|
||||
check('x', [0x78]);
|
||||
check('\u00e9', [0xc3, 0xa9]);
|
||||
check('\ua66e', [0xea, 0x99, 0xae]);
|
||||
check('\U0001f4a9', [0xf0, 0x9f, 0x92, 0xa9]);
|
||||
check('x', &[0x78]);
|
||||
check('\u00e9', &[0xc3, 0xa9]);
|
||||
check('\ua66e', &[0xea, 0x99, 0xae]);
|
||||
check('\U0001f4a9', &[0xf0, 0x9f, 0x92, 0xa9]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -191,10 +191,10 @@ fn test_encode_utf16() {
|
||||
assert_eq!(buf[..n], expect);
|
||||
}
|
||||
|
||||
check('x', [0x0078]);
|
||||
check('\u00e9', [0x00e9]);
|
||||
check('\ua66e', [0xa66e]);
|
||||
check('\U0001f4a9', [0xd83d, 0xdca9]);
|
||||
check('x', &[0x0078]);
|
||||
check('\u00e9', &[0x00e9]);
|
||||
check('\ua66e', &[0xa66e]);
|
||||
check('\U0001f4a9', &[0xd83d, 0xdca9]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -627,7 +627,7 @@ fn test_random_access_zip() {
|
||||
#[test]
|
||||
fn test_random_access_take() {
|
||||
let xs = [1i, 2, 3, 4, 5];
|
||||
let empty: &[int] = [];
|
||||
let empty: &[int] = &[];
|
||||
check_randacc_iter(xs.iter().take(3), 3);
|
||||
check_randacc_iter(xs.iter().take(20), xs.len());
|
||||
check_randacc_iter(xs.iter().take(0), 0);
|
||||
@@ -637,7 +637,7 @@ fn test_random_access_take() {
|
||||
#[test]
|
||||
fn test_random_access_skip() {
|
||||
let xs = [1i, 2, 3, 4, 5];
|
||||
let empty: &[int] = [];
|
||||
let empty: &[int] = &[];
|
||||
check_randacc_iter(xs.iter().skip(2), xs.len() - 2);
|
||||
check_randacc_iter(empty.iter().skip(2), 0);
|
||||
}
|
||||
@@ -669,7 +669,7 @@ fn test_random_access_map() {
|
||||
#[test]
|
||||
fn test_random_access_cycle() {
|
||||
let xs = [1i, 2, 3, 4, 5];
|
||||
let empty: &[int] = [];
|
||||
let empty: &[int] = &[];
|
||||
check_randacc_iter(xs.iter().cycle().take(27), 27);
|
||||
check_randacc_iter(empty.iter().cycle(), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user