Skip to content

Commit

Permalink
fix run-pass test
Browse files Browse the repository at this point in the history
  • Loading branch information
llogiq committed Aug 23, 2016
1 parent cfce351 commit 8bdb3e1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/test/run-pass/rfc1623.rs
Expand Up @@ -22,26 +22,32 @@ const SOME_EXPLICIT_CONST_STR : &'static str = "&'static str";
fn id_u8_slice(arg: &[u8]) -> &[u8] { arg }

// one with a function, argument elided
static SOME_STATIC_SIMPLE_FN : &fn(&[u8]) -> &[u8] = id_u8_slice;
const SOME_CONST_SIMPLE_FN : &fn(&[u8]) -> &[u8] = id_u8_slice;
static SOME_STATIC_SIMPLE_FN : &fn(&[u8]) -> &[u8] =
&(id_u8_slice as fn(&[u8]) -> &[u8]);
const SOME_CONST_SIMPLE_FN : &fn(&[u8]) -> &[u8] =
&(id_u8_slice as fn(&[u8]) -> &[u8]);

// this should be the same as without elision
static SOME_STATIC_NON_ELIDED_fN : &fn<'a>(&'a [u8]) -> &'a [u8] = id_u8_slice;
const SOME_CONST_NON_ELIDED_fN : &fn<'a>(&'a [u8]) -> &'a [u8] = id_u8_slice;
static SOME_STATIC_NON_ELIDED_fN : &for<'a> fn(&'a [u8]) -> &'a [u8] =
&(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]);
const SOME_CONST_NON_ELIDED_fN : &for<'a> fn(&'a [u8]) -> &'a [u8] =
&(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]);

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

static SOME_STATIC_MULTI_FN : &fn(&u8, &u8, &u8) = multi_args;
const SOME_CONST_MULTI_FN : &fn(&u8, &u8, &u8) = multi_args;
static SOME_STATIC_MULTI_FN : &fn(&u8, &u8, &u8) =
&(multi_args as fn(&u8, &u8, &u8));
const SOME_CONST_MULTI_FN : &fn(&u8, &u8, &u8) =
&(multi_args as fn(&u8, &u8, &u8));


fn main() {
// make sure that the lifetime is actually elided (and not defaulted)
let x = &[1u8, 2, 3];
SOME_STATIC_SIMPLE_FN(x);
SOME_CONST_SIMPLE_FN(x);

// make sure this works with different lifetimes
let a = &1;
{
Expand Down

0 comments on commit 8bdb3e1

Please sign in to comment.