File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,11 @@ impl<'a> JitEngine {
105
105
let sig = function. get_signature ( ) ;
106
106
assert_eq ! ( Type :: get:: <R >( ctx) , sig. get_return( ) ) ;
107
107
let arg = Type :: get :: < A > ( ctx) ;
108
- if let Some ( args) = StructType :: cast ( arg) {
109
- assert_eq ! ( sig . get_params ( ) , args. get_elements( ) ) ;
108
+ assert_eq ! ( sig . get_params ( ) , if let Some ( args) = StructType :: cast( arg) {
109
+ args. get_elements( )
110
110
} else {
111
- assert_eq ! ( arg, sig . get_return ( ) ) ;
112
- }
111
+ vec! [ arg]
112
+ } ) ;
113
113
}
114
114
unsafe {
115
115
cb ( self . get_function :: < A , R > ( function) ) ;
Original file line number Diff line number Diff line change @@ -6,11 +6,12 @@ use context::{Context, GetContext};
6
6
use target:: TargetData ;
7
7
use util:: { self , CastFrom } ;
8
8
use std:: { fmt, mem} ;
9
+ use std:: marker:: PhantomData ;
9
10
use std:: iter:: Iterator ;
10
11
use std:: ops:: Deref ;
11
12
12
13
/// Defines how a value should be laid out in memory.
13
- pub struct Type ;
14
+ pub struct Type ( PhantomData < [ u8 ] > ) ;
14
15
native_ref ! ( & Type = LLVMTypeRef ) ;
15
16
impl Type {
16
17
#[ inline( always) ]
@@ -105,7 +106,7 @@ impl StructType {
105
106
} )
106
107
}
107
108
/// Returns the elements that make up this struct.
108
- pub fn get_elements ( & self ) -> Vec < Type > {
109
+ pub fn get_elements ( & self ) -> Vec < & Type > {
109
110
unsafe {
110
111
let size = core:: LLVMCountStructElementTypes ( self . into ( ) ) ;
111
112
let mut els: Vec < _ > = ( 0 ..size) . map ( |_| mem:: uninitialized ( ) ) . collect ( ) ;
You can’t perform that action at this time.
0 commit comments