From e71571a3cda0f7a283bd58a1c74a79c06de27661 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 15 Jan 2014 19:35:38 -0500 Subject: [PATCH] Use as_slice() method on option --- src/librustc/middle/trans/foreign.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index ea9f608ff56..8711932bdd2 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -282,20 +282,20 @@ pub fn trans_native_call<'a>( // FIXME(#8357) We really ought to report a span here ccx.sess.fatal( format!("ABI string `{}` has no suitable ABI \ - for target architecture", - fn_abis.user_string(ccx.tcx))); + for target architecture", + fn_abis.user_string(ccx.tcx))); } }; // A function pointer is called without the declaration available, so we have to apply // any attributes with ABI implications directly to the call instruction. Right now, the // only attribute we need to worry about is `sret`. - let sret_attr = [(1, StructRetAttribute)]; - let attrs = if fn_type.ret_ty.is_indirect() { - sret_attr.as_slice() + let sret_attr = if fn_type.ret_ty.is_indirect() { + Some((1, StructRetAttribute)) } else { - &[] + None }; + let attrs = sret_attr.as_slice(); let llforeign_retval = CallWithConv(bcx, llfn, llargs_foreign, cc, attrs); // If the function we just called does not use an outpointer,