--- /dev/null
+# i686-unknown-freebsd configuration
+CC_i686-unknown-freebsd=$(CC)
+CXX_i686-unknown-freebsd=$(CXX)
+CPP_i686-unknown-freebsd=$(CPP)
+AR_i686-unknown-freebsd=$(AR)
+CFG_LIB_NAME_i686-unknown-freebsd=lib$(1).so
+CFG_STATIC_LIB_NAME_i686-unknown-freebsd=lib$(1).a
+CFG_LIB_GLOB_i686-unknown-freebsd=lib$(1)-*.so
+CFG_LIB_DSYM_GLOB_i686-unknown-freebsd=$(1)-*.dylib.dSYM
+CFG_JEMALLOC_CFLAGS_i686-unknown-freebsd := -m32 -arch i386 -I/usr/local/include $(CFLAGS)
+CFG_GCCISH_CFLAGS_i686-unknown-freebsd := -Wall -Werror -g -fPIC -m32 -arch i386 -I/usr/local/include $(CFLAGS)
+CFG_GCCISH_LINK_FLAGS_i686-unknown-freebsd := -m32 -shared -fPIC -g -pthread -lrt
+CFG_GCCISH_DEF_FLAG_i686-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
+CFG_LLC_FLAGS_i686-unknown-freebsd :=
+CFG_INSTALL_NAME_i686-unknown-freebsd =
+CFG_EXE_SUFFIX_i686-unknown-freebsd :=
+CFG_WINDOWSY_i686-unknown-freebsd :=
+CFG_UNIXY_i686-unknown-freebsd := 1
+CFG_LDPATH_i686-unknown-freebsd :=
+CFG_RUN_i686-unknown-freebsd=$(2)
+CFG_RUN_TARG_i686-unknown-freebsd=$(call CFG_RUN_i686-unknown-freebsd,,$(2))
+CFG_GNU_TRIPLE_i686-unknown-freebsd := i686-unknown-freebsd
ptr::write(self.ptr.offset(off as isize), t);
}
- /// Returns true iff the buffer is at capacity
+ /// Returns true if and only if the buffer is at capacity
#[inline]
fn is_full(&self) -> bool { self.cap - self.len() == 1 }
fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
}
+
+ /// Returns the wrapped `Formatter`.
+ #[unstable(feature = "debug_builder_formatter", reason = "recently added")]
+ pub fn formatter(&mut self) -> &mut fmt::Formatter<'b> {
+ &mut self.fmt
+ }
}
struct DebugInner<'a, 'b: 'a> {
impl<$($name:Debug),*> Debug for ($($name,)*) {
#[allow(non_snake_case, unused_assignments)]
fn fmt(&self, f: &mut Formatter) -> Result {
- try!(write!(f, "("));
+ let mut builder = f.debug_tuple("");
let ($(ref $name,)*) = *self;
let mut n = 0;
$(
- if n > 0 {
- try!(write!(f, ", "));
- }
- try!(write!(f, "{:?}", *$name));
+ builder.field($name);
n += 1;
)*
+
if n == 1 {
- try!(write!(f, ","));
+ try!(write!(builder.formatter(), ","));
}
- write!(f, ")")
+
+ builder.finish()
}
}
peel! { $($name,)* }
acc
}
- /// Returns `true` iff `self == 2^k` for some `k`.
+ /// Returns `true` if and only if `self == 2^k` for some `k`.
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_power_of_two(self) -> bool {
}
}
+ #[cfg(target_arch = "x86")]
+ pub mod arch {
+ pub mod c95 {
+ pub type c_char = i8;
+ pub type c_schar = i8;
+ pub type c_uchar = u8;
+ pub type c_short = i16;
+ pub type c_ushort = u16;
+ pub type c_int = i32;
+ pub type c_uint = u32;
+ pub type c_long = i32;
+ pub type c_ulong = u32;
+ pub type c_float = f32;
+ pub type c_double = f64;
+ pub type size_t = u32;
+ pub type ptrdiff_t = i32;
+ pub type clock_t = i32;
+ pub type time_t = i32;
+ pub type suseconds_t = i32;
+ pub type wchar_t = i32;
+ }
+ pub mod c99 {
+ pub type c_longlong = i64;
+ pub type c_ulonglong = u64;
+ pub type intptr_t = i32;
+ pub type uintptr_t = u32;
+ pub type intmax_t = i64;
+ pub type uintmax_t = u64;
+ }
+ pub mod posix88 {
+ pub type off_t = i64;
+ pub type dev_t = u32;
+ pub type ino_t = u32;
+ pub type pid_t = i32;
+ pub type uid_t = u32;
+ pub type gid_t = u32;
+ pub type useconds_t = u32;
+ pub type mode_t = u16;
+ pub type ssize_t = i32;
+ }
+ pub mod posix01 {
+ use types::common::c95::{c_void};
+ use types::common::c99::{uint8_t, uint32_t, int32_t};
+ use types::os::arch::c95::{c_long, time_t};
+ use types::os::arch::posix88::{dev_t, gid_t, ino_t};
+ use types::os::arch::posix88::{mode_t, off_t};
+ use types::os::arch::posix88::{uid_t};
+
+ pub type nlink_t = u16;
+ pub type blksize_t = i32;
+ pub type blkcnt_t = i64;
+ pub type fflags_t = u32;
+ #[repr(C)]
+ #[derive(Copy, Clone)] pub struct stat {
+ pub st_dev: dev_t,
+ pub st_ino: ino_t,
+ pub st_mode: mode_t,
+ pub st_nlink: nlink_t,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub st_rdev: dev_t,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub st_size: off_t,
+ pub st_blocks: blkcnt_t,
+ pub st_blksize: blksize_t,
+ pub st_flags: fflags_t,
+ pub st_gen: uint32_t,
+ pub st_lspare: int32_t,
+ pub st_birthtime: time_t,
+ pub st_birthtime_nsec: c_long,
+ pub __unused: [uint8_t; 2],
+ }
+
+ #[repr(C)]
+ #[derive(Copy, Clone)] pub struct utimbuf {
+ pub actime: time_t,
+ pub modtime: time_t,
+ }
+
+ pub type pthread_attr_t = *mut c_void;
+ }
+ pub mod posix08 {
+ }
+ pub mod bsd44 {
+ }
+ pub mod extra {
+ }
+ }
+
#[cfg(target_arch = "x86_64")]
pub mod arch {
pub mod c95 {
--- /dev/null
+// Copyright 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 target::Target;
+
+pub fn target() -> Target {
+ let mut base = super::freebsd_base::opts();
+ base.cpu = "pentium4".to_string();
+ base.pre_link_args.push("-m32".to_string());
+ base.morestack = false;
+
+ Target {
+ data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
+ llvm_target: "i686-unknown-freebsd".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "32".to_string(),
+ arch: "x86".to_string(),
+ target_os: "freebsd".to_string(),
+ target_env: "".to_string(),
+ options: base,
+ }
+}
arm_linux_androideabi,
aarch64_linux_android,
+ i686_unknown_freebsd,
x86_64_unknown_freebsd,
i686_unknown_dragonfly,
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
- placeholder="Click or press 'S' to search, '?' for more options..."
+ placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
<div id="help" class="hidden">
<div class="shortcuts">
- <h1>Keyboard shortcuts</h1>
+ <h1>Keyboard Shortcuts</h1>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
</dl>
</div>
<div class="infos">
- <h1>Search tricks</h1>
+ <h1>Search Tricks</h1>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
#help {
background: #e9e9e9;
- border-radius: 4px;
box-shadow: 0 0 6px rgba(0,0,0,.2);
position: absolute;
top: 300px;
#help dt {
float: left;
- border-radius: 3px;
+ border-radius: 4px;
border: 1px solid #bfbfbf;
background: #fff;
width: 23px;
highlightSourceLines(null);
$(window).on('hashchange', highlightSourceLines);
- // Helper function for Keyboard events,
- // Get's the char from the keypress event
+ // Gets the human-readable string for the virtual-key code of the
+ // given KeyboardEvent, ev.
//
- // This method is used because e.wich === x is not
- // compatible with non-english keyboard layouts
+ // This function is meant as a polyfill for KeyboardEvent#key,
+ // since it is not supported in Trident. We also test for
+ // KeyboardEvent#keyCode because the handleShortcut handler is
+ // also registered for the keydown event, because Blink doesn't fire
+ // keypress on hitting the Escape key.
//
- // Note: event.type must be keypress !
- function getChar(event) {
- if (event.which == null) {
- return String.fromCharCode(event.keyCode) // IE
- } else if (event.which!=0 && event.charCode!=0) {
- return String.fromCharCode(event.which) // the rest
- } else {
- return null // special key
- }
+ // So I guess you could say things are getting pretty interoperable.
+ function getVirtualKey(ev) {
+ if ("key" in ev && typeof ev.key != "undefined")
+ return ev.key;
+
+ var c = ev.charCode || ev.keyCode;
+ if (c == 27)
+ return "Escape";
+ return String.fromCharCode(c);
}
- $(document).on('keypress', function handleKeyboardShortcut(e) {
- if (document.activeElement.tagName === 'INPUT') {
+ function handleShortcut(ev) {
+ if (document.activeElement.tagName == "INPUT")
return;
- }
- if (getChar(e) === '?') {
- if (e.shiftKey && $('#help').hasClass('hidden')) {
- e.preventDefault();
- $('#help').removeClass('hidden');
+ switch (getVirtualKey(ev)) {
+ case "Escape":
+ if (!$("#help").hasClass("hidden")) {
+ ev.preventDefault();
+ $("#help").addClass("hidden");
+ } else if (!$("#search").hasClass("hidden")) {
+ ev.preventDefault();
+ $("#search").addClass("hidden");
+ $("#main").removeClass("hidden");
}
- } else if (getChar(e) === 's' || getChar(e) === 'S') {
- e.preventDefault();
- $('.search-input').focus();
- }
- }).on('keydown', function(e) {
- // The escape key event has to be captured with the keydown event.
- // Because keypressed has no keycode for the escape key
- // (and other special keys in general)...
- if (document.activeElement.tagName === 'INPUT') {
- return;
- }
-
- if (e.keyCode === 27) { // escape key
- if (!$('#help').hasClass('hidden')) {
- e.preventDefault();
- $('#help').addClass('hidden');
- } else if (!$('#search').hasClass('hidden')) {
- e.preventDefault();
- $('#search').addClass('hidden');
- $('#main').removeClass('hidden');
+ break;
+
+ case "s":
+ case "S":
+ ev.preventDefault();
+ $(".search-input").focus();
+ break;
+
+ case "?":
+ if (ev.shiftKey && $("#help").hasClass("hidden")) {
+ ev.preventDefault();
+ $("#help").removeClass("hidden");
}
+ break;
}
- }).on('click', function(e) {
- if (!$(e.target).closest('#help').length) {
- $('#help').addClass('hidden');
+ }
+
+ $(document).on("keypress", handleShortcut);
+ $(document).on("keydown", handleShortcut);
+ $(document).on("click", function(ev) {
+ if (!$(ev.target).closest("#help").length) {
+ $("#help").addClass("hidden");
}
});
-
$('.version-selector').on('change', function() {
var i, match,
url = document.location.href,
document.location.href = url;
});
+
/**
* A function to compute the Levenshtein distance between two strings
* Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported
}
var featureRegexp = new RegExp('^\s*#!\\[feature\\(\.*?\\)\\]');
- var elements = document.querySelectorAll('pre.rust');
+ var elements = document.querySelectorAll('pre.rust-example-rendered');
Array.prototype.forEach.call(elements, function(el) {
el.onmouseover = function(e) {
/// will be extended to `size` and have all of the intermediate data filled
/// in with 0s.
///
+ /// # Errors
+ ///
+ /// This function will return an error if the file is not opened for writing.
+ ///
/// # Examples
///
/// ```no_run
/// use std::fs::File;
///
/// # fn foo() -> std::io::Result<()> {
- /// let mut f = try!(File::open("foo.txt"));
- /// try!(f.set_len(0));
+ /// let mut f = try!(File::create("foo.txt"));
+ /// try!(f.set_len(10));
/// # Ok(())
/// # }
/// ```
asm!("movl $$0x48+90*4, %eax
movl $0, %gs:(%eax)" :: "r"(limit) : "eax" : "volatile")
}
- #[cfg(all(target_arch = "x86",
- any(target_os = "linux", target_os = "freebsd")))]
+ #[cfg(all(target_arch = "x86", target_os = "linux"))]
#[inline(always)]
unsafe fn target_record_sp_limit(limit: usize) {
asm!("movl $0, %gs:48" :: "r"(limit) :: "volatile")
// aarch64 - FIXME(AARCH64): missing...
// powerpc - FIXME(POWERPC): missing...
// arm-ios - iOS segmented stack is disabled for now, see related notes
- // openbsd - segmented stack is disabled
+ // openbsd/bitrig/netbsd - no segmented stacks.
+ // x86-freebsd - no segmented stacks.
#[cfg(any(target_arch = "aarch64",
target_arch = "powerpc",
all(target_arch = "arm", target_os = "ios"),
+ all(target_arch = "x86", target_os = "freebsd"),
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]
movl %gs:(%eax), $0" : "=r"(limit) :: "eax" : "volatile");
return limit;
}
- #[cfg(all(target_arch = "x86",
- any(target_os = "linux", target_os = "freebsd")))]
+ #[cfg(all(target_arch = "x86", target_os = "linux"))]
#[inline(always)]
unsafe fn target_get_sp_limit() -> usize {
let limit;
// aarch64 - FIXME(AARCH64): missing...
// powerpc - FIXME(POWERPC): missing...
- // arm-ios - iOS doesn't support segmented stacks yet.
- // openbsd - OpenBSD doesn't support segmented stacks.
+ // arm-ios - no segmented stacks.
+ // openbsd/bitrig/netbsd - no segmented stacks.
+ // x86-freebsd - no segmented stacks..
//
// This function might be called by runtime though
// so it is unsafe to unreachable, let's return a fixed constant.
#[cfg(any(target_arch = "aarch64",
target_arch = "powerpc",
all(target_arch = "arm", target_os = "ios"),
+ all(target_arch = "x86", target_os = "freebsd"),
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]