Skip to content

Commit 1338340

Browse files
committed
Replace 'region' with 'lifetime' in a few transmute function names
1 parent 2f79054 commit 1338340

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/doc/guide-unsafe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use std::cast;
7070
let mut x: u8 = 1;
7171
7272
let ref_1: &mut u8 = &mut x;
73-
let ref_2: &mut u8 = unsafe { cast::transmute_mut_region(ref_1) };
73+
let ref_2: &mut u8 = unsafe { cast::transmute_mut_lifetime(ref_1) };
7474
7575
// oops, ref_1 and ref_2 point to the same piece of data (x) and are
7676
// both usable

src/libarena/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
extern crate collections;
2828

29-
use std::cast::{transmute, transmute_mut, transmute_mut_region};
29+
use std::cast::{transmute, transmute_mut, transmute_mut_lifetime};
3030
use std::cast;
3131
use std::cell::{Cell, RefCell};
3232
use std::mem;
@@ -186,7 +186,7 @@ impl Arena {
186186
#[inline]
187187
fn alloc_copy_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
188188
unsafe {
189-
let this = transmute_mut_region(self);
189+
let this = transmute_mut_lifetime(self);
190190
let start = round_up(this.copy_head.fill.get(), align);
191191
let end = start + n_bytes;
192192
if end > self.chunk_size() {
@@ -233,7 +233,7 @@ impl Arena {
233233
let after_tydesc;
234234

235235
{
236-
let head = transmute_mut_region(&mut self.head);
236+
let head = transmute_mut_lifetime(&mut self.head);
237237

238238
tydesc_start = head.fill.get();
239239
after_tydesc = head.fill.get() + mem::size_of::<*TyDesc>();
@@ -245,7 +245,7 @@ impl Arena {
245245
return self.alloc_noncopy_grow(n_bytes, align);
246246
}
247247

248-
let head = transmute_mut_region(&mut self.head);
248+
let head = transmute_mut_lifetime(&mut self.head);
249249
head.fill.set(round_up(end, mem::pref_align_of::<*TyDesc>()));
250250

251251
//debug!("idx = {}, size = {}, align = {}, fill = {}",

src/libgreen/sched.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ impl Scheduler {
630630
unsafe {
631631

632632
let sched: &mut Scheduler =
633-
cast::transmute_mut_region(*next_task.sched.get_mut_ref());
633+
cast::transmute_mut_lifetime(*next_task.sched.get_mut_ref());
634634

635635
let current_task: &mut GreenTask = match sched.cleanup_job {
636636
Some(CleanupJob { task: ref mut task, .. }) => &mut **task,
@@ -681,8 +681,8 @@ impl Scheduler {
681681
let next_task_context =
682682
&mut next_task.coroutine.get_mut_ref().saved_context;
683683
unsafe {
684-
(cast::transmute_mut_region(current_task_context),
685-
cast::transmute_mut_region(next_task_context))
684+
(cast::transmute_mut_lifetime(current_task_context),
685+
cast::transmute_mut_lifetime(next_task_context))
686686
}
687687
}
688688

src/libstd/cast.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ pub unsafe fn transmute<L, G>(thing: L) -> G {
6363
#[inline]
6464
pub unsafe fn transmute_mut<'a,T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
6565

66-
/// Coerce a reference to have an arbitrary associated region.
66+
/// Coerce a reference to have an arbitrary associated lifetime.
6767
#[inline]
68-
pub unsafe fn transmute_region<'a,'b,T>(ptr: &'a T) -> &'b T {
68+
pub unsafe fn transmute_lifetime<'a,'b,T>(ptr: &'a T) -> &'b T {
6969
transmute(ptr)
7070
}
7171

@@ -75,28 +75,28 @@ pub unsafe fn transmute_mut_unsafe<T>(ptr: *T) -> *mut T {
7575
transmute(ptr)
7676
}
7777

78-
/// Coerce a mutable reference to have an arbitrary associated region.
78+
/// Coerce a mutable reference to have an arbitrary associated lifetime.
7979
#[inline]
80-
pub unsafe fn transmute_mut_region<'a,'b,T>(ptr: &'a mut T) -> &'b mut T {
80+
pub unsafe fn transmute_mut_lifetime<'a,'b,T>(ptr: &'a mut T) -> &'b mut T {
8181
transmute(ptr)
8282
}
8383

8484
/// Transforms lifetime of the second pointer to match the first.
8585
#[inline]
8686
pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
87-
transmute_region(ptr)
87+
transmute_lifetime(ptr)
8888
}
8989

9090
/// Transforms lifetime of the second pointer to match the first.
9191
#[inline]
9292
pub unsafe fn copy_mut_lifetime<'a,S,T>(_ptr: &'a mut S, ptr: &mut T) -> &'a mut T {
93-
transmute_mut_region(ptr)
93+
transmute_mut_lifetime(ptr)
9494
}
9595

9696
/// Transforms lifetime of the second pointer to match the first.
9797
#[inline]
9898
pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
99-
transmute_region(ptr)
99+
transmute_lifetime(ptr)
100100
}
101101

102102

0 commit comments

Comments
 (0)