Skip to content

Commit 8bdb3e1

Browse files
committed
fix run-pass test
1 parent cfce351 commit 8bdb3e1

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/test/run-pass/rfc1623.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,32 @@ const SOME_EXPLICIT_CONST_STR : &'static str = "&'static str";
2222
fn id_u8_slice(arg: &[u8]) -> &[u8] { arg }
2323

2424
// one with a function, argument elided
25-
static SOME_STATIC_SIMPLE_FN : &fn(&[u8]) -> &[u8] = id_u8_slice;
26-
const SOME_CONST_SIMPLE_FN : &fn(&[u8]) -> &[u8] = id_u8_slice;
25+
static SOME_STATIC_SIMPLE_FN : &fn(&[u8]) -> &[u8] =
26+
&(id_u8_slice as fn(&[u8]) -> &[u8]);
27+
const SOME_CONST_SIMPLE_FN : &fn(&[u8]) -> &[u8] =
28+
&(id_u8_slice as fn(&[u8]) -> &[u8]);
2729

2830
// this should be the same as without elision
29-
static SOME_STATIC_NON_ELIDED_fN : &fn<'a>(&'a [u8]) -> &'a [u8] = id_u8_slice;
30-
const SOME_CONST_NON_ELIDED_fN : &fn<'a>(&'a [u8]) -> &'a [u8] = id_u8_slice;
31+
static SOME_STATIC_NON_ELIDED_fN : &for<'a> fn(&'a [u8]) -> &'a [u8] =
32+
&(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]);
33+
const SOME_CONST_NON_ELIDED_fN : &for<'a> fn(&'a [u8]) -> &'a [u8] =
34+
&(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]);
3135

3236
// another function that elides, each to a different unbound lifetime
3337
fn multi_args(a: &u8, b: &u8, c: &u8) { }
3438

35-
static SOME_STATIC_MULTI_FN : &fn(&u8, &u8, &u8) = multi_args;
36-
const SOME_CONST_MULTI_FN : &fn(&u8, &u8, &u8) = multi_args;
39+
static SOME_STATIC_MULTI_FN : &fn(&u8, &u8, &u8) =
40+
&(multi_args as fn(&u8, &u8, &u8));
41+
const SOME_CONST_MULTI_FN : &fn(&u8, &u8, &u8) =
42+
&(multi_args as fn(&u8, &u8, &u8));
3743

3844

3945
fn main() {
4046
// make sure that the lifetime is actually elided (and not defaulted)
4147
let x = &[1u8, 2, 3];
4248
SOME_STATIC_SIMPLE_FN(x);
4349
SOME_CONST_SIMPLE_FN(x);
44-
50+
4551
// make sure this works with different lifetimes
4652
let a = &1;
4753
{

0 commit comments

Comments
 (0)