]>
Commit | Line | Data |
---|---|---|
29967ef6 | 1 | #![feature( |
5e7ed085 FG |
2 | no_core, |
3 | lang_items, | |
4 | intrinsics, | |
5 | unboxed_closures, | |
6 | extern_types, | |
7 | decl_macro, | |
8 | rustc_attrs, | |
9 | transparent_unions, | |
10 | auto_traits, | |
11 | thread_local | |
29967ef6 XL |
12 | )] |
13 | #![no_core] | |
14 | #![allow(dead_code)] | |
15 | ||
16 | #[lang = "sized"] | |
17 | pub trait Sized {} | |
18 | ||
04454e1e FG |
19 | #[lang = "destruct"] |
20 | pub trait Destruct {} | |
21 | ||
9c376795 FG |
22 | #[lang = "tuple_trait"] |
23 | pub trait Tuple {} | |
24 | ||
29967ef6 XL |
25 | #[lang = "unsize"] |
26 | pub trait Unsize<T: ?Sized> {} | |
27 | ||
28 | #[lang = "coerce_unsized"] | |
29 | pub trait CoerceUnsized<T> {} | |
30 | ||
31 | impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} | |
32 | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {} | |
33 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {} | |
34 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {} | |
35 | ||
36 | #[lang = "dispatch_from_dyn"] | |
37 | pub trait DispatchFromDyn<T> {} | |
38 | ||
39 | // &T -> &U | |
40 | impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} | |
41 | // &mut T -> &mut U | |
42 | impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {} | |
43 | // *const T -> *const U | |
44 | impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {} | |
45 | // *mut T -> *mut U | |
46 | impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {} | |
47 | impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {} | |
48 | ||
49 | #[lang = "receiver"] | |
50 | pub trait Receiver {} | |
51 | ||
52 | impl<T: ?Sized> Receiver for &T {} | |
53 | impl<T: ?Sized> Receiver for &mut T {} | |
54 | impl<T: ?Sized> Receiver for Box<T> {} | |
55 | ||
56 | #[lang = "copy"] | |
57 | pub unsafe trait Copy {} | |
58 | ||
59 | unsafe impl Copy for bool {} | |
60 | unsafe impl Copy for u8 {} | |
61 | unsafe impl Copy for u16 {} | |
62 | unsafe impl Copy for u32 {} | |
63 | unsafe impl Copy for u64 {} | |
64 | unsafe impl Copy for u128 {} | |
65 | unsafe impl Copy for usize {} | |
66 | unsafe impl Copy for i8 {} | |
67 | unsafe impl Copy for i16 {} | |
68 | unsafe impl Copy for i32 {} | |
69 | unsafe impl Copy for isize {} | |
70 | unsafe impl Copy for f32 {} | |
5e7ed085 | 71 | unsafe impl Copy for f64 {} |
29967ef6 XL |
72 | unsafe impl Copy for char {} |
73 | unsafe impl<'a, T: ?Sized> Copy for &'a T {} | |
74 | unsafe impl<T: ?Sized> Copy for *const T {} | |
75 | unsafe impl<T: ?Sized> Copy for *mut T {} | |
76 | unsafe impl<T: Copy> Copy for Option<T> {} | |
77 | ||
78 | #[lang = "sync"] | |
79 | pub unsafe trait Sync {} | |
80 | ||
81 | unsafe impl Sync for bool {} | |
82 | unsafe impl Sync for u8 {} | |
83 | unsafe impl Sync for u16 {} | |
84 | unsafe impl Sync for u32 {} | |
85 | unsafe impl Sync for u64 {} | |
86 | unsafe impl Sync for usize {} | |
87 | unsafe impl Sync for i8 {} | |
88 | unsafe impl Sync for i16 {} | |
89 | unsafe impl Sync for i32 {} | |
90 | unsafe impl Sync for isize {} | |
91 | unsafe impl Sync for char {} | |
92 | unsafe impl<'a, T: ?Sized> Sync for &'a T {} | |
93 | unsafe impl Sync for [u8; 16] {} | |
94 | ||
95 | #[lang = "freeze"] | |
96 | unsafe auto trait Freeze {} | |
97 | ||
98 | unsafe impl<T: ?Sized> Freeze for PhantomData<T> {} | |
99 | unsafe impl<T: ?Sized> Freeze for *const T {} | |
100 | unsafe impl<T: ?Sized> Freeze for *mut T {} | |
101 | unsafe impl<T: ?Sized> Freeze for &T {} | |
102 | unsafe impl<T: ?Sized> Freeze for &mut T {} | |
103 | ||
104 | #[lang = "structural_peq"] | |
105 | pub trait StructuralPartialEq {} | |
106 | ||
107 | #[lang = "structural_teq"] | |
108 | pub trait StructuralEq {} | |
109 | ||
110 | #[lang = "not"] | |
111 | pub trait Not { | |
112 | type Output; | |
113 | ||
114 | fn not(self) -> Self::Output; | |
115 | } | |
116 | ||
117 | impl Not for bool { | |
118 | type Output = bool; | |
119 | ||
120 | fn not(self) -> bool { | |
121 | !self | |
122 | } | |
123 | } | |
124 | ||
125 | #[lang = "mul"] | |
126 | pub trait Mul<RHS = Self> { | |
127 | type Output; | |
128 | ||
129 | #[must_use] | |
130 | fn mul(self, rhs: RHS) -> Self::Output; | |
131 | } | |
132 | ||
133 | impl Mul for u8 { | |
134 | type Output = Self; | |
135 | ||
136 | fn mul(self, rhs: Self) -> Self::Output { | |
137 | self * rhs | |
138 | } | |
139 | } | |
140 | ||
141 | impl Mul for usize { | |
142 | type Output = Self; | |
143 | ||
144 | fn mul(self, rhs: Self) -> Self::Output { | |
145 | self * rhs | |
146 | } | |
147 | } | |
148 | ||
149 | #[lang = "add"] | |
150 | pub trait Add<RHS = Self> { | |
151 | type Output; | |
152 | ||
153 | fn add(self, rhs: RHS) -> Self::Output; | |
154 | } | |
155 | ||
156 | impl Add for u8 { | |
157 | type Output = Self; | |
158 | ||
159 | fn add(self, rhs: Self) -> Self { | |
160 | self + rhs | |
161 | } | |
162 | } | |
163 | ||
164 | impl Add for i8 { | |
165 | type Output = Self; | |
166 | ||
167 | fn add(self, rhs: Self) -> Self { | |
168 | self + rhs | |
169 | } | |
170 | } | |
171 | ||
172 | impl Add for usize { | |
173 | type Output = Self; | |
174 | ||
175 | fn add(self, rhs: Self) -> Self { | |
176 | self + rhs | |
177 | } | |
178 | } | |
179 | ||
180 | #[lang = "sub"] | |
181 | pub trait Sub<RHS = Self> { | |
182 | type Output; | |
183 | ||
184 | fn sub(self, rhs: RHS) -> Self::Output; | |
185 | } | |
186 | ||
187 | impl Sub for usize { | |
188 | type Output = Self; | |
189 | ||
190 | fn sub(self, rhs: Self) -> Self { | |
191 | self - rhs | |
192 | } | |
193 | } | |
194 | ||
195 | impl Sub for u8 { | |
196 | type Output = Self; | |
197 | ||
198 | fn sub(self, rhs: Self) -> Self { | |
199 | self - rhs | |
200 | } | |
201 | } | |
202 | ||
203 | impl Sub for i8 { | |
204 | type Output = Self; | |
205 | ||
206 | fn sub(self, rhs: Self) -> Self { | |
207 | self - rhs | |
208 | } | |
209 | } | |
210 | ||
211 | impl Sub for i16 { | |
212 | type Output = Self; | |
213 | ||
214 | fn sub(self, rhs: Self) -> Self { | |
215 | self - rhs | |
216 | } | |
217 | } | |
218 | ||
219 | #[lang = "rem"] | |
220 | pub trait Rem<RHS = Self> { | |
221 | type Output; | |
222 | ||
223 | fn rem(self, rhs: RHS) -> Self::Output; | |
224 | } | |
225 | ||
226 | impl Rem for usize { | |
227 | type Output = Self; | |
228 | ||
229 | fn rem(self, rhs: Self) -> Self { | |
230 | self % rhs | |
231 | } | |
232 | } | |
233 | ||
234 | #[lang = "bitor"] | |
235 | pub trait BitOr<RHS = Self> { | |
236 | type Output; | |
237 | ||
238 | #[must_use] | |
239 | fn bitor(self, rhs: RHS) -> Self::Output; | |
240 | } | |
241 | ||
242 | impl BitOr for bool { | |
243 | type Output = bool; | |
244 | ||
245 | fn bitor(self, rhs: bool) -> bool { | |
246 | self | rhs | |
247 | } | |
248 | } | |
249 | ||
250 | impl<'a> BitOr<bool> for &'a bool { | |
251 | type Output = bool; | |
252 | ||
253 | fn bitor(self, rhs: bool) -> bool { | |
254 | *self | rhs | |
255 | } | |
256 | } | |
257 | ||
258 | #[lang = "eq"] | |
259 | pub trait PartialEq<Rhs: ?Sized = Self> { | |
260 | fn eq(&self, other: &Rhs) -> bool; | |
261 | fn ne(&self, other: &Rhs) -> bool; | |
262 | } | |
263 | ||
264 | impl PartialEq for u8 { | |
265 | fn eq(&self, other: &u8) -> bool { | |
266 | (*self) == (*other) | |
267 | } | |
268 | fn ne(&self, other: &u8) -> bool { | |
269 | (*self) != (*other) | |
270 | } | |
271 | } | |
272 | ||
273 | impl PartialEq for u16 { | |
274 | fn eq(&self, other: &u16) -> bool { | |
275 | (*self) == (*other) | |
276 | } | |
277 | fn ne(&self, other: &u16) -> bool { | |
278 | (*self) != (*other) | |
279 | } | |
280 | } | |
281 | ||
282 | impl PartialEq for u32 { | |
283 | fn eq(&self, other: &u32) -> bool { | |
284 | (*self) == (*other) | |
285 | } | |
286 | fn ne(&self, other: &u32) -> bool { | |
287 | (*self) != (*other) | |
288 | } | |
289 | } | |
290 | ||
291 | ||
292 | impl PartialEq for u64 { | |
293 | fn eq(&self, other: &u64) -> bool { | |
294 | (*self) == (*other) | |
295 | } | |
296 | fn ne(&self, other: &u64) -> bool { | |
297 | (*self) != (*other) | |
298 | } | |
299 | } | |
300 | ||
301 | impl PartialEq for u128 { | |
302 | fn eq(&self, other: &u128) -> bool { | |
303 | (*self) == (*other) | |
304 | } | |
305 | fn ne(&self, other: &u128) -> bool { | |
306 | (*self) != (*other) | |
307 | } | |
308 | } | |
309 | ||
310 | impl PartialEq for usize { | |
311 | fn eq(&self, other: &usize) -> bool { | |
312 | (*self) == (*other) | |
313 | } | |
314 | fn ne(&self, other: &usize) -> bool { | |
315 | (*self) != (*other) | |
316 | } | |
317 | } | |
318 | ||
319 | impl PartialEq for i8 { | |
320 | fn eq(&self, other: &i8) -> bool { | |
321 | (*self) == (*other) | |
322 | } | |
323 | fn ne(&self, other: &i8) -> bool { | |
324 | (*self) != (*other) | |
325 | } | |
326 | } | |
327 | ||
328 | impl PartialEq for i32 { | |
329 | fn eq(&self, other: &i32) -> bool { | |
330 | (*self) == (*other) | |
331 | } | |
332 | fn ne(&self, other: &i32) -> bool { | |
333 | (*self) != (*other) | |
334 | } | |
335 | } | |
336 | ||
337 | impl PartialEq for isize { | |
338 | fn eq(&self, other: &isize) -> bool { | |
339 | (*self) == (*other) | |
340 | } | |
341 | fn ne(&self, other: &isize) -> bool { | |
342 | (*self) != (*other) | |
343 | } | |
344 | } | |
345 | ||
346 | impl PartialEq for char { | |
347 | fn eq(&self, other: &char) -> bool { | |
348 | (*self) == (*other) | |
349 | } | |
350 | fn ne(&self, other: &char) -> bool { | |
351 | (*self) != (*other) | |
352 | } | |
353 | } | |
354 | ||
355 | impl<T: ?Sized> PartialEq for *const T { | |
356 | fn eq(&self, other: &*const T) -> bool { | |
357 | *self == *other | |
358 | } | |
359 | fn ne(&self, other: &*const T) -> bool { | |
360 | *self != *other | |
361 | } | |
362 | } | |
363 | ||
364 | impl <T: PartialEq> PartialEq for Option<T> { | |
365 | fn eq(&self, other: &Self) -> bool { | |
366 | match (self, other) { | |
367 | (Some(lhs), Some(rhs)) => *lhs == *rhs, | |
368 | (None, None) => true, | |
369 | _ => false, | |
370 | } | |
371 | } | |
372 | ||
373 | fn ne(&self, other: &Self) -> bool { | |
374 | match (self, other) { | |
375 | (Some(lhs), Some(rhs)) => *lhs != *rhs, | |
376 | (None, None) => false, | |
377 | _ => true, | |
378 | } | |
379 | } | |
380 | } | |
381 | ||
6a06907d XL |
382 | #[lang = "shl"] |
383 | pub trait Shl<RHS = Self> { | |
384 | type Output; | |
385 | ||
386 | #[must_use] | |
387 | fn shl(self, rhs: RHS) -> Self::Output; | |
388 | } | |
389 | ||
390 | impl Shl for u128 { | |
391 | type Output = u128; | |
392 | ||
393 | fn shl(self, rhs: u128) -> u128 { | |
394 | self << rhs | |
395 | } | |
396 | } | |
397 | ||
29967ef6 XL |
398 | #[lang = "neg"] |
399 | pub trait Neg { | |
400 | type Output; | |
401 | ||
402 | fn neg(self) -> Self::Output; | |
403 | } | |
404 | ||
405 | impl Neg for i8 { | |
406 | type Output = i8; | |
407 | ||
408 | fn neg(self) -> i8 { | |
409 | -self | |
410 | } | |
411 | } | |
412 | ||
413 | impl Neg for i16 { | |
414 | type Output = i16; | |
415 | ||
416 | fn neg(self) -> i16 { | |
417 | self | |
418 | } | |
419 | } | |
420 | ||
421 | impl Neg for isize { | |
422 | type Output = isize; | |
423 | ||
424 | fn neg(self) -> isize { | |
425 | -self | |
426 | } | |
427 | } | |
428 | ||
429 | impl Neg for f32 { | |
430 | type Output = f32; | |
431 | ||
432 | fn neg(self) -> f32 { | |
433 | -self | |
434 | } | |
435 | } | |
436 | ||
437 | pub enum Option<T> { | |
438 | Some(T), | |
439 | None, | |
440 | } | |
441 | ||
442 | pub use Option::*; | |
443 | ||
444 | #[lang = "phantom_data"] | |
445 | pub struct PhantomData<T: ?Sized>; | |
446 | ||
447 | #[lang = "fn_once"] | |
448 | #[rustc_paren_sugar] | |
9c376795 | 449 | pub trait FnOnce<Args: Tuple> { |
29967ef6 XL |
450 | #[lang = "fn_once_output"] |
451 | type Output; | |
452 | ||
453 | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; | |
454 | } | |
455 | ||
456 | #[lang = "fn_mut"] | |
457 | #[rustc_paren_sugar] | |
9c376795 | 458 | pub trait FnMut<Args: Tuple>: FnOnce<Args> { |
29967ef6 XL |
459 | extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; |
460 | } | |
461 | ||
462 | #[lang = "panic"] | |
463 | #[track_caller] | |
064997fb | 464 | pub fn panic(_msg: &'static str) -> ! { |
29967ef6 XL |
465 | unsafe { |
466 | libc::puts("Panicking\n\0" as *const str as *const i8); | |
467 | intrinsics::abort(); | |
468 | } | |
469 | } | |
470 | ||
471 | #[lang = "panic_bounds_check"] | |
472 | #[track_caller] | |
473 | fn panic_bounds_check(index: usize, len: usize) -> ! { | |
474 | unsafe { | |
475 | libc::printf("index out of bounds: the len is %d but the index is %d\n\0" as *const str as *const i8, len, index); | |
476 | intrinsics::abort(); | |
477 | } | |
478 | } | |
479 | ||
480 | #[lang = "eh_personality"] | |
481 | fn eh_personality() -> ! { | |
482 | loop {} | |
483 | } | |
484 | ||
485 | #[lang = "drop_in_place"] | |
486 | #[allow(unconditional_recursion)] | |
487 | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { | |
488 | // Code here does not matter - this is replaced by the | |
489 | // real drop glue by the compiler. | |
490 | drop_in_place(to_drop); | |
491 | } | |
492 | ||
493 | #[lang = "deref"] | |
494 | pub trait Deref { | |
495 | type Target: ?Sized; | |
496 | ||
497 | fn deref(&self) -> &Self::Target; | |
498 | } | |
499 | ||
04454e1e FG |
500 | #[repr(transparent)] |
501 | #[rustc_layout_scalar_valid_range_start(1)] | |
502 | #[rustc_nonnull_optimization_guaranteed] | |
064997fb | 503 | pub struct NonNull<T: ?Sized>(pub *const T); |
04454e1e FG |
504 | |
505 | impl<T: ?Sized, U: ?Sized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {} | |
506 | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {} | |
507 | ||
5e7ed085 | 508 | pub struct Unique<T: ?Sized> { |
04454e1e | 509 | pub pointer: NonNull<T>, |
5e7ed085 FG |
510 | pub _marker: PhantomData<T>, |
511 | } | |
512 | ||
513 | impl<T: ?Sized, U: ?Sized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {} | |
5e7ed085 FG |
514 | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {} |
515 | ||
29967ef6 | 516 | #[lang = "owned_box"] |
5e7ed085 | 517 | pub struct Box<T: ?Sized>(Unique<T>, ()); |
29967ef6 XL |
518 | |
519 | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {} | |
520 | ||
521 | impl<T: ?Sized> Drop for Box<T> { | |
522 | fn drop(&mut self) { | |
523 | // drop is currently performed by compiler. | |
524 | } | |
525 | } | |
526 | ||
064997fb | 527 | impl<T: ?Sized> Deref for Box<T> { |
29967ef6 XL |
528 | type Target = T; |
529 | ||
530 | fn deref(&self) -> &Self::Target { | |
531 | &**self | |
532 | } | |
533 | } | |
534 | ||
535 | #[lang = "exchange_malloc"] | |
536 | unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { | |
537 | libc::malloc(size) | |
538 | } | |
539 | ||
540 | #[lang = "box_free"] | |
f2b60f7d | 541 | unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) { |
04454e1e | 542 | libc::free(ptr.pointer.0 as *mut u8); |
29967ef6 XL |
543 | } |
544 | ||
545 | #[lang = "drop"] | |
546 | pub trait Drop { | |
547 | fn drop(&mut self); | |
548 | } | |
549 | ||
550 | #[lang = "manually_drop"] | |
551 | #[repr(transparent)] | |
552 | pub struct ManuallyDrop<T: ?Sized> { | |
553 | pub value: T, | |
554 | } | |
555 | ||
556 | #[lang = "maybe_uninit"] | |
557 | #[repr(transparent)] | |
558 | pub union MaybeUninit<T> { | |
559 | pub uninit: (), | |
560 | pub value: ManuallyDrop<T>, | |
561 | } | |
562 | ||
563 | pub mod intrinsics { | |
564 | extern "rust-intrinsic" { | |
2b03887a | 565 | #[rustc_safe_intrinsic] |
29967ef6 | 566 | pub fn abort() -> !; |
2b03887a | 567 | #[rustc_safe_intrinsic] |
29967ef6 XL |
568 | pub fn size_of<T>() -> usize; |
569 | pub fn size_of_val<T: ?::Sized>(val: *const T) -> usize; | |
2b03887a | 570 | #[rustc_safe_intrinsic] |
29967ef6 XL |
571 | pub fn min_align_of<T>() -> usize; |
572 | pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize; | |
573 | pub fn copy<T>(src: *const T, dst: *mut T, count: usize); | |
574 | pub fn transmute<T, U>(e: T) -> U; | |
575 | pub fn ctlz_nonzero<T>(x: T) -> T; | |
2b03887a | 576 | #[rustc_safe_intrinsic] |
923072b8 | 577 | pub fn needs_drop<T: ?::Sized>() -> bool; |
2b03887a | 578 | #[rustc_safe_intrinsic] |
29967ef6 | 579 | pub fn bitreverse<T>(x: T) -> T; |
2b03887a | 580 | #[rustc_safe_intrinsic] |
29967ef6 XL |
581 | pub fn bswap<T>(x: T) -> T; |
582 | pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize); | |
583 | } | |
584 | } | |
585 | ||
586 | pub mod libc { | |
f2b60f7d FG |
587 | // With the new Universal CRT, msvc has switched to all the printf functions being inline wrapper |
588 | // functions. legacy_stdio_definitions.lib which provides the printf wrapper functions as normal | |
589 | // symbols to link against. | |
590 | #[cfg_attr(unix, link(name = "c"))] | |
591 | #[cfg_attr(target_env="msvc", link(name="legacy_stdio_definitions"))] | |
592 | extern "C" { | |
593 | pub fn printf(format: *const i8, ...) -> i32; | |
594 | } | |
595 | ||
5869c6ff XL |
596 | #[cfg_attr(unix, link(name = "c"))] |
597 | #[cfg_attr(target_env = "msvc", link(name = "msvcrt"))] | |
29967ef6 XL |
598 | extern "C" { |
599 | pub fn puts(s: *const i8) -> i32; | |
29967ef6 XL |
600 | pub fn malloc(size: usize) -> *mut u8; |
601 | pub fn free(ptr: *mut u8); | |
602 | pub fn memcpy(dst: *mut u8, src: *const u8, size: usize); | |
603 | pub fn memmove(dst: *mut u8, src: *const u8, size: usize); | |
604 | pub fn strncpy(dst: *mut u8, src: *const u8, size: usize); | |
605 | } | |
606 | } | |
607 | ||
608 | #[lang = "index"] | |
609 | pub trait Index<Idx: ?Sized> { | |
610 | type Output: ?Sized; | |
611 | fn index(&self, index: Idx) -> &Self::Output; | |
612 | } | |
613 | ||
614 | impl<T> Index<usize> for [T; 3] { | |
615 | type Output = T; | |
616 | ||
617 | fn index(&self, index: usize) -> &Self::Output { | |
618 | &self[index] | |
619 | } | |
620 | } | |
621 | ||
622 | impl<T> Index<usize> for [T] { | |
623 | type Output = T; | |
624 | ||
625 | fn index(&self, index: usize) -> &Self::Output { | |
626 | &self[index] | |
627 | } | |
628 | } | |
629 | ||
630 | extern { | |
631 | type VaListImpl; | |
632 | } | |
633 | ||
634 | #[lang = "va_list"] | |
635 | #[repr(transparent)] | |
636 | pub struct VaList<'a>(&'a mut VaListImpl); | |
637 | ||
638 | #[rustc_builtin_macro] | |
639 | #[rustc_macro_transparency = "semitransparent"] | |
640 | pub macro stringify($($t:tt)*) { /* compiler built-in */ } | |
641 | ||
642 | #[rustc_builtin_macro] | |
643 | #[rustc_macro_transparency = "semitransparent"] | |
644 | pub macro file() { /* compiler built-in */ } | |
645 | ||
646 | #[rustc_builtin_macro] | |
647 | #[rustc_macro_transparency = "semitransparent"] | |
648 | pub macro line() { /* compiler built-in */ } | |
649 | ||
650 | #[rustc_builtin_macro] | |
651 | #[rustc_macro_transparency = "semitransparent"] | |
652 | pub macro cfg() { /* compiler built-in */ } | |
653 | ||
654 | #[rustc_builtin_macro] | |
655 | #[rustc_macro_transparency = "semitransparent"] | |
656 | pub macro global_asm() { /* compiler built-in */ } | |
657 | ||
658 | pub static A_STATIC: u8 = 42; | |
659 | ||
660 | #[lang = "panic_location"] | |
661 | struct PanicLocation { | |
662 | file: &'static str, | |
663 | line: u32, | |
664 | column: u32, | |
665 | } | |
666 | ||
667 | #[no_mangle] | |
cdc7bbd5 | 668 | #[cfg(not(windows))] |
29967ef6 XL |
669 | pub fn get_tls() -> u8 { |
670 | #[thread_local] | |
671 | static A: u8 = 42; | |
672 | ||
673 | A | |
674 | } |