@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null
+doc/FiraSans-Regular.woff: $(D)/FiraSans-Regular.woff | doc/
+ @$(call E, cp: $@)
+ $(Q)cp -a $< $@ 2> /dev/null
+
+doc/FiraSans-Medium.woff: $(D)/FiraSans-Medium.woff | doc/
+ @$(call E, cp: $@)
+ $(Q)cp -a $< $@ 2> /dev/null
+
+doc/Heuristica-Regular.woff: $(D)/Heuristica-Regular.woff | doc/
+ @$(call E, cp: $@)
+ $(Q)cp -a $< $@ 2> /dev/null
+
+doc/Heuristica-Italic.woff: $(D)/Heuristica-Italic.woff | doc/
+ @$(call E, cp: $@)
+ $(Q)cp -a $< $@ 2> /dev/null
+
+doc/Heuristica-Bold.woff: $(D)/Heuristica-Bold.woff | doc/
+ @$(call E, cp: $@)
+ $(Q)cp -a $< $@ 2> /dev/null
+
# The (english) documentation for each doc item.
define DEF_SHOULD_BUILD_PDF_DOC
-<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico" />
+<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico">
+<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400'
+ rel='stylesheet' type='text/css'>
\ No newline at end of file
The `spawn` function spins up a new task,
given a *heap allocated closure* to run.
As you can see in the code,
-we call `chan.send()` from the original task,
+we call `tx.send()` from the original task,
passing in our boxed array,
and we call `rx.recv()` (short for 'receive') inside of the new task:
values given to the `Sender` via the `send` method come out the other end via the `recv` method on the `Receiver`.
font-family: 'Fira Sans';
font-style: normal;
font-weight: 400;
- src: local('Fira Sans'), url("http://www.rust-lang.org/fonts/FiraSans-Regular.woff") format('woff');
+ src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
}
@font-face {
font-family: 'Fira Sans';
font-style: normal;
font-weight: 500;
- src: local('Fira Sans Medium'), url("http://www.rust-lang.org/fonts/FiraSans-Medium.woff") format('woff');
+ src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
}
@font-face {
font-family: 'Heuristica';
font-style: normal;
font-weight: 400;
- src: local('Heuristica Regular'), url("http://www.rust-lang.org/fonts/Heuristica-Regular.woff") format('woff');
+ src: local('Heuristica Regular'), url("Heuristica-Regular.woff") format('woff');
}
@font-face {
font-family: 'Heuristica';
font-style: italic;
font-weight: 400;
- src: local('Heuristica Italic'), url("http://www.rust-lang.org/fonts/Heuristica-Italic.woff") format('woff');
+ src: local('Heuristica Italic'), url("Heuristica-Italic.woff") format('woff');
}
@font-face {
font-family: 'Heuristica';
font-style: normal;
font-weight: 700;
- src: local('Heuristica Bold'), url("http://www.rust-lang.org/fonts/Heuristica-Bold.woff") format('woff');
+ src: local('Heuristica Bold'), url("Heuristica-Bold.woff") format('woff');
}
-/* Global page semantics
- ========================================================================== */
+
+*:not(body) {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
+/* General structure */
+
body {
margin: 0 auto;
padding: 0 15px;
h1 {
margin-bottom: 20px;
}
-@media (min-width: 1170px) {
- h1 {
- margin-top: 40px;
- margin-bottom: 30px;
- }
- h1, h2, h3 {
- margin-top: 30px;
- margin-bottom: 15px;
- }
-}
h4, h5, h6 {
margin-top: 12px;
margin-bottom: 10px;
margin-bottom: 1em;
}
-/* Links layout
- ========================================================================== */
+/* Links layout */
+
a {
text-decoration: none;
color: #428BCA;
h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover,
h5 a:hover {text-decoration: none;}
-/* Code
- ========================================================================== */
+/* Code */
+
pre, code {
- font-family: Menlo, Monaco, Consolas, "DejaVu Sans Mono", monospace;
- border-radius: 4px;
+ font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", monospace;
}
pre {
- background-color: #FDFDFD;
- border: 1px solid #CCC;
- border-radius: 0.5em;
+ border-left: 2px solid #eee;
white-space: pre-wrap;
- padding: 9.5px;
+ padding: 14px;
+ padding-right: 0;
margin: 20px 0;
font-size: 13px;
word-break: break-all;
code {
padding: 0 2px;
color: #8D1A38;
- white-space: nowrap;
+ white-space: pre-wrap;
}
pre code {
padding: 0;
font-size: inherit;
color: inherit;
- white-space: pre-wrap;
- background-color: transparent;
- border-radius: 0;
}
/* Code highlighting */
pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; }
pre.rust .lifetime { color: #B76514; }
+/* The rest */
-/* The rest
- ========================================================================== */
#versioninfo {
text-align: center;
margin: 0.5em;
font-size: 1.1em;
}
-@media only screen and (min-width: 768px) {
+@media (min-width: 992px) {
#versioninfo {
+ font-size: 0.8em;
position: fixed;
bottom: 0px;
right: 0px;
background-color: #fff;
margin: 2px;
padding: 0 2px;
- border-radius: .3em;
+ border-radius: .2em;
}
}
#versioninfo a.hash {
}
blockquote {
- color: black;
- border-left: 5px solid #eee;
- margin: 0 0 20px;
- padding: 10px 20px;
+ color: #000;
+ margin: 20px 0;
+ padding: 15px 20px;
+ background-color: #f2f7f9;
+ border-top: .1em solid #e5eef2;
+ border-bottom: .1em solid #e5eef2;
}
blockquote p {
font-size: 17px;
padding: 5px;
}
+@media (min-width: 1170px) {
+ pre {
+ font-size: 15px;
+ }
+}
+
@media print {
* {
text-shadow: none !important;
<title>{title}</title>
- <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600'
+ <link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,600'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="{root_path}main.css">
- {favicon, select, none{} other{<link rel="shortcut icon" href="#" />}}
+ {favicon, select, none{} other{<link rel="shortcut icon" href="#">}}
</head>
<body>
<!--[if lte IE 8]>
impl<'a> fmt::Show for Item<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
- match attr::find_stability(self.item.attrs.iter()) {
- Some(ref stability) => {
- try!(write!(fmt.buf,
- "<a class='stability {lvl}' title='{reason}'>{lvl}</a>",
- lvl = stability.level.to_str(),
- reason = match stability.text {
- Some(ref s) => (*s).clone(),
- None => InternedString::new(""),
- }));
- }
- None => {}
- }
-
// Write the breadcrumb trail header for the top
try!(write!(fmt.buf, "\n<h1 class='fqn'>"));
match self.item.inner {
try!(write!(fmt.buf, "<a class='{}' href=''>{}</a>",
shortty(self.item), self.item.name.get_ref().as_slice()));
+ // Write stability attributes
+ match attr::find_stability(self.item.attrs.iter()) {
+ Some(ref stability) => {
+ try!(write!(fmt.buf,
+ "<a class='stability {lvl}' title='{reason}'>{lvl}</a>",
+ lvl = stability.level.to_str(),
+ reason = match stability.text {
+ Some(ref s) => (*s).clone(),
+ None => InternedString::new(""),
+ }));
+ }
+ None => {}
+ }
+
+ // Write `src` tag
if self.cx.include_sources {
let mut path = Vec::new();
clean_srcpath(self.item.source.filename.as_bytes(), |component| {
font-family: 'Fira Sans';
font-style: normal;
font-weight: 400;
- src: local('Fira Sans'), url("http://www.rust-lang.org/fonts/FiraSans-Regular.woff") format('woff');
+ src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
}
@font-face {
font-family: 'Fira Sans';
font-style: normal;
font-weight: 500;
- src: local('Fira Sans Medium'), url("http://www.rust-lang.org/fonts/FiraSans-Medium.woff") format('woff');
+ src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
}
@font-face {
font-family: 'Heuristica';
font-style: normal;
font-weight: 400;
- src: local('Heuristica Regular'), url("http://www.rust-lang.org/fonts/Heuristica-Regular.woff") format('woff');
+ src: local('Heuristica Regular'), url("Heuristica-Regular.woff") format('woff');
}
@font-face {
font-family: 'Heuristica';
font-style: italic;
font-weight: 400;
- src: local('Heuristica Italic'), url("http://www.rust-lang.org/fonts/Heuristica-Italic.woff") format('woff');
+ src: local('Heuristica Italic'), url("Heuristica-Italic.woff") format('woff');
}
@font-face {
font-family: 'Heuristica';
font-style: normal;
font-weight: 700;
- src: local('Heuristica Bold'), url("http://www.rust-lang.org/fonts/Heuristica-Bold.woff") format('woff');
+ src: local('Heuristica Bold'), url("Heuristica-Bold.woff") format('woff');
}
@import "normalize.css";
h1, h2, h3:not(.impl), h4:not(.method) {
color: black;
font-weight: 500;
- margin: 30px 0 20px 0;
+ margin: 30px 0 15px 0;
padding-bottom: 6px;
}
h1.fqn {
h3.impl {
margin-top: 15px;
}
-h1, h2, h3, h4, section.sidebar, a.source, .content a.mod, .search-input {
+h1, h2, h3, h4, section.sidebar, a.source, .search-input, .content table a {
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
code, pre {
font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", Inconsolata, monospace;
+ white-space: pre-wrap;
}
pre {
font-size: 15px;
+ padding: 14px;
+ padding-right: 0;
+ border-left: 2px solid #eee;
+}
+
+.source pre {
+ border-left: none;
+ padding: 20px;
}
nav.sub {
padding: 20px 0;
}
-.content pre { padding: 20px; }
.content.source pre.rust {
white-space: pre;
overflow: auto;
}
.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 {
- margin: 40px 0 10px 0;
- padding: 10px 0;
+ margin: 30px 0 15px 0;
border-bottom: 1px solid #DDD;
}
.stability {
border-left: 6px solid #000;
border-radius: 3px;
- padding: 8px 3px 8px 10px;
+ padding: 2px 10px;
text-transform: lowercase;
- display: block;
- margin-bottom: 20px;
+ margin-left: 10px;
}
.stability.Deprecated { border-color: #D60027; color: #880017; }
:target { background: #FDFFD3; }
-pre.rust, pre.line-numbers { background-color: #F5F5F5; }
-
/* Code highlighting */
pre.rust .kw { color: #8959A8; }
pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; }
pub static EPSILON: f32 = 1.19209290e-07_f32;
-/// Minimum normalized f32 value
-pub static MIN_VALUE: f32 = 1.17549435e-38_f32;
-/// Maximum f32 value
+/// Smallest finite f32 value
+pub static MIN_VALUE: f32 = -3.40282347e+38_f32;
+/// Smallest positive, normalized f32 value
+pub static MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
+/// Largest finite f32 value
pub static MAX_VALUE: f32 = 3.40282347e+38_f32;
pub static MIN_EXP: int = -125;
pub mod consts {
// FIXME: replace with mathematical constants from cmath.
- // FIXME(#11621): These constants should be deprecated once CTFE is
- // implemented in favour of calling their respective functions in `Float`.
+ // FIXME(#5527): These constants should be deprecated once associated
+ // constants are implemented in favour of referencing the respective members
+ // of `Float`.
/// Archimedes' constant
pub static PI: f32 = 3.14159265358979323846264338327950288_f32;
#[inline]
fn max_10_exp(_: Option<f32>) -> int { MAX_10_EXP }
+ #[inline]
+ fn min_pos_value(_: Option<f32>) -> f32 { MIN_POS_VALUE }
+
/// Constructs a floating point number by multiplying `x` by 2 raised to the
/// power of `exp`
#[inline]
}
}
-// FIXME(#11621): These constants should be deprecated once CTFE is implemented
-// in favour of calling their respective functions in `Bounded` and `Float`.
+// FIXME(#5527): These constants should be deprecated once associated
+// constants are implemented in favour of referencing the respective
+// members of `Bounded` and `Float`.
pub static RADIX: uint = 2u;
pub static EPSILON: f64 = 2.2204460492503131e-16_f64;
-/// Minimum normalized f64 value
-pub static MIN_VALUE: f64 = 2.2250738585072014e-308_f64;
-/// Maximum f64 value
+/// Smallest finite f64 value
+pub static MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
+/// Smallest positive, normalized f64 value
+pub static MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
+/// Largest finite f64 value
pub static MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
pub static MIN_EXP: int = -1021;
pub mod consts {
// FIXME: replace with mathematical constants from cmath.
- // FIXME(#11621): These constants should be deprecated once CTFE is
- // implemented in favour of calling their respective functions in `Float`.
+ // FIXME(#5527): These constants should be deprecated once associated
+ // constants are implemented in favour of referencing the respective members
+ // of `Float`.
/// Archimedes' constant
pub static PI: f64 = 3.14159265358979323846264338327950288_f64;
}
#[inline]
- fn mantissa_digits(_: Option<f64>) -> uint { 53 }
+ fn mantissa_digits(_: Option<f64>) -> uint { MANTISSA_DIGITS }
#[inline]
- fn digits(_: Option<f64>) -> uint { 15 }
+ fn digits(_: Option<f64>) -> uint { DIGITS }
#[inline]
- fn epsilon() -> f64 { 2.2204460492503131e-16 }
+ fn epsilon() -> f64 { EPSILON }
#[inline]
- fn min_exp(_: Option<f64>) -> int { -1021 }
+ fn min_exp(_: Option<f64>) -> int { MIN_EXP }
#[inline]
- fn max_exp(_: Option<f64>) -> int { 1024 }
+ fn max_exp(_: Option<f64>) -> int { MAX_EXP }
#[inline]
- fn min_10_exp(_: Option<f64>) -> int { -307 }
+ fn min_10_exp(_: Option<f64>) -> int { MIN_10_EXP }
#[inline]
- fn max_10_exp(_: Option<f64>) -> int { 308 }
+ fn max_10_exp(_: Option<f64>) -> int { MAX_10_EXP }
+
+ #[inline]
+ fn min_pos_value(_: Option<f64>) -> f64 { MIN_POS_VALUE }
/// Constructs a floating point number by multiplying `x` by 2 raised to the
/// power of `exp`
/// Numbers which have upper and lower bounds
pub trait Bounded {
// FIXME (#5527): These should be associated constants
+ /// returns the smallest finite number this type can represent
fn min_value() -> Self;
+ /// returns the largest finite number this type can represent
fn max_value() -> Self;
}
/// Returns the category that this number falls into.
fn classify(self) -> FPCategory;
+ // FIXME (#5527): These should be associated constants
+
/// Returns the number of binary digits of mantissa that this type supports.
fn mantissa_digits(unused_self: Option<Self>) -> uint;
/// Returns the number of base-10 digits of precision that this type supports.
fn min_10_exp(unused_self: Option<Self>) -> int;
/// Returns the maximum base-10 exponent that this type can represent.
fn max_10_exp(unused_self: Option<Self>) -> int;
+ /// Returns the smallest normalized positive number that this type can represent.
+ fn min_pos_value(unused_self: Option<Self>) -> Self;
/// Constructs a floating point number created by multiplying `x` by 2
/// raised to the power of `exp`.
/// legs of length `x` and `y`.
fn hypot(self, other: Self) -> Self;
+ // FIXME (#5527): These should be associated constants
+
/// Archimedes' constant.
fn pi() -> Self;
/// 2.0 * pi.
--- /dev/null
+-include ../tools.mk
+
+all:
+ $(RUSTC) dylib.rs -o $(TMPDIR)/libdylib.so
+ $(RUSTC) main.rs
+ $(call RUN,main)
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type = "dylib"]
+#![allow(dead_code)]
+
+#[no_mangle] pub extern "C" fn fun1() {}
+#[no_mangle] extern "C" fn fun2() {}
+
+mod foo {
+ #[no_mangle] pub extern "C" fn fun3() {}
+}
+pub mod bar {
+ #[no_mangle] pub extern "C" fn fun4() {}
+}
+
+#[no_mangle] pub fn fun5() {}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::unstable::dynamic_lib::DynamicLibrary;
+use std::os;
+
+pub fn main() {
+ unsafe {
+ let path = Path::new("libdylib.so");
+ let a = DynamicLibrary::open(Some(&path)).unwrap();
+ assert!(a.symbol::<int>("fun1").is_ok());
+ assert!(a.symbol::<int>("fun2").is_err());
+ assert!(a.symbol::<int>("fun3").is_err());
+ assert!(a.symbol::<int>("fun4").is_ok());
+ assert!(a.symbol::<int>("fun5").is_ok());
+ }
+}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-test FIXME (#5074) nested method calls
+// ignore-test FIXME (#6268) nested method calls
// Test that (safe) nested calls with `&mut` receivers are permitted.
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32 dynamic_lib can read dllexported symbols only
-// ignore-linux apparently dlsym doesn't work on program symbols?
-// ignore-android apparently dlsym doesn't work on program symbols?
-// ignore-freebsd apparently dlsym doesn't work on program symbols?
-
-use std::unstable::dynamic_lib::DynamicLibrary;
-
-#[no_mangle] pub extern "C" fn fun1() {}
-#[no_mangle] extern "C" fn fun2() {}
-
-mod foo {
- #[no_mangle] pub extern "C" fn fun3() {}
-}
-pub mod bar {
- #[no_mangle] pub extern "C" fn fun4() {}
-}
-
-#[no_mangle] pub fn fun5() {}
-
-pub fn main() {
- unsafe {
- let a = DynamicLibrary::open(None).unwrap();
- assert!(a.symbol::<int>("fun1").is_ok());
- assert!(a.symbol::<int>("fun2").is_err());
- assert!(a.symbol::<int>("fun3").is_err());
- assert!(a.symbol::<int>("fun4").is_ok());
- assert!(a.symbol::<int>("fun5").is_err());
- }
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-test
-//
-// Problem here is that transactions aren't implemented for integer literal
-// inference.
-
-trait plus {
- fn plus() -> int;
-}
-
-impl foo of plus for uint { fn plus() -> int { self as int + 20 } }
-impl foo of plus for int { fn plus() -> int { self + 10 } }
-
-pub fn main() {
- assert_eq!(10.plus(), 20);
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-test - this isn't really a test.
-
- {
-
-// select!
-macro_rules! select_if (
-
- {
- $index:expr,
- $count:expr
- } => {
- fail!()
- };
-
- {
- $index:expr,
- $count:expr,
- $port:path => [
- $(type_this $message:path$(($(x $x: ident),+))dont_type_this*
- -> $next:ident => { $e:expr }),+
- ]
- $(, $ports:path => [
- $(type_this $messages:path$(($(x $xs: ident),+))dont_type_this*
- -> $nexts:ident => { $es:expr }),+
- ] )*
- } => {
- if $index == $count {
- match pipes::try_recv($port) {
- $(Some($message($($($x,)+)* next)) => {
- let $next = next;
- $e
- })+
- _ => fail!()
- }
- } else {
- select_if!(
- $index,
- $count + 1
- $(, $ports => [
- $(type_this $messages$(($(x $xs),+))dont_type_this*
- -> $nexts => { $es }),+
- ])*
- )
- }
- };
-)
-
-macro_rules! select (
- {
- $( $port:path => {
- $($message:path$(($($x: ident),+))dont_type_this*
- -> $next:ident $e:expr),+
- } )+
- } => {
- let index = pipes::selecti([$(($port).header()),+]);
- select_if!(index, 0 $(, $port => [
- $(type_this $message$(($(x $x),+))dont_type_this* -> $next => { $e }),+
- ])+)
- }
-)
-
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-// ignore-test
-
-pub fn main() {
- let s = shell!( uname -a );
- log(debug, s);
-}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-test #7340 fails on 32-bit linux
-use std::ptr;
+// ignore-linux #7340 fails on 32-bit linux
+// ignore-macos #7340 fails on 32-bit macos
-enum a_tag<A> {
- a_tag(A)
+use std::cast;
+
+enum Tag<A> {
+ Tag(A)
}
-struct t_rec {
+struct Rec {
c8: u8,
- t: a_tag<u64>
+ t: Tag<u64>
}
-fn mk_rec() -> t_rec {
- return t_rec { c8:0u8, t:a_tag(0u64) };
+fn mk_rec() -> Rec {
+ return Rec { c8:0u8, t:Tag(0u64) };
}
-fn is_8_byte_aligned(u: &a_tag<u64>) -> bool {
- let p = ptr::to_unsafe_ptr(u) as uint;
+fn is_8_byte_aligned(u: &Tag<u64>) -> bool {
+ let p: uint = unsafe { cast::transmute(u) };
return (p & 7u) == 0u;
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-test #7340 fails on 32-bit linux
-use std::ptr;
+// ignore-linux #7340 fails on 32-bit linux
+// ignore-macos #7340 fails on 32-bit macos
-enum a_tag<A,B> {
- varA(A),
- varB(B)
+use std::cast;
+
+enum Tag<A,B> {
+ VarA(A),
+ VarB(B),
}
-struct t_rec<A,B> {
+struct Rec<A,B> {
chA: u8,
- tA: a_tag<A,B>,
+ tA: Tag<A,B>,
chB: u8,
- tB: a_tag<A,B>
+ tB: Tag<A,B>,
}
-fn mk_rec<A,B>(a: A, b: B) -> t_rec<A,B> {
- return t_rec{ chA:0u8, tA:varA(a), chB:1u8, tB:varB(b) };
+fn mk_rec<A,B>(a: A, b: B) -> Rec<A,B> {
+ Rec { chA:0u8, tA:VarA(a), chB:1u8, tB:VarB(b) }
}
fn is_aligned<A>(amnt: uint, u: &A) -> bool {
- let p = ptr::to_unsafe_ptr(u) as uint;
+ let p: uint = unsafe { cast::transmute(u) };
return (p & (amnt-1u)) == 0u;
}
-fn variant_data_is_aligned<A,B>(amnt: uint, u: &a_tag<A,B>) -> bool {
+fn variant_data_is_aligned<A,B>(amnt: uint, u: &Tag<A,B>) -> bool {
match u {
- &varA(ref a) => is_aligned(amnt, a),
- &varB(ref b) => is_aligned(amnt, b)
+ &VarA(ref a) => is_aligned(amnt, a),
+ &VarB(ref b) => is_aligned(amnt, b)
}
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-test #7340 fails on 32-bit linux
-use std::ptr;
+// ignore-linux #7340 fails on 32-bit linux
+// ignore-macos #7340 fails on 32-bit macos
-enum a_tag {
- a_tag(u64)
+use std::cast;
+
+enum Tag {
+ Tag(u64)
}
-struct t_rec {
+struct Rec {
c8: u8,
- t: a_tag
+ t: Tag
}
-fn mk_rec() -> t_rec {
- return t_rec { c8:0u8, t:a_tag(0u64) };
+fn mk_rec() -> Rec {
+ return Rec { c8:0u8, t:Tag(0u64) };
}
-fn is_8_byte_aligned(u: &a_tag) -> bool {
- let p = ptr::to_unsafe_ptr(u) as u64;
- return (p & 7u64) == 0u64;
+fn is_8_byte_aligned(u: &Tag) -> bool {
+ let p: uint = unsafe { cast::transmute(u) };
+ return (p & 7u) == 0u;
}
pub fn main() {