about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-04-19 15:57:31 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-04-19 15:57:31 -0700
commitdcea71720852cf6b7d682d6caa054a2d6fb96068 (patch)
tree77fce57400f1dde62ca8f45bff2da256c11b8767
parentf93b3cd5c3783eabd527607adda891d8a84dab4f (diff)
downloadrust-dcea71720852cf6b7d682d6caa054a2d6fb96068.tar.gz
rust-dcea71720852cf6b7d682d6caa054a2d6fb96068.zip
librustc: Fix botched merge. rs=merge
-rw-r--r--src/libcore/vec.rs9
-rw-r--r--src/librustc/middle/trans/reflect.rs8
-rw-r--r--src/libsyntax/parse/token.rs8
3 files changed, 19 insertions, 6 deletions
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 0d612369cc5..efb11271af6 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -1976,6 +1976,7 @@ pub trait ImmutableVector<'self, T> {
     fn alli(&self, f: &fn(uint, t: &T) -> bool) -> bool;
     fn flat_map<U>(&self, f: &fn(t: &T) -> ~[U]) -> ~[U];
     fn filter_mapped<U:Copy>(&self, f: &fn(t: &T) -> Option<U>) -> ~[U];
+    unsafe fn unsafe_ref(&self, index: uint) -> *T;
 }
 
 /// Extension methods for vectors
@@ -2097,6 +2098,14 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
     fn filter_mapped<U:Copy>(&self, f: &fn(t: &T) -> Option<U>) -> ~[U] {
         filter_mapped(*self, f)
     }
+
+    /// Returns a pointer to the element at the given index, without doing
+    /// bounds checking.
+    #[inline(always)]
+    unsafe fn unsafe_ref(&self, index: uint) -> *T {
+        let (ptr, _): (*T, uint) = transmute(*self);
+        ptr.offset(index)
+    }
 }
 
 pub trait ImmutableEqVector<T:Eq> {
diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs
index e62e19f636a..30c14ab679f 100644
--- a/src/librustc/middle/trans/reflect.rs
+++ b/src/librustc/middle/trans/reflect.rs
@@ -288,11 +288,15 @@ pub impl Reflector {
                 let arg = unsafe {
                     llvm::LLVMGetParam(llfdecl, first_real_arg as c_uint)
                 };
-                let fcx = new_fn_ctxt(ccx, ~[], llfdecl, None);
+                let fcx = new_fn_ctxt(ccx,
+                                      ~[],
+                                      llfdecl,
+                                      ty::mk_uint(ccx.tcx),
+                                      None);
                 let bcx = top_scope_block(fcx, None);
                 let arg = BitCast(bcx, arg, llptrty);
                 let ret = adt::trans_get_discr(bcx, repr, arg);
-                Store(bcx, ret, fcx.llretptr);
+                Store(bcx, ret, fcx.llretptr.get());
                 cleanup_and_Br(bcx, bcx, fcx.llreturn);
                 finish_fn(fcx, bcx.llbb);
                 llfdecl
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index b94b53076ec..2483cacd1a6 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -376,10 +376,10 @@ pub struct ident_interner {
 
 pub impl ident_interner {
     fn intern(&self, val: @~str) -> ast::ident {
-        ast::ident { repr: self.interner.intern(val), ctxt: 0}
+        ast::ident { repr: self.interner.intern(val), ctxt: 0 }
     }
     fn gensym(&self, val: @~str) -> ast::ident {
-        ast::ident { repr: self.interner.gensym(val), ctxt: 0}
+        ast::ident { repr: self.interner.gensym(val), ctxt: 0 }
     }
     fn get(&self, idx: ast::ident) -> @~str {
         self.interner.get(idx.repr)
@@ -388,9 +388,9 @@ pub impl ident_interner {
         self.interner.len()
     }
     fn find_equiv<Q:Hash + IterBytes + Equiv<@~str>>(&self, val: &Q)
-                                                  -> Option<ast::ident> {
+                                                     -> Option<ast::ident> {
         match self.interner.find_equiv(val) {
-            Some(v) => Some(ast::ident { repr: v }),
+            Some(v) => Some(ast::ident { repr: v, ctxt: 0 }),
             None => None,
         }
     }