(index<- ) ./libstd/intrinsics.rs
git branch: * master c7553ea auto merge of #13609 : richo/rust/str-type-vim, r=alexcrichton
modified: Sat Apr 19 11:22:39 2014
1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 /*! rustc compiler intrinsics.
12
13 The corresponding definitions are in librustc/middle/trans/foreign.rs.
14
15 # Volatiles
16
17 The volatile intrinsics provide operations intended to act on I/O
18 memory, which are guaranteed to not be reordered by the compiler
19 across other volatile intrinsics. See the LLVM documentation on
20 [[volatile]].
21
22 [volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
23
24 # Atomics
25
26 The atomic intrinsics provide common atomic operations on machine
27 words, with multiple possible memory orderings. They obey the same
28 semantics as C++11. See the LLVM documentation on [[atomics]].
29
30 [atomics]: http://llvm.org/docs/Atomics.html
31
32 A quick refresher on memory ordering:
33
34 * Acquire - a barrier for acquiring a lock. Subsequent reads and writes
35 take place after the barrier.
36 * Release - a barrier for releasing a lock. Preceding reads and writes
37 take place before the barrier.
38 * Sequentially consistent - sequentially consistent operations are
39 guaranteed to happen in order. This is the standard mode for working
40 with atomic types and is equivalent to Java's `volatile`.
41
42 */
43
44 #![allow(missing_doc)]
45
46 // This is needed to prevent duplicate lang item definitions.
47 #[cfg(test)]
48 pub use realstd::intrinsics::{TyDesc, Opaque, TyVisitor, TypeId};
49
50 pub type GlueFn = extern "Rust" fn(*i8);
51
52 #[lang="ty_desc"]
53 #[cfg(not(test))]
54 pub struct TyDesc {
55 // sizeof(T)
56 pub size: uint,
57
58 // alignof(T)
59 pub align: uint,
60
61 // Called when a value of type `T` is no longer needed
62 pub drop_glue: GlueFn,
63
64 // Called by reflection visitor to visit a value of type `T`
65 pub visit_glue: GlueFn,
66
67 // Name corresponding to the type
68 pub name: &'static str,
69 }
70
71 #[lang="opaque"]
72 #[cfg(not(test))]
73 pub enum Opaque { }
74
75 pub type Disr = u64;
76
77 #[lang="ty_visitor"]
78 #[cfg(not(test))]
79 pub trait TyVisitor {
80 fn visit_bot(&mut self) -> bool;
81 fn visit_nil(&mut self) -> bool;
82 fn visit_bool(&mut self) -> bool;
83
84 fn visit_int(&mut self) -> bool;
85 fn visit_i8(&mut self) -> bool;
86 fn visit_i16(&mut self) -> bool;
87 fn visit_i32(&mut self) -> bool;
88 fn visit_i64(&mut self) -> bool;
89
90 fn visit_uint(&mut self) -> bool;
91 fn visit_u8(&mut self) -> bool;
92 fn visit_u16(&mut self) -> bool;
93 fn visit_u32(&mut self) -> bool;
94 fn visit_u64(&mut self) -> bool;
95
96 fn visit_f32(&mut self) -> bool;
97 fn visit_f64(&mut self) -> bool;
98
99 fn visit_char(&mut self) -> bool;
100
101 fn visit_estr_box(&mut self) -> bool;
102 fn visit_estr_uniq(&mut self) -> bool;
103 fn visit_estr_slice(&mut self) -> bool;
104 fn visit_estr_fixed(&mut self, n: uint, sz: uint, align: uint) -> bool;
105
106 fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
107 fn visit_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
108 fn visit_ptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
109 fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
110
111 fn visit_evec_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
112 fn visit_evec_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
113 fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
114 fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
115 mtbl: uint, inner: *TyDesc) -> bool;
116
117 fn visit_enter_rec(&mut self, n_fields: uint,
118 sz: uint, align: uint) -> bool;
119 fn visit_rec_field(&mut self, i: uint, name: &str,
120 mtbl: uint, inner: *TyDesc) -> bool;
121 fn visit_leave_rec(&mut self, n_fields: uint,
122 sz: uint, align: uint) -> bool;
123
124 fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
125 sz: uint, align: uint) -> bool;
126 fn visit_class_field(&mut self, i: uint, name: &str, named: bool,
127 mtbl: uint, inner: *TyDesc) -> bool;
128 fn visit_leave_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
129 sz: uint, align: uint) -> bool;
130
131 fn visit_enter_tup(&mut self, n_fields: uint,
132 sz: uint, align: uint) -> bool;
133 fn visit_tup_field(&mut self, i: uint, inner: *TyDesc) -> bool;
134 fn visit_leave_tup(&mut self, n_fields: uint,
135 sz: uint, align: uint) -> bool;
136
137 fn visit_enter_enum(&mut self, n_variants: uint,
138 get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
139 sz: uint, align: uint) -> bool;
140 fn visit_enter_enum_variant(&mut self, variant: uint,
141 disr_val: Disr,
142 n_fields: uint,
143 name: &str) -> bool;
144 fn visit_enum_variant_field(&mut self, i: uint, offset: uint, inner: *TyDesc) -> bool;
145 fn visit_leave_enum_variant(&mut self, variant: uint,
146 disr_val: Disr,
147 n_fields: uint,
148 name: &str) -> bool;
149 fn visit_leave_enum(&mut self, n_variants: uint,
150 get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
151 sz: uint, align: uint) -> bool;
152
153 fn visit_enter_fn(&mut self, purity: uint, proto: uint,
154 n_inputs: uint, retstyle: uint) -> bool;
155 fn visit_fn_input(&mut self, i: uint, mode: uint, inner: *TyDesc) -> bool;
156 fn visit_fn_output(&mut self, retstyle: uint, variadic: bool, inner: *TyDesc) -> bool;
157 fn visit_leave_fn(&mut self, purity: uint, proto: uint,
158 n_inputs: uint, retstyle: uint) -> bool;
159
160 fn visit_trait(&mut self, name: &str) -> bool;
161 fn visit_param(&mut self, i: uint) -> bool;
162 fn visit_self(&mut self) -> bool;
163 }
164
165 extern "rust-intrinsic" {
166
167 // NB: These intrinsics take unsafe pointers because they mutate aliased
168 // memory, which is not valid for either `&` or `&mut`.
169
170 pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
171 pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
172 pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
173 pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
174 pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;
175
176 pub fn atomic_load<T>(src: *T) -> T;
177 pub fn atomic_load_acq<T>(src: *T) -> T;
178 pub fn atomic_load_relaxed<T>(src: *T) -> T;
179
180 pub fn atomic_store<T>(dst: *mut T, val: T);
181 pub fn atomic_store_rel<T>(dst: *mut T, val: T);
182 pub fn atomic_store_relaxed<T>(dst: *mut T, val: T);
183
184 pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T;
185 pub fn atomic_xchg_acq<T>(dst: *mut T, src: T) -> T;
186 pub fn atomic_xchg_rel<T>(dst: *mut T, src: T) -> T;
187 pub fn atomic_xchg_acqrel<T>(dst: *mut T, src: T) -> T;
188 pub fn atomic_xchg_relaxed<T>(dst: *mut T, src: T) -> T;
189
190 pub fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
191 pub fn atomic_xadd_acq<T>(dst: *mut T, src: T) -> T;
192 pub fn atomic_xadd_rel<T>(dst: *mut T, src: T) -> T;
193 pub fn atomic_xadd_acqrel<T>(dst: *mut T, src: T) -> T;
194 pub fn atomic_xadd_relaxed<T>(dst: *mut T, src: T) -> T;
195
196 pub fn atomic_xsub<T>(dst: *mut T, src: T) -> T;
197 pub fn atomic_xsub_acq<T>(dst: *mut T, src: T) -> T;
198 pub fn atomic_xsub_rel<T>(dst: *mut T, src: T) -> T;
199 pub fn atomic_xsub_acqrel<T>(dst: *mut T, src: T) -> T;
200 pub fn atomic_xsub_relaxed<T>(dst: *mut T, src: T) -> T;
201
202 pub fn atomic_and<T>(dst: *mut T, src: T) -> T;
203 pub fn atomic_and_acq<T>(dst: *mut T, src: T) -> T;
204 pub fn atomic_and_rel<T>(dst: *mut T, src: T) -> T;
205 pub fn atomic_and_acqrel<T>(dst: *mut T, src: T) -> T;
206 pub fn atomic_and_relaxed<T>(dst: *mut T, src: T) -> T;
207
208 pub fn atomic_nand<T>(dst: *mut T, src: T) -> T;
209 pub fn atomic_nand_acq<T>(dst: *mut T, src: T) -> T;
210 pub fn atomic_nand_rel<T>(dst: *mut T, src: T) -> T;
211 pub fn atomic_nand_acqrel<T>(dst: *mut T, src: T) -> T;
212 pub fn atomic_nand_relaxed<T>(dst: *mut T, src: T) -> T;
213
214 pub fn atomic_or<T>(dst: *mut T, src: T) -> T;
215 pub fn atomic_or_acq<T>(dst: *mut T, src: T) -> T;
216 pub fn atomic_or_rel<T>(dst: *mut T, src: T) -> T;
217 pub fn atomic_or_acqrel<T>(dst: *mut T, src: T) -> T;
218 pub fn atomic_or_relaxed<T>(dst: *mut T, src: T) -> T;
219
220 pub fn atomic_xor<T>(dst: *mut T, src: T) -> T;
221 pub fn atomic_xor_acq<T>(dst: *mut T, src: T) -> T;
222 pub fn atomic_xor_rel<T>(dst: *mut T, src: T) -> T;
223 pub fn atomic_xor_acqrel<T>(dst: *mut T, src: T) -> T;
224 pub fn atomic_xor_relaxed<T>(dst: *mut T, src: T) -> T;
225
226 pub fn atomic_max<T>(dst: *mut T, src: T) -> T;
227 pub fn atomic_max_acq<T>(dst: *mut T, src: T) -> T;
228 pub fn atomic_max_rel<T>(dst: *mut T, src: T) -> T;
229 pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T;
230 pub fn atomic_max_relaxed<T>(dst: *mut T, src: T) -> T;
231
232 pub fn atomic_min<T>(dst: *mut T, src: T) -> T;
233 pub fn atomic_min_acq<T>(dst: *mut T, src: T) -> T;
234 pub fn atomic_min_rel<T>(dst: *mut T, src: T) -> T;
235 pub fn atomic_min_acqrel<T>(dst: *mut T, src: T) -> T;
236 pub fn atomic_min_relaxed<T>(dst: *mut T, src: T) -> T;
237
238 pub fn atomic_umin<T>(dst: *mut T, src: T) -> T;
239 pub fn atomic_umin_acq<T>(dst: *mut T, src: T) -> T;
240 pub fn atomic_umin_rel<T>(dst: *mut T, src: T) -> T;
241 pub fn atomic_umin_acqrel<T>(dst: *mut T, src: T) -> T;
242 pub fn atomic_umin_relaxed<T>(dst: *mut T, src: T) -> T;
243
244 pub fn atomic_umax<T>(dst: *mut T, src: T) -> T;
245 pub fn atomic_umax_acq<T>(dst: *mut T, src: T) -> T;
246 pub fn atomic_umax_rel<T>(dst: *mut T, src: T) -> T;
247 pub fn atomic_umax_acqrel<T>(dst: *mut T, src: T) -> T;
248 pub fn atomic_umax_relaxed<T>(dst: *mut T, src: T) -> T;
249 }
250
251 extern "rust-intrinsic" {
252
253 pub fn atomic_fence();
254 pub fn atomic_fence_acq();
255 pub fn atomic_fence_rel();
256 pub fn atomic_fence_acqrel();
257
258 /// Abort the execution of the process.
259 pub fn abort() -> !;
260
261 /// Execute a breakpoint trap, for inspection by a debugger.
262 pub fn breakpoint();
263
264 pub fn volatile_load<T>(src: *T) -> T;
265 pub fn volatile_store<T>(dst: *mut T, val: T);
266
267
268 /// The size of a type in bytes.
269 ///
270 /// This is the exact number of bytes in memory taken up by a
271 /// value of the given type. In other words, a memset of this size
272 /// would *exactly* overwrite a value. When laid out in vectors
273 /// and structures there may be additional padding between
274 /// elements.
275 pub fn size_of<T>() -> uint;
276
277 /// Move a value to an uninitialized memory location.
278 ///
279 /// Drop glue is not run on the destination.
280 pub fn move_val_init<T>(dst: &mut T, src: T);
281
282 pub fn min_align_of<T>() -> uint;
283 pub fn pref_align_of<T>() -> uint;
284
285 /// Get a static pointer to a type descriptor.
286 pub fn get_tydesc<T>() -> *TyDesc;
287
288 /// Gets an identifier which is globally unique to the specified type. This
289 /// function will return the same value for a type regardless of whichever
290 /// crate it is invoked in.
291 pub fn type_id<T: 'static>() -> TypeId;
292
293
294 /// Create a value initialized to zero.
295 ///
296 /// `init` is unsafe because it returns a zeroed-out datum,
297 /// which is unsafe unless T is Copy.
298 pub fn init<T>() -> T;
299
300 /// Create an uninitialized value.
301 pub fn uninit<T>() -> T;
302
303 /// Move a value out of scope without running drop glue.
304 ///
305 /// `forget` is unsafe because the caller is responsible for
306 /// ensuring the argument is deallocated already.
307 pub fn forget<T>(_: T) -> ();
308 pub fn transmute<T,U>(e: T) -> U;
309
310 /// Returns `true` if a type requires drop glue.
311 pub fn needs_drop<T>() -> bool;
312
313 /// Returns `true` if a type is managed (will be allocated on the local heap)
314 pub fn owns_managed<T>() -> bool;
315
316 pub fn visit_tydesc(td: *TyDesc, tv: &mut TyVisitor);
317
318 /// Calculates the offset from a pointer. The offset *must* be in-bounds of
319 /// the object, or one-byte-past-the-end. An arithmetic overflow is also
320 /// undefined behaviour.
321 ///
322 /// This is implemented as an intrinsic to avoid converting to and from an
323 /// integer, since the conversion would throw away aliasing information.
324 pub fn offset<T>(dst: *T, offset: int) -> *T;
325
326 /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
327 /// a size of `count` * `size_of::<T>()` and an alignment of
328 /// `min_align_of::<T>()`
329 pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint);
330
331 /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
332 /// a size of `count` * `size_of::<T>()` and an alignment of
333 /// `min_align_of::<T>()`
334 pub fn copy_memory<T>(dst: *mut T, src: *T, count: uint);
335
336 /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
337 /// size of `count` * `size_of::<T>()` and an alignment of
338 /// `min_align_of::<T>()`
339 pub fn set_memory<T>(dst: *mut T, val: u8, count: uint);
340
341 pub fn sqrtf32(x: f32) -> f32;
342 pub fn sqrtf64(x: f64) -> f64;
343
344 pub fn powif32(a: f32, x: i32) -> f32;
345 pub fn powif64(a: f64, x: i32) -> f64;
346
347 pub fn sinf32(x: f32) -> f32;
348 pub fn sinf64(x: f64) -> f64;
349
350 pub fn cosf32(x: f32) -> f32;
351 pub fn cosf64(x: f64) -> f64;
352
353 pub fn powf32(a: f32, x: f32) -> f32;
354 pub fn powf64(a: f64, x: f64) -> f64;
355
356 pub fn expf32(x: f32) -> f32;
357 pub fn expf64(x: f64) -> f64;
358
359 pub fn exp2f32(x: f32) -> f32;
360 pub fn exp2f64(x: f64) -> f64;
361
362 pub fn logf32(x: f32) -> f32;
363 pub fn logf64(x: f64) -> f64;
364
365 pub fn log10f32(x: f32) -> f32;
366 pub fn log10f64(x: f64) -> f64;
367
368 pub fn log2f32(x: f32) -> f32;
369 pub fn log2f64(x: f64) -> f64;
370
371 pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
372 pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
373
374 pub fn fabsf32(x: f32) -> f32;
375 pub fn fabsf64(x: f64) -> f64;
376
377 pub fn copysignf32(x: f32, y: f32) -> f32;
378 pub fn copysignf64(x: f64, y: f64) -> f64;
379
380 pub fn floorf32(x: f32) -> f32;
381 pub fn floorf64(x: f64) -> f64;
382
383 pub fn ceilf32(x: f32) -> f32;
384 pub fn ceilf64(x: f64) -> f64;
385
386 pub fn truncf32(x: f32) -> f32;
387 pub fn truncf64(x: f64) -> f64;
388
389 pub fn rintf32(x: f32) -> f32;
390 pub fn rintf64(x: f64) -> f64;
391
392 pub fn nearbyintf32(x: f32) -> f32;
393 pub fn nearbyintf64(x: f64) -> f64;
394
395 pub fn roundf32(x: f32) -> f32;
396 pub fn roundf64(x: f64) -> f64;
397
398 pub fn ctpop8(x: u8) -> u8;
399 pub fn ctpop16(x: u16) -> u16;
400 pub fn ctpop32(x: u32) -> u32;
401 pub fn ctpop64(x: u64) -> u64;
402
403 pub fn ctlz8(x: u8) -> u8;
404 pub fn ctlz16(x: u16) -> u16;
405 pub fn ctlz32(x: u32) -> u32;
406 pub fn ctlz64(x: u64) -> u64;
407
408 pub fn cttz8(x: u8) -> u8;
409 pub fn cttz16(x: u16) -> u16;
410 pub fn cttz32(x: u32) -> u32;
411 pub fn cttz64(x: u64) -> u64;
412
413 pub fn bswap16(x: u16) -> u16;
414 pub fn bswap32(x: u32) -> u32;
415 pub fn bswap64(x: u64) -> u64;
416
417 pub fn i8_add_with_overflow(x: i8, y: i8) -> (i8, bool);
418 pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
419 pub fn i32_add_with_overflow(x: i32, y: i32) -> (i32, bool);
420 pub fn i64_add_with_overflow(x: i64, y: i64) -> (i64, bool);
421
422 pub fn u8_add_with_overflow(x: u8, y: u8) -> (u8, bool);
423 pub fn u16_add_with_overflow(x: u16, y: u16) -> (u16, bool);
424 pub fn u32_add_with_overflow(x: u32, y: u32) -> (u32, bool);
425 pub fn u64_add_with_overflow(x: u64, y: u64) -> (u64, bool);
426
427 pub fn i8_sub_with_overflow(x: i8, y: i8) -> (i8, bool);
428 pub fn i16_sub_with_overflow(x: i16, y: i16) -> (i16, bool);
429 pub fn i32_sub_with_overflow(x: i32, y: i32) -> (i32, bool);
430 pub fn i64_sub_with_overflow(x: i64, y: i64) -> (i64, bool);
431
432 pub fn u8_sub_with_overflow(x: u8, y: u8) -> (u8, bool);
433 pub fn u16_sub_with_overflow(x: u16, y: u16) -> (u16, bool);
434 pub fn u32_sub_with_overflow(x: u32, y: u32) -> (u32, bool);
435 pub fn u64_sub_with_overflow(x: u64, y: u64) -> (u64, bool);
436
437 pub fn i8_mul_with_overflow(x: i8, y: i8) -> (i8, bool);
438 pub fn i16_mul_with_overflow(x: i16, y: i16) -> (i16, bool);
439 pub fn i32_mul_with_overflow(x: i32, y: i32) -> (i32, bool);
440 pub fn i64_mul_with_overflow(x: i64, y: i64) -> (i64, bool);
441
442 pub fn u8_mul_with_overflow(x: u8, y: u8) -> (u8, bool);
443 pub fn u16_mul_with_overflow(x: u16, y: u16) -> (u16, bool);
444 pub fn u32_mul_with_overflow(x: u32, y: u32) -> (u32, bool);
445 pub fn u64_mul_with_overflow(x: u64, y: u64) -> (u64, bool);
446 }
447
448
449 /// `TypeId` represents a globally unique identifier for a type
450 #[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
451 // middle/lang_items.rs
452 #[deriving(Eq, Hash, Show, TotalEq)]
453 #[cfg(not(test))]
454 pub struct TypeId {
455 t: u64,
456 }
457
458 #[cfg(not(test))]
459 impl TypeId {
460 /// Returns the `TypeId` of the type this generic function has been instantiated with
461 pub fn of<T: 'static>() -> TypeId {
462 unsafe { type_id::<T>() }
463 }
464 }
libstd/intrinsics.rs:453:18-453:18 -struct- definition:
pub struct TypeId {
t: u64,
}
references:- 18451: // middle/lang_items.rs
--
460: /// Returns the `TypeId` of the type this generic function has been instantiated with
461: pub fn of<T: 'static>() -> TypeId {
462: unsafe { type_id::<T>() }
libstd/any.rs:
41: /// Get the `TypeId` of `self`
42: fn get_type_id(&self) -> TypeId;
43: }
--
46: /// Get the `TypeId` of `self`
47: fn get_type_id(&self) -> TypeId {
48: TypeId::of::<T>()
libstd/intrinsics.rs:
451: // middle/lang_items.rs
libstd/intrinsics.rs:49:1-49:1 -ty- definition:
pub type GlueFn = extern "Rust" fn(*i8);
pub struct TyDesc {
// sizeof(T)
references:- 261: // Called when a value of type `T` is no longer needed
62: pub drop_glue: GlueFn,
--
64: // Called by reflection visitor to visit a value of type `T`
65: pub visit_glue: GlueFn,
libstd/intrinsics.rs:74:1-74:1 -ty- definition:
pub type Disr = u64;
pub trait TyVisitor {
fn visit_bot(&mut self) -> bool;
references:- 13145: fn visit_leave_enum_variant(&mut self, variant: uint,
146: disr_val: Disr,
147: n_fields: uint,
--
149: fn visit_leave_enum(&mut self, n_variants: uint,
150: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
151: sz: uint, align: uint) -> bool;
libstd/repr.rs:
465: _n_variants: uint,
466: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
467: _sz: uint,
--
476: fn visit_enter_enum_variant(&mut self, _variant: uint,
477: disr_val: Disr,
478: n_fields: uint,
--
539: _n_variants: uint,
540: _get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
541: _sz: uint,
libstd/reflect.rs:
361: fn visit_enter_enum(&mut self, n_variants: uint,
362: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
363: sz: uint, align: uint)
--
372: fn visit_enter_enum_variant(&mut self, variant: uint,
373: disr_val: Disr,
374: n_fields: uint,
--
391: fn visit_leave_enum_variant(&mut self, variant: uint,
392: disr_val: Disr,
393: n_fields: uint,
--
402: fn visit_leave_enum(&mut self, n_variants: uint,
403: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
404: sz: uint, align: uint) -> bool {
libstd/intrinsics.rs:
140: fn visit_enter_enum_variant(&mut self, variant: uint,
141: disr_val: Disr,
142: n_fields: uint,
libstd/intrinsics.rs:78:18-78:18 -trait- definition:
pub trait TyVisitor {
fn visit_bot(&mut self) -> bool;
fn visit_nil(&mut self) -> bool;
references:- 10316: pub fn visit_tydesc(td: *TyDesc, tv: &mut TyVisitor);
libstd/repr.rs:
597: let mut v = reflect::MovePtrAdaptor(u);
598: visit_tydesc(tydesc, &mut v as &mut TyVisitor);
599: match v.unwrap().last_err {
libstd/reflect.rs:
72: /// Abstract type-directed pointer-movement using the MovePtr trait
73: impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
74: fn visit_bot(&mut self) -> bool {
--
412: fn visit_trait(&mut self, name: &str) -> bool {
413: self.align_to::<~TyVisitor>();
414: if ! self.inner.visit_trait(name) { return false; }
415: self.bump_past::<~TyVisitor>();
416: true
libstd/intrinsics.rs:53:18-53:18 -struct- definition:
pub struct TyDesc {
// sizeof(T)
pub size: uint,
references:- 48libstd/repr.rs:
libstd/reflect.rs:
libstd/intrinsics.rs:72:18-72:18 -enum- definition:
pub enum Opaque { }
pub type Disr = u64;
pub trait TyVisitor {
references:- 6137: fn visit_enter_enum(&mut self, n_variants: uint,
138: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
139: sz: uint, align: uint) -> bool;
libstd/repr.rs:
465: _n_variants: uint,
466: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
467: _sz: uint,
--
539: _n_variants: uint,
540: _get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
541: _sz: uint,
libstd/reflect.rs:
361: fn visit_enter_enum(&mut self, n_variants: uint,
362: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
363: sz: uint, align: uint)
--
402: fn visit_leave_enum(&mut self, n_variants: uint,
403: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
404: sz: uint, align: uint) -> bool {
libstd/intrinsics.rs:
149: fn visit_leave_enum(&mut self, n_variants: uint,
150: get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
151: sz: uint, align: uint) -> bool;