Skip to content

Commit dcea717

Browse files
committed
librustc: Fix botched merge. rs=merge
1 parent f93b3cd commit dcea717

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

src/libcore/vec.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,6 +1976,7 @@ pub trait ImmutableVector<'self, T> {
19761976
fn alli(&self, f: &fn(uint, t: &T) -> bool) -> bool;
19771977
fn flat_map<U>(&self, f: &fn(t: &T) -> ~[U]) -> ~[U];
19781978
fn filter_mapped<U:Copy>(&self, f: &fn(t: &T) -> Option<U>) -> ~[U];
1979+
unsafe fn unsafe_ref(&self, index: uint) -> *T;
19791980
}
19801981

19811982
/// Extension methods for vectors
@@ -2097,6 +2098,14 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
20972098
fn filter_mapped<U:Copy>(&self, f: &fn(t: &T) -> Option<U>) -> ~[U] {
20982099
filter_mapped(*self, f)
20992100
}
2101+
2102+
/// Returns a pointer to the element at the given index, without doing
2103+
/// bounds checking.
2104+
#[inline(always)]
2105+
unsafe fn unsafe_ref(&self, index: uint) -> *T {
2106+
let (ptr, _): (*T, uint) = transmute(*self);
2107+
ptr.offset(index)
2108+
}
21002109
}
21012110

21022111
pub trait ImmutableEqVector<T:Eq> {

src/librustc/middle/trans/reflect.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,15 @@ pub impl Reflector {
288288
let arg = unsafe {
289289
llvm::LLVMGetParam(llfdecl, first_real_arg as c_uint)
290290
};
291-
let fcx = new_fn_ctxt(ccx, ~[], llfdecl, None);
291+
let fcx = new_fn_ctxt(ccx,
292+
~[],
293+
llfdecl,
294+
ty::mk_uint(ccx.tcx),
295+
None);
292296
let bcx = top_scope_block(fcx, None);
293297
let arg = BitCast(bcx, arg, llptrty);
294298
let ret = adt::trans_get_discr(bcx, repr, arg);
295-
Store(bcx, ret, fcx.llretptr);
299+
Store(bcx, ret, fcx.llretptr.get());
296300
cleanup_and_Br(bcx, bcx, fcx.llreturn);
297301
finish_fn(fcx, bcx.llbb);
298302
llfdecl

src/libsyntax/parse/token.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,10 @@ pub struct ident_interner {
376376
377377
pub impl ident_interner {
378378
fn intern(&self, val: @~str) -> ast::ident {
379-
ast::ident { repr: self.interner.intern(val), ctxt: 0}
379+
ast::ident { repr: self.interner.intern(val), ctxt: 0 }
380380
}
381381
fn gensym(&self, val: @~str) -> ast::ident {
382-
ast::ident { repr: self.interner.gensym(val), ctxt: 0}
382+
ast::ident { repr: self.interner.gensym(val), ctxt: 0 }
383383
}
384384
fn get(&self, idx: ast::ident) -> @~str {
385385
self.interner.get(idx.repr)
@@ -388,9 +388,9 @@ pub impl ident_interner {
388388
self.interner.len()
389389
}
390390
fn find_equiv<Q:Hash + IterBytes + Equiv<@~str>>(&self, val: &Q)
391-
-> Option<ast::ident> {
391+
-> Option<ast::ident> {
392392
match self.interner.find_equiv(val) {
393-
Some(v) => Some(ast::ident { repr: v }),
393+
Some(v) => Some(ast::ident { repr: v, ctxt: 0 }),
394394
None => None,
395395
}
396396
}

0 commit comments

Comments
 (0)