auto merge of #17853 : alexcrichton/rust/issue-17718, r=pcwalton

This change is an implementation of [RFC 69][rfc] which adds a third kind of
global to the language, `const`. This global is most similar to what the old
`static` was, and if you're unsure about what to use then you should use a
`const`.

The semantics of these three kinds of globals are:

* A `const` does not represent a memory location, but only a value. Constants
  are translated as rvalues, which means that their values are directly inlined
  at usage location (similar to a #define in C/C++). Constant values are, well,
  constant, and can not be modified. Any "modification" is actually a
  modification to a local value on the stack rather than the actual constant
  itself.

  Almost all values are allowed inside constants, whether they have interior
  mutability or not. There are a few minor restrictions listed in the RFC, but
  they should in general not come up too often.

* A `static` now always represents a memory location (unconditionally). Any
  references to the same `static` are actually a reference to the same memory
  location. Only values whose types ascribe to `Sync` are allowed in a `static`.
  This restriction is in place because many threads may access a `static`
  concurrently. Lifting this restriction (and allowing unsafe access) is a
  future extension not implemented at this time.

* A `static mut` continues to always represent a memory location. All references
  to a `static mut` continue to be `unsafe`.

This is a large breaking change, and many programs will need to be updated
accordingly. A summary of the breaking changes is:

* Statics may no longer be used in patterns. Statics now always represent a
  memory location, which can sometimes be modified. To fix code, repurpose the
  matched-on-`static` to a `const`.

      static FOO: uint = 4;
      match n {
          FOO => { /* ... */ }
          _ => { /* ... */ }
      }

  change this code to:

      const FOO: uint = 4;
      match n {
          FOO => { /* ... */ }
          _ => { /* ... */ }
      }

* Statics may no longer refer to other statics by value. Due to statics being
  able to change at runtime, allowing them to reference one another could
  possibly lead to confusing semantics. If you are in this situation, use a
  constant initializer instead. Note, however, that statics may reference other
  statics by address, however.

* Statics may no longer be used in constant expressions, such as array lengths.
  This is due to the same restrictions as listed above. Use a `const` instead.

[breaking-change]
Closes #17718 

[rfc]: https://github.com/rust-lang/rfcs/pull/246
This commit is contained in:
bors
2014-10-10 00:07:08 +00:00
193 changed files with 3932 additions and 3152 deletions
+65 -19
View File
@@ -1383,44 +1383,87 @@ a = Cat { name: "Spotty".to_string(), weight: 2.7 };
In this example, `Cat` is a _struct-like enum variant_,
whereas `Dog` is simply called an enum variant.
### Static items
### Constant items
```{.ebnf .gram}
static_item : "static" ident ':' type '=' expr ';' ;
const_item : "const" ident ':' type '=' expr ';' ;
```
A *static item* is a named _constant value_ stored in the global data section
of a crate. Immutable static items are stored in the read-only data section.
The constant value bound to a static item is, like all constant values,
evaluated at compile time. Static items have the `static` lifetime, which
outlives all other lifetimes in a Rust program. Only values stored in the
global data section (such as string constants and static items) can have the
`static` lifetime; dynamically constructed values cannot safely be assigned the
`static` lifetime. Static items are declared with the `static` keyword. A
static item must have a _constant expression_ giving its definition.
A *constant item* is a named _constant value_ which is not associated with a
specific memory location in the program. Constants are essentially inlined
wherever they are used, meaning that they are copied directly into the relevant
context when used. References to the same constant are not necessarily
guaranteed to refer to the same memory address.
Static items must be explicitly typed. The type may be `bool`, `char`,
a number, or a type derived from those primitive types. The derived types are
references with the `static` lifetime, fixed-size arrays, tuples, and structs.
Constant values must not have destructors, and otherwise permit most forms of
data. Constants may refer to the address of other constants, in which case the
address will have the `static` lifetime. The compiler is, however, still at
liberty to translate the constant many times, so the address referred to may not
be stable.
Constants must be explicitly typed. The type may be `bool`, `char`, a number, or
a type derived from those primitive types. The derived types are references with
the `static` lifetime, fixed-size arrays, tuples, enum variants, and structs.
```
static BIT1: uint = 1 << 0;
static BIT2: uint = 1 << 1;
const BIT1: uint = 1 << 0;
const BIT2: uint = 1 << 1;
static BITS: [uint, ..2] = [BIT1, BIT2];
static STRING: &'static str = "bitstring";
const BITS: [uint, ..2] = [BIT1, BIT2];
const STRING: &'static str = "bitstring";
struct BitsNStrings<'a> {
mybits: [uint, ..2],
mystring: &'a str
}
static BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings {
const BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings {
mybits: BITS,
mystring: STRING
};
```
### Static items
```{.ebnf .gram}
static_item : "static" ident ':' type '=' expr ';' ;
```
A *static item* is similar to a *constant*, except that it represents a precise
memory location in the program. A static is never "inlined" at the usage site,
and all references to it refer to the same memory location. Static items have
the `static` lifetime, which outlives all other lifetimes in a Rust program.
Static items may be placed in read-only memory if they do not contain any
interior mutability.
Statics may contain interior mutability through the `UnsafeCell` language item.
All access to a static is safe, but there are a number of restrictions on
statics:
* Statics may not contain any destructors.
* The types of static values must ascribe to `Sync` to allow threadsafe access.
* Statics may not refer to other statics by value, only by reference.
* Constants cannot refer to statics.
Constants should in general be preferred over statics, unless large amounts of
data are being stored, or single-address and mutability properties are required.
```
use std::sync::atomic;
// Note that INIT_ATOMIC_UINT is a *const*, but it may be used to initialize a
// static. This static can be modified, so it is not placed in read-only memory.
static COUNTER: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT;
// This table is a candidate to be placed in read-only memory.
static TABLE: &'static [uint] = &[1, 2, 3, /* ... */];
for slot in TABLE.iter() {
println!("{}", slot);
}
COUNTER.fetch_add(1, atomic::SeqCst);
```
#### Mutable statics
If a static item is declared with the `mut` keyword, then it is allowed to
@@ -1455,6 +1498,9 @@ unsafe fn bump_levels_unsafe2() -> uint {
}
```
Mutable statics have the same restrictions as normal statics, except that the
type of the value is not required to ascribe to `Sync`.
### Traits
A _trait_ describes a set of method types.
+4 -4
View File
@@ -333,14 +333,14 @@ def emit_property_module(f, mod, tbl, emit_fn):
def emit_regex_module(f, cats, w_data):
f.write("pub mod regex {\n")
regex_class = "&'static [(char, char)]"
class_table = "&'static [(&'static str, %s)]" % regex_class
class_table = "&'static [(&'static str, &'static %s)]" % regex_class
emit_table(f, "UNICODE_CLASSES", cats, class_table,
pfun=lambda x: "(\"%s\",super::%s::%s_table)" % (x[0], x[1], x[0]))
pfun=lambda x: "(\"%s\",&super::%s::%s_table)" % (x[0], x[1], x[0]))
f.write(" pub static PERLD: %s = super::general_category::Nd_table;\n\n"
f.write(" pub static PERLD: &'static %s = &super::general_category::Nd_table;\n\n"
% regex_class)
f.write(" pub static PERLS: %s = super::property::White_Space_table;\n\n"
f.write(" pub static PERLS: &'static %s = &super::property::White_Space_table;\n\n"
% regex_class)
emit_table(f, "PERLW", w_data, regex_class)
+1 -1
View File
@@ -85,7 +85,7 @@ pub fn stats_print() {
///
/// This preserves the non-null invariant for types like `Box<T>`. The address may overlap with
/// non-zero-size memory allocations.
pub static EMPTY: *mut () = 0x1 as *mut ();
pub const EMPTY: *mut () = 0x1 as *mut ();
/// The allocator for unique pointers.
#[cfg(not(test))]
+4 -4
View File
@@ -34,10 +34,10 @@
use slice;
// FIXME: #5244: need to manually update the TrieNode constructor
static SHIFT: uint = 4;
static SIZE: uint = 1 << SHIFT;
static MASK: uint = SIZE - 1;
static NUM_CHUNKS: uint = uint::BITS / SHIFT;
const SHIFT: uint = 4;
const SIZE: uint = 1 << SHIFT;
const MASK: uint = SIZE - 1;
const NUM_CHUNKS: uint = uint::BITS / SHIFT;
#[deriving(Clone)]
enum Child<T> {
+4 -4
View File
@@ -77,19 +77,19 @@ pub enum Ordering {
/// An `AtomicBool` initialized to `false`
#[unstable = "may be renamed, pending conventions for static initalizers"]
pub static INIT_ATOMIC_BOOL: AtomicBool =
pub const INIT_ATOMIC_BOOL: AtomicBool =
AtomicBool { v: UnsafeCell { value: 0 }, nocopy: marker::NoCopy };
/// An `AtomicInt` initialized to `0`
#[unstable = "may be renamed, pending conventions for static initalizers"]
pub static INIT_ATOMIC_INT: AtomicInt =
pub const INIT_ATOMIC_INT: AtomicInt =
AtomicInt { v: UnsafeCell { value: 0 }, nocopy: marker::NoCopy };
/// An `AtomicUint` initialized to `0`
#[unstable = "may be renamed, pending conventions for static initalizers"]
pub static INIT_ATOMIC_UINT: AtomicUint =
pub const INIT_ATOMIC_UINT: AtomicUint =
AtomicUint { v: UnsafeCell { value: 0, }, nocopy: marker::NoCopy };
// NB: Needs to be -1 (0b11111111...) to make fetch_nand work correctly
static UINT_TRUE: uint = -1;
const UINT_TRUE: uint = -1;
#[stable]
impl AtomicBool {
+2 -2
View File
@@ -219,8 +219,8 @@ pub struct RefCell<T> {
// Values [1, MAX-1] represent the number of `Ref` active
// (will not outgrow its range since `uint` is the size of the address space)
type BorrowFlag = uint;
static UNUSED: BorrowFlag = 0;
static WRITING: BorrowFlag = -1;
const UNUSED: BorrowFlag = 0;
const WRITING: BorrowFlag = -1;
impl<T> RefCell<T> {
/// Create a new `RefCell` containing `value`
+1 -1
View File
@@ -63,7 +63,7 @@
*/
/// The highest valid code point
pub static MAX: char = '\U0010ffff';
pub const MAX: char = '\U0010ffff';
/// Converts from `u32` to a `char`
#[inline]
+33 -33
View File
@@ -20,29 +20,29 @@
use num::Float;
use option::Option;
pub static RADIX: uint = 2u;
pub const RADIX: uint = 2u;
pub static MANTISSA_DIGITS: uint = 24u;
pub static DIGITS: uint = 6u;
pub const MANTISSA_DIGITS: uint = 24u;
pub const DIGITS: uint = 6u;
pub static EPSILON: f32 = 1.19209290e-07_f32;
pub const EPSILON: f32 = 1.19209290e-07_f32;
/// Smallest finite f32 value
pub static MIN_VALUE: f32 = -3.40282347e+38_f32;
pub const MIN_VALUE: f32 = -3.40282347e+38_f32;
/// Smallest positive, normalized f32 value
pub static MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
/// Largest finite f32 value
pub static MAX_VALUE: f32 = 3.40282347e+38_f32;
pub const MAX_VALUE: f32 = 3.40282347e+38_f32;
pub static MIN_EXP: int = -125;
pub static MAX_EXP: int = 128;
pub const MIN_EXP: int = -125;
pub const MAX_EXP: int = 128;
pub static MIN_10_EXP: int = -37;
pub static MAX_10_EXP: int = 38;
pub const MIN_10_EXP: int = -37;
pub const MAX_10_EXP: int = 38;
pub static NAN: f32 = 0.0_f32/0.0_f32;
pub static INFINITY: f32 = 1.0_f32/0.0_f32;
pub static NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
pub const NAN: f32 = 0.0_f32/0.0_f32;
pub const INFINITY: f32 = 1.0_f32/0.0_f32;
pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
/// Various useful constants.
pub mod consts {
@@ -53,55 +53,55 @@ pub mod consts {
// of `Float`.
/// Archimedes' constant
pub static PI: f32 = 3.14159265358979323846264338327950288_f32;
pub const PI: f32 = 3.14159265358979323846264338327950288_f32;
/// pi * 2.0
pub static PI_2: f32 = 6.28318530717958647692528676655900576_f32;
pub const PI_2: f32 = 6.28318530717958647692528676655900576_f32;
/// pi/2.0
pub static FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
/// pi/3.0
pub static FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
pub const FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
/// pi/4.0
pub static FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
pub const FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
/// pi/6.0
pub static FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
pub const FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
/// pi/8.0
pub static FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
pub const FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
/// 1.0/pi
pub static FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
pub const FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
/// 2.0/pi
pub static FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
/// 2.0/sqrt(pi)
pub static FRAC_2_SQRTPI: f32 = 1.12837916709551257389615890312154517_f32;
pub const FRAC_2_SQRTPI: f32 = 1.12837916709551257389615890312154517_f32;
/// sqrt(2.0)
pub static SQRT2: f32 = 1.41421356237309504880168872420969808_f32;
pub const SQRT2: f32 = 1.41421356237309504880168872420969808_f32;
/// 1.0/sqrt(2.0)
pub static FRAC_1_SQRT2: f32 = 0.707106781186547524400844362104849039_f32;
pub const FRAC_1_SQRT2: f32 = 0.707106781186547524400844362104849039_f32;
/// Euler's number
pub static E: f32 = 2.71828182845904523536028747135266250_f32;
pub const E: f32 = 2.71828182845904523536028747135266250_f32;
/// log2(e)
pub static LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
pub const LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
/// log10(e)
pub static LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
pub const LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
/// ln(2.0)
pub static LN_2: f32 = 0.693147180559945309417232121458176568_f32;
pub const LN_2: f32 = 0.693147180559945309417232121458176568_f32;
/// ln(10.0)
pub static LN_10: f32 = 2.30258509299404568401799145468436421_f32;
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
}
impl Float for f32 {
@@ -143,8 +143,8 @@ fn is_normal(self) -> bool {
/// is going to be tested, it is generally faster to use the specific
/// predicate instead.
fn classify(self) -> FPCategory {
static EXP_MASK: u32 = 0x7f800000;
static MAN_MASK: u32 = 0x007fffff;
const EXP_MASK: u32 = 0x7f800000;
const MAN_MASK: u32 = 0x007fffff;
let bits: u32 = unsafe { mem::transmute(self) };
match (bits & MAN_MASK, bits & EXP_MASK) {
+33 -33
View File
@@ -24,31 +24,31 @@
// constants are implemented in favour of referencing the respective
// members of `Bounded` and `Float`.
pub static RADIX: uint = 2u;
pub const RADIX: uint = 2u;
pub static MANTISSA_DIGITS: uint = 53u;
pub static DIGITS: uint = 15u;
pub const MANTISSA_DIGITS: uint = 53u;
pub const DIGITS: uint = 15u;
pub static EPSILON: f64 = 2.2204460492503131e-16_f64;
pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
/// Smallest finite f64 value
pub static MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
pub const MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
/// Smallest positive, normalized f64 value
pub static MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
/// Largest finite f64 value
pub static MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
pub static MIN_EXP: int = -1021;
pub static MAX_EXP: int = 1024;
pub const MIN_EXP: int = -1021;
pub const MAX_EXP: int = 1024;
pub static MIN_10_EXP: int = -307;
pub static MAX_10_EXP: int = 308;
pub const MIN_10_EXP: int = -307;
pub const MAX_10_EXP: int = 308;
pub static NAN: f64 = 0.0_f64/0.0_f64;
pub const NAN: f64 = 0.0_f64/0.0_f64;
pub static INFINITY: f64 = 1.0_f64/0.0_f64;
pub const INFINITY: f64 = 1.0_f64/0.0_f64;
pub static NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
/// Various useful constants.
pub mod consts {
@@ -59,55 +59,55 @@ pub mod consts {
// of `Float`.
/// Archimedes' constant
pub static PI: f64 = 3.14159265358979323846264338327950288_f64;
pub const PI: f64 = 3.14159265358979323846264338327950288_f64;
/// pi * 2.0
pub static PI_2: f64 = 6.28318530717958647692528676655900576_f64;
pub const PI_2: f64 = 6.28318530717958647692528676655900576_f64;
/// pi/2.0
pub static FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
pub const FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
/// pi/3.0
pub static FRAC_PI_3: f64 = 1.04719755119659774615421446109316763_f64;
pub const FRAC_PI_3: f64 = 1.04719755119659774615421446109316763_f64;
/// pi/4.0
pub static FRAC_PI_4: f64 = 0.785398163397448309615660845819875721_f64;
pub const FRAC_PI_4: f64 = 0.785398163397448309615660845819875721_f64;
/// pi/6.0
pub static FRAC_PI_6: f64 = 0.52359877559829887307710723054658381_f64;
pub const FRAC_PI_6: f64 = 0.52359877559829887307710723054658381_f64;
/// pi/8.0
pub static FRAC_PI_8: f64 = 0.39269908169872415480783042290993786_f64;
pub const FRAC_PI_8: f64 = 0.39269908169872415480783042290993786_f64;
/// 1.0/pi
pub static FRAC_1_PI: f64 = 0.318309886183790671537767526745028724_f64;
pub const FRAC_1_PI: f64 = 0.318309886183790671537767526745028724_f64;
/// 2.0/pi
pub static FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
pub const FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
/// 2.0/sqrt(pi)
pub static FRAC_2_SQRTPI: f64 = 1.12837916709551257389615890312154517_f64;
pub const FRAC_2_SQRTPI: f64 = 1.12837916709551257389615890312154517_f64;
/// sqrt(2.0)
pub static SQRT2: f64 = 1.41421356237309504880168872420969808_f64;
pub const SQRT2: f64 = 1.41421356237309504880168872420969808_f64;
/// 1.0/sqrt(2.0)
pub static FRAC_1_SQRT2: f64 = 0.707106781186547524400844362104849039_f64;
pub const FRAC_1_SQRT2: f64 = 0.707106781186547524400844362104849039_f64;
/// Euler's number
pub static E: f64 = 2.71828182845904523536028747135266250_f64;
pub const E: f64 = 2.71828182845904523536028747135266250_f64;
/// log2(e)
pub static LOG2_E: f64 = 1.44269504088896340735992468100189214_f64;
pub const LOG2_E: f64 = 1.44269504088896340735992468100189214_f64;
/// log10(e)
pub static LOG10_E: f64 = 0.434294481903251827651128918916605082_f64;
pub const LOG10_E: f64 = 0.434294481903251827651128918916605082_f64;
/// ln(2.0)
pub static LN_2: f64 = 0.693147180559945309417232121458176568_f64;
pub const LN_2: f64 = 0.693147180559945309417232121458176568_f64;
/// ln(10.0)
pub static LN_10: f64 = 2.30258509299404568401799145468436421_f64;
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
}
impl Float for f64 {
@@ -149,8 +149,8 @@ fn is_normal(self) -> bool {
/// is going to be tested, it is generally faster to use the specific
/// predicate instead.
fn classify(self) -> FPCategory {
static EXP_MASK: u64 = 0x7ff0000000000000;
static MAN_MASK: u64 = 0x000fffffffffffff;
const EXP_MASK: u64 = 0x7ff0000000000000;
const MAN_MASK: u64 = 0x000fffffffffffff;
let bits: u64 = unsafe { mem::transmute(self) };
match (bits & MAN_MASK, bits & EXP_MASK) {
+4 -4
View File
@@ -16,20 +16,20 @@ macro_rules! int_module (($T:ty, $bits:expr) => (
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `mem::size_of` function.
#[unstable]
pub static BITS : uint = $bits;
pub const BITS : uint = $bits;
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `mem::size_of` function.
#[unstable]
pub static BYTES : uint = ($bits / 8);
pub const BYTES : uint = ($bits / 8);
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `Bounded::min_value` function.
#[unstable]
pub static MIN: $T = (-1 as $T) << (BITS - 1);
pub const MIN: $T = (-1 as $T) << (BITS - 1);
// FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `Bounded::max_value` function.
#[unstable]
pub static MAX: $T = !MIN;
pub const MAX: $T = !MIN;
))
+4 -4
View File
@@ -14,13 +14,13 @@
macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (
#[unstable]
pub static BITS : uint = $bits;
pub const BITS : uint = $bits;
#[unstable]
pub static BYTES : uint = ($bits / 8);
pub const BYTES : uint = ($bits / 8);
#[unstable]
pub static MIN: $T = 0 as $T;
pub const MIN: $T = 0 as $T;
#[unstable]
pub static MAX: $T = 0 as $T - 1 as $T;
pub const MAX: $T = 0 as $T - 1 as $T;
))
+2 -2
View File
@@ -1049,9 +1049,9 @@ pub struct CharRange {
}
/// Mask of the value bits of a continuation byte
static CONT_MASK: u8 = 0b0011_1111u8;
const CONT_MASK: u8 = 0b0011_1111u8;
/// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte
static TAG_CONT_U8: u8 = 0b1000_0000u8;
const TAG_CONT_U8: u8 = 0b1000_0000u8;
/// Unsafe operations
pub mod raw {
+1656 -1656
View File
@@ -2003,108 +2003,108 @@ pub mod os {
pub mod c95 {
use types::os::arch::c95::{c_int, c_uint};
pub static EXIT_FAILURE : c_int = 1;
pub static EXIT_SUCCESS : c_int = 0;
pub static RAND_MAX : c_int = 32767;
pub static EOF : c_int = -1;
pub static SEEK_SET : c_int = 0;
pub static SEEK_CUR : c_int = 1;
pub static SEEK_END : c_int = 2;
pub static _IOFBF : c_int = 0;
pub static _IONBF : c_int = 4;
pub static _IOLBF : c_int = 64;
pub static BUFSIZ : c_uint = 512_u32;
pub static FOPEN_MAX : c_uint = 20_u32;
pub static FILENAME_MAX : c_uint = 260_u32;
pub static L_tmpnam : c_uint = 16_u32;
pub static TMP_MAX : c_uint = 32767_u32;
pub const EXIT_FAILURE : c_int = 1;
pub const EXIT_SUCCESS : c_int = 0;
pub const RAND_MAX : c_int = 32767;
pub const EOF : c_int = -1;
pub const SEEK_SET : c_int = 0;
pub const SEEK_CUR : c_int = 1;
pub const SEEK_END : c_int = 2;
pub const _IOFBF : c_int = 0;
pub const _IONBF : c_int = 4;
pub const _IOLBF : c_int = 64;
pub const BUFSIZ : c_uint = 512_u32;
pub const FOPEN_MAX : c_uint = 20_u32;
pub const FILENAME_MAX : c_uint = 260_u32;
pub const L_tmpnam : c_uint = 16_u32;
pub const TMP_MAX : c_uint = 32767_u32;
pub static WSAEINTR: c_int = 10004;
pub static WSAEBADF: c_int = 10009;
pub static WSAEACCES: c_int = 10013;
pub static WSAEFAULT: c_int = 10014;
pub static WSAEINVAL: c_int = 10022;
pub static WSAEMFILE: c_int = 10024;
pub static WSAEWOULDBLOCK: c_int = 10035;
pub static WSAEINPROGRESS: c_int = 10036;
pub static WSAEALREADY: c_int = 10037;
pub static WSAENOTSOCK: c_int = 10038;
pub static WSAEDESTADDRREQ: c_int = 10039;
pub static WSAEMSGSIZE: c_int = 10040;
pub static WSAEPROTOTYPE: c_int = 10041;
pub static WSAENOPROTOOPT: c_int = 10042;
pub static WSAEPROTONOSUPPORT: c_int = 10043;
pub static WSAESOCKTNOSUPPORT: c_int = 10044;
pub static WSAEOPNOTSUPP: c_int = 10045;
pub static WSAEPFNOSUPPORT: c_int = 10046;
pub static WSAEAFNOSUPPORT: c_int = 10047;
pub static WSAEADDRINUSE: c_int = 10048;
pub static WSAEADDRNOTAVAIL: c_int = 10049;
pub static WSAENETDOWN: c_int = 10050;
pub static WSAENETUNREACH: c_int = 10051;
pub static WSAENETRESET: c_int = 10052;
pub static WSAECONNABORTED: c_int = 10053;
pub static WSAECONNRESET: c_int = 10054;
pub static WSAENOBUFS: c_int = 10055;
pub static WSAEISCONN: c_int = 10056;
pub static WSAENOTCONN: c_int = 10057;
pub static WSAESHUTDOWN: c_int = 10058;
pub static WSAETOOMANYREFS: c_int = 10059;
pub static WSAETIMEDOUT: c_int = 10060;
pub static WSAECONNREFUSED: c_int = 10061;
pub static WSAELOOP: c_int = 10062;
pub static WSAENAMETOOLONG: c_int = 10063;
pub static WSAEHOSTDOWN: c_int = 10064;
pub static WSAEHOSTUNREACH: c_int = 10065;
pub static WSAENOTEMPTY: c_int = 10066;
pub static WSAEPROCLIM: c_int = 10067;
pub static WSAEUSERS: c_int = 10068;
pub static WSAEDQUOT: c_int = 10069;
pub static WSAESTALE: c_int = 10070;
pub static WSAEREMOTE: c_int = 10071;
pub static WSASYSNOTREADY: c_int = 10091;
pub static WSAVERNOTSUPPORTED: c_int = 10092;
pub static WSANOTINITIALISED: c_int = 10093;
pub static WSAEDISCON: c_int = 10101;
pub static WSAENOMORE: c_int = 10102;
pub static WSAECANCELLED: c_int = 10103;
pub static WSAEINVALIDPROCTABLE: c_int = 10104;
pub static WSAEINVALIDPROVIDER: c_int = 10105;
pub static WSAEPROVIDERFAILEDINIT: c_int = 10106;
pub const WSAEINTR: c_int = 10004;
pub const WSAEBADF: c_int = 10009;
pub const WSAEACCES: c_int = 10013;
pub const WSAEFAULT: c_int = 10014;
pub const WSAEINVAL: c_int = 10022;
pub const WSAEMFILE: c_int = 10024;
pub const WSAEWOULDBLOCK: c_int = 10035;
pub const WSAEINPROGRESS: c_int = 10036;
pub const WSAEALREADY: c_int = 10037;
pub const WSAENOTSOCK: c_int = 10038;
pub const WSAEDESTADDRREQ: c_int = 10039;
pub const WSAEMSGSIZE: c_int = 10040;
pub const WSAEPROTOTYPE: c_int = 10041;
pub const WSAENOPROTOOPT: c_int = 10042;
pub const WSAEPROTONOSUPPORT: c_int = 10043;
pub const WSAESOCKTNOSUPPORT: c_int = 10044;
pub const WSAEOPNOTSUPP: c_int = 10045;
pub const WSAEPFNOSUPPORT: c_int = 10046;
pub const WSAEAFNOSUPPORT: c_int = 10047;
pub const WSAEADDRINUSE: c_int = 10048;
pub const WSAEADDRNOTAVAIL: c_int = 10049;
pub const WSAENETDOWN: c_int = 10050;
pub const WSAENETUNREACH: c_int = 10051;
pub const WSAENETRESET: c_int = 10052;
pub const WSAECONNABORTED: c_int = 10053;
pub const WSAECONNRESET: c_int = 10054;
pub const WSAENOBUFS: c_int = 10055;
pub const WSAEISCONN: c_int = 10056;
pub const WSAENOTCONN: c_int = 10057;
pub const WSAESHUTDOWN: c_int = 10058;
pub const WSAETOOMANYREFS: c_int = 10059;
pub const WSAETIMEDOUT: c_int = 10060;
pub const WSAECONNREFUSED: c_int = 10061;
pub const WSAELOOP: c_int = 10062;
pub const WSAENAMETOOLONG: c_int = 10063;
pub const WSAEHOSTDOWN: c_int = 10064;
pub const WSAEHOSTUNREACH: c_int = 10065;
pub const WSAENOTEMPTY: c_int = 10066;
pub const WSAEPROCLIM: c_int = 10067;
pub const WSAEUSERS: c_int = 10068;
pub const WSAEDQUOT: c_int = 10069;
pub const WSAESTALE: c_int = 10070;
pub const WSAEREMOTE: c_int = 10071;
pub const WSASYSNOTREADY: c_int = 10091;
pub const WSAVERNOTSUPPORTED: c_int = 10092;
pub const WSANOTINITIALISED: c_int = 10093;
pub const WSAEDISCON: c_int = 10101;
pub const WSAENOMORE: c_int = 10102;
pub const WSAECANCELLED: c_int = 10103;
pub const WSAEINVALIDPROCTABLE: c_int = 10104;
pub const WSAEINVALIDPROVIDER: c_int = 10105;
pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
}
pub mod c99 {
}
pub mod posix88 {
use types::os::arch::c95::c_int;
pub static O_RDONLY : c_int = 0;
pub static O_WRONLY : c_int = 1;
pub static O_RDWR : c_int = 2;
pub static O_APPEND : c_int = 8;
pub static O_CREAT : c_int = 256;
pub static O_EXCL : c_int = 1024;
pub static O_TRUNC : c_int = 512;
pub static S_IFIFO : c_int = 4096;
pub static S_IFCHR : c_int = 8192;
pub static S_IFBLK : c_int = 12288;
pub static S_IFDIR : c_int = 16384;
pub static S_IFREG : c_int = 32768;
pub static S_IFLNK : c_int = 40960;
pub static S_IFMT : c_int = 61440;
pub static S_IEXEC : c_int = 64;
pub static S_IWRITE : c_int = 128;
pub static S_IREAD : c_int = 256;
pub static S_IRWXU : c_int = 448;
pub static S_IXUSR : c_int = 64;
pub static S_IWUSR : c_int = 128;
pub static S_IRUSR : c_int = 256;
pub static F_OK : c_int = 0;
pub static R_OK : c_int = 4;
pub static W_OK : c_int = 2;
pub static X_OK : c_int = 1;
pub static STDIN_FILENO : c_int = 0;
pub static STDOUT_FILENO : c_int = 1;
pub static STDERR_FILENO : c_int = 2;
pub const O_RDONLY : c_int = 0;
pub const O_WRONLY : c_int = 1;
pub const O_RDWR : c_int = 2;
pub const O_APPEND : c_int = 8;
pub const O_CREAT : c_int = 256;
pub const O_EXCL : c_int = 1024;
pub const O_TRUNC : c_int = 512;
pub const S_IFIFO : c_int = 4096;
pub const S_IFCHR : c_int = 8192;
pub const S_IFBLK : c_int = 12288;
pub const S_IFDIR : c_int = 16384;
pub const S_IFREG : c_int = 32768;
pub const S_IFLNK : c_int = 40960;
pub const S_IFMT : c_int = 61440;
pub const S_IEXEC : c_int = 64;
pub const S_IWRITE : c_int = 128;
pub const S_IREAD : c_int = 256;
pub const S_IRWXU : c_int = 448;
pub const S_IXUSR : c_int = 64;
pub const S_IWUSR : c_int = 128;
pub const S_IRUSR : c_int = 256;
pub const F_OK : c_int = 0;
pub const R_OK : c_int = 4;
pub const W_OK : c_int = 2;
pub const X_OK : c_int = 1;
pub const STDIN_FILENO : c_int = 0;
pub const STDOUT_FILENO : c_int = 1;
pub const STDERR_FILENO : c_int = 2;
}
pub mod posix01 {
}
@@ -2113,265 +2113,265 @@ pub mod posix08 {
pub mod bsd44 {
use types::os::arch::c95::c_int;
pub static AF_INET: c_int = 2;
pub static AF_INET6: c_int = 23;
pub static SOCK_STREAM: c_int = 1;
pub static SOCK_DGRAM: c_int = 2;
pub static SOCK_RAW: c_int = 3;
pub static IPPROTO_TCP: c_int = 6;
pub static IPPROTO_IP: c_int = 0;
pub static IPPROTO_IPV6: c_int = 41;
pub static IP_MULTICAST_TTL: c_int = 3;
pub static IP_MULTICAST_LOOP: c_int = 4;
pub static IP_ADD_MEMBERSHIP: c_int = 5;
pub static IP_DROP_MEMBERSHIP: c_int = 6;
pub static IPV6_ADD_MEMBERSHIP: c_int = 5;
pub static IPV6_DROP_MEMBERSHIP: c_int = 6;
pub static IP_TTL: c_int = 4;
pub static IP_HDRINCL: c_int = 2;
pub const AF_INET: c_int = 2;
pub const AF_INET6: c_int = 23;
pub const SOCK_STREAM: c_int = 1;
pub const SOCK_DGRAM: c_int = 2;
pub const SOCK_RAW: c_int = 3;
pub const IPPROTO_TCP: c_int = 6;
pub const IPPROTO_IP: c_int = 0;
pub const IPPROTO_IPV6: c_int = 41;
pub const IP_MULTICAST_TTL: c_int = 3;
pub const IP_MULTICAST_LOOP: c_int = 4;
pub const IP_ADD_MEMBERSHIP: c_int = 5;
pub const IP_DROP_MEMBERSHIP: c_int = 6;
pub const IPV6_ADD_MEMBERSHIP: c_int = 5;
pub const IPV6_DROP_MEMBERSHIP: c_int = 6;
pub const IP_TTL: c_int = 4;
pub const IP_HDRINCL: c_int = 2;
pub static TCP_NODELAY: c_int = 0x0001;
pub static SOL_SOCKET: c_int = 0xffff;
pub static SO_KEEPALIVE: c_int = 8;
pub static SO_BROADCAST: c_int = 32;
pub static SO_REUSEADDR: c_int = 4;
pub static SO_ERROR: c_int = 0x1007;
pub const TCP_NODELAY: c_int = 0x0001;
pub const SOL_SOCKET: c_int = 0xffff;
pub const SO_KEEPALIVE: c_int = 8;
pub const SO_BROADCAST: c_int = 32;
pub const SO_REUSEADDR: c_int = 4;
pub const SO_ERROR: c_int = 0x1007;
pub static IFF_LOOPBACK: c_int = 4;
pub const IFF_LOOPBACK: c_int = 4;
pub static SHUT_RD: c_int = 0;
pub static SHUT_WR: c_int = 1;
pub static SHUT_RDWR: c_int = 2;
pub const SHUT_RD: c_int = 0;
pub const SHUT_WR: c_int = 1;
pub const SHUT_RDWR: c_int = 2;
}
pub mod extra {
use types::os::arch::c95::{c_int, c_long};
use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
pub static TRUE : BOOL = 1;
pub static FALSE : BOOL = 0;
pub const TRUE : BOOL = 1;
pub const FALSE : BOOL = 0;
pub static O_TEXT : c_int = 16384;
pub static O_BINARY : c_int = 32768;
pub static O_NOINHERIT: c_int = 128;
pub const O_TEXT : c_int = 16384;
pub const O_BINARY : c_int = 32768;
pub const O_NOINHERIT: c_int = 128;
pub static ERROR_SUCCESS : c_int = 0;
pub static ERROR_INVALID_FUNCTION: c_int = 1;
pub static ERROR_FILE_NOT_FOUND: c_int = 2;
pub static ERROR_ACCESS_DENIED: c_int = 5;
pub static ERROR_INVALID_HANDLE : c_int = 6;
pub static ERROR_BROKEN_PIPE: c_int = 109;
pub static ERROR_DISK_FULL : c_int = 112;
pub static ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
pub static ERROR_INSUFFICIENT_BUFFER : c_int = 122;
pub static ERROR_INVALID_NAME : c_int = 123;
pub static ERROR_ALREADY_EXISTS : c_int = 183;
pub static ERROR_PIPE_BUSY: c_int = 231;
pub static ERROR_NO_DATA: c_int = 232;
pub static ERROR_INVALID_ADDRESS : c_int = 487;
pub static ERROR_PIPE_CONNECTED: c_int = 535;
pub static ERROR_NOTHING_TO_TERMINATE: c_int = 758;
pub static ERROR_OPERATION_ABORTED: c_int = 995;
pub static ERROR_IO_PENDING: c_int = 997;
pub static ERROR_FILE_INVALID : c_int = 1006;
pub static ERROR_NOT_FOUND: c_int = 1168;
pub static INVALID_HANDLE_VALUE: HANDLE = -1 as HANDLE;
pub const ERROR_SUCCESS : c_int = 0;
pub const ERROR_INVALID_FUNCTION: c_int = 1;
pub const ERROR_FILE_NOT_FOUND: c_int = 2;
pub const ERROR_ACCESS_DENIED: c_int = 5;
pub const ERROR_INVALID_HANDLE : c_int = 6;
pub const ERROR_BROKEN_PIPE: c_int = 109;
pub const ERROR_DISK_FULL : c_int = 112;
pub const ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
pub const ERROR_INSUFFICIENT_BUFFER : c_int = 122;
pub const ERROR_INVALID_NAME : c_int = 123;
pub const ERROR_ALREADY_EXISTS : c_int = 183;
pub const ERROR_PIPE_BUSY: c_int = 231;
pub const ERROR_NO_DATA: c_int = 232;
pub const ERROR_INVALID_ADDRESS : c_int = 487;
pub const ERROR_PIPE_CONNECTED: c_int = 535;
pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
pub const ERROR_OPERATION_ABORTED: c_int = 995;
pub const ERROR_IO_PENDING: c_int = 997;
pub const ERROR_FILE_INVALID : c_int = 1006;
pub const ERROR_NOT_FOUND: c_int = 1168;
pub const INVALID_HANDLE_VALUE: HANDLE = -1 as HANDLE;
pub static DELETE : DWORD = 0x00010000;
pub static READ_CONTROL : DWORD = 0x00020000;
pub static SYNCHRONIZE : DWORD = 0x00100000;
pub static WRITE_DAC : DWORD = 0x00040000;
pub static WRITE_OWNER : DWORD = 0x00080000;
pub const DELETE : DWORD = 0x00010000;
pub const READ_CONTROL : DWORD = 0x00020000;
pub const SYNCHRONIZE : DWORD = 0x00100000;
pub const WRITE_DAC : DWORD = 0x00040000;
pub const WRITE_OWNER : DWORD = 0x00080000;
pub static PROCESS_CREATE_PROCESS : DWORD = 0x0080;
pub static PROCESS_CREATE_THREAD : DWORD = 0x0002;
pub static PROCESS_DUP_HANDLE : DWORD = 0x0040;
pub static PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
pub static PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
pub static PROCESS_SET_INFORMATION : DWORD = 0x0200;
pub static PROCESS_SET_QUOTA : DWORD = 0x0100;
pub static PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
pub static PROCESS_TERMINATE : DWORD = 0x0001;
pub static PROCESS_VM_OPERATION : DWORD = 0x0008;
pub static PROCESS_VM_READ : DWORD = 0x0010;
pub static PROCESS_VM_WRITE : DWORD = 0x0020;
pub const PROCESS_CREATE_PROCESS : DWORD = 0x0080;
pub const PROCESS_CREATE_THREAD : DWORD = 0x0002;
pub const PROCESS_DUP_HANDLE : DWORD = 0x0040;
pub const PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
pub const PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
pub const PROCESS_SET_INFORMATION : DWORD = 0x0200;
pub const PROCESS_SET_QUOTA : DWORD = 0x0100;
pub const PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
pub const PROCESS_TERMINATE : DWORD = 0x0001;
pub const PROCESS_VM_OPERATION : DWORD = 0x0008;
pub const PROCESS_VM_READ : DWORD = 0x0010;
pub const PROCESS_VM_WRITE : DWORD = 0x0020;
pub static STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
pub static STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
pub static STARTF_PREVENTPINNING : DWORD = 0x00002000;
pub static STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
pub static STARTF_TITLEISAPPID : DWORD = 0x00001000;
pub static STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
pub static STARTF_USECOUNTCHARS : DWORD = 0x00000008;
pub static STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
pub static STARTF_USEHOTKEY : DWORD = 0x00000200;
pub static STARTF_USEPOSITION : DWORD = 0x00000004;
pub static STARTF_USESHOWWINDOW : DWORD = 0x00000001;
pub static STARTF_USESIZE : DWORD = 0x00000002;
pub static STARTF_USESTDHANDLES : DWORD = 0x00000100;
pub const STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
pub const STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
pub const STARTF_PREVENTPINNING : DWORD = 0x00002000;
pub const STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
pub const STARTF_TITLEISAPPID : DWORD = 0x00001000;
pub const STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
pub const STARTF_USECOUNTCHARS : DWORD = 0x00000008;
pub const STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
pub const STARTF_USEHOTKEY : DWORD = 0x00000200;
pub const STARTF_USEPOSITION : DWORD = 0x00000004;
pub const STARTF_USESHOWWINDOW : DWORD = 0x00000001;
pub const STARTF_USESIZE : DWORD = 0x00000002;
pub const STARTF_USESTDHANDLES : DWORD = 0x00000100;
pub static WAIT_ABANDONED : DWORD = 0x00000080;
pub static WAIT_OBJECT_0 : DWORD = 0x00000000;
pub static WAIT_TIMEOUT : DWORD = 0x00000102;
pub static WAIT_FAILED : DWORD = -1;
pub const WAIT_ABANDONED : DWORD = 0x00000080;
pub const WAIT_OBJECT_0 : DWORD = 0x00000000;
pub const WAIT_TIMEOUT : DWORD = 0x00000102;
pub const WAIT_FAILED : DWORD = -1;
pub static DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
pub static DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
pub const DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
pub const DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
pub static INFINITE : DWORD = -1;
pub static STILL_ACTIVE : DWORD = 259;
pub const INFINITE : DWORD = -1;
pub const STILL_ACTIVE : DWORD = 259;
pub static MEM_COMMIT : DWORD = 0x00001000;
pub static MEM_RESERVE : DWORD = 0x00002000;
pub static MEM_DECOMMIT : DWORD = 0x00004000;
pub static MEM_RELEASE : DWORD = 0x00008000;
pub static MEM_RESET : DWORD = 0x00080000;
pub static MEM_RESET_UNDO : DWORD = 0x1000000;
pub static MEM_LARGE_PAGES : DWORD = 0x20000000;
pub static MEM_PHYSICAL : DWORD = 0x00400000;
pub static MEM_TOP_DOWN : DWORD = 0x00100000;
pub static MEM_WRITE_WATCH : DWORD = 0x00200000;
pub const MEM_COMMIT : DWORD = 0x00001000;
pub const MEM_RESERVE : DWORD = 0x00002000;
pub const MEM_DECOMMIT : DWORD = 0x00004000;
pub const MEM_RELEASE : DWORD = 0x00008000;
pub const MEM_RESET : DWORD = 0x00080000;
pub const MEM_RESET_UNDO : DWORD = 0x1000000;
pub const MEM_LARGE_PAGES : DWORD = 0x20000000;
pub const MEM_PHYSICAL : DWORD = 0x00400000;
pub const MEM_TOP_DOWN : DWORD = 0x00100000;
pub const MEM_WRITE_WATCH : DWORD = 0x00200000;
pub static PAGE_EXECUTE : DWORD = 0x10;
pub static PAGE_EXECUTE_READ : DWORD = 0x20;
pub static PAGE_EXECUTE_READWRITE : DWORD = 0x40;
pub static PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
pub static PAGE_NOACCESS : DWORD = 0x01;
pub static PAGE_READONLY : DWORD = 0x02;
pub static PAGE_READWRITE : DWORD = 0x04;
pub static PAGE_WRITECOPY : DWORD = 0x08;
pub static PAGE_GUARD : DWORD = 0x100;
pub static PAGE_NOCACHE : DWORD = 0x200;
pub static PAGE_WRITECOMBINE : DWORD = 0x400;
pub const PAGE_EXECUTE : DWORD = 0x10;
pub const PAGE_EXECUTE_READ : DWORD = 0x20;
pub const PAGE_EXECUTE_READWRITE : DWORD = 0x40;
pub const PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
pub const PAGE_NOACCESS : DWORD = 0x01;
pub const PAGE_READONLY : DWORD = 0x02;
pub const PAGE_READWRITE : DWORD = 0x04;
pub const PAGE_WRITECOPY : DWORD = 0x08;
pub const PAGE_GUARD : DWORD = 0x100;
pub const PAGE_NOCACHE : DWORD = 0x200;
pub const PAGE_WRITECOMBINE : DWORD = 0x400;
pub static SEC_COMMIT : DWORD = 0x8000000;
pub static SEC_IMAGE : DWORD = 0x1000000;
pub static SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
pub static SEC_LARGE_PAGES : DWORD = 0x80000000;
pub static SEC_NOCACHE : DWORD = 0x10000000;
pub static SEC_RESERVE : DWORD = 0x4000000;
pub static SEC_WRITECOMBINE : DWORD = 0x40000000;
pub const SEC_COMMIT : DWORD = 0x8000000;
pub const SEC_IMAGE : DWORD = 0x1000000;
pub const SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
pub const SEC_LARGE_PAGES : DWORD = 0x80000000;
pub const SEC_NOCACHE : DWORD = 0x10000000;
pub const SEC_RESERVE : DWORD = 0x4000000;
pub const SEC_WRITECOMBINE : DWORD = 0x40000000;
pub static FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
pub static FILE_MAP_READ : DWORD = 0x4;
pub static FILE_MAP_WRITE : DWORD = 0x2;
pub static FILE_MAP_COPY : DWORD = 0x1;
pub static FILE_MAP_EXECUTE : DWORD = 0x20;
pub const FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
pub const FILE_MAP_READ : DWORD = 0x4;
pub const FILE_MAP_WRITE : DWORD = 0x2;
pub const FILE_MAP_COPY : DWORD = 0x1;
pub const FILE_MAP_EXECUTE : DWORD = 0x20;
pub static PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
pub static PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
pub static PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
pub static PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
pub static PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
pub const PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
pub const PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
pub const PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
pub const PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
pub const PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
pub static MOVEFILE_COPY_ALLOWED: DWORD = 2;
pub static MOVEFILE_CREATE_HARDLINK: DWORD = 16;
pub static MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
pub static MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
pub static MOVEFILE_REPLACE_EXISTING: DWORD = 1;
pub static MOVEFILE_WRITE_THROUGH: DWORD = 8;
pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
pub static SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
pub static FILE_SHARE_DELETE: DWORD = 0x4;
pub static FILE_SHARE_READ: DWORD = 0x1;
pub static FILE_SHARE_WRITE: DWORD = 0x2;
pub const FILE_SHARE_DELETE: DWORD = 0x4;
pub const FILE_SHARE_READ: DWORD = 0x1;
pub const FILE_SHARE_WRITE: DWORD = 0x2;
pub static CREATE_ALWAYS: DWORD = 2;
pub static CREATE_NEW: DWORD = 1;
pub static OPEN_ALWAYS: DWORD = 4;
pub static OPEN_EXISTING: DWORD = 3;
pub static TRUNCATE_EXISTING: DWORD = 5;
pub const CREATE_ALWAYS: DWORD = 2;
pub const CREATE_NEW: DWORD = 1;
pub const OPEN_ALWAYS: DWORD = 4;
pub const OPEN_EXISTING: DWORD = 3;
pub const TRUNCATE_EXISTING: DWORD = 5;
pub static FILE_APPEND_DATA: DWORD = 0x00000004;
pub static FILE_READ_DATA: DWORD = 0x00000001;
pub static FILE_WRITE_DATA: DWORD = 0x00000002;
pub const FILE_APPEND_DATA: DWORD = 0x00000004;
pub const FILE_READ_DATA: DWORD = 0x00000001;
pub const FILE_WRITE_DATA: DWORD = 0x00000002;
pub static FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
pub static FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
pub static FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
pub static FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
pub static FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
pub static FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
pub static FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
pub static FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
pub static FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
pub static FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
pub static FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
pub static FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
pub static FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
pub static FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
pub static FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
pub static FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
pub static FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
pub static FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
pub static FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
pub static FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
pub static FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
pub static FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
pub static FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
pub static FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
pub static FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
pub static FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
pub static FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
pub static FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
pub static FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
pub static FILE_NAME_NORMALIZED: DWORD = 0x0;
pub static FILE_NAME_OPENED: DWORD = 0x8;
pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
pub const FILE_NAME_OPENED: DWORD = 0x8;
pub static VOLUME_NAME_DOS: DWORD = 0x0;
pub static VOLUME_NAME_GUID: DWORD = 0x1;
pub static VOLUME_NAME_NONE: DWORD = 0x4;
pub static VOLUME_NAME_NT: DWORD = 0x2;
pub const VOLUME_NAME_DOS: DWORD = 0x0;
pub const VOLUME_NAME_GUID: DWORD = 0x1;
pub const VOLUME_NAME_NONE: DWORD = 0x4;
pub const VOLUME_NAME_NT: DWORD = 0x2;
pub static GENERIC_READ: DWORD = 0x80000000;
pub static GENERIC_WRITE: DWORD = 0x40000000;
pub static GENERIC_EXECUTE: DWORD = 0x20000000;
pub static GENERIC_ALL: DWORD = 0x10000000;
pub static FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
pub static FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
pub const GENERIC_READ: DWORD = 0x80000000;
pub const GENERIC_WRITE: DWORD = 0x40000000;
pub const GENERIC_EXECUTE: DWORD = 0x20000000;
pub const GENERIC_ALL: DWORD = 0x10000000;
pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
pub static STANDARD_RIGHTS_READ: DWORD = 0x20000;
pub static STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
pub static FILE_WRITE_EA: DWORD = 0x00000010;
pub static FILE_READ_EA: DWORD = 0x00000008;
pub static FILE_GENERIC_READ: DWORD =
pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
pub const FILE_WRITE_EA: DWORD = 0x00000010;
pub const FILE_READ_EA: DWORD = 0x00000008;
pub const FILE_GENERIC_READ: DWORD =
STANDARD_RIGHTS_READ | FILE_READ_DATA |
FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
pub static FILE_GENERIC_WRITE: DWORD =
pub const FILE_GENERIC_WRITE: DWORD =
STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
SYNCHRONIZE;
pub static FILE_BEGIN: DWORD = 0;
pub static FILE_CURRENT: DWORD = 1;
pub static FILE_END: DWORD = 2;
pub const FILE_BEGIN: DWORD = 0;
pub const FILE_CURRENT: DWORD = 1;
pub const FILE_END: DWORD = 2;
pub static MAX_PROTOCOL_CHAIN: DWORD = 7;
pub static WSAPROTOCOL_LEN: DWORD = 255;
pub static INVALID_SOCKET: DWORD = !0;
pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
pub const WSAPROTOCOL_LEN: DWORD = 255;
pub const INVALID_SOCKET: DWORD = !0;
pub static DETACHED_PROCESS: DWORD = 0x00000008;
pub static CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
pub static CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
pub const DETACHED_PROCESS: DWORD = 0x00000008;
pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
pub static PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
pub static PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
pub static PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
pub static PIPE_TYPE_BYTE: DWORD = 0x00000000;
pub static PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
pub static PIPE_READMODE_BYTE: DWORD = 0x00000000;
pub static PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
pub static PIPE_WAIT: DWORD = 0x00000000;
pub static PIPE_NOWAIT: DWORD = 0x00000001;
pub static PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
pub static PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
pub static PIPE_UNLIMITED_INSTANCES: DWORD = 255;
pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
pub const PIPE_WAIT: DWORD = 0x00000000;
pub const PIPE_NOWAIT: DWORD = 0x00000001;
pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
pub static IPPROTO_RAW: c_int = 255;
pub const IPPROTO_RAW: c_int = 255;
pub static FIONBIO: c_long = -0x7FFB9982;
pub const FIONBIO: c_long = -0x7FFB9982;
}
pub mod sysconf {
}
@@ -2383,21 +2383,21 @@ pub mod os {
pub mod c95 {
use types::os::arch::c95::{c_int, c_uint};
pub static EXIT_FAILURE : c_int = 1;
pub static EXIT_SUCCESS : c_int = 0;
pub static RAND_MAX : c_int = 2147483647;
pub static EOF : c_int = -1;
pub static SEEK_SET : c_int = 0;
pub static SEEK_CUR : c_int = 1;
pub static SEEK_END : c_int = 2;
pub static _IOFBF : c_int = 0;
pub static _IONBF : c_int = 2;
pub static _IOLBF : c_int = 1;
pub static BUFSIZ : c_uint = 8192_u32;
pub static FOPEN_MAX : c_uint = 16_u32;
pub static FILENAME_MAX : c_uint = 4096_u32;
pub static L_tmpnam : c_uint = 20_u32;
pub static TMP_MAX : c_uint = 238328_u32;
pub const EXIT_FAILURE : c_int = 1;
pub const EXIT_SUCCESS : c_int = 0;
pub const RAND_MAX : c_int = 2147483647;
pub const EOF : c_int = -1;
pub const SEEK_SET : c_int = 0;
pub const SEEK_CUR : c_int = 1;
pub const SEEK_END : c_int = 2;
pub const _IOFBF : c_int = 0;
pub const _IONBF : c_int = 2;
pub const _IOLBF : c_int = 1;
pub const BUFSIZ : c_uint = 8192_u32;
pub const FOPEN_MAX : c_uint = 16_u32;
pub const FILENAME_MAX : c_uint = 4096_u32;
pub const L_tmpnam : c_uint = 20_u32;
pub const TMP_MAX : c_uint = 238328_u32;
}
pub mod c99 {
}
@@ -2409,210 +2409,210 @@ pub mod posix88 {
use types::common::c95::c_void;
use types::os::arch::posix88::mode_t;
pub static O_RDONLY : c_int = 0;
pub static O_WRONLY : c_int = 1;
pub static O_RDWR : c_int = 2;
pub static O_APPEND : c_int = 1024;
pub static O_CREAT : c_int = 64;
pub static O_EXCL : c_int = 128;
pub static O_TRUNC : c_int = 512;
pub static S_IFIFO : mode_t = 4096;
pub static S_IFCHR : mode_t = 8192;
pub static S_IFBLK : mode_t = 24576;
pub static S_IFDIR : mode_t = 16384;
pub static S_IFREG : mode_t = 32768;
pub static S_IFLNK : mode_t = 40960;
pub static S_IFMT : mode_t = 61440;
pub static S_IEXEC : mode_t = 64;
pub static S_IWRITE : mode_t = 128;
pub static S_IREAD : mode_t = 256;
pub static S_IRWXU : mode_t = 448;
pub static S_IXUSR : mode_t = 64;
pub static S_IWUSR : mode_t = 128;
pub static S_IRUSR : mode_t = 256;
pub static F_OK : c_int = 0;
pub static R_OK : c_int = 4;
pub static W_OK : c_int = 2;
pub static X_OK : c_int = 1;
pub static STDIN_FILENO : c_int = 0;
pub static STDOUT_FILENO : c_int = 1;
pub static STDERR_FILENO : c_int = 2;
pub static F_LOCK : c_int = 1;
pub static F_TEST : c_int = 3;
pub static F_TLOCK : c_int = 2;
pub static F_ULOCK : c_int = 0;
pub static SIGHUP : c_int = 1;
pub static SIGINT : c_int = 2;
pub static SIGQUIT : c_int = 3;
pub static SIGILL : c_int = 4;
pub static SIGABRT : c_int = 6;
pub static SIGFPE : c_int = 8;
pub static SIGKILL : c_int = 9;
pub static SIGSEGV : c_int = 11;
pub static SIGPIPE : c_int = 13;
pub static SIGALRM : c_int = 14;
pub static SIGTERM : c_int = 15;
pub const O_RDONLY : c_int = 0;
pub const O_WRONLY : c_int = 1;
pub const O_RDWR : c_int = 2;
pub const O_APPEND : c_int = 1024;
pub const O_CREAT : c_int = 64;
pub const O_EXCL : c_int = 128;
pub const O_TRUNC : c_int = 512;
pub const S_IFIFO : mode_t = 4096;
pub const S_IFCHR : mode_t = 8192;
pub const S_IFBLK : mode_t = 24576;
pub const S_IFDIR : mode_t = 16384;
pub const S_IFREG : mode_t = 32768;
pub const S_IFLNK : mode_t = 40960;
pub const S_IFMT : mode_t = 61440;
pub const S_IEXEC : mode_t = 64;
pub const S_IWRITE : mode_t = 128;
pub const S_IREAD : mode_t = 256;
pub const S_IRWXU : mode_t = 448;
pub const S_IXUSR : mode_t = 64;
pub const S_IWUSR : mode_t = 128;
pub const S_IRUSR : mode_t = 256;
pub const F_OK : c_int = 0;
pub const R_OK : c_int = 4;
pub const W_OK : c_int = 2;
pub const X_OK : c_int = 1;
pub const STDIN_FILENO : c_int = 0;
pub const STDOUT_FILENO : c_int = 1;
pub const STDERR_FILENO : c_int = 2;
pub const F_LOCK : c_int = 1;
pub const F_TEST : c_int = 3;
pub const F_TLOCK : c_int = 2;
pub const F_ULOCK : c_int = 0;
pub const SIGHUP : c_int = 1;
pub const SIGINT : c_int = 2;
pub const SIGQUIT : c_int = 3;
pub const SIGILL : c_int = 4;
pub const SIGABRT : c_int = 6;
pub const SIGFPE : c_int = 8;
pub const SIGKILL : c_int = 9;
pub const SIGSEGV : c_int = 11;
pub const SIGPIPE : c_int = 13;
pub const SIGALRM : c_int = 14;
pub const SIGTERM : c_int = 15;
pub static PROT_NONE : c_int = 0;
pub static PROT_READ : c_int = 1;
pub static PROT_WRITE : c_int = 2;
pub static PROT_EXEC : c_int = 4;
pub const PROT_NONE : c_int = 0;
pub const PROT_READ : c_int = 1;
pub const PROT_WRITE : c_int = 2;
pub const PROT_EXEC : c_int = 4;
pub static MAP_FILE : c_int = 0x0000;
pub static MAP_SHARED : c_int = 0x0001;
pub static MAP_PRIVATE : c_int = 0x0002;
pub static MAP_FIXED : c_int = 0x0010;
pub static MAP_ANON : c_int = 0x0020;
pub const MAP_FILE : c_int = 0x0000;
pub const MAP_SHARED : c_int = 0x0001;
pub const MAP_PRIVATE : c_int = 0x0002;
pub const MAP_FIXED : c_int = 0x0010;
pub const MAP_ANON : c_int = 0x0020;
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub static MCL_CURRENT : c_int = 0x0001;
pub static MCL_FUTURE : c_int = 0x0002;
pub const MCL_CURRENT : c_int = 0x0001;
pub const MCL_FUTURE : c_int = 0x0002;
pub static MS_ASYNC : c_int = 0x0001;
pub static MS_INVALIDATE : c_int = 0x0002;
pub static MS_SYNC : c_int = 0x0004;
pub const MS_ASYNC : c_int = 0x0001;
pub const MS_INVALIDATE : c_int = 0x0002;
pub const MS_SYNC : c_int = 0x0004;
pub static EPERM : c_int = 1;
pub static ENOENT : c_int = 2;
pub static ESRCH : c_int = 3;
pub static EINTR : c_int = 4;
pub static EIO : c_int = 5;
pub static ENXIO : c_int = 6;
pub static E2BIG : c_int = 7;
pub static ENOEXEC : c_int = 8;
pub static EBADF : c_int = 9;
pub static ECHILD : c_int = 10;
pub static EAGAIN : c_int = 11;
pub static ENOMEM : c_int = 12;
pub static EACCES : c_int = 13;
pub static EFAULT : c_int = 14;
pub static ENOTBLK : c_int = 15;
pub static EBUSY : c_int = 16;
pub static EEXIST : c_int = 17;
pub static EXDEV : c_int = 18;
pub static ENODEV : c_int = 19;
pub static ENOTDIR : c_int = 20;
pub static EISDIR : c_int = 21;
pub static EINVAL : c_int = 22;
pub static ENFILE : c_int = 23;
pub static EMFILE : c_int = 24;
pub static ENOTTY : c_int = 25;
pub static ETXTBSY : c_int = 26;
pub static EFBIG : c_int = 27;
pub static ENOSPC : c_int = 28;
pub static ESPIPE : c_int = 29;
pub static EROFS : c_int = 30;
pub static EMLINK : c_int = 31;
pub static EPIPE : c_int = 32;
pub static EDOM : c_int = 33;
pub static ERANGE : c_int = 34;
pub const EPERM : c_int = 1;
pub const ENOENT : c_int = 2;
pub const ESRCH : c_int = 3;
pub const EINTR : c_int = 4;
pub const EIO : c_int = 5;
pub const ENXIO : c_int = 6;
pub const E2BIG : c_int = 7;
pub const ENOEXEC : c_int = 8;
pub const EBADF : c_int = 9;
pub const ECHILD : c_int = 10;
pub const EAGAIN : c_int = 11;
pub const ENOMEM : c_int = 12;
pub const EACCES : c_int = 13;
pub const EFAULT : c_int = 14;
pub const ENOTBLK : c_int = 15;
pub const EBUSY : c_int = 16;
pub const EEXIST : c_int = 17;
pub const EXDEV : c_int = 18;
pub const ENODEV : c_int = 19;
pub const ENOTDIR : c_int = 20;
pub const EISDIR : c_int = 21;
pub const EINVAL : c_int = 22;
pub const ENFILE : c_int = 23;
pub const EMFILE : c_int = 24;
pub const ENOTTY : c_int = 25;
pub const ETXTBSY : c_int = 26;
pub const EFBIG : c_int = 27;
pub const ENOSPC : c_int = 28;
pub const ESPIPE : c_int = 29;
pub const EROFS : c_int = 30;
pub const EMLINK : c_int = 31;
pub const EPIPE : c_int = 32;
pub const EDOM : c_int = 33;
pub const ERANGE : c_int = 34;
pub static EDEADLK: c_int = 35;
pub static ENAMETOOLONG: c_int = 36;
pub static ENOLCK: c_int = 37;
pub static ENOSYS: c_int = 38;
pub static ENOTEMPTY: c_int = 39;
pub static ELOOP: c_int = 40;
pub static EWOULDBLOCK: c_int = EAGAIN;
pub static ENOMSG: c_int = 42;
pub static EIDRM: c_int = 43;
pub static ECHRNG: c_int = 44;
pub static EL2NSYNC: c_int = 45;
pub static EL3HLT: c_int = 46;
pub static EL3RST: c_int = 47;
pub static ELNRNG: c_int = 48;
pub static EUNATCH: c_int = 49;
pub static ENOCSI: c_int = 50;
pub static EL2HLT: c_int = 51;
pub static EBADE: c_int = 52;
pub static EBADR: c_int = 53;
pub static EXFULL: c_int = 54;
pub static ENOANO: c_int = 55;
pub static EBADRQC: c_int = 56;
pub static EBADSLT: c_int = 57;
pub const EDEADLK: c_int = 35;
pub const ENAMETOOLONG: c_int = 36;
pub const ENOLCK: c_int = 37;
pub const ENOSYS: c_int = 38;
pub const ENOTEMPTY: c_int = 39;
pub const ELOOP: c_int = 40;
pub const EWOULDBLOCK: c_int = EAGAIN;
pub const ENOMSG: c_int = 42;
pub const EIDRM: c_int = 43;
pub const ECHRNG: c_int = 44;
pub const EL2NSYNC: c_int = 45;
pub const EL3HLT: c_int = 46;
pub const EL3RST: c_int = 47;
pub const ELNRNG: c_int = 48;
pub const EUNATCH: c_int = 49;
pub const ENOCSI: c_int = 50;
pub const EL2HLT: c_int = 51;
pub const EBADE: c_int = 52;
pub const EBADR: c_int = 53;
pub const EXFULL: c_int = 54;
pub const ENOANO: c_int = 55;
pub const EBADRQC: c_int = 56;
pub const EBADSLT: c_int = 57;
pub static EDEADLOCK: c_int = EDEADLK;
pub const EDEADLOCK: c_int = EDEADLK;
pub static EBFONT: c_int = 59;
pub static ENOSTR: c_int = 60;
pub static ENODATA: c_int = 61;
pub static ETIME: c_int = 62;
pub static ENOSR: c_int = 63;
pub static ENONET: c_int = 64;
pub static ENOPKG: c_int = 65;
pub static EREMOTE: c_int = 66;
pub static ENOLINK: c_int = 67;
pub static EADV: c_int = 68;
pub static ESRMNT: c_int = 69;
pub static ECOMM: c_int = 70;
pub static EPROTO: c_int = 71;
pub static EMULTIHOP: c_int = 72;
pub static EDOTDOT: c_int = 73;
pub static EBADMSG: c_int = 74;
pub static EOVERFLOW: c_int = 75;
pub static ENOTUNIQ: c_int = 76;
pub static EBADFD: c_int = 77;
pub static EREMCHG: c_int = 78;
pub static ELIBACC: c_int = 79;
pub static ELIBBAD: c_int = 80;
pub static ELIBSCN: c_int = 81;
pub static ELIBMAX: c_int = 82;
pub static ELIBEXEC: c_int = 83;
pub static EILSEQ: c_int = 84;
pub static ERESTART: c_int = 85;
pub static ESTRPIPE: c_int = 86;
pub static EUSERS: c_int = 87;
pub static ENOTSOCK: c_int = 88;
pub static EDESTADDRREQ: c_int = 89;
pub static EMSGSIZE: c_int = 90;
pub static EPROTOTYPE: c_int = 91;
pub static ENOPROTOOPT: c_int = 92;
pub static EPROTONOSUPPORT: c_int = 93;
pub static ESOCKTNOSUPPORT: c_int = 94;
pub static EOPNOTSUPP: c_int = 95;
pub static EPFNOSUPPORT: c_int = 96;
pub static EAFNOSUPPORT: c_int = 97;
pub static EADDRINUSE: c_int = 98;
pub static EADDRNOTAVAIL: c_int = 99;
pub static ENETDOWN: c_int = 100;
pub static ENETUNREACH: c_int = 101;
pub static ENETRESET: c_int = 102;
pub static ECONNABORTED: c_int = 103;
pub static ECONNRESET: c_int = 104;
pub static ENOBUFS: c_int = 105;
pub static EISCONN: c_int = 106;
pub static ENOTCONN: c_int = 107;
pub static ESHUTDOWN: c_int = 108;
pub static ETOOMANYREFS: c_int = 109;
pub static ETIMEDOUT: c_int = 110;
pub static ECONNREFUSED: c_int = 111;
pub static EHOSTDOWN: c_int = 112;
pub static EHOSTUNREACH: c_int = 113;
pub static EALREADY: c_int = 114;
pub static EINPROGRESS: c_int = 115;
pub static ESTALE: c_int = 116;
pub static EUCLEAN: c_int = 117;
pub static ENOTNAM: c_int = 118;
pub static ENAVAIL: c_int = 119;
pub static EISNAM: c_int = 120;
pub static EREMOTEIO: c_int = 121;
pub static EDQUOT: c_int = 122;
pub const EBFONT: c_int = 59;
pub const ENOSTR: c_int = 60;
pub const ENODATA: c_int = 61;
pub const ETIME: c_int = 62;
pub const ENOSR: c_int = 63;
pub const ENONET: c_int = 64;
pub const ENOPKG: c_int = 65;
pub const EREMOTE: c_int = 66;
pub const ENOLINK: c_int = 67;
pub const EADV: c_int = 68;
pub const ESRMNT: c_int = 69;
pub const ECOMM: c_int = 70;
pub const EPROTO: c_int = 71;
pub const EMULTIHOP: c_int = 72;
pub const EDOTDOT: c_int = 73;
pub const EBADMSG: c_int = 74;
pub const EOVERFLOW: c_int = 75;
pub const ENOTUNIQ: c_int = 76;
pub const EBADFD: c_int = 77;
pub const EREMCHG: c_int = 78;
pub const ELIBACC: c_int = 79;
pub const ELIBBAD: c_int = 80;
pub const ELIBSCN: c_int = 81;
pub const ELIBMAX: c_int = 82;
pub const ELIBEXEC: c_int = 83;
pub const EILSEQ: c_int = 84;
pub const ERESTART: c_int = 85;
pub const ESTRPIPE: c_int = 86;
pub const EUSERS: c_int = 87;
pub const ENOTSOCK: c_int = 88;
pub const EDESTADDRREQ: c_int = 89;
pub const EMSGSIZE: c_int = 90;
pub const EPROTOTYPE: c_int = 91;
pub const ENOPROTOOPT: c_int = 92;
pub const EPROTONOSUPPORT: c_int = 93;
pub const ESOCKTNOSUPPORT: c_int = 94;
pub const EOPNOTSUPP: c_int = 95;
pub const EPFNOSUPPORT: c_int = 96;
pub const EAFNOSUPPORT: c_int = 97;
pub const EADDRINUSE: c_int = 98;
pub const EADDRNOTAVAIL: c_int = 99;
pub const ENETDOWN: c_int = 100;
pub const ENETUNREACH: c_int = 101;
pub const ENETRESET: c_int = 102;
pub const ECONNABORTED: c_int = 103;
pub const ECONNRESET: c_int = 104;
pub const ENOBUFS: c_int = 105;
pub const EISCONN: c_int = 106;
pub const ENOTCONN: c_int = 107;
pub const ESHUTDOWN: c_int = 108;
pub const ETOOMANYREFS: c_int = 109;
pub const ETIMEDOUT: c_int = 110;
pub const ECONNREFUSED: c_int = 111;
pub const EHOSTDOWN: c_int = 112;
pub const EHOSTUNREACH: c_int = 113;
pub const EALREADY: c_int = 114;
pub const EINPROGRESS: c_int = 115;
pub const ESTALE: c_int = 116;
pub const EUCLEAN: c_int = 117;
pub const ENOTNAM: c_int = 118;
pub const ENAVAIL: c_int = 119;
pub const EISNAM: c_int = 120;
pub const EREMOTEIO: c_int = 121;
pub const EDQUOT: c_int = 122;
pub static ENOMEDIUM: c_int = 123;
pub static EMEDIUMTYPE: c_int = 124;
pub static ECANCELED: c_int = 125;
pub static ENOKEY: c_int = 126;
pub static EKEYEXPIRED: c_int = 127;
pub static EKEYREVOKED: c_int = 128;
pub static EKEYREJECTED: c_int = 129;
pub const ENOMEDIUM: c_int = 123;
pub const EMEDIUMTYPE: c_int = 124;
pub const ECANCELED: c_int = 125;
pub const ENOKEY: c_int = 126;
pub const EKEYEXPIRED: c_int = 127;
pub const EKEYREVOKED: c_int = 128;
pub const EKEYREJECTED: c_int = 129;
pub static EOWNERDEAD: c_int = 130;
pub static ENOTRECOVERABLE: c_int = 131;
pub const EOWNERDEAD: c_int = 130;
pub const ENOTRECOVERABLE: c_int = 131;
pub static ERFKILL: c_int = 132;
pub const ERFKILL: c_int = 132;
pub static EHWPOISON: c_int = 133;
pub const EHWPOISON: c_int = 133;
}
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
@@ -2621,288 +2621,288 @@ pub mod posix88 {
use types::common::c95::c_void;
use types::os::arch::posix88::mode_t;
pub static O_RDONLY : c_int = 0;
pub static O_WRONLY : c_int = 1;
pub static O_RDWR : c_int = 2;
pub static O_APPEND : c_int = 8;
pub static O_CREAT : c_int = 256;
pub static O_EXCL : c_int = 1024;
pub static O_TRUNC : c_int = 512;
pub static S_IFIFO : mode_t = 4096;
pub static S_IFCHR : mode_t = 8192;
pub static S_IFBLK : mode_t = 24576;
pub static S_IFDIR : mode_t = 16384;
pub static S_IFREG : mode_t = 32768;
pub static S_IFLNK : mode_t = 40960;
pub static S_IFMT : mode_t = 61440;
pub static S_IEXEC : mode_t = 64;
pub static S_IWRITE : mode_t = 128;
pub static S_IREAD : mode_t = 256;
pub static S_IRWXU : mode_t = 448;
pub static S_IXUSR : mode_t = 64;
pub static S_IWUSR : mode_t = 128;
pub static S_IRUSR : mode_t = 256;
pub static F_OK : c_int = 0;
pub static R_OK : c_int = 4;
pub static W_OK : c_int = 2;
pub static X_OK : c_int = 1;
pub static STDIN_FILENO : c_int = 0;
pub static STDOUT_FILENO : c_int = 1;
pub static STDERR_FILENO : c_int = 2;
pub static F_LOCK : c_int = 1;
pub static F_TEST : c_int = 3;
pub static F_TLOCK : c_int = 2;
pub static F_ULOCK : c_int = 0;
pub static SIGHUP : c_int = 1;
pub static SIGINT : c_int = 2;
pub static SIGQUIT : c_int = 3;
pub static SIGILL : c_int = 4;
pub static SIGABRT : c_int = 6;
pub static SIGFPE : c_int = 8;
pub static SIGKILL : c_int = 9;
pub static SIGSEGV : c_int = 11;
pub static SIGPIPE : c_int = 13;
pub static SIGALRM : c_int = 14;
pub static SIGTERM : c_int = 15;
pub const O_RDONLY : c_int = 0;
pub const O_WRONLY : c_int = 1;
pub const O_RDWR : c_int = 2;
pub const O_APPEND : c_int = 8;
pub const O_CREAT : c_int = 256;
pub const O_EXCL : c_int = 1024;
pub const O_TRUNC : c_int = 512;
pub const S_IFIFO : mode_t = 4096;
pub const S_IFCHR : mode_t = 8192;
pub const S_IFBLK : mode_t = 24576;
pub const S_IFDIR : mode_t = 16384;
pub const S_IFREG : mode_t = 32768;
pub const S_IFLNK : mode_t = 40960;
pub const S_IFMT : mode_t = 61440;
pub const S_IEXEC : mode_t = 64;
pub const S_IWRITE : mode_t = 128;
pub const S_IREAD : mode_t = 256;
pub const S_IRWXU : mode_t = 448;
pub const S_IXUSR : mode_t = 64;
pub const S_IWUSR : mode_t = 128;
pub const S_IRUSR : mode_t = 256;
pub const F_OK : c_int = 0;
pub const R_OK : c_int = 4;
pub const W_OK : c_int = 2;
pub const X_OK : c_int = 1;
pub const STDIN_FILENO : c_int = 0;
pub const STDOUT_FILENO : c_int = 1;
pub const STDERR_FILENO : c_int = 2;
pub const F_LOCK : c_int = 1;
pub const F_TEST : c_int = 3;
pub const F_TLOCK : c_int = 2;
pub const F_ULOCK : c_int = 0;
pub const SIGHUP : c_int = 1;
pub const SIGINT : c_int = 2;
pub const SIGQUIT : c_int = 3;
pub const SIGILL : c_int = 4;
pub const SIGABRT : c_int = 6;
pub const SIGFPE : c_int = 8;
pub const SIGKILL : c_int = 9;
pub const SIGSEGV : c_int = 11;
pub const SIGPIPE : c_int = 13;
pub const SIGALRM : c_int = 14;
pub const SIGTERM : c_int = 15;
pub static PROT_NONE : c_int = 0;
pub static PROT_READ : c_int = 1;
pub static PROT_WRITE : c_int = 2;
pub static PROT_EXEC : c_int = 4;
pub const PROT_NONE : c_int = 0;
pub const PROT_READ : c_int = 1;
pub const PROT_WRITE : c_int = 2;
pub const PROT_EXEC : c_int = 4;
pub static MAP_FILE : c_int = 0x0000;
pub static MAP_SHARED : c_int = 0x0001;
pub static MAP_PRIVATE : c_int = 0x0002;
pub static MAP_FIXED : c_int = 0x0010;
pub static MAP_ANON : c_int = 0x0800;
pub const MAP_FILE : c_int = 0x0000;
pub const MAP_SHARED : c_int = 0x0001;
pub const MAP_PRIVATE : c_int = 0x0002;
pub const MAP_FIXED : c_int = 0x0010;
pub const MAP_ANON : c_int = 0x0800;
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub static MCL_CURRENT : c_int = 0x0001;
pub static MCL_FUTURE : c_int = 0x0002;
pub const MCL_CURRENT : c_int = 0x0001;
pub const MCL_FUTURE : c_int = 0x0002;
pub static MS_ASYNC : c_int = 0x0001;
pub static MS_INVALIDATE : c_int = 0x0002;
pub static MS_SYNC : c_int = 0x0004;
pub const MS_ASYNC : c_int = 0x0001;
pub const MS_INVALIDATE : c_int = 0x0002;
pub const MS_SYNC : c_int = 0x0004;
pub static EPERM : c_int = 1;
pub static ENOENT : c_int = 2;
pub static ESRCH : c_int = 3;
pub static EINTR : c_int = 4;
pub static EIO : c_int = 5;
pub static ENXIO : c_int = 6;
pub static E2BIG : c_int = 7;
pub static ENOEXEC : c_int = 8;
pub static EBADF : c_int = 9;
pub static ECHILD : c_int = 10;
pub static EAGAIN : c_int = 11;
pub static ENOMEM : c_int = 12;
pub static EACCES : c_int = 13;
pub static EFAULT : c_int = 14;
pub static ENOTBLK : c_int = 15;
pub static EBUSY : c_int = 16;
pub static EEXIST : c_int = 17;
pub static EXDEV : c_int = 18;
pub static ENODEV : c_int = 19;
pub static ENOTDIR : c_int = 20;
pub static EISDIR : c_int = 21;
pub static EINVAL : c_int = 22;
pub static ENFILE : c_int = 23;
pub static EMFILE : c_int = 24;
pub static ENOTTY : c_int = 25;
pub static ETXTBSY : c_int = 26;
pub static EFBIG : c_int = 27;
pub static ENOSPC : c_int = 28;
pub static ESPIPE : c_int = 29;
pub static EROFS : c_int = 30;
pub static EMLINK : c_int = 31;
pub static EPIPE : c_int = 32;
pub static EDOM : c_int = 33;
pub static ERANGE : c_int = 34;
pub const EPERM : c_int = 1;
pub const ENOENT : c_int = 2;
pub const ESRCH : c_int = 3;
pub const EINTR : c_int = 4;
pub const EIO : c_int = 5;
pub const ENXIO : c_int = 6;
pub const E2BIG : c_int = 7;
pub const ENOEXEC : c_int = 8;
pub const EBADF : c_int = 9;
pub const ECHILD : c_int = 10;
pub const EAGAIN : c_int = 11;
pub const ENOMEM : c_int = 12;
pub const EACCES : c_int = 13;
pub const EFAULT : c_int = 14;
pub const ENOTBLK : c_int = 15;
pub const EBUSY : c_int = 16;
pub const EEXIST : c_int = 17;
pub const EXDEV : c_int = 18;
pub const ENODEV : c_int = 19;
pub const ENOTDIR : c_int = 20;
pub const EISDIR : c_int = 21;
pub const EINVAL : c_int = 22;
pub const ENFILE : c_int = 23;
pub const EMFILE : c_int = 24;
pub const ENOTTY : c_int = 25;
pub const ETXTBSY : c_int = 26;
pub const EFBIG : c_int = 27;
pub const ENOSPC : c_int = 28;
pub const ESPIPE : c_int = 29;
pub const EROFS : c_int = 30;
pub const EMLINK : c_int = 31;
pub const EPIPE : c_int = 32;
pub const EDOM : c_int = 33;
pub const ERANGE : c_int = 34;
pub static ENOMSG: c_int = 35;
pub static EIDRM: c_int = 36;
pub static ECHRNG: c_int = 37;
pub static EL2NSYNC: c_int = 38;
pub static EL3HLT: c_int = 39;
pub static EL3RST: c_int = 40;
pub static ELNRNG: c_int = 41;
pub static EUNATCH: c_int = 42;
pub static ENOCSI: c_int = 43;
pub static EL2HLT: c_int = 44;
pub static EDEADLK: c_int = 45;
pub static ENOLCK: c_int = 46;
pub static EBADE: c_int = 50;
pub static EBADR: c_int = 51;
pub static EXFULL: c_int = 52;
pub static ENOANO: c_int = 53;
pub static EBADRQC: c_int = 54;
pub static EBADSLT: c_int = 55;
pub static EDEADLOCK: c_int = 56;
pub static EBFONT: c_int = 59;
pub static ENOSTR: c_int = 60;
pub static ENODATA: c_int = 61;
pub static ETIME: c_int = 62;
pub static ENOSR: c_int = 63;
pub static ENONET: c_int = 64;
pub static ENOPKG: c_int = 65;
pub static EREMOTE: c_int = 66;
pub static ENOLINK: c_int = 67;
pub static EADV: c_int = 68;
pub static ESRMNT: c_int = 69;
pub static ECOMM: c_int = 70;
pub static EPROTO: c_int = 71;
pub static EDOTDOT: c_int = 73;
pub static EMULTIHOP: c_int = 74;
pub static EBADMSG: c_int = 77;
pub static ENAMETOOLONG: c_int = 78;
pub static EOVERFLOW: c_int = 79;
pub static ENOTUNIQ: c_int = 80;
pub static EBADFD: c_int = 81;
pub static EREMCHG: c_int = 82;
pub static ELIBACC: c_int = 83;
pub static ELIBBAD: c_int = 84;
pub static ELIBSCN: c_int = 95;
pub static ELIBMAX: c_int = 86;
pub static ELIBEXEC: c_int = 87;
pub static EILSEQ: c_int = 88;
pub static ENOSYS: c_int = 89;
pub static ELOOP: c_int = 90;
pub static ERESTART: c_int = 91;
pub static ESTRPIPE: c_int = 92;
pub static ENOTEMPTY: c_int = 93;
pub static EUSERS: c_int = 94;
pub static ENOTSOCK: c_int = 95;
pub static EDESTADDRREQ: c_int = 96;
pub static EMSGSIZE: c_int = 97;
pub static EPROTOTYPE: c_int = 98;
pub static ENOPROTOOPT: c_int = 99;
pub static EPROTONOSUPPORT: c_int = 120;
pub static ESOCKTNOSUPPORT: c_int = 121;
pub static EOPNOTSUPP: c_int = 122;
pub static EPFNOSUPPORT: c_int = 123;
pub static EAFNOSUPPORT: c_int = 124;
pub static EADDRINUSE: c_int = 125;
pub static EADDRNOTAVAIL: c_int = 126;
pub static ENETDOWN: c_int = 127;
pub static ENETUNREACH: c_int = 128;
pub static ENETRESET: c_int = 129;
pub static ECONNABORTED: c_int = 130;
pub static ECONNRESET: c_int = 131;
pub static ENOBUFS: c_int = 132;
pub static EISCONN: c_int = 133;
pub static ENOTCONN: c_int = 134;
pub static EUCLEAN: c_int = 135;
pub static ENOTNAM: c_int = 137;
pub static ENAVAIL: c_int = 138;
pub static EISNAM: c_int = 139;
pub static EREMOTEIO: c_int = 140;
pub static ESHUTDOWN: c_int = 143;
pub static ETOOMANYREFS: c_int = 144;
pub static ETIMEDOUT: c_int = 145;
pub static ECONNREFUSED: c_int = 146;
pub static EHOSTDOWN: c_int = 147;
pub static EHOSTUNREACH: c_int = 148;
pub static EWOULDBLOCK: c_int = EAGAIN;
pub static EALREADY: c_int = 149;
pub static EINPROGRESS: c_int = 150;
pub static ESTALE: c_int = 151;
pub static ECANCELED: c_int = 158;
pub const ENOMSG: c_int = 35;
pub const EIDRM: c_int = 36;
pub const ECHRNG: c_int = 37;
pub const EL2NSYNC: c_int = 38;
pub const EL3HLT: c_int = 39;
pub const EL3RST: c_int = 40;
pub const ELNRNG: c_int = 41;
pub const EUNATCH: c_int = 42;
pub const ENOCSI: c_int = 43;
pub const EL2HLT: c_int = 44;
pub const EDEADLK: c_int = 45;
pub const ENOLCK: c_int = 46;
pub const EBADE: c_int = 50;
pub const EBADR: c_int = 51;
pub const EXFULL: c_int = 52;
pub const ENOANO: c_int = 53;
pub const EBADRQC: c_int = 54;
pub const EBADSLT: c_int = 55;
pub const EDEADLOCK: c_int = 56;
pub const EBFONT: c_int = 59;
pub const ENOSTR: c_int = 60;
pub const ENODATA: c_int = 61;
pub const ETIME: c_int = 62;
pub const ENOSR: c_int = 63;
pub const ENONET: c_int = 64;
pub const ENOPKG: c_int = 65;
pub const EREMOTE: c_int = 66;
pub const ENOLINK: c_int = 67;
pub const EADV: c_int = 68;
pub const ESRMNT: c_int = 69;
pub const ECOMM: c_int = 70;
pub const EPROTO: c_int = 71;
pub const EDOTDOT: c_int = 73;
pub const EMULTIHOP: c_int = 74;
pub const EBADMSG: c_int = 77;
pub const ENAMETOOLONG: c_int = 78;
pub const EOVERFLOW: c_int = 79;
pub const ENOTUNIQ: c_int = 80;
pub const EBADFD: c_int = 81;
pub const EREMCHG: c_int = 82;
pub const ELIBACC: c_int = 83;
pub const ELIBBAD: c_int = 84;
pub const ELIBSCN: c_int = 95;
pub const ELIBMAX: c_int = 86;
pub const ELIBEXEC: c_int = 87;
pub const EILSEQ: c_int = 88;
pub const ENOSYS: c_int = 89;
pub const ELOOP: c_int = 90;
pub const ERESTART: c_int = 91;
pub const ESTRPIPE: c_int = 92;
pub const ENOTEMPTY: c_int = 93;
pub const EUSERS: c_int = 94;
pub const ENOTSOCK: c_int = 95;
pub const EDESTADDRREQ: c_int = 96;
pub const EMSGSIZE: c_int = 97;
pub const EPROTOTYPE: c_int = 98;
pub const ENOPROTOOPT: c_int = 99;
pub const EPROTONOSUPPORT: c_int = 120;
pub const ESOCKTNOSUPPORT: c_int = 121;
pub const EOPNOTSUPP: c_int = 122;
pub const EPFNOSUPPORT: c_int = 123;
pub const EAFNOSUPPORT: c_int = 124;
pub const EADDRINUSE: c_int = 125;
pub const EADDRNOTAVAIL: c_int = 126;
pub const ENETDOWN: c_int = 127;
pub const ENETUNREACH: c_int = 128;
pub const ENETRESET: c_int = 129;
pub const ECONNABORTED: c_int = 130;
pub const ECONNRESET: c_int = 131;
pub const ENOBUFS: c_int = 132;
pub const EISCONN: c_int = 133;
pub const ENOTCONN: c_int = 134;
pub const EUCLEAN: c_int = 135;
pub const ENOTNAM: c_int = 137;
pub const ENAVAIL: c_int = 138;
pub const EISNAM: c_int = 139;
pub const EREMOTEIO: c_int = 140;
pub const ESHUTDOWN: c_int = 143;
pub const ETOOMANYREFS: c_int = 144;
pub const ETIMEDOUT: c_int = 145;
pub const ECONNREFUSED: c_int = 146;
pub const EHOSTDOWN: c_int = 147;
pub const EHOSTUNREACH: c_int = 148;
pub const EWOULDBLOCK: c_int = EAGAIN;
pub const EALREADY: c_int = 149;
pub const EINPROGRESS: c_int = 150;
pub const ESTALE: c_int = 151;
pub const ECANCELED: c_int = 158;
pub static ENOMEDIUM: c_int = 159;
pub static EMEDIUMTYPE: c_int = 160;
pub static ENOKEY: c_int = 161;
pub static EKEYEXPIRED: c_int = 162;
pub static EKEYREVOKED: c_int = 163;
pub static EKEYREJECTED: c_int = 164;
pub const ENOMEDIUM: c_int = 159;
pub const EMEDIUMTYPE: c_int = 160;
pub const ENOKEY: c_int = 161;
pub const EKEYEXPIRED: c_int = 162;
pub const EKEYREVOKED: c_int = 163;
pub const EKEYREJECTED: c_int = 164;
pub static EOWNERDEAD: c_int = 165;
pub static ENOTRECOVERABLE: c_int = 166;
pub const EOWNERDEAD: c_int = 165;
pub const ENOTRECOVERABLE: c_int = 166;
pub static ERFKILL: c_int = 167;
pub const ERFKILL: c_int = 167;
pub static EHWPOISON: c_int = 168;
pub const EHWPOISON: c_int = 168;
pub static EDQUOT: c_int = 1133;
pub const EDQUOT: c_int = 1133;
}
pub mod posix01 {
use types::os::arch::c95::{c_int, size_t};
pub static F_DUPFD : c_int = 0;
pub static F_GETFD : c_int = 1;
pub static F_SETFD : c_int = 2;
pub static F_GETFL : c_int = 3;
pub static F_SETFL : c_int = 4;
pub const F_DUPFD : c_int = 0;
pub const F_GETFD : c_int = 1;
pub const F_SETFD : c_int = 2;
pub const F_GETFL : c_int = 3;
pub const F_SETFL : c_int = 4;
pub static SIGTRAP : c_int = 5;
pub static SIGPIPE: c_int = 13;
pub static SIG_IGN: size_t = 1;
pub const SIGTRAP : c_int = 5;
pub const SIGPIPE: c_int = 13;
pub const SIG_IGN: size_t = 1;
pub static GLOB_ERR : c_int = 1 << 0;
pub static GLOB_MARK : c_int = 1 << 1;
pub static GLOB_NOSORT : c_int = 1 << 2;
pub static GLOB_DOOFFS : c_int = 1 << 3;
pub static GLOB_NOCHECK : c_int = 1 << 4;
pub static GLOB_APPEND : c_int = 1 << 5;
pub static GLOB_NOESCAPE : c_int = 1 << 6;
pub const GLOB_ERR : c_int = 1 << 0;
pub const GLOB_MARK : c_int = 1 << 1;
pub const GLOB_NOSORT : c_int = 1 << 2;
pub const GLOB_DOOFFS : c_int = 1 << 3;
pub const GLOB_NOCHECK : c_int = 1 << 4;
pub const GLOB_APPEND : c_int = 1 << 5;
pub const GLOB_NOESCAPE : c_int = 1 << 6;
pub static GLOB_NOSPACE : c_int = 1;
pub static GLOB_ABORTED : c_int = 2;
pub static GLOB_NOMATCH : c_int = 3;
pub const GLOB_NOSPACE : c_int = 1;
pub const GLOB_ABORTED : c_int = 2;
pub const GLOB_NOMATCH : c_int = 3;
pub static POSIX_MADV_NORMAL : c_int = 0;
pub static POSIX_MADV_RANDOM : c_int = 1;
pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
pub static POSIX_MADV_WILLNEED : c_int = 3;
pub static POSIX_MADV_DONTNEED : c_int = 4;
pub const POSIX_MADV_NORMAL : c_int = 0;
pub const POSIX_MADV_RANDOM : c_int = 1;
pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
pub const POSIX_MADV_WILLNEED : c_int = 3;
pub const POSIX_MADV_DONTNEED : c_int = 4;
pub static _SC_MQ_PRIO_MAX : c_int = 28;
pub static _SC_IOV_MAX : c_int = 60;
pub static _SC_GETGR_R_SIZE_MAX : c_int = 69;
pub static _SC_GETPW_R_SIZE_MAX : c_int = 70;
pub static _SC_LOGIN_NAME_MAX : c_int = 71;
pub static _SC_TTY_NAME_MAX : c_int = 72;
pub static _SC_THREADS : c_int = 67;
pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
pub static _SC_THREAD_KEYS_MAX : c_int = 74;
pub static _SC_THREAD_STACK_MIN : c_int = 75;
pub static _SC_THREAD_THREADS_MAX : c_int = 76;
pub static _SC_THREAD_ATTR_STACKADDR : c_int = 77;
pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
pub static _SC_THREAD_PRIO_INHERIT : c_int = 80;
pub static _SC_THREAD_PRIO_PROTECT : c_int = 81;
pub static _SC_THREAD_PROCESS_SHARED : c_int = 82;
pub static _SC_ATEXIT_MAX : c_int = 87;
pub static _SC_XOPEN_VERSION : c_int = 89;
pub static _SC_XOPEN_XCU_VERSION : c_int = 90;
pub static _SC_XOPEN_UNIX : c_int = 91;
pub static _SC_XOPEN_CRYPT : c_int = 92;
pub static _SC_XOPEN_ENH_I18N : c_int = 93;
pub static _SC_XOPEN_SHM : c_int = 94;
pub static _SC_XOPEN_LEGACY : c_int = 129;
pub static _SC_XOPEN_REALTIME : c_int = 130;
pub static _SC_XOPEN_REALTIME_THREADS : c_int = 131;
pub const _SC_MQ_PRIO_MAX : c_int = 28;
pub const _SC_IOV_MAX : c_int = 60;
pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
pub const _SC_LOGIN_NAME_MAX : c_int = 71;
pub const _SC_TTY_NAME_MAX : c_int = 72;
pub const _SC_THREADS : c_int = 67;
pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
pub const _SC_THREAD_KEYS_MAX : c_int = 74;
pub const _SC_THREAD_STACK_MIN : c_int = 75;
pub const _SC_THREAD_THREADS_MAX : c_int = 76;
pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
pub const _SC_ATEXIT_MAX : c_int = 87;
pub const _SC_XOPEN_VERSION : c_int = 89;
pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
pub const _SC_XOPEN_UNIX : c_int = 91;
pub const _SC_XOPEN_CRYPT : c_int = 92;
pub const _SC_XOPEN_ENH_I18N : c_int = 93;
pub const _SC_XOPEN_SHM : c_int = 94;
pub const _SC_XOPEN_LEGACY : c_int = 129;
pub const _SC_XOPEN_REALTIME : c_int = 130;
pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
pub static PTHREAD_CREATE_JOINABLE: c_int = 0;
pub static PTHREAD_CREATE_DETACHED: c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
pub const PTHREAD_CREATE_DETACHED: c_int = 1;
#[cfg(target_os = "android")]
pub static PTHREAD_STACK_MIN: size_t = 8192;
pub const PTHREAD_STACK_MIN: size_t = 8192;
#[cfg(all(target_os = "linux",
any(target_arch = "arm",
target_arch = "x86",
target_arch = "x86_64")))]
pub static PTHREAD_STACK_MIN: size_t = 16384;
pub const PTHREAD_STACK_MIN: size_t = 16384;
#[cfg(all(target_os = "linux",
any(target_arch = "mips", target_arch = "mipsel")))]
pub static PTHREAD_STACK_MIN: size_t = 131072;
pub const PTHREAD_STACK_MIN: size_t = 131072;
pub static CLOCK_REALTIME: c_int = 0;
pub static CLOCK_MONOTONIC: c_int = 1;
pub const CLOCK_REALTIME: c_int = 0;
pub const CLOCK_MONOTONIC: c_int = 1;
}
pub mod posix08 {
}
@@ -2912,93 +2912,93 @@ pub mod posix08 {
pub mod bsd44 {
use types::os::arch::c95::c_int;
pub static MADV_NORMAL : c_int = 0;
pub static MADV_RANDOM : c_int = 1;
pub static MADV_SEQUENTIAL : c_int = 2;
pub static MADV_WILLNEED : c_int = 3;
pub static MADV_DONTNEED : c_int = 4;
pub static MADV_REMOVE : c_int = 9;
pub static MADV_DONTFORK : c_int = 10;
pub static MADV_DOFORK : c_int = 11;
pub static MADV_MERGEABLE : c_int = 12;
pub static MADV_UNMERGEABLE : c_int = 13;
pub static MADV_HWPOISON : c_int = 100;
pub const MADV_NORMAL : c_int = 0;
pub const MADV_RANDOM : c_int = 1;
pub const MADV_SEQUENTIAL : c_int = 2;
pub const MADV_WILLNEED : c_int = 3;
pub const MADV_DONTNEED : c_int = 4;
pub const MADV_REMOVE : c_int = 9;
pub const MADV_DONTFORK : c_int = 10;
pub const MADV_DOFORK : c_int = 11;
pub const MADV_MERGEABLE : c_int = 12;
pub const MADV_UNMERGEABLE : c_int = 13;
pub const MADV_HWPOISON : c_int = 100;
pub static IFF_LOOPBACK: c_int = 0x8;
pub const IFF_LOOPBACK: c_int = 0x8;
pub static AF_UNIX: c_int = 1;
pub static AF_INET: c_int = 2;
pub static AF_INET6: c_int = 10;
pub static SOCK_STREAM: c_int = 1;
pub static SOCK_DGRAM: c_int = 2;
pub static SOCK_RAW: c_int = 3;
pub static IPPROTO_TCP: c_int = 6;
pub static IPPROTO_IP: c_int = 0;
pub static IPPROTO_IPV6: c_int = 41;
pub static IP_MULTICAST_TTL: c_int = 33;
pub static IP_MULTICAST_LOOP: c_int = 34;
pub static IP_TTL: c_int = 2;
pub static IP_HDRINCL: c_int = 3;
pub static IP_ADD_MEMBERSHIP: c_int = 35;
pub static IP_DROP_MEMBERSHIP: c_int = 36;
pub static IPV6_ADD_MEMBERSHIP: c_int = 20;
pub static IPV6_DROP_MEMBERSHIP: c_int = 21;
pub const AF_UNIX: c_int = 1;
pub const AF_INET: c_int = 2;
pub const AF_INET6: c_int = 10;
pub const SOCK_STREAM: c_int = 1;
pub const SOCK_DGRAM: c_int = 2;
pub const SOCK_RAW: c_int = 3;
pub const IPPROTO_TCP: c_int = 6;
pub const IPPROTO_IP: c_int = 0;
pub const IPPROTO_IPV6: c_int = 41;
pub const IP_MULTICAST_TTL: c_int = 33;
pub const IP_MULTICAST_LOOP: c_int = 34;
pub const IP_TTL: c_int = 2;
pub const IP_HDRINCL: c_int = 3;
pub const IP_ADD_MEMBERSHIP: c_int = 35;
pub const IP_DROP_MEMBERSHIP: c_int = 36;
pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
pub static TCP_NODELAY: c_int = 1;
pub static SOL_SOCKET: c_int = 1;
pub static SO_KEEPALIVE: c_int = 9;
pub static SO_BROADCAST: c_int = 6;
pub static SO_REUSEADDR: c_int = 2;
pub static SO_ERROR: c_int = 4;
pub const TCP_NODELAY: c_int = 1;
pub const SOL_SOCKET: c_int = 1;
pub const SO_KEEPALIVE: c_int = 9;
pub const SO_BROADCAST: c_int = 6;
pub const SO_REUSEADDR: c_int = 2;
pub const SO_ERROR: c_int = 4;
pub static SHUT_RD: c_int = 0;
pub static SHUT_WR: c_int = 1;
pub static SHUT_RDWR: c_int = 2;
pub const SHUT_RD: c_int = 0;
pub const SHUT_WR: c_int = 1;
pub const SHUT_RDWR: c_int = 2;
}
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
pub mod bsd44 {
use types::os::arch::c95::c_int;
pub static MADV_NORMAL : c_int = 0;
pub static MADV_RANDOM : c_int = 1;
pub static MADV_SEQUENTIAL : c_int = 2;
pub static MADV_WILLNEED : c_int = 3;
pub static MADV_DONTNEED : c_int = 4;
pub static MADV_REMOVE : c_int = 9;
pub static MADV_DONTFORK : c_int = 10;
pub static MADV_DOFORK : c_int = 11;
pub static MADV_MERGEABLE : c_int = 12;
pub static MADV_UNMERGEABLE : c_int = 13;
pub static MADV_HWPOISON : c_int = 100;
pub const MADV_NORMAL : c_int = 0;
pub const MADV_RANDOM : c_int = 1;
pub const MADV_SEQUENTIAL : c_int = 2;
pub const MADV_WILLNEED : c_int = 3;
pub const MADV_DONTNEED : c_int = 4;
pub const MADV_REMOVE : c_int = 9;
pub const MADV_DONTFORK : c_int = 10;
pub const MADV_DOFORK : c_int = 11;
pub const MADV_MERGEABLE : c_int = 12;
pub const MADV_UNMERGEABLE : c_int = 13;
pub const MADV_HWPOISON : c_int = 100;
pub static AF_UNIX: c_int = 1;
pub static AF_INET: c_int = 2;
pub static AF_INET6: c_int = 10;
pub static SOCK_STREAM: c_int = 2;
pub static SOCK_DGRAM: c_int = 1;
pub static SOCK_RAW: c_int = 3;
pub static IPPROTO_TCP: c_int = 6;
pub static IPPROTO_IP: c_int = 0;
pub static IPPROTO_IPV6: c_int = 41;
pub static IP_MULTICAST_TTL: c_int = 33;
pub static IP_MULTICAST_LOOP: c_int = 34;
pub static IP_TTL: c_int = 2;
pub static IP_HDRINCL: c_int = 3;
pub static IP_ADD_MEMBERSHIP: c_int = 35;
pub static IP_DROP_MEMBERSHIP: c_int = 36;
pub static IPV6_ADD_MEMBERSHIP: c_int = 20;
pub static IPV6_DROP_MEMBERSHIP: c_int = 21;
pub const AF_UNIX: c_int = 1;
pub const AF_INET: c_int = 2;
pub const AF_INET6: c_int = 10;
pub const SOCK_STREAM: c_int = 2;
pub const SOCK_DGRAM: c_int = 1;
pub const SOCK_RAW: c_int = 3;
pub const IPPROTO_TCP: c_int = 6;
pub const IPPROTO_IP: c_int = 0;
pub const IPPROTO_IPV6: c_int = 41;
pub const IP_MULTICAST_TTL: c_int = 33;
pub const IP_MULTICAST_LOOP: c_int = 34;
pub const IP_TTL: c_int = 2;
pub const IP_HDRINCL: c_int = 3;
pub const IP_ADD_MEMBERSHIP: c_int = 35;
pub const IP_DROP_MEMBERSHIP: c_int = 36;
pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
pub static TCP_NODELAY: c_int = 1;
pub static SOL_SOCKET: c_int = 65535;
pub static SO_KEEPALIVE: c_int = 8;
pub static SO_BROADCAST: c_int = 32;
pub static SO_REUSEADDR: c_int = 4;
pub static SO_ERROR: c_int = 4103;
pub const TCP_NODELAY: c_int = 1;
pub const SOL_SOCKET: c_int = 65535;
pub const SO_KEEPALIVE: c_int = 8;
pub const SO_BROADCAST: c_int = 32;
pub const SO_REUSEADDR: c_int = 4;
pub const SO_ERROR: c_int = 4103;
pub static SHUT_RD: c_int = 0;
pub static SHUT_WR: c_int = 1;
pub static SHUT_RDWR: c_int = 2;
pub const SHUT_RD: c_int = 0;
pub const SHUT_WR: c_int = 1;
pub const SHUT_RDWR: c_int = 2;
}
#[cfg(any(target_arch = "x86",
target_arch = "x86_64",
@@ -3006,149 +3006,149 @@ pub mod bsd44 {
pub mod extra {
use types::os::arch::c95::c_int;
pub static AF_PACKET : c_int = 17;
pub static IPPROTO_RAW : c_int = 255;
pub const AF_PACKET : c_int = 17;
pub const IPPROTO_RAW : c_int = 255;
pub static O_RSYNC : c_int = 1052672;
pub static O_DSYNC : c_int = 4096;
pub static O_NONBLOCK : c_int = 2048;
pub static O_SYNC : c_int = 1052672;
pub const O_RSYNC : c_int = 1052672;
pub const O_DSYNC : c_int = 4096;
pub const O_NONBLOCK : c_int = 2048;
pub const O_SYNC : c_int = 1052672;
pub static PROT_GROWSDOWN : c_int = 0x010000000;
pub static PROT_GROWSUP : c_int = 0x020000000;
pub const PROT_GROWSDOWN : c_int = 0x010000000;
pub const PROT_GROWSUP : c_int = 0x020000000;
pub static MAP_TYPE : c_int = 0x000f;
pub static MAP_ANONYMOUS : c_int = 0x0020;
pub static MAP_32BIT : c_int = 0x0040;
pub static MAP_GROWSDOWN : c_int = 0x0100;
pub static MAP_DENYWRITE : c_int = 0x0800;
pub static MAP_EXECUTABLE : c_int = 0x01000;
pub static MAP_LOCKED : c_int = 0x02000;
pub static MAP_NONRESERVE : c_int = 0x04000;
pub static MAP_POPULATE : c_int = 0x08000;
pub static MAP_NONBLOCK : c_int = 0x010000;
pub static MAP_STACK : c_int = 0x020000;
pub const MAP_TYPE : c_int = 0x000f;
pub const MAP_ANONYMOUS : c_int = 0x0020;
pub const MAP_32BIT : c_int = 0x0040;
pub const MAP_GROWSDOWN : c_int = 0x0100;
pub const MAP_DENYWRITE : c_int = 0x0800;
pub const MAP_EXECUTABLE : c_int = 0x01000;
pub const MAP_LOCKED : c_int = 0x02000;
pub const MAP_NONRESERVE : c_int = 0x04000;
pub const MAP_POPULATE : c_int = 0x08000;
pub const MAP_NONBLOCK : c_int = 0x010000;
pub const MAP_STACK : c_int = 0x020000;
}
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
pub mod extra {
use types::os::arch::c95::c_int;
pub static AF_PACKET : c_int = 17;
pub static IPPROTO_RAW : c_int = 255;
pub const AF_PACKET : c_int = 17;
pub const IPPROTO_RAW : c_int = 255;
pub static O_RSYNC : c_int = 16400;
pub static O_DSYNC : c_int = 16;
pub static O_NONBLOCK : c_int = 128;
pub static O_SYNC : c_int = 16400;
pub const O_RSYNC : c_int = 16400;
pub const O_DSYNC : c_int = 16;
pub const O_NONBLOCK : c_int = 128;
pub const O_SYNC : c_int = 16400;
pub static PROT_GROWSDOWN : c_int = 0x01000000;
pub static PROT_GROWSUP : c_int = 0x02000000;
pub const PROT_GROWSDOWN : c_int = 0x01000000;
pub const PROT_GROWSUP : c_int = 0x02000000;
pub static MAP_TYPE : c_int = 0x000f;
pub static MAP_ANONYMOUS : c_int = 0x0800;
pub static MAP_GROWSDOWN : c_int = 0x01000;
pub static MAP_DENYWRITE : c_int = 0x02000;
pub static MAP_EXECUTABLE : c_int = 0x04000;
pub static MAP_LOCKED : c_int = 0x08000;
pub static MAP_NONRESERVE : c_int = 0x0400;
pub static MAP_POPULATE : c_int = 0x010000;
pub static MAP_NONBLOCK : c_int = 0x020000;
pub static MAP_STACK : c_int = 0x040000;
pub const MAP_TYPE : c_int = 0x000f;
pub const MAP_ANONYMOUS : c_int = 0x0800;
pub const MAP_GROWSDOWN : c_int = 0x01000;
pub const MAP_DENYWRITE : c_int = 0x02000;
pub const MAP_EXECUTABLE : c_int = 0x04000;
pub const MAP_LOCKED : c_int = 0x08000;
pub const MAP_NONRESERVE : c_int = 0x0400;
pub const MAP_POPULATE : c_int = 0x010000;
pub const MAP_NONBLOCK : c_int = 0x020000;
pub const MAP_STACK : c_int = 0x040000;
}
#[cfg(target_os = "linux")]
pub mod sysconf {
use types::os::arch::c95::c_int;
pub static _SC_ARG_MAX : c_int = 0;
pub static _SC_CHILD_MAX : c_int = 1;
pub static _SC_CLK_TCK : c_int = 2;
pub static _SC_NGROUPS_MAX : c_int = 3;
pub static _SC_OPEN_MAX : c_int = 4;
pub static _SC_STREAM_MAX : c_int = 5;
pub static _SC_TZNAME_MAX : c_int = 6;
pub static _SC_JOB_CONTROL : c_int = 7;
pub static _SC_SAVED_IDS : c_int = 8;
pub static _SC_REALTIME_SIGNALS : c_int = 9;
pub static _SC_PRIORITY_SCHEDULING : c_int = 10;
pub static _SC_TIMERS : c_int = 11;
pub static _SC_ASYNCHRONOUS_IO : c_int = 12;
pub static _SC_PRIORITIZED_IO : c_int = 13;
pub static _SC_SYNCHRONIZED_IO : c_int = 14;
pub static _SC_FSYNC : c_int = 15;
pub static _SC_MAPPED_FILES : c_int = 16;
pub static _SC_MEMLOCK : c_int = 17;
pub static _SC_MEMLOCK_RANGE : c_int = 18;
pub static _SC_MEMORY_PROTECTION : c_int = 19;
pub static _SC_MESSAGE_PASSING : c_int = 20;
pub static _SC_SEMAPHORES : c_int = 21;
pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
pub static _SC_AIO_LISTIO_MAX : c_int = 23;
pub static _SC_AIO_MAX : c_int = 24;
pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
pub static _SC_DELAYTIMER_MAX : c_int = 26;
pub static _SC_MQ_OPEN_MAX : c_int = 27;
pub static _SC_VERSION : c_int = 29;
pub static _SC_PAGESIZE : c_int = 30;
pub static _SC_RTSIG_MAX : c_int = 31;
pub static _SC_SEM_NSEMS_MAX : c_int = 32;
pub static _SC_SEM_VALUE_MAX : c_int = 33;
pub static _SC_SIGQUEUE_MAX : c_int = 34;
pub static _SC_TIMER_MAX : c_int = 35;
pub static _SC_BC_BASE_MAX : c_int = 36;
pub static _SC_BC_DIM_MAX : c_int = 37;
pub static _SC_BC_SCALE_MAX : c_int = 38;
pub static _SC_BC_STRING_MAX : c_int = 39;
pub static _SC_COLL_WEIGHTS_MAX : c_int = 40;
pub static _SC_EXPR_NEST_MAX : c_int = 42;
pub static _SC_LINE_MAX : c_int = 43;
pub static _SC_RE_DUP_MAX : c_int = 44;
pub static _SC_2_VERSION : c_int = 46;
pub static _SC_2_C_BIND : c_int = 47;
pub static _SC_2_C_DEV : c_int = 48;
pub static _SC_2_FORT_DEV : c_int = 49;
pub static _SC_2_FORT_RUN : c_int = 50;
pub static _SC_2_SW_DEV : c_int = 51;
pub static _SC_2_LOCALEDEF : c_int = 52;
pub static _SC_2_CHAR_TERM : c_int = 95;
pub static _SC_2_C_VERSION : c_int = 96;
pub static _SC_2_UPE : c_int = 97;
pub static _SC_XBS5_ILP32_OFF32 : c_int = 125;
pub static _SC_XBS5_ILP32_OFFBIG : c_int = 126;
pub static _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
pub const _SC_ARG_MAX : c_int = 0;
pub const _SC_CHILD_MAX : c_int = 1;
pub const _SC_CLK_TCK : c_int = 2;
pub const _SC_NGROUPS_MAX : c_int = 3;
pub const _SC_OPEN_MAX : c_int = 4;
pub const _SC_STREAM_MAX : c_int = 5;
pub const _SC_TZNAME_MAX : c_int = 6;
pub const _SC_JOB_CONTROL : c_int = 7;
pub const _SC_SAVED_IDS : c_int = 8;
pub const _SC_REALTIME_SIGNALS : c_int = 9;
pub const _SC_PRIORITY_SCHEDULING : c_int = 10;
pub const _SC_TIMERS : c_int = 11;
pub const _SC_ASYNCHRONOUS_IO : c_int = 12;
pub const _SC_PRIORITIZED_IO : c_int = 13;
pub const _SC_SYNCHRONIZED_IO : c_int = 14;
pub const _SC_FSYNC : c_int = 15;
pub const _SC_MAPPED_FILES : c_int = 16;
pub const _SC_MEMLOCK : c_int = 17;
pub const _SC_MEMLOCK_RANGE : c_int = 18;
pub const _SC_MEMORY_PROTECTION : c_int = 19;
pub const _SC_MESSAGE_PASSING : c_int = 20;
pub const _SC_SEMAPHORES : c_int = 21;
pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
pub const _SC_AIO_LISTIO_MAX : c_int = 23;
pub const _SC_AIO_MAX : c_int = 24;
pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
pub const _SC_DELAYTIMER_MAX : c_int = 26;
pub const _SC_MQ_OPEN_MAX : c_int = 27;
pub const _SC_VERSION : c_int = 29;
pub const _SC_PAGESIZE : c_int = 30;
pub const _SC_RTSIG_MAX : c_int = 31;
pub const _SC_SEM_NSEMS_MAX : c_int = 32;
pub const _SC_SEM_VALUE_MAX : c_int = 33;
pub const _SC_SIGQUEUE_MAX : c_int = 34;
pub const _SC_TIMER_MAX : c_int = 35;
pub const _SC_BC_BASE_MAX : c_int = 36;
pub const _SC_BC_DIM_MAX : c_int = 37;
pub const _SC_BC_SCALE_MAX : c_int = 38;
pub const _SC_BC_STRING_MAX : c_int = 39;
pub const _SC_COLL_WEIGHTS_MAX : c_int = 40;
pub const _SC_EXPR_NEST_MAX : c_int = 42;
pub const _SC_LINE_MAX : c_int = 43;
pub const _SC_RE_DUP_MAX : c_int = 44;
pub const _SC_2_VERSION : c_int = 46;
pub const _SC_2_C_BIND : c_int = 47;
pub const _SC_2_C_DEV : c_int = 48;
pub const _SC_2_FORT_DEV : c_int = 49;
pub const _SC_2_FORT_RUN : c_int = 50;
pub const _SC_2_SW_DEV : c_int = 51;
pub const _SC_2_LOCALEDEF : c_int = 52;
pub const _SC_2_CHAR_TERM : c_int = 95;
pub const _SC_2_C_VERSION : c_int = 96;
pub const _SC_2_UPE : c_int = 97;
pub const _SC_XBS5_ILP32_OFF32 : c_int = 125;
pub const _SC_XBS5_ILP32_OFFBIG : c_int = 126;
pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
}
#[cfg(target_os = "android")]
pub mod sysconf {
use types::os::arch::c95::c_int;
pub static _SC_ARG_MAX : c_int = 0;
pub static _SC_BC_BASE_MAX : c_int = 1;
pub static _SC_BC_DIM_MAX : c_int = 2;
pub static _SC_BC_SCALE_MAX : c_int = 3;
pub static _SC_BC_STRING_MAX : c_int = 4;
pub static _SC_CHILD_MAX : c_int = 5;
pub static _SC_CLK_TCK : c_int = 6;
pub static _SC_COLL_WEIGHTS_MAX : c_int = 7;
pub static _SC_EXPR_NEST_MAX : c_int = 8;
pub static _SC_LINE_MAX : c_int = 9;
pub static _SC_NGROUPS_MAX : c_int = 10;
pub static _SC_OPEN_MAX : c_int = 11;
pub static _SC_2_C_BIND : c_int = 13;
pub static _SC_2_C_DEV : c_int = 14;
pub static _SC_2_C_VERSION : c_int = 15;
pub static _SC_2_CHAR_TERM : c_int = 16;
pub static _SC_2_FORT_DEV : c_int = 17;
pub static _SC_2_FORT_RUN : c_int = 18;
pub static _SC_2_LOCALEDEF : c_int = 19;
pub static _SC_2_SW_DEV : c_int = 20;
pub static _SC_2_UPE : c_int = 21;
pub static _SC_2_VERSION : c_int = 22;
pub static _SC_JOB_CONTROL : c_int = 23;
pub static _SC_SAVED_IDS : c_int = 24;
pub static _SC_VERSION : c_int = 25;
pub static _SC_RE_DUP_MAX : c_int = 26;
pub static _SC_STREAM_MAX : c_int = 27;
pub static _SC_TZNAME_MAX : c_int = 28;
pub static _SC_PAGESIZE : c_int = 39;
pub const _SC_ARG_MAX : c_int = 0;
pub const _SC_BC_BASE_MAX : c_int = 1;
pub const _SC_BC_DIM_MAX : c_int = 2;
pub const _SC_BC_SCALE_MAX : c_int = 3;
pub const _SC_BC_STRING_MAX : c_int = 4;
pub const _SC_CHILD_MAX : c_int = 5;
pub const _SC_CLK_TCK : c_int = 6;
pub const _SC_COLL_WEIGHTS_MAX : c_int = 7;
pub const _SC_EXPR_NEST_MAX : c_int = 8;
pub const _SC_LINE_MAX : c_int = 9;
pub const _SC_NGROUPS_MAX : c_int = 10;
pub const _SC_OPEN_MAX : c_int = 11;
pub const _SC_2_C_BIND : c_int = 13;
pub const _SC_2_C_DEV : c_int = 14;
pub const _SC_2_C_VERSION : c_int = 15;
pub const _SC_2_CHAR_TERM : c_int = 16;
pub const _SC_2_FORT_DEV : c_int = 17;
pub const _SC_2_FORT_RUN : c_int = 18;
pub const _SC_2_LOCALEDEF : c_int = 19;
pub const _SC_2_SW_DEV : c_int = 20;
pub const _SC_2_UPE : c_int = 21;
pub const _SC_2_VERSION : c_int = 22;
pub const _SC_JOB_CONTROL : c_int = 23;
pub const _SC_SAVED_IDS : c_int = 24;
pub const _SC_VERSION : c_int = 25;
pub const _SC_RE_DUP_MAX : c_int = 26;
pub const _SC_STREAM_MAX : c_int = 27;
pub const _SC_TZNAME_MAX : c_int = 28;
pub const _SC_PAGESIZE : c_int = 39;
}
}
@@ -3157,21 +3157,21 @@ pub mod os {
pub mod c95 {
use types::os::arch::c95::{c_int, c_uint};
pub static EXIT_FAILURE : c_int = 1;
pub static EXIT_SUCCESS : c_int = 0;
pub static RAND_MAX : c_int = 2147483647;
pub static EOF : c_int = -1;
pub static SEEK_SET : c_int = 0;
pub static SEEK_CUR : c_int = 1;
pub static SEEK_END : c_int = 2;
pub static _IOFBF : c_int = 0;
pub static _IONBF : c_int = 2;
pub static _IOLBF : c_int = 1;
pub static BUFSIZ : c_uint = 1024_u32;
pub static FOPEN_MAX : c_uint = 20_u32;
pub static FILENAME_MAX : c_uint = 1024_u32;
pub static L_tmpnam : c_uint = 1024_u32;
pub static TMP_MAX : c_uint = 308915776_u32;
pub const EXIT_FAILURE : c_int = 1;
pub const EXIT_SUCCESS : c_int = 0;
pub const RAND_MAX : c_int = 2147483647;
pub const EOF : c_int = -1;
pub const SEEK_SET : c_int = 0;
pub const SEEK_CUR : c_int = 1;
pub const SEEK_END : c_int = 2;
pub const _IOFBF : c_int = 0;
pub const _IONBF : c_int = 2;
pub const _IOLBF : c_int = 1;
pub const BUFSIZ : c_uint = 1024_u32;
pub const FOPEN_MAX : c_uint = 20_u32;
pub const FILENAME_MAX : c_uint = 1024_u32;
pub const L_tmpnam : c_uint = 1024_u32;
pub const TMP_MAX : c_uint = 308915776_u32;
}
pub mod c99 {
}
@@ -3180,384 +3180,384 @@ pub mod posix88 {
use types::os::arch::c95::c_int;
use types::os::arch::posix88::mode_t;
pub static O_RDONLY : c_int = 0;
pub static O_WRONLY : c_int = 1;
pub static O_RDWR : c_int = 2;
pub static O_APPEND : c_int = 8;
pub static O_CREAT : c_int = 512;
pub static O_EXCL : c_int = 2048;
pub static O_TRUNC : c_int = 1024;
pub static S_IFIFO : mode_t = 4096;
pub static S_IFCHR : mode_t = 8192;
pub static S_IFBLK : mode_t = 24576;
pub static S_IFDIR : mode_t = 16384;
pub static S_IFREG : mode_t = 32768;
pub static S_IFLNK : mode_t = 40960;
pub static S_IFMT : mode_t = 61440;
pub static S_IEXEC : mode_t = 64;
pub static S_IWRITE : mode_t = 128;
pub static S_IREAD : mode_t = 256;
pub static S_IRWXU : mode_t = 448;
pub static S_IXUSR : mode_t = 64;
pub static S_IWUSR : mode_t = 128;
pub static S_IRUSR : mode_t = 256;
pub static F_OK : c_int = 0;
pub static R_OK : c_int = 4;
pub static W_OK : c_int = 2;
pub static X_OK : c_int = 1;
pub static STDIN_FILENO : c_int = 0;
pub static STDOUT_FILENO : c_int = 1;
pub static STDERR_FILENO : c_int = 2;
pub static F_LOCK : c_int = 1;
pub static F_TEST : c_int = 3;
pub static F_TLOCK : c_int = 2;
pub static F_ULOCK : c_int = 0;
pub static SIGHUP : c_int = 1;
pub static SIGINT : c_int = 2;
pub static SIGQUIT : c_int = 3;
pub static SIGILL : c_int = 4;
pub static SIGABRT : c_int = 6;
pub static SIGFPE : c_int = 8;
pub static SIGKILL : c_int = 9;
pub static SIGSEGV : c_int = 11;
pub static SIGPIPE : c_int = 13;
pub static SIGALRM : c_int = 14;
pub static SIGTERM : c_int = 15;
pub const O_RDONLY : c_int = 0;
pub const O_WRONLY : c_int = 1;
pub const O_RDWR : c_int = 2;
pub const O_APPEND : c_int = 8;
pub const O_CREAT : c_int = 512;
pub const O_EXCL : c_int = 2048;
pub const O_TRUNC : c_int = 1024;
pub const S_IFIFO : mode_t = 4096;
pub const S_IFCHR : mode_t = 8192;
pub const S_IFBLK : mode_t = 24576;
pub const S_IFDIR : mode_t = 16384;
pub const S_IFREG : mode_t = 32768;
pub const S_IFLNK : mode_t = 40960;
pub const S_IFMT : mode_t = 61440;
pub const S_IEXEC : mode_t = 64;
pub const S_IWRITE : mode_t = 128;
pub const S_IREAD : mode_t = 256;
pub const S_IRWXU : mode_t = 448;
pub const S_IXUSR : mode_t = 64;
pub const S_IWUSR : mode_t = 128;
pub const S_IRUSR : mode_t = 256;
pub const F_OK : c_int = 0;
pub const R_OK : c_int = 4;
pub const W_OK : c_int = 2;
pub const X_OK : c_int = 1;
pub const STDIN_FILENO : c_int = 0;
pub const STDOUT_FILENO : c_int = 1;
pub const STDERR_FILENO : c_int = 2;
pub const F_LOCK : c_int = 1;
pub const F_TEST : c_int = 3;
pub const F_TLOCK : c_int = 2;
pub const F_ULOCK : c_int = 0;
pub const SIGHUP : c_int = 1;
pub const SIGINT : c_int = 2;
pub const SIGQUIT : c_int = 3;
pub const SIGILL : c_int = 4;
pub const SIGABRT : c_int = 6;
pub const SIGFPE : c_int = 8;
pub const SIGKILL : c_int = 9;
pub const SIGSEGV : c_int = 11;
pub const SIGPIPE : c_int = 13;
pub const SIGALRM : c_int = 14;
pub const SIGTERM : c_int = 15;
pub static PROT_NONE : c_int = 0;
pub static PROT_READ : c_int = 1;
pub static PROT_WRITE : c_int = 2;
pub static PROT_EXEC : c_int = 4;
pub const PROT_NONE : c_int = 0;
pub const PROT_READ : c_int = 1;
pub const PROT_WRITE : c_int = 2;
pub const PROT_EXEC : c_int = 4;
pub static MAP_FILE : c_int = 0x0000;
pub static MAP_SHARED : c_int = 0x0001;
pub static MAP_PRIVATE : c_int = 0x0002;
pub static MAP_FIXED : c_int = 0x0010;
pub static MAP_ANON : c_int = 0x1000;
pub const MAP_FILE : c_int = 0x0000;
pub const MAP_SHARED : c_int = 0x0001;
pub const MAP_PRIVATE : c_int = 0x0002;
pub const MAP_FIXED : c_int = 0x0010;
pub const MAP_ANON : c_int = 0x1000;
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub static MCL_CURRENT : c_int = 0x0001;
pub static MCL_FUTURE : c_int = 0x0002;
pub const MCL_CURRENT : c_int = 0x0001;
pub const MCL_FUTURE : c_int = 0x0002;
pub static MS_SYNC : c_int = 0x0000;
pub static MS_ASYNC : c_int = 0x0001;
pub static MS_INVALIDATE : c_int = 0x0002;
pub const MS_SYNC : c_int = 0x0000;
pub const MS_ASYNC : c_int = 0x0001;
pub const MS_INVALIDATE : c_int = 0x0002;
pub static EPERM : c_int = 1;
pub static ENOENT : c_int = 2;
pub static ESRCH : c_int = 3;
pub static EINTR : c_int = 4;
pub static EIO : c_int = 5;
pub static ENXIO : c_int = 6;
pub static E2BIG : c_int = 7;
pub static ENOEXEC : c_int = 8;
pub static EBADF : c_int = 9;
pub static ECHILD : c_int = 10;
pub static EDEADLK : c_int = 11;
pub static ENOMEM : c_int = 12;
pub static EACCES : c_int = 13;
pub static EFAULT : c_int = 14;
pub static ENOTBLK : c_int = 15;
pub static EBUSY : c_int = 16;
pub static EEXIST : c_int = 17;
pub static EXDEV : c_int = 18;
pub static ENODEV : c_int = 19;
pub static ENOTDIR : c_int = 20;
pub static EISDIR : c_int = 21;
pub static EINVAL : c_int = 22;
pub static ENFILE : c_int = 23;
pub static EMFILE : c_int = 24;
pub static ENOTTY : c_int = 25;
pub static ETXTBSY : c_int = 26;
pub static EFBIG : c_int = 27;
pub static ENOSPC : c_int = 28;
pub static ESPIPE : c_int = 29;
pub static EROFS : c_int = 30;
pub static EMLINK : c_int = 31;
pub static EPIPE : c_int = 32;
pub static EDOM : c_int = 33;
pub static ERANGE : c_int = 34;
pub static EAGAIN : c_int = 35;
pub static EWOULDBLOCK : c_int = 35;
pub static EINPROGRESS : c_int = 36;
pub static EALREADY : c_int = 37;
pub static ENOTSOCK : c_int = 38;
pub static EDESTADDRREQ : c_int = 39;
pub static EMSGSIZE : c_int = 40;
pub static EPROTOTYPE : c_int = 41;
pub static ENOPROTOOPT : c_int = 42;
pub static EPROTONOSUPPORT : c_int = 43;
pub static ESOCKTNOSUPPORT : c_int = 44;
pub static EOPNOTSUPP : c_int = 45;
pub static EPFNOSUPPORT : c_int = 46;
pub static EAFNOSUPPORT : c_int = 47;
pub static EADDRINUSE : c_int = 48;
pub static EADDRNOTAVAIL : c_int = 49;
pub static ENETDOWN : c_int = 50;
pub static ENETUNREACH : c_int = 51;
pub static ENETRESET : c_int = 52;
pub static ECONNABORTED : c_int = 53;
pub static ECONNRESET : c_int = 54;
pub static ENOBUFS : c_int = 55;
pub static EISCONN : c_int = 56;
pub static ENOTCONN : c_int = 57;
pub static ESHUTDOWN : c_int = 58;
pub static ETOOMANYREFS : c_int = 59;
pub static ETIMEDOUT : c_int = 60;
pub static ECONNREFUSED : c_int = 61;
pub static ELOOP : c_int = 62;
pub static ENAMETOOLONG : c_int = 63;
pub static EHOSTDOWN : c_int = 64;
pub static EHOSTUNREACH : c_int = 65;
pub static ENOTEMPTY : c_int = 66;
pub static EPROCLIM : c_int = 67;
pub static EUSERS : c_int = 68;
pub static EDQUOT : c_int = 69;
pub static ESTALE : c_int = 70;
pub static EREMOTE : c_int = 71;
pub static EBADRPC : c_int = 72;
pub static ERPCMISMATCH : c_int = 73;
pub static EPROGUNAVAIL : c_int = 74;
pub static EPROGMISMATCH : c_int = 75;
pub static EPROCUNAVAIL : c_int = 76;
pub static ENOLCK : c_int = 77;
pub static ENOSYS : c_int = 78;
pub static EFTYPE : c_int = 79;
pub static EAUTH : c_int = 80;
pub static ENEEDAUTH : c_int = 81;
pub static EIDRM : c_int = 82;
pub static ENOMSG : c_int = 83;
pub static EOVERFLOW : c_int = 84;
pub static ECANCELED : c_int = 85;
pub static EILSEQ : c_int = 86;
pub static ENOATTR : c_int = 87;
pub static EDOOFUS : c_int = 88;
pub static EBADMSG : c_int = 89;
pub static EMULTIHOP : c_int = 90;
pub static ENOLINK : c_int = 91;
pub static EPROTO : c_int = 92;
pub static ENOMEDIUM : c_int = 93;
pub static EUNUSED94 : c_int = 94;
pub static EUNUSED95 : c_int = 95;
pub static EUNUSED96 : c_int = 96;
pub static EUNUSED97 : c_int = 97;
pub static EUNUSED98 : c_int = 98;
pub static EASYNC : c_int = 99;
pub static ELAST : c_int = 99;
pub const EPERM : c_int = 1;
pub const ENOENT : c_int = 2;
pub const ESRCH : c_int = 3;
pub const EINTR : c_int = 4;
pub const EIO : c_int = 5;
pub const ENXIO : c_int = 6;
pub const E2BIG : c_int = 7;
pub const ENOEXEC : c_int = 8;
pub const EBADF : c_int = 9;
pub const ECHILD : c_int = 10;
pub const EDEADLK : c_int = 11;
pub const ENOMEM : c_int = 12;
pub const EACCES : c_int = 13;
pub const EFAULT : c_int = 14;
pub const ENOTBLK : c_int = 15;
pub const EBUSY : c_int = 16;
pub const EEXIST : c_int = 17;
pub const EXDEV : c_int = 18;
pub const ENODEV : c_int = 19;
pub const ENOTDIR : c_int = 20;
pub const EISDIR : c_int = 21;
pub const EINVAL : c_int = 22;
pub const ENFILE : c_int = 23;
pub const EMFILE : c_int = 24;
pub const ENOTTY : c_int = 25;
pub const ETXTBSY : c_int = 26;
pub const EFBIG : c_int = 27;
pub const ENOSPC : c_int = 28;
pub const ESPIPE : c_int = 29;
pub const EROFS : c_int = 30;
pub const EMLINK : c_int = 31;
pub const EPIPE : c_int = 32;
pub const EDOM : c_int = 33;
pub const ERANGE : c_int = 34;
pub const EAGAIN : c_int = 35;
pub const EWOULDBLOCK : c_int = 35;
pub const EINPROGRESS : c_int = 36;
pub const EALREADY : c_int = 37;
pub const ENOTSOCK : c_int = 38;
pub const EDESTADDRREQ : c_int = 39;
pub const EMSGSIZE : c_int = 40;
pub const EPROTOTYPE : c_int = 41;
pub const ENOPROTOOPT : c_int = 42;
pub const EPROTONOSUPPORT : c_int = 43;
pub const ESOCKTNOSUPPORT : c_int = 44;
pub const EOPNOTSUPP : c_int = 45;
pub const EPFNOSUPPORT : c_int = 46;
pub const EAFNOSUPPORT : c_int = 47;
pub const EADDRINUSE : c_int = 48;
pub const EADDRNOTAVAIL : c_int = 49;
pub const ENETDOWN : c_int = 50;
pub const ENETUNREACH : c_int = 51;
pub const ENETRESET : c_int = 52;
pub const ECONNABORTED : c_int = 53;
pub const ECONNRESET : c_int = 54;
pub const ENOBUFS : c_int = 55;
pub const EISCONN : c_int = 56;
pub const ENOTCONN : c_int = 57;
pub const ESHUTDOWN : c_int = 58;
pub const ETOOMANYREFS : c_int = 59;
pub const ETIMEDOUT : c_int = 60;
pub const ECONNREFUSED : c_int = 61;
pub const ELOOP : c_int = 62;
pub const ENAMETOOLONG : c_int = 63;
pub const EHOSTDOWN : c_int = 64;
pub const EHOSTUNREACH : c_int = 65;
pub const ENOTEMPTY : c_int = 66;
pub const EPROCLIM : c_int = 67;
pub const EUSERS : c_int = 68;
pub const EDQUOT : c_int = 69;
pub const ESTALE : c_int = 70;
pub const EREMOTE : c_int = 71;
pub const EBADRPC : c_int = 72;
pub const ERPCMISMATCH : c_int = 73;
pub const EPROGUNAVAIL : c_int = 74;
pub const EPROGMISMATCH : c_int = 75;
pub const EPROCUNAVAIL : c_int = 76;
pub const ENOLCK : c_int = 77;
pub const ENOSYS : c_int = 78;
pub const EFTYPE : c_int = 79;
pub const EAUTH : c_int = 80;
pub const ENEEDAUTH : c_int = 81;
pub const EIDRM : c_int = 82;
pub const ENOMSG : c_int = 83;
pub const EOVERFLOW : c_int = 84;
pub const ECANCELED : c_int = 85;
pub const EILSEQ : c_int = 86;
pub const ENOATTR : c_int = 87;
pub const EDOOFUS : c_int = 88;
pub const EBADMSG : c_int = 89;
pub const EMULTIHOP : c_int = 90;
pub const ENOLINK : c_int = 91;
pub const EPROTO : c_int = 92;
pub const ENOMEDIUM : c_int = 93;
pub const EUNUSED94 : c_int = 94;
pub const EUNUSED95 : c_int = 95;
pub const EUNUSED96 : c_int = 96;
pub const EUNUSED97 : c_int = 97;
pub const EUNUSED98 : c_int = 98;
pub const EASYNC : c_int = 99;
pub const ELAST : c_int = 99;
}
pub mod posix01 {
use types::os::arch::c95::{c_int, size_t};
pub static F_DUPFD : c_int = 0;
pub static F_GETFD : c_int = 1;
pub static F_SETFD : c_int = 2;
pub static F_GETFL : c_int = 3;
pub static F_SETFL : c_int = 4;
pub const F_DUPFD : c_int = 0;
pub const F_GETFD : c_int = 1;
pub const F_SETFD : c_int = 2;
pub const F_GETFL : c_int = 3;
pub const F_SETFL : c_int = 4;
pub static SIGTRAP : c_int = 5;
pub static SIGPIPE: c_int = 13;
pub static SIG_IGN: size_t = 1;
pub const SIGTRAP : c_int = 5;
pub const SIGPIPE: c_int = 13;
pub const SIG_IGN: size_t = 1;
pub static GLOB_APPEND : c_int = 0x0001;
pub static GLOB_DOOFFS : c_int = 0x0002;
pub static GLOB_ERR : c_int = 0x0004;
pub static GLOB_MARK : c_int = 0x0008;
pub static GLOB_NOCHECK : c_int = 0x0010;
pub static GLOB_NOSORT : c_int = 0x0020;
pub static GLOB_NOESCAPE : c_int = 0x2000;
pub const GLOB_APPEND : c_int = 0x0001;
pub const GLOB_DOOFFS : c_int = 0x0002;
pub const GLOB_ERR : c_int = 0x0004;
pub const GLOB_MARK : c_int = 0x0008;
pub const GLOB_NOCHECK : c_int = 0x0010;
pub const GLOB_NOSORT : c_int = 0x0020;
pub const GLOB_NOESCAPE : c_int = 0x2000;
pub static GLOB_NOSPACE : c_int = -1;
pub static GLOB_ABORTED : c_int = -2;
pub static GLOB_NOMATCH : c_int = -3;
pub const GLOB_NOSPACE : c_int = -1;
pub const GLOB_ABORTED : c_int = -2;
pub const GLOB_NOMATCH : c_int = -3;
pub static POSIX_MADV_NORMAL : c_int = 0;
pub static POSIX_MADV_RANDOM : c_int = 1;
pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
pub static POSIX_MADV_WILLNEED : c_int = 3;
pub static POSIX_MADV_DONTNEED : c_int = 4;
pub const POSIX_MADV_NORMAL : c_int = 0;
pub const POSIX_MADV_RANDOM : c_int = 1;
pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
pub const POSIX_MADV_WILLNEED : c_int = 3;
pub const POSIX_MADV_DONTNEED : c_int = 4;
pub static _SC_IOV_MAX : c_int = 56;
pub static _SC_GETGR_R_SIZE_MAX : c_int = 70;
pub static _SC_GETPW_R_SIZE_MAX : c_int = 71;
pub static _SC_LOGIN_NAME_MAX : c_int = 73;
pub static _SC_MQ_PRIO_MAX : c_int = 75;
pub static _SC_THREAD_ATTR_STACKADDR : c_int = 82;
pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
pub static _SC_THREAD_KEYS_MAX : c_int = 86;
pub static _SC_THREAD_PRIO_INHERIT : c_int = 87;
pub static _SC_THREAD_PRIO_PROTECT : c_int = 88;
pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
pub static _SC_THREAD_PROCESS_SHARED : c_int = 90;
pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
pub static _SC_THREAD_STACK_MIN : c_int = 93;
pub static _SC_THREAD_THREADS_MAX : c_int = 94;
pub static _SC_THREADS : c_int = 96;
pub static _SC_TTY_NAME_MAX : c_int = 101;
pub static _SC_ATEXIT_MAX : c_int = 107;
pub static _SC_XOPEN_CRYPT : c_int = 108;
pub static _SC_XOPEN_ENH_I18N : c_int = 109;
pub static _SC_XOPEN_LEGACY : c_int = 110;
pub static _SC_XOPEN_REALTIME : c_int = 111;
pub static _SC_XOPEN_REALTIME_THREADS : c_int = 112;
pub static _SC_XOPEN_SHM : c_int = 113;
pub static _SC_XOPEN_UNIX : c_int = 115;
pub static _SC_XOPEN_VERSION : c_int = 116;
pub static _SC_XOPEN_XCU_VERSION : c_int = 117;
pub const _SC_IOV_MAX : c_int = 56;
pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
pub const _SC_LOGIN_NAME_MAX : c_int = 73;
pub const _SC_MQ_PRIO_MAX : c_int = 75;
pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
pub const _SC_THREAD_KEYS_MAX : c_int = 86;
pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
pub const _SC_THREAD_STACK_MIN : c_int = 93;
pub const _SC_THREAD_THREADS_MAX : c_int = 94;
pub const _SC_THREADS : c_int = 96;
pub const _SC_TTY_NAME_MAX : c_int = 101;
pub const _SC_ATEXIT_MAX : c_int = 107;
pub const _SC_XOPEN_CRYPT : c_int = 108;
pub const _SC_XOPEN_ENH_I18N : c_int = 109;
pub const _SC_XOPEN_LEGACY : c_int = 110;
pub const _SC_XOPEN_REALTIME : c_int = 111;
pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
pub const _SC_XOPEN_SHM : c_int = 113;
pub const _SC_XOPEN_UNIX : c_int = 115;
pub const _SC_XOPEN_VERSION : c_int = 116;
pub const _SC_XOPEN_XCU_VERSION : c_int = 117;
pub static PTHREAD_CREATE_JOINABLE: c_int = 0;
pub static PTHREAD_CREATE_DETACHED: c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
pub const PTHREAD_CREATE_DETACHED: c_int = 1;
#[cfg(target_arch = "arm")]
pub static PTHREAD_STACK_MIN: size_t = 4096;
pub const PTHREAD_STACK_MIN: size_t = 4096;
#[cfg(all(target_os = "freebsd",
any(target_arch = "mips",
target_arch = "mipsel",
target_arch = "x86",
target_arch = "x86_64")))]
pub static PTHREAD_STACK_MIN: size_t = 2048;
pub const PTHREAD_STACK_MIN: size_t = 2048;
#[cfg(target_os = "dragonfly")]
pub static PTHREAD_STACK_MIN: size_t = 1024;
pub const PTHREAD_STACK_MIN: size_t = 1024;
pub static CLOCK_REALTIME: c_int = 0;
pub static CLOCK_MONOTONIC: c_int = 4;
pub const CLOCK_REALTIME: c_int = 0;
pub const CLOCK_MONOTONIC: c_int = 4;
}
pub mod posix08 {
}
pub mod bsd44 {
use types::os::arch::c95::c_int;
pub static MADV_NORMAL : c_int = 0;
pub static MADV_RANDOM : c_int = 1;
pub static MADV_SEQUENTIAL : c_int = 2;
pub static MADV_WILLNEED : c_int = 3;
pub static MADV_DONTNEED : c_int = 4;
pub static MADV_FREE : c_int = 5;
pub static MADV_NOSYNC : c_int = 6;
pub static MADV_AUTOSYNC : c_int = 7;
pub static MADV_NOCORE : c_int = 8;
pub static MADV_CORE : c_int = 9;
pub static MADV_PROTECT : c_int = 10;
pub const MADV_NORMAL : c_int = 0;
pub const MADV_RANDOM : c_int = 1;
pub const MADV_SEQUENTIAL : c_int = 2;
pub const MADV_WILLNEED : c_int = 3;
pub const MADV_DONTNEED : c_int = 4;
pub const MADV_FREE : c_int = 5;
pub const MADV_NOSYNC : c_int = 6;
pub const MADV_AUTOSYNC : c_int = 7;
pub const MADV_NOCORE : c_int = 8;
pub const MADV_CORE : c_int = 9;
pub const MADV_PROTECT : c_int = 10;
pub static MINCORE_INCORE : c_int = 0x1;
pub static MINCORE_REFERENCED : c_int = 0x2;
pub static MINCORE_MODIFIED : c_int = 0x4;
pub static MINCORE_REFERENCED_OTHER : c_int = 0x8;
pub static MINCORE_MODIFIED_OTHER : c_int = 0x10;
pub static MINCORE_SUPER : c_int = 0x20;
pub const MINCORE_INCORE : c_int = 0x1;
pub const MINCORE_REFERENCED : c_int = 0x2;
pub const MINCORE_MODIFIED : c_int = 0x4;
pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
pub const MINCORE_SUPER : c_int = 0x20;
pub static AF_INET: c_int = 2;
pub static AF_INET6: c_int = 28;
pub static AF_UNIX: c_int = 1;
pub static SOCK_STREAM: c_int = 1;
pub static SOCK_DGRAM: c_int = 2;
pub static SOCK_RAW: c_int = 3;
pub static IPPROTO_TCP: c_int = 6;
pub static IPPROTO_IP: c_int = 0;
pub static IPPROTO_IPV6: c_int = 41;
pub static IP_MULTICAST_TTL: c_int = 10;
pub static IP_MULTICAST_LOOP: c_int = 11;
pub static IP_TTL: c_int = 4;
pub static IP_HDRINCL: c_int = 2;
pub static IP_ADD_MEMBERSHIP: c_int = 12;
pub static IP_DROP_MEMBERSHIP: c_int = 13;
pub static IPV6_ADD_MEMBERSHIP: c_int = 12;
pub static IPV6_DROP_MEMBERSHIP: c_int = 13;
pub const AF_INET: c_int = 2;
pub const AF_INET6: c_int = 28;
pub const AF_UNIX: c_int = 1;
pub const SOCK_STREAM: c_int = 1;
pub const SOCK_DGRAM: c_int = 2;
pub const SOCK_RAW: c_int = 3;
pub const IPPROTO_TCP: c_int = 6;
pub const IPPROTO_IP: c_int = 0;
pub const IPPROTO_IPV6: c_int = 41;
pub const IP_MULTICAST_TTL: c_int = 10;
pub const IP_MULTICAST_LOOP: c_int = 11;
pub const IP_TTL: c_int = 4;
pub const IP_HDRINCL: c_int = 2;
pub const IP_ADD_MEMBERSHIP: c_int = 12;
pub const IP_DROP_MEMBERSHIP: c_int = 13;
pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
pub static TCP_NODELAY: c_int = 1;
pub static TCP_KEEPIDLE: c_int = 256;
pub static SOL_SOCKET: c_int = 0xffff;
pub static SO_KEEPALIVE: c_int = 0x0008;
pub static SO_BROADCAST: c_int = 0x0020;
pub static SO_REUSEADDR: c_int = 0x0004;
pub static SO_ERROR: c_int = 0x1007;
pub const TCP_NODELAY: c_int = 1;
pub const TCP_KEEPIDLE: c_int = 256;
pub const SOL_SOCKET: c_int = 0xffff;
pub const SO_KEEPALIVE: c_int = 0x0008;
pub const SO_BROADCAST: c_int = 0x0020;
pub const SO_REUSEADDR: c_int = 0x0004;
pub const SO_ERROR: c_int = 0x1007;
pub static IFF_LOOPBACK: c_int = 0x8;
pub const IFF_LOOPBACK: c_int = 0x8;
pub static SHUT_RD: c_int = 0;
pub static SHUT_WR: c_int = 1;
pub static SHUT_RDWR: c_int = 2;
pub const SHUT_RD: c_int = 0;
pub const SHUT_WR: c_int = 1;
pub const SHUT_RDWR: c_int = 2;
}
pub mod extra {
use types::os::arch::c95::c_int;
pub static O_SYNC : c_int = 128;
pub static O_NONBLOCK : c_int = 4;
pub static CTL_KERN: c_int = 1;
pub static KERN_PROC: c_int = 14;
pub const O_SYNC : c_int = 128;
pub const O_NONBLOCK : c_int = 4;
pub const CTL_KERN: c_int = 1;
pub const KERN_PROC: c_int = 14;
#[cfg(target_os = "freebsd")]
pub static KERN_PROC_PATHNAME: c_int = 12;
pub const KERN_PROC_PATHNAME: c_int = 12;
#[cfg(target_os = "dragonfly")]
pub static KERN_PROC_PATHNAME: c_int = 9;
pub const KERN_PROC_PATHNAME: c_int = 9;
pub static MAP_COPY : c_int = 0x0002;
pub static MAP_RENAME : c_int = 0x0020;
pub static MAP_NORESERVE : c_int = 0x0040;
pub static MAP_HASSEMAPHORE : c_int = 0x0200;
pub static MAP_STACK : c_int = 0x0400;
pub static MAP_NOSYNC : c_int = 0x0800;
pub static MAP_NOCORE : c_int = 0x020000;
pub const MAP_COPY : c_int = 0x0002;
pub const MAP_RENAME : c_int = 0x0020;
pub const MAP_NORESERVE : c_int = 0x0040;
pub const MAP_HASSEMAPHORE : c_int = 0x0200;
pub const MAP_STACK : c_int = 0x0400;
pub const MAP_NOSYNC : c_int = 0x0800;
pub const MAP_NOCORE : c_int = 0x020000;
pub static IPPROTO_RAW : c_int = 255;
pub const IPPROTO_RAW : c_int = 255;
}
pub mod sysconf {
use types::os::arch::c95::c_int;
pub static _SC_ARG_MAX : c_int = 1;
pub static _SC_CHILD_MAX : c_int = 2;
pub static _SC_CLK_TCK : c_int = 3;
pub static _SC_NGROUPS_MAX : c_int = 4;
pub static _SC_OPEN_MAX : c_int = 5;
pub static _SC_JOB_CONTROL : c_int = 6;
pub static _SC_SAVED_IDS : c_int = 7;
pub static _SC_VERSION : c_int = 8;
pub static _SC_BC_BASE_MAX : c_int = 9;
pub static _SC_BC_DIM_MAX : c_int = 10;
pub static _SC_BC_SCALE_MAX : c_int = 11;
pub static _SC_BC_STRING_MAX : c_int = 12;
pub static _SC_COLL_WEIGHTS_MAX : c_int = 13;
pub static _SC_EXPR_NEST_MAX : c_int = 14;
pub static _SC_LINE_MAX : c_int = 15;
pub static _SC_RE_DUP_MAX : c_int = 16;
pub static _SC_2_VERSION : c_int = 17;
pub static _SC_2_C_BIND : c_int = 18;
pub static _SC_2_C_DEV : c_int = 19;
pub static _SC_2_CHAR_TERM : c_int = 20;
pub static _SC_2_FORT_DEV : c_int = 21;
pub static _SC_2_FORT_RUN : c_int = 22;
pub static _SC_2_LOCALEDEF : c_int = 23;
pub static _SC_2_SW_DEV : c_int = 24;
pub static _SC_2_UPE : c_int = 25;
pub static _SC_STREAM_MAX : c_int = 26;
pub static _SC_TZNAME_MAX : c_int = 27;
pub static _SC_ASYNCHRONOUS_IO : c_int = 28;
pub static _SC_MAPPED_FILES : c_int = 29;
pub static _SC_MEMLOCK : c_int = 30;
pub static _SC_MEMLOCK_RANGE : c_int = 31;
pub static _SC_MEMORY_PROTECTION : c_int = 32;
pub static _SC_MESSAGE_PASSING : c_int = 33;
pub static _SC_PRIORITIZED_IO : c_int = 34;
pub static _SC_PRIORITY_SCHEDULING : c_int = 35;
pub static _SC_REALTIME_SIGNALS : c_int = 36;
pub static _SC_SEMAPHORES : c_int = 37;
pub static _SC_FSYNC : c_int = 38;
pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
pub static _SC_SYNCHRONIZED_IO : c_int = 40;
pub static _SC_TIMERS : c_int = 41;
pub static _SC_AIO_LISTIO_MAX : c_int = 42;
pub static _SC_AIO_MAX : c_int = 43;
pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
pub static _SC_DELAYTIMER_MAX : c_int = 45;
pub static _SC_MQ_OPEN_MAX : c_int = 46;
pub static _SC_PAGESIZE : c_int = 47;
pub static _SC_RTSIG_MAX : c_int = 48;
pub static _SC_SEM_NSEMS_MAX : c_int = 49;
pub static _SC_SEM_VALUE_MAX : c_int = 50;
pub static _SC_SIGQUEUE_MAX : c_int = 51;
pub static _SC_TIMER_MAX : c_int = 52;
pub const _SC_ARG_MAX : c_int = 1;
pub const _SC_CHILD_MAX : c_int = 2;
pub const _SC_CLK_TCK : c_int = 3;
pub const _SC_NGROUPS_MAX : c_int = 4;
pub const _SC_OPEN_MAX : c_int = 5;
pub const _SC_JOB_CONTROL : c_int = 6;
pub const _SC_SAVED_IDS : c_int = 7;
pub const _SC_VERSION : c_int = 8;
pub const _SC_BC_BASE_MAX : c_int = 9;
pub const _SC_BC_DIM_MAX : c_int = 10;
pub const _SC_BC_SCALE_MAX : c_int = 11;
pub const _SC_BC_STRING_MAX : c_int = 12;
pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
pub const _SC_EXPR_NEST_MAX : c_int = 14;
pub const _SC_LINE_MAX : c_int = 15;
pub const _SC_RE_DUP_MAX : c_int = 16;
pub const _SC_2_VERSION : c_int = 17;
pub const _SC_2_C_BIND : c_int = 18;
pub const _SC_2_C_DEV : c_int = 19;
pub const _SC_2_CHAR_TERM : c_int = 20;
pub const _SC_2_FORT_DEV : c_int = 21;
pub const _SC_2_FORT_RUN : c_int = 22;
pub const _SC_2_LOCALEDEF : c_int = 23;
pub const _SC_2_SW_DEV : c_int = 24;
pub const _SC_2_UPE : c_int = 25;
pub const _SC_STREAM_MAX : c_int = 26;
pub const _SC_TZNAME_MAX : c_int = 27;
pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
pub const _SC_MAPPED_FILES : c_int = 29;
pub const _SC_MEMLOCK : c_int = 30;
pub const _SC_MEMLOCK_RANGE : c_int = 31;
pub const _SC_MEMORY_PROTECTION : c_int = 32;
pub const _SC_MESSAGE_PASSING : c_int = 33;
pub const _SC_PRIORITIZED_IO : c_int = 34;
pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
pub const _SC_REALTIME_SIGNALS : c_int = 36;
pub const _SC_SEMAPHORES : c_int = 37;
pub const _SC_FSYNC : c_int = 38;
pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
pub const _SC_SYNCHRONIZED_IO : c_int = 40;
pub const _SC_TIMERS : c_int = 41;
pub const _SC_AIO_LISTIO_MAX : c_int = 42;
pub const _SC_AIO_MAX : c_int = 43;
pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
pub const _SC_DELAYTIMER_MAX : c_int = 45;
pub const _SC_MQ_OPEN_MAX : c_int = 46;
pub const _SC_PAGESIZE : c_int = 47;
pub const _SC_RTSIG_MAX : c_int = 48;
pub const _SC_SEM_NSEMS_MAX : c_int = 49;
pub const _SC_SEM_VALUE_MAX : c_int = 50;
pub const _SC_SIGQUEUE_MAX : c_int = 51;
pub const _SC_TIMER_MAX : c_int = 52;
}
}
@@ -3566,21 +3566,21 @@ pub mod os {
pub mod c95 {
use types::os::arch::c95::{c_int, c_uint};
pub static EXIT_FAILURE : c_int = 1;
pub static EXIT_SUCCESS : c_int = 0;
pub static RAND_MAX : c_int = 2147483647;
pub static EOF : c_int = -1;
pub static SEEK_SET : c_int = 0;
pub static SEEK_CUR : c_int = 1;
pub static SEEK_END : c_int = 2;
pub static _IOFBF : c_int = 0;
pub static _IONBF : c_int = 2;
pub static _IOLBF : c_int = 1;
pub static BUFSIZ : c_uint = 1024_u32;
pub static FOPEN_MAX : c_uint = 20_u32;
pub static FILENAME_MAX : c_uint = 1024_u32;
pub static L_tmpnam : c_uint = 1024_u32;
pub static TMP_MAX : c_uint = 308915776_u32;
pub const EXIT_FAILURE : c_int = 1;
pub const EXIT_SUCCESS : c_int = 0;
pub const RAND_MAX : c_int = 2147483647;
pub const EOF : c_int = -1;
pub const SEEK_SET : c_int = 0;
pub const SEEK_CUR : c_int = 1;
pub const SEEK_END : c_int = 2;
pub const _IOFBF : c_int = 0;
pub const _IONBF : c_int = 2;
pub const _IOLBF : c_int = 1;
pub const BUFSIZ : c_uint = 1024_u32;
pub const FOPEN_MAX : c_uint = 20_u32;
pub const FILENAME_MAX : c_uint = 1024_u32;
pub const L_tmpnam : c_uint = 1024_u32;
pub const TMP_MAX : c_uint = 308915776_u32;
}
pub mod c99 {
}
@@ -3589,378 +3589,378 @@ pub mod posix88 {
use types::os::arch::c95::c_int;
use types::os::arch::posix88::mode_t;
pub static O_RDONLY : c_int = 0;
pub static O_WRONLY : c_int = 1;
pub static O_RDWR : c_int = 2;
pub static O_APPEND : c_int = 8;
pub static O_CREAT : c_int = 512;
pub static O_EXCL : c_int = 2048;
pub static O_TRUNC : c_int = 1024;
pub static S_IFIFO : mode_t = 4096;
pub static S_IFCHR : mode_t = 8192;
pub static S_IFBLK : mode_t = 24576;
pub static S_IFDIR : mode_t = 16384;
pub static S_IFREG : mode_t = 32768;
pub static S_IFLNK : mode_t = 40960;
pub static S_IFMT : mode_t = 61440;
pub static S_IEXEC : mode_t = 64;
pub static S_IWRITE : mode_t = 128;
pub static S_IREAD : mode_t = 256;
pub static S_IRWXU : mode_t = 448;
pub static S_IXUSR : mode_t = 64;
pub static S_IWUSR : mode_t = 128;
pub static S_IRUSR : mode_t = 256;
pub static F_OK : c_int = 0;
pub static R_OK : c_int = 4;
pub static W_OK : c_int = 2;
pub static X_OK : c_int = 1;
pub static STDIN_FILENO : c_int = 0;
pub static STDOUT_FILENO : c_int = 1;
pub static STDERR_FILENO : c_int = 2;
pub static F_LOCK : c_int = 1;
pub static F_TEST : c_int = 3;
pub static F_TLOCK : c_int = 2;
pub static F_ULOCK : c_int = 0;
pub static SIGHUP : c_int = 1;
pub static SIGINT : c_int = 2;
pub static SIGQUIT : c_int = 3;
pub static SIGILL : c_int = 4;
pub static SIGABRT : c_int = 6;
pub static SIGFPE : c_int = 8;
pub static SIGKILL : c_int = 9;
pub static SIGSEGV : c_int = 11;
pub static SIGPIPE : c_int = 13;
pub static SIGALRM : c_int = 14;
pub static SIGTERM : c_int = 15;
pub const O_RDONLY : c_int = 0;
pub const O_WRONLY : c_int = 1;
pub const O_RDWR : c_int = 2;
pub const O_APPEND : c_int = 8;
pub const O_CREAT : c_int = 512;
pub const O_EXCL : c_int = 2048;
pub const O_TRUNC : c_int = 1024;
pub const S_IFIFO : mode_t = 4096;
pub const S_IFCHR : mode_t = 8192;
pub const S_IFBLK : mode_t = 24576;
pub const S_IFDIR : mode_t = 16384;
pub const S_IFREG : mode_t = 32768;
pub const S_IFLNK : mode_t = 40960;
pub const S_IFMT : mode_t = 61440;
pub const S_IEXEC : mode_t = 64;
pub const S_IWRITE : mode_t = 128;
pub const S_IREAD : mode_t = 256;
pub const S_IRWXU : mode_t = 448;
pub const S_IXUSR : mode_t = 64;
pub const S_IWUSR : mode_t = 128;
pub const S_IRUSR : mode_t = 256;
pub const F_OK : c_int = 0;
pub const R_OK : c_int = 4;
pub const W_OK : c_int = 2;
pub const X_OK : c_int = 1;
pub const STDIN_FILENO : c_int = 0;
pub const STDOUT_FILENO : c_int = 1;
pub const STDERR_FILENO : c_int = 2;
pub const F_LOCK : c_int = 1;
pub const F_TEST : c_int = 3;
pub const F_TLOCK : c_int = 2;
pub const F_ULOCK : c_int = 0;
pub const SIGHUP : c_int = 1;
pub const SIGINT : c_int = 2;
pub const SIGQUIT : c_int = 3;
pub const SIGILL : c_int = 4;
pub const SIGABRT : c_int = 6;
pub const SIGFPE : c_int = 8;
pub const SIGKILL : c_int = 9;
pub const SIGSEGV : c_int = 11;
pub const SIGPIPE : c_int = 13;
pub const SIGALRM : c_int = 14;
pub const SIGTERM : c_int = 15;
pub static PROT_NONE : c_int = 0;
pub static PROT_READ : c_int = 1;
pub static PROT_WRITE : c_int = 2;
pub static PROT_EXEC : c_int = 4;
pub const PROT_NONE : c_int = 0;
pub const PROT_READ : c_int = 1;
pub const PROT_WRITE : c_int = 2;
pub const PROT_EXEC : c_int = 4;
pub static MAP_FILE : c_int = 0x0000;
pub static MAP_SHARED : c_int = 0x0001;
pub static MAP_PRIVATE : c_int = 0x0002;
pub static MAP_FIXED : c_int = 0x0010;
pub static MAP_ANON : c_int = 0x1000;
pub const MAP_FILE : c_int = 0x0000;
pub const MAP_SHARED : c_int = 0x0001;
pub const MAP_PRIVATE : c_int = 0x0002;
pub const MAP_FIXED : c_int = 0x0010;
pub const MAP_ANON : c_int = 0x1000;
pub static MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
pub static MCL_CURRENT : c_int = 0x0001;
pub static MCL_FUTURE : c_int = 0x0002;
pub const MCL_CURRENT : c_int = 0x0001;
pub const MCL_FUTURE : c_int = 0x0002;
pub static MS_ASYNC : c_int = 0x0001;
pub static MS_INVALIDATE : c_int = 0x0002;
pub static MS_SYNC : c_int = 0x0010;
pub const MS_ASYNC : c_int = 0x0001;
pub const MS_INVALIDATE : c_int = 0x0002;
pub const MS_SYNC : c_int = 0x0010;
pub static MS_KILLPAGES : c_int = 0x0004;
pub static MS_DEACTIVATE : c_int = 0x0008;
pub const MS_KILLPAGES : c_int = 0x0004;
pub const MS_DEACTIVATE : c_int = 0x0008;
pub static EPERM : c_int = 1;
pub static ENOENT : c_int = 2;
pub static ESRCH : c_int = 3;
pub static EINTR : c_int = 4;
pub static EIO : c_int = 5;
pub static ENXIO : c_int = 6;
pub static E2BIG : c_int = 7;
pub static ENOEXEC : c_int = 8;
pub static EBADF : c_int = 9;
pub static ECHILD : c_int = 10;
pub static EDEADLK : c_int = 11;
pub static ENOMEM : c_int = 12;
pub static EACCES : c_int = 13;
pub static EFAULT : c_int = 14;
pub static ENOTBLK : c_int = 15;
pub static EBUSY : c_int = 16;
pub static EEXIST : c_int = 17;
pub static EXDEV : c_int = 18;
pub static ENODEV : c_int = 19;
pub static ENOTDIR : c_int = 20;
pub static EISDIR : c_int = 21;
pub static EINVAL : c_int = 22;
pub static ENFILE : c_int = 23;
pub static EMFILE : c_int = 24;
pub static ENOTTY : c_int = 25;
pub static ETXTBSY : c_int = 26;
pub static EFBIG : c_int = 27;
pub static ENOSPC : c_int = 28;
pub static ESPIPE : c_int = 29;
pub static EROFS : c_int = 30;
pub static EMLINK : c_int = 31;
pub static EPIPE : c_int = 32;
pub static EDOM : c_int = 33;
pub static ERANGE : c_int = 34;
pub static EAGAIN : c_int = 35;
pub static EWOULDBLOCK : c_int = EAGAIN;
pub static EINPROGRESS : c_int = 36;
pub static EALREADY : c_int = 37;
pub static ENOTSOCK : c_int = 38;
pub static EDESTADDRREQ : c_int = 39;
pub static EMSGSIZE : c_int = 40;
pub static EPROTOTYPE : c_int = 41;
pub static ENOPROTOOPT : c_int = 42;
pub static EPROTONOSUPPORT : c_int = 43;
pub static ESOCKTNOSUPPORT : c_int = 44;
pub static ENOTSUP : c_int = 45;
pub static EPFNOSUPPORT : c_int = 46;
pub static EAFNOSUPPORT : c_int = 47;
pub static EADDRINUSE : c_int = 48;
pub static EADDRNOTAVAIL : c_int = 49;
pub static ENETDOWN : c_int = 50;
pub static ENETUNREACH : c_int = 51;
pub static ENETRESET : c_int = 52;
pub static ECONNABORTED : c_int = 53;
pub static ECONNRESET : c_int = 54;
pub static ENOBUFS : c_int = 55;
pub static EISCONN : c_int = 56;
pub static ENOTCONN : c_int = 57;
pub static ESHUTDOWN : c_int = 58;
pub static ETOOMANYREFS : c_int = 59;
pub static ETIMEDOUT : c_int = 60;
pub static ECONNREFUSED : c_int = 61;
pub static ELOOP : c_int = 62;
pub static ENAMETOOLONG : c_int = 63;
pub static EHOSTDOWN : c_int = 64;
pub static EHOSTUNREACH : c_int = 65;
pub static ENOTEMPTY : c_int = 66;
pub static EPROCLIM : c_int = 67;
pub static EUSERS : c_int = 68;
pub static EDQUOT : c_int = 69;
pub static ESTALE : c_int = 70;
pub static EREMOTE : c_int = 71;
pub static EBADRPC : c_int = 72;
pub static ERPCMISMATCH : c_int = 73;
pub static EPROGUNAVAIL : c_int = 74;
pub static EPROGMISMATCH : c_int = 75;
pub static EPROCUNAVAIL : c_int = 76;
pub static ENOLCK : c_int = 77;
pub static ENOSYS : c_int = 78;
pub static EFTYPE : c_int = 79;
pub static EAUTH : c_int = 80;
pub static ENEEDAUTH : c_int = 81;
pub static EPWROFF : c_int = 82;
pub static EDEVERR : c_int = 83;
pub static EOVERFLOW : c_int = 84;
pub static EBADEXEC : c_int = 85;
pub static EBADARCH : c_int = 86;
pub static ESHLIBVERS : c_int = 87;
pub static EBADMACHO : c_int = 88;
pub static ECANCELED : c_int = 89;
pub static EIDRM : c_int = 90;
pub static ENOMSG : c_int = 91;
pub static EILSEQ : c_int = 92;
pub static ENOATTR : c_int = 93;
pub static EBADMSG : c_int = 94;
pub static EMULTIHOP : c_int = 95;
pub static ENODATA : c_int = 96;
pub static ENOLINK : c_int = 97;
pub static ENOSR : c_int = 98;
pub static ENOSTR : c_int = 99;
pub static EPROTO : c_int = 100;
pub static ETIME : c_int = 101;
pub static EOPNOTSUPP : c_int = 102;
pub static ENOPOLICY : c_int = 103;
pub static ENOTRECOVERABLE : c_int = 104;
pub static EOWNERDEAD : c_int = 105;
pub static EQFULL : c_int = 106;
pub static ELAST : c_int = 106;
pub const EPERM : c_int = 1;
pub const ENOENT : c_int = 2;
pub const ESRCH : c_int = 3;
pub const EINTR : c_int = 4;
pub const EIO : c_int = 5;
pub const ENXIO : c_int = 6;
pub const E2BIG : c_int = 7;
pub const ENOEXEC : c_int = 8;
pub const EBADF : c_int = 9;
pub const ECHILD : c_int = 10;
pub const EDEADLK : c_int = 11;
pub const ENOMEM : c_int = 12;
pub const EACCES : c_int = 13;
pub const EFAULT : c_int = 14;
pub const ENOTBLK : c_int = 15;
pub const EBUSY : c_int = 16;
pub const EEXIST : c_int = 17;
pub const EXDEV : c_int = 18;
pub const ENODEV : c_int = 19;
pub const ENOTDIR : c_int = 20;
pub const EISDIR : c_int = 21;
pub const EINVAL : c_int = 22;
pub const ENFILE : c_int = 23;
pub const EMFILE : c_int = 24;
pub const ENOTTY : c_int = 25;
pub const ETXTBSY : c_int = 26;
pub const EFBIG : c_int = 27;
pub const ENOSPC : c_int = 28;
pub const ESPIPE : c_int = 29;
pub const EROFS : c_int = 30;
pub const EMLINK : c_int = 31;
pub const EPIPE : c_int = 32;
pub const EDOM : c_int = 33;
pub const ERANGE : c_int = 34;
pub const EAGAIN : c_int = 35;
pub const EWOULDBLOCK : c_int = EAGAIN;
pub const EINPROGRESS : c_int = 36;
pub const EALREADY : c_int = 37;
pub const ENOTSOCK : c_int = 38;
pub const EDESTADDRREQ : c_int = 39;
pub const EMSGSIZE : c_int = 40;
pub const EPROTOTYPE : c_int = 41;
pub const ENOPROTOOPT : c_int = 42;
pub const EPROTONOSUPPORT : c_int = 43;
pub const ESOCKTNOSUPPORT : c_int = 44;
pub const ENOTSUP : c_int = 45;
pub const EPFNOSUPPORT : c_int = 46;
pub const EAFNOSUPPORT : c_int = 47;
pub const EADDRINUSE : c_int = 48;
pub const EADDRNOTAVAIL : c_int = 49;
pub const ENETDOWN : c_int = 50;
pub const ENETUNREACH : c_int = 51;
pub const ENETRESET : c_int = 52;
pub const ECONNABORTED : c_int = 53;
pub const ECONNRESET : c_int = 54;
pub const ENOBUFS : c_int = 55;
pub const EISCONN : c_int = 56;
pub const ENOTCONN : c_int = 57;
pub const ESHUTDOWN : c_int = 58;
pub const ETOOMANYREFS : c_int = 59;
pub const ETIMEDOUT : c_int = 60;
pub const ECONNREFUSED : c_int = 61;
pub const ELOOP : c_int = 62;
pub const ENAMETOOLONG : c_int = 63;
pub const EHOSTDOWN : c_int = 64;
pub const EHOSTUNREACH : c_int = 65;
pub const ENOTEMPTY : c_int = 66;
pub const EPROCLIM : c_int = 67;
pub const EUSERS : c_int = 68;
pub const EDQUOT : c_int = 69;
pub const ESTALE : c_int = 70;
pub const EREMOTE : c_int = 71;
pub const EBADRPC : c_int = 72;
pub const ERPCMISMATCH : c_int = 73;
pub const EPROGUNAVAIL : c_int = 74;
pub const EPROGMISMATCH : c_int = 75;
pub const EPROCUNAVAIL : c_int = 76;
pub const ENOLCK : c_int = 77;
pub const ENOSYS : c_int = 78;
pub const EFTYPE : c_int = 79;
pub const EAUTH : c_int = 80;
pub const ENEEDAUTH : c_int = 81;
pub const EPWROFF : c_int = 82;
pub const EDEVERR : c_int = 83;
pub const EOVERFLOW : c_int = 84;
pub const EBADEXEC : c_int = 85;
pub const EBADARCH : c_int = 86;
pub const ESHLIBVERS : c_int = 87;
pub const EBADMACHO : c_int = 88;
pub const ECANCELED : c_int = 89;
pub const EIDRM : c_int = 90;
pub const ENOMSG : c_int = 91;
pub const EILSEQ : c_int = 92;
pub const ENOATTR : c_int = 93;
pub const EBADMSG : c_int = 94;
pub const EMULTIHOP : c_int = 95;
pub const ENODATA : c_int = 96;
pub const ENOLINK : c_int = 97;
pub const ENOSR : c_int = 98;
pub const ENOSTR : c_int = 99;
pub const EPROTO : c_int = 100;
pub const ETIME : c_int = 101;
pub const EOPNOTSUPP : c_int = 102;
pub const ENOPOLICY : c_int = 103;
pub const ENOTRECOVERABLE : c_int = 104;
pub const EOWNERDEAD : c_int = 105;
pub const EQFULL : c_int = 106;
pub const ELAST : c_int = 106;
}
pub mod posix01 {
use types::os::arch::c95::{c_int, size_t};
pub static F_DUPFD : c_int = 0;
pub static F_GETFD : c_int = 1;
pub static F_SETFD : c_int = 2;
pub static F_GETFL : c_int = 3;
pub static F_SETFL : c_int = 4;
pub const F_DUPFD : c_int = 0;
pub const F_GETFD : c_int = 1;
pub const F_SETFD : c_int = 2;
pub const F_GETFL : c_int = 3;
pub const F_SETFL : c_int = 4;
pub static SIGTRAP : c_int = 5;
pub static SIGPIPE: c_int = 13;
pub static SIG_IGN: size_t = 1;
pub const SIGTRAP : c_int = 5;
pub const SIGPIPE: c_int = 13;
pub const SIG_IGN: size_t = 1;
pub static GLOB_APPEND : c_int = 0x0001;
pub static GLOB_DOOFFS : c_int = 0x0002;
pub static GLOB_ERR : c_int = 0x0004;
pub static GLOB_MARK : c_int = 0x0008;
pub static GLOB_NOCHECK : c_int = 0x0010;
pub static GLOB_NOSORT : c_int = 0x0020;
pub static GLOB_NOESCAPE : c_int = 0x2000;
pub const GLOB_APPEND : c_int = 0x0001;
pub const GLOB_DOOFFS : c_int = 0x0002;
pub const GLOB_ERR : c_int = 0x0004;
pub const GLOB_MARK : c_int = 0x0008;
pub const GLOB_NOCHECK : c_int = 0x0010;
pub const GLOB_NOSORT : c_int = 0x0020;
pub const GLOB_NOESCAPE : c_int = 0x2000;
pub static GLOB_NOSPACE : c_int = -1;
pub static GLOB_ABORTED : c_int = -2;
pub static GLOB_NOMATCH : c_int = -3;
pub const GLOB_NOSPACE : c_int = -1;
pub const GLOB_ABORTED : c_int = -2;
pub const GLOB_NOMATCH : c_int = -3;
pub static POSIX_MADV_NORMAL : c_int = 0;
pub static POSIX_MADV_RANDOM : c_int = 1;
pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
pub static POSIX_MADV_WILLNEED : c_int = 3;
pub static POSIX_MADV_DONTNEED : c_int = 4;
pub const POSIX_MADV_NORMAL : c_int = 0;
pub const POSIX_MADV_RANDOM : c_int = 1;
pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
pub const POSIX_MADV_WILLNEED : c_int = 3;
pub const POSIX_MADV_DONTNEED : c_int = 4;
pub static _SC_IOV_MAX : c_int = 56;
pub static _SC_GETGR_R_SIZE_MAX : c_int = 70;
pub static _SC_GETPW_R_SIZE_MAX : c_int = 71;
pub static _SC_LOGIN_NAME_MAX : c_int = 73;
pub static _SC_MQ_PRIO_MAX : c_int = 75;
pub static _SC_THREAD_ATTR_STACKADDR : c_int = 82;
pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
pub static _SC_THREAD_KEYS_MAX : c_int = 86;
pub static _SC_THREAD_PRIO_INHERIT : c_int = 87;
pub static _SC_THREAD_PRIO_PROTECT : c_int = 88;
pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
pub static _SC_THREAD_PROCESS_SHARED : c_int = 90;
pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
pub static _SC_THREAD_STACK_MIN : c_int = 93;
pub static _SC_THREAD_THREADS_MAX : c_int = 94;
pub static _SC_THREADS : c_int = 96;
pub static _SC_TTY_NAME_MAX : c_int = 101;
pub static _SC_ATEXIT_MAX : c_int = 107;
pub static _SC_XOPEN_CRYPT : c_int = 108;
pub static _SC_XOPEN_ENH_I18N : c_int = 109;
pub static _SC_XOPEN_LEGACY : c_int = 110;
pub static _SC_XOPEN_REALTIME : c_int = 111;
pub static _SC_XOPEN_REALTIME_THREADS : c_int = 112;
pub static _SC_XOPEN_SHM : c_int = 113;
pub static _SC_XOPEN_UNIX : c_int = 115;
pub static _SC_XOPEN_VERSION : c_int = 116;
pub static _SC_XOPEN_XCU_VERSION : c_int = 121;
pub const _SC_IOV_MAX : c_int = 56;
pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
pub const _SC_LOGIN_NAME_MAX : c_int = 73;
pub const _SC_MQ_PRIO_MAX : c_int = 75;
pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
pub const _SC_THREAD_KEYS_MAX : c_int = 86;
pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
pub const _SC_THREAD_STACK_MIN : c_int = 93;
pub const _SC_THREAD_THREADS_MAX : c_int = 94;
pub const _SC_THREADS : c_int = 96;
pub const _SC_TTY_NAME_MAX : c_int = 101;
pub const _SC_ATEXIT_MAX : c_int = 107;
pub const _SC_XOPEN_CRYPT : c_int = 108;
pub const _SC_XOPEN_ENH_I18N : c_int = 109;
pub const _SC_XOPEN_LEGACY : c_int = 110;
pub const _SC_XOPEN_REALTIME : c_int = 111;
pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
pub const _SC_XOPEN_SHM : c_int = 113;
pub const _SC_XOPEN_UNIX : c_int = 115;
pub const _SC_XOPEN_VERSION : c_int = 116;
pub const _SC_XOPEN_XCU_VERSION : c_int = 121;
pub static PTHREAD_CREATE_JOINABLE: c_int = 1;
pub static PTHREAD_CREATE_DETACHED: c_int = 2;
pub static PTHREAD_STACK_MIN: size_t = 8192;
pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
pub const PTHREAD_CREATE_DETACHED: c_int = 2;
pub const PTHREAD_STACK_MIN: size_t = 8192;
}
pub mod posix08 {
}
pub mod bsd44 {
use types::os::arch::c95::c_int;
pub static MADV_NORMAL : c_int = 0;
pub static MADV_RANDOM : c_int = 1;
pub static MADV_SEQUENTIAL : c_int = 2;
pub static MADV_WILLNEED : c_int = 3;
pub static MADV_DONTNEED : c_int = 4;
pub static MADV_FREE : c_int = 5;
pub static MADV_ZERO_WIRED_PAGES : c_int = 6;
pub static MADV_FREE_REUSABLE : c_int = 7;
pub static MADV_FREE_REUSE : c_int = 8;
pub static MADV_CAN_REUSE : c_int = 9;
pub const MADV_NORMAL : c_int = 0;
pub const MADV_RANDOM : c_int = 1;
pub const MADV_SEQUENTIAL : c_int = 2;
pub const MADV_WILLNEED : c_int = 3;
pub const MADV_DONTNEED : c_int = 4;
pub const MADV_FREE : c_int = 5;
pub const MADV_ZERO_WIRED_PAGES : c_int = 6;
pub const MADV_FREE_REUSABLE : c_int = 7;
pub const MADV_FREE_REUSE : c_int = 8;
pub const MADV_CAN_REUSE : c_int = 9;
pub static MINCORE_INCORE : c_int = 0x1;
pub static MINCORE_REFERENCED : c_int = 0x2;
pub static MINCORE_MODIFIED : c_int = 0x4;
pub static MINCORE_REFERENCED_OTHER : c_int = 0x8;
pub static MINCORE_MODIFIED_OTHER : c_int = 0x10;
pub const MINCORE_INCORE : c_int = 0x1;
pub const MINCORE_REFERENCED : c_int = 0x2;
pub const MINCORE_MODIFIED : c_int = 0x4;
pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
pub static AF_UNIX: c_int = 1;
pub static AF_INET: c_int = 2;
pub static AF_INET6: c_int = 30;
pub static SOCK_STREAM: c_int = 1;
pub static SOCK_DGRAM: c_int = 2;
pub static SOCK_RAW: c_int = 3;
pub static IPPROTO_TCP: c_int = 6;
pub static IPPROTO_IP: c_int = 0;
pub static IPPROTO_IPV6: c_int = 41;
pub static IP_MULTICAST_TTL: c_int = 10;
pub static IP_MULTICAST_LOOP: c_int = 11;
pub static IP_TTL: c_int = 4;
pub static IP_HDRINCL: c_int = 2;
pub static IP_ADD_MEMBERSHIP: c_int = 12;
pub static IP_DROP_MEMBERSHIP: c_int = 13;
pub static IPV6_ADD_MEMBERSHIP: c_int = 12;
pub static IPV6_DROP_MEMBERSHIP: c_int = 13;
pub const AF_UNIX: c_int = 1;
pub const AF_INET: c_int = 2;
pub const AF_INET6: c_int = 30;
pub const SOCK_STREAM: c_int = 1;
pub const SOCK_DGRAM: c_int = 2;
pub const SOCK_RAW: c_int = 3;
pub const IPPROTO_TCP: c_int = 6;
pub const IPPROTO_IP: c_int = 0;
pub const IPPROTO_IPV6: c_int = 41;
pub const IP_MULTICAST_TTL: c_int = 10;
pub const IP_MULTICAST_LOOP: c_int = 11;
pub const IP_TTL: c_int = 4;
pub const IP_HDRINCL: c_int = 2;
pub const IP_ADD_MEMBERSHIP: c_int = 12;
pub const IP_DROP_MEMBERSHIP: c_int = 13;
pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
pub static TCP_NODELAY: c_int = 0x01;
pub static TCP_KEEPALIVE: c_int = 0x10;
pub static SOL_SOCKET: c_int = 0xffff;
pub static SO_KEEPALIVE: c_int = 0x0008;
pub static SO_BROADCAST: c_int = 0x0020;
pub static SO_REUSEADDR: c_int = 0x0004;
pub static SO_ERROR: c_int = 0x1007;
pub const TCP_NODELAY: c_int = 0x01;
pub const TCP_KEEPALIVE: c_int = 0x10;
pub const SOL_SOCKET: c_int = 0xffff;
pub const SO_KEEPALIVE: c_int = 0x0008;
pub const SO_BROADCAST: c_int = 0x0020;
pub const SO_REUSEADDR: c_int = 0x0004;
pub const SO_ERROR: c_int = 0x1007;
pub static IFF_LOOPBACK: c_int = 0x8;
pub const IFF_LOOPBACK: c_int = 0x8;
pub static SHUT_RD: c_int = 0;
pub static SHUT_WR: c_int = 1;
pub static SHUT_RDWR: c_int = 2;
pub const SHUT_RD: c_int = 0;
pub const SHUT_WR: c_int = 1;
pub const SHUT_RDWR: c_int = 2;
}
pub mod extra {
use types::os::arch::c95::c_int;
pub static O_DSYNC : c_int = 4194304;
pub static O_SYNC : c_int = 128;
pub static O_NONBLOCK : c_int = 4;
pub static F_FULLFSYNC : c_int = 51;
pub const O_DSYNC : c_int = 4194304;
pub const O_SYNC : c_int = 128;
pub const O_NONBLOCK : c_int = 4;
pub const F_FULLFSYNC : c_int = 51;
pub static MAP_COPY : c_int = 0x0002;
pub static MAP_RENAME : c_int = 0x0020;
pub static MAP_NORESERVE : c_int = 0x0040;
pub static MAP_NOEXTEND : c_int = 0x0100;
pub static MAP_HASSEMAPHORE : c_int = 0x0200;
pub static MAP_NOCACHE : c_int = 0x0400;
pub static MAP_JIT : c_int = 0x0800;
pub static MAP_STACK : c_int = 0;
pub const MAP_COPY : c_int = 0x0002;
pub const MAP_RENAME : c_int = 0x0020;
pub const MAP_NORESERVE : c_int = 0x0040;
pub const MAP_NOEXTEND : c_int = 0x0100;
pub const MAP_HASSEMAPHORE : c_int = 0x0200;
pub const MAP_NOCACHE : c_int = 0x0400;
pub const MAP_JIT : c_int = 0x0800;
pub const MAP_STACK : c_int = 0;
pub static IPPROTO_RAW : c_int = 255;
pub const IPPROTO_RAW : c_int = 255;
}
pub mod sysconf {
use types::os::arch::c95::c_int;
pub static _SC_ARG_MAX : c_int = 1;
pub static _SC_CHILD_MAX : c_int = 2;
pub static _SC_CLK_TCK : c_int = 3;
pub static _SC_NGROUPS_MAX : c_int = 4;
pub static _SC_OPEN_MAX : c_int = 5;
pub static _SC_JOB_CONTROL : c_int = 6;
pub static _SC_SAVED_IDS : c_int = 7;
pub static _SC_VERSION : c_int = 8;
pub static _SC_BC_BASE_MAX : c_int = 9;
pub static _SC_BC_DIM_MAX : c_int = 10;
pub static _SC_BC_SCALE_MAX : c_int = 11;
pub static _SC_BC_STRING_MAX : c_int = 12;
pub static _SC_COLL_WEIGHTS_MAX : c_int = 13;
pub static _SC_EXPR_NEST_MAX : c_int = 14;
pub static _SC_LINE_MAX : c_int = 15;
pub static _SC_RE_DUP_MAX : c_int = 16;
pub static _SC_2_VERSION : c_int = 17;
pub static _SC_2_C_BIND : c_int = 18;
pub static _SC_2_C_DEV : c_int = 19;
pub static _SC_2_CHAR_TERM : c_int = 20;
pub static _SC_2_FORT_DEV : c_int = 21;
pub static _SC_2_FORT_RUN : c_int = 22;
pub static _SC_2_LOCALEDEF : c_int = 23;
pub static _SC_2_SW_DEV : c_int = 24;
pub static _SC_2_UPE : c_int = 25;
pub static _SC_STREAM_MAX : c_int = 26;
pub static _SC_TZNAME_MAX : c_int = 27;
pub static _SC_ASYNCHRONOUS_IO : c_int = 28;
pub static _SC_PAGESIZE : c_int = 29;
pub static _SC_MEMLOCK : c_int = 30;
pub static _SC_MEMLOCK_RANGE : c_int = 31;
pub static _SC_MEMORY_PROTECTION : c_int = 32;
pub static _SC_MESSAGE_PASSING : c_int = 33;
pub static _SC_PRIORITIZED_IO : c_int = 34;
pub static _SC_PRIORITY_SCHEDULING : c_int = 35;
pub static _SC_REALTIME_SIGNALS : c_int = 36;
pub static _SC_SEMAPHORES : c_int = 37;
pub static _SC_FSYNC : c_int = 38;
pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
pub static _SC_SYNCHRONIZED_IO : c_int = 40;
pub static _SC_TIMERS : c_int = 41;
pub static _SC_AIO_LISTIO_MAX : c_int = 42;
pub static _SC_AIO_MAX : c_int = 43;
pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
pub static _SC_DELAYTIMER_MAX : c_int = 45;
pub static _SC_MQ_OPEN_MAX : c_int = 46;
pub static _SC_MAPPED_FILES : c_int = 47;
pub static _SC_RTSIG_MAX : c_int = 48;
pub static _SC_SEM_NSEMS_MAX : c_int = 49;
pub static _SC_SEM_VALUE_MAX : c_int = 50;
pub static _SC_SIGQUEUE_MAX : c_int = 51;
pub static _SC_TIMER_MAX : c_int = 52;
pub static _SC_XBS5_ILP32_OFF32 : c_int = 122;
pub static _SC_XBS5_ILP32_OFFBIG : c_int = 123;
pub static _SC_XBS5_LP64_OFF64 : c_int = 124;
pub static _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
pub const _SC_ARG_MAX : c_int = 1;
pub const _SC_CHILD_MAX : c_int = 2;
pub const _SC_CLK_TCK : c_int = 3;
pub const _SC_NGROUPS_MAX : c_int = 4;
pub const _SC_OPEN_MAX : c_int = 5;
pub const _SC_JOB_CONTROL : c_int = 6;
pub const _SC_SAVED_IDS : c_int = 7;
pub const _SC_VERSION : c_int = 8;
pub const _SC_BC_BASE_MAX : c_int = 9;
pub const _SC_BC_DIM_MAX : c_int = 10;
pub const _SC_BC_SCALE_MAX : c_int = 11;
pub const _SC_BC_STRING_MAX : c_int = 12;
pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
pub const _SC_EXPR_NEST_MAX : c_int = 14;
pub const _SC_LINE_MAX : c_int = 15;
pub const _SC_RE_DUP_MAX : c_int = 16;
pub const _SC_2_VERSION : c_int = 17;
pub const _SC_2_C_BIND : c_int = 18;
pub const _SC_2_C_DEV : c_int = 19;
pub const _SC_2_CHAR_TERM : c_int = 20;
pub const _SC_2_FORT_DEV : c_int = 21;
pub const _SC_2_FORT_RUN : c_int = 22;
pub const _SC_2_LOCALEDEF : c_int = 23;
pub const _SC_2_SW_DEV : c_int = 24;
pub const _SC_2_UPE : c_int = 25;
pub const _SC_STREAM_MAX : c_int = 26;
pub const _SC_TZNAME_MAX : c_int = 27;
pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
pub const _SC_PAGESIZE : c_int = 29;
pub const _SC_MEMLOCK : c_int = 30;
pub const _SC_MEMLOCK_RANGE : c_int = 31;
pub const _SC_MEMORY_PROTECTION : c_int = 32;
pub const _SC_MESSAGE_PASSING : c_int = 33;
pub const _SC_PRIORITIZED_IO : c_int = 34;
pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
pub const _SC_REALTIME_SIGNALS : c_int = 36;
pub const _SC_SEMAPHORES : c_int = 37;
pub const _SC_FSYNC : c_int = 38;
pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
pub const _SC_SYNCHRONIZED_IO : c_int = 40;
pub const _SC_TIMERS : c_int = 41;
pub const _SC_AIO_LISTIO_MAX : c_int = 42;
pub const _SC_AIO_MAX : c_int = 43;
pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
pub const _SC_DELAYTIMER_MAX : c_int = 45;
pub const _SC_MQ_OPEN_MAX : c_int = 46;
pub const _SC_MAPPED_FILES : c_int = 47;
pub const _SC_RTSIG_MAX : c_int = 48;
pub const _SC_SEM_NSEMS_MAX : c_int = 49;
pub const _SC_SEM_VALUE_MAX : c_int = 50;
pub const _SC_SIGQUEUE_MAX : c_int = 51;
pub const _SC_TIMER_MAX : c_int = 52;
pub const _SC_XBS5_ILP32_OFF32 : c_int = 122;
pub const _SC_XBS5_ILP32_OFFBIG : c_int = 123;
pub const _SC_XBS5_LP64_OFF64 : c_int = 124;
pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
}
}
}
@@ -4356,7 +4356,7 @@ pub mod unistd {
use types::os::arch::posix88::{gid_t, off_t, pid_t};
use types::os::arch::posix88::{ssize_t, uid_t};
pub static _PC_NAME_MAX: c_int = 4;
pub const _PC_NAME_MAX: c_int = 4;
extern {
pub fn access(path: *const c_char, amode: c_int) -> c_int;
+6 -6
View File
@@ -188,10 +188,10 @@
/// Maximum logging level of a module that can be specified. Common logging
/// levels are found in the DEBUG/INFO/WARN/ERROR constants.
pub static MAX_LOG_LEVEL: u32 = 255;
pub const MAX_LOG_LEVEL: u32 = 255;
/// The default logging level of a crate if no other is specified.
static DEFAULT_LOG_LEVEL: u32 = 1;
const DEFAULT_LOG_LEVEL: u32 = 1;
/// An unsafe constant that is the maximum logging level of any module
/// specified. This is the first line of defense to determining whether a
@@ -205,13 +205,13 @@
static mut FILTER: *const Regex = 0 as *const _;
/// Debug log level
pub static DEBUG: u32 = 4;
pub const DEBUG: u32 = 4;
/// Info log level
pub static INFO: u32 = 3;
pub const INFO: u32 = 3;
/// Warn log level
pub static WARN: u32 = 2;
pub const WARN: u32 = 2;
/// Error log level
pub static ERROR: u32 = 1;
pub const ERROR: u32 = 1;
local_data_key!(local_logger: Box<Logger + Send>)
+35 -35
View File
@@ -23,41 +23,41 @@
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly"))]
pub static FIONBIO: libc::c_ulong = 0x8004667e;
pub const FIONBIO: libc::c_ulong = 0x8004667e;
#[cfg(any(all(target_os = "linux",
any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "arm")),
target_os = "android"))]
pub static FIONBIO: libc::c_ulong = 0x5421;
pub const FIONBIO: libc::c_ulong = 0x5421;
#[cfg(all(target_os = "linux",
any(target_arch = "mips", target_arch = "mipsel")))]
pub static FIONBIO: libc::c_ulong = 0x667e;
pub const FIONBIO: libc::c_ulong = 0x667e;
#[cfg(any(target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly"))]
pub static FIOCLEX: libc::c_ulong = 0x20006601;
pub const FIOCLEX: libc::c_ulong = 0x20006601;
#[cfg(any(all(target_os = "linux",
any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "arm")),
target_os = "android"))]
pub static FIOCLEX: libc::c_ulong = 0x5451;
pub const FIOCLEX: libc::c_ulong = 0x5451;
#[cfg(all(target_os = "linux",
any(target_arch = "mips", target_arch = "mipsel")))]
pub static FIOCLEX: libc::c_ulong = 0x6601;
pub const FIOCLEX: libc::c_ulong = 0x6601;
#[cfg(any(target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly"))]
pub static MSG_DONTWAIT: libc::c_int = 0x80;
pub const MSG_DONTWAIT: libc::c_int = 0x80;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub static MSG_DONTWAIT: libc::c_int = 0x40;
pub const MSG_DONTWAIT: libc::c_int = 0x40;
pub static WNOHANG: libc::c_int = 1;
pub const WNOHANG: libc::c_int = 1;
extern {
pub fn gettimeofday(timeval: *mut libc::timeval,
@@ -89,7 +89,7 @@ pub fn sigaction(signum: libc::c_int,
#[cfg(any(target_os = "macos", target_os = "ios"))]
mod select {
pub static FD_SETSIZE: uint = 1024;
pub const FD_SETSIZE: uint = 1024;
#[repr(C)]
pub struct fd_set {
@@ -109,7 +109,7 @@ mod select {
use std::uint;
use libc;
pub static FD_SETSIZE: uint = 1024;
pub const FD_SETSIZE: uint = 1024;
#[repr(C)]
pub struct fd_set {
@@ -131,14 +131,14 @@ pub fn fd_set(set: &mut fd_set, fd: i32) {
mod signal {
use libc;
pub static SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub static SA_NOCLDWAIT: libc::c_ulong = 0x00000002;
pub static SA_NODEFER: libc::c_ulong = 0x40000000;
pub static SA_ONSTACK: libc::c_ulong = 0x08000000;
pub static SA_RESETHAND: libc::c_ulong = 0x80000000;
pub static SA_RESTART: libc::c_ulong = 0x10000000;
pub static SA_SIGINFO: libc::c_ulong = 0x00000004;
pub static SIGCHLD: libc::c_int = 17;
pub const SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub const SA_NOCLDWAIT: libc::c_ulong = 0x00000002;
pub const SA_NODEFER: libc::c_ulong = 0x40000000;
pub const SA_ONSTACK: libc::c_ulong = 0x08000000;
pub const SA_RESETHAND: libc::c_ulong = 0x80000000;
pub const SA_RESTART: libc::c_ulong = 0x10000000;
pub const SA_SIGINFO: libc::c_ulong = 0x00000004;
pub const SIGCHLD: libc::c_int = 17;
// This definition is not as accurate as it could be, {pid, uid, status} is
// actually a giant union. Currently we're only interested in these fields,
@@ -179,14 +179,14 @@ pub struct sigset_t {
mod signal {
use libc;
pub static SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub static SA_NOCLDWAIT: libc::c_ulong = 0x00010000;
pub static SA_NODEFER: libc::c_ulong = 0x40000000;
pub static SA_ONSTACK: libc::c_ulong = 0x08000000;
pub static SA_RESETHAND: libc::c_ulong = 0x80000000;
pub static SA_RESTART: libc::c_ulong = 0x10000000;
pub static SA_SIGINFO: libc::c_ulong = 0x00000008;
pub static SIGCHLD: libc::c_int = 18;
pub const SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub const SA_NOCLDWAIT: libc::c_ulong = 0x00010000;
pub const SA_NODEFER: libc::c_ulong = 0x40000000;
pub const SA_ONSTACK: libc::c_ulong = 0x08000000;
pub const SA_RESETHAND: libc::c_ulong = 0x80000000;
pub const SA_RESTART: libc::c_ulong = 0x10000000;
pub const SA_SIGINFO: libc::c_ulong = 0x00000008;
pub const SIGCHLD: libc::c_int = 18;
// This definition is not as accurate as it could be, {pid, uid, status} is
// actually a giant union. Currently we're only interested in these fields,
@@ -223,14 +223,14 @@ pub struct sigset_t {
mod signal {
use libc;
pub static SA_ONSTACK: libc::c_int = 0x0001;
pub static SA_RESTART: libc::c_int = 0x0002;
pub static SA_RESETHAND: libc::c_int = 0x0004;
pub static SA_NOCLDSTOP: libc::c_int = 0x0008;
pub static SA_NODEFER: libc::c_int = 0x0010;
pub static SA_NOCLDWAIT: libc::c_int = 0x0020;
pub static SA_SIGINFO: libc::c_int = 0x0040;
pub static SIGCHLD: libc::c_int = 20;
pub const SA_ONSTACK: libc::c_int = 0x0001;
pub const SA_RESTART: libc::c_int = 0x0002;
pub const SA_RESETHAND: libc::c_int = 0x0004;
pub const SA_NOCLDSTOP: libc::c_int = 0x0008;
pub const SA_NODEFER: libc::c_int = 0x0010;
pub const SA_NOCLDWAIT: libc::c_int = 0x0020;
pub const SA_SIGINFO: libc::c_int = 0x0040;
pub const SIGCHLD: libc::c_int = 20;
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub type sigset_t = u32;
+19 -19
View File
@@ -14,26 +14,26 @@
use libc;
pub static WSADESCRIPTION_LEN: uint = 256;
pub static WSASYS_STATUS_LEN: uint = 128;
pub static FIONBIO: libc::c_long = 0x8004667e;
static FD_SETSIZE: uint = 64;
pub static MSG_DONTWAIT: libc::c_int = 0;
pub static ERROR_ILLEGAL_CHARACTER: libc::c_int = 582;
pub static ENABLE_ECHO_INPUT: libc::DWORD = 0x4;
pub static ENABLE_EXTENDED_FLAGS: libc::DWORD = 0x80;
pub static ENABLE_INSERT_MODE: libc::DWORD = 0x20;
pub static ENABLE_LINE_INPUT: libc::DWORD = 0x2;
pub static ENABLE_PROCESSED_INPUT: libc::DWORD = 0x1;
pub static ENABLE_QUICK_EDIT_MODE: libc::DWORD = 0x40;
pub static WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT;
pub const WSADESCRIPTION_LEN: uint = 256;
pub const WSASYS_STATUS_LEN: uint = 128;
pub const FIONBIO: libc::c_long = 0x8004667e;
pub const FD_SETSIZE: uint = 64;
pub const MSG_DONTWAIT: libc::c_int = 0;
pub const ERROR_ILLEGAL_CHARACTER: libc::c_int = 582;
pub const ENABLE_ECHO_INPUT: libc::DWORD = 0x4;
pub const ENABLE_EXTENDED_FLAGS: libc::DWORD = 0x80;
pub const ENABLE_INSERT_MODE: libc::DWORD = 0x20;
pub const ENABLE_LINE_INPUT: libc::DWORD = 0x2;
pub const ENABLE_PROCESSED_INPUT: libc::DWORD = 0x1;
pub const ENABLE_QUICK_EDIT_MODE: libc::DWORD = 0x40;
pub const WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT;
pub static FD_ACCEPT: libc::c_long = 0x08;
pub static FD_MAX_EVENTS: uint = 10;
pub static WSA_INFINITE: libc::DWORD = libc::INFINITE;
pub static WSA_WAIT_TIMEOUT: libc::DWORD = libc::consts::os::extra::WAIT_TIMEOUT;
pub static WSA_WAIT_EVENT_0: libc::DWORD = libc::consts::os::extra::WAIT_OBJECT_0;
pub static WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED;
pub const FD_ACCEPT: libc::c_long = 0x08;
pub const FD_MAX_EVENTS: uint = 10;
pub const WSA_INFINITE: libc::DWORD = libc::INFINITE;
pub const WSA_WAIT_TIMEOUT: libc::DWORD = libc::consts::os::extra::WAIT_TIMEOUT;
pub const WSA_WAIT_EVENT_0: libc::DWORD = libc::consts::os::extra::WAIT_OBJECT_0;
pub const WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED;
#[repr(C)]
#[cfg(target_arch = "x86")]
+3 -3
View File
@@ -77,7 +77,7 @@
/// size is the double of the size of `BigDigit`.
pub type DoubleBigDigit = u64;
pub static ZERO_BIG_DIGIT: BigDigit = 0;
pub const ZERO_BIG_DIGIT: BigDigit = 0;
static ZERO_VEC: [BigDigit, ..1] = [ZERO_BIG_DIGIT];
#[allow(non_snake_case)]
@@ -87,10 +87,10 @@ pub mod BigDigit {
// `DoubleBigDigit` size dependent
#[allow(non_uppercase_statics)]
pub static bits: uint = 32;
pub const bits: uint = 32;
#[allow(non_uppercase_statics)]
pub static base: DoubleBigDigit = 1 << bits;
pub const base: DoubleBigDigit = 1 << bits;
#[allow(non_uppercase_statics)]
static lo_mask: DoubleBigDigit = (-1 as DoubleBigDigit) >> bits;
+7 -7
View File
@@ -194,13 +194,13 @@ mod test {
use std::num::{Zero, One, Float};
use std::hash::hash;
pub static _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 };
pub static _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 };
pub static _1_1i : Complex64 = Complex { re: 1.0, im: 1.0 };
pub static _0_1i : Complex64 = Complex { re: 0.0, im: 1.0 };
pub static _neg1_1i : Complex64 = Complex { re: -1.0, im: 1.0 };
pub static _05_05i : Complex64 = Complex { re: 0.5, im: 0.5 };
pub static all_consts : [Complex64, .. 5] = [_0_0i, _1_0i, _1_1i, _neg1_1i, _05_05i];
pub const _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 };
pub const _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 };
pub const _1_1i : Complex64 = Complex { re: 1.0, im: 1.0 };
pub const _0_1i : Complex64 = Complex { re: 0.0, im: 1.0 };
pub const _neg1_1i : Complex64 = Complex { re: -1.0, im: 1.0 };
pub const _05_05i : Complex64 = Complex { re: 0.5, im: 0.5 };
pub const all_consts : [Complex64, .. 5] = [_0_0i, _1_0i, _1_1i, _neg1_1i, _05_05i];
#[test]
fn test_consts() {
+3 -3
View File
@@ -14,9 +14,9 @@
use {Rng, SeedableRng, Rand};
static KEY_WORDS : uint = 8; // 8 words for the 256-bit key
static STATE_WORDS : uint = 16;
static CHACHA_ROUNDS: uint = 20; // Cryptographically secure from 8 upwards as of this writing
const KEY_WORDS : uint = 8; // 8 words for the 256-bit key
const STATE_WORDS : uint = 16;
const CHACHA_ROUNDS: uint = 20; // Cryptographically secure from 8 upwards as of this writing
/// A random number generator that uses the ChaCha20 algorithm [1].
///
+7 -7
View File
@@ -16,9 +16,9 @@
use {Rng, SeedableRng, Rand};
static RAND_SIZE_LEN: u32 = 8;
static RAND_SIZE: u32 = 1 << (RAND_SIZE_LEN as uint);
static RAND_SIZE_UINT: uint = 1 << (RAND_SIZE_LEN as uint);
const RAND_SIZE_LEN: u32 = 8;
const RAND_SIZE: u32 = 1 << (RAND_SIZE_LEN as uint);
const RAND_SIZE_UINT: uint = 1 << (RAND_SIZE_LEN as uint);
/// A random number generator that uses the ISAAC algorithm[1].
///
@@ -251,8 +251,8 @@ fn rand<R: Rng>(other: &mut R) -> IsaacRng {
}
}
static RAND_SIZE_64_LEN: uint = 8;
static RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN;
const RAND_SIZE_64_LEN: uint = 8;
const RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN;
/// A random number generator that uses ISAAC-64[1], the 64-bit
/// variant of the ISAAC algorithm.
@@ -356,8 +356,8 @@ fn isaac64(&mut self) {
// abbreviations
let mut a = self.a;
let mut b = self.b + self.c;
static MIDPOINT: uint = RAND_SIZE_64 / 2;
static MP_VEC: [(uint, uint), .. 2] = [(0,MIDPOINT), (MIDPOINT, 0)];
const MIDPOINT: uint = RAND_SIZE_64 / 2;
const MP_VEC: [(uint, uint), .. 2] = [(0,MIDPOINT), (MIDPOINT, 0)];
macro_rules! ind (
($x:expr) => {
*self.mem.unsafe_get(($x as uint >> 3) & (RAND_SIZE_64 - 1))
+37 -22
View File
@@ -162,12 +162,12 @@ fn unwrap(self) -> Result<Ast, Error> {
/// expression.
pub type Flags = u8;
pub static FLAG_EMPTY: u8 = 0;
pub static FLAG_NOCASE: u8 = 1 << 0; // i
pub static FLAG_MULTI: u8 = 1 << 1; // m
pub static FLAG_DOTNL: u8 = 1 << 2; // s
pub static FLAG_SWAP_GREED: u8 = 1 << 3; // U
pub static FLAG_NEGATED: u8 = 1 << 4; // char class or not word boundary
pub const FLAG_EMPTY: u8 = 0;
pub const FLAG_NOCASE: u8 = 1 << 0; // i
pub const FLAG_MULTI: u8 = 1 << 1; // m
pub const FLAG_DOTNL: u8 = 1 << 2; // s
pub const FLAG_SWAP_GREED: u8 = 1 << 3; // U
pub const FLAG_NEGATED: u8 = 1 << 4; // char class or not word boundary
struct Parser<'a> {
// The input, parsed only as a sequence of UTF8 code points.
@@ -1025,7 +1025,7 @@ fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> {
}
type Class = &'static [(char, char)];
type NamedClasses = &'static [(&'static str, Class)];
type NamedClasses = &'static [(&'static str, &'static Class)];
static ASCII_CLASSES: NamedClasses = &[
// Classes must be in alphabetical order so that bsearch works.
@@ -1044,19 +1044,34 @@ fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> {
// [:word:] word characters (== [0-9A-Za-z_])
// [:xdigit:] hex digit (== [0-9A-Fa-f])
// Taken from: http://golang.org/pkg/regex/syntax/
("alnum", &[('0', '9'), ('A', 'Z'), ('a', 'z')]),
("alpha", &[('A', 'Z'), ('a', 'z')]),
("ascii", &[('\x00', '\x7F')]),
("blank", &[(' ', ' '), ('\t', '\t')]),
("cntrl", &[('\x00', '\x1F'), ('\x7F', '\x7F')]),
("digit", &[('0', '9')]),
("graph", &[('!', '~')]),
("lower", &[('a', 'z')]),
("print", &[(' ', '~')]),
("punct", &[('!', '/'), (':', '@'), ('[', '`'), ('{', '~')]),
("space", &[('\t', '\t'), ('\n', '\n'), ('\x0B', '\x0B'), ('\x0C', '\x0C'),
('\r', '\r'), (' ', ' ')]),
("upper", &[('A', 'Z')]),
("word", &[('0', '9'), ('A', 'Z'), ('a', 'z'), ('_', '_')]),
("xdigit", &[('0', '9'), ('A', 'F'), ('a', 'f')]),
("alnum", &ALNUM),
("alpha", &ALPHA),
("ascii", &ASCII),
("blank", &BLANK),
("cntrl", &CNTRL),
("digit", &DIGIT),
("graph", &GRAPH),
("lower", &LOWER),
("print", &PRINT),
("punct", &PUNCT),
("space", &SPACE),
("upper", &UPPER),
("word", &WORD),
("xdigit", &XDIGIT),
];
static ALNUM: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z')];
static ALPHA: Class = &[('A', 'Z'), ('a', 'z')];
static ASCII: Class = &[('\x00', '\x7F')];
static BLANK: Class = &[(' ', ' '), ('\t', '\t')];
static CNTRL: Class = &[('\x00', '\x1F'), ('\x7F', '\x7F')];
static DIGIT: Class = &[('0', '9')];
static GRAPH: Class = &[('!', '~')];
static LOWER: Class = &[('a', 'z')];
static PRINT: Class = &[(' ', '~')];
static PUNCT: Class = &[('!', '/'), (':', '@'), ('[', '`'), ('{', '~')];
static SPACE: Class = &[('\t', '\t'), ('\n', '\n'), ('\x0B', '\x0B'),
('\x0C', '\x0C'), ('\r', '\r'), (' ', ' ')];
static UPPER: Class = &[('A', 'Z')];
static WORD: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z'), ('_', '_')];
static XDIGIT: Class = &[('0', '9'), ('A', 'F'), ('a', 'f')];
+1 -1
View File
@@ -128,7 +128,7 @@ pub struct ExNative {
#[doc(hidden)]
pub original: &'static str,
#[doc(hidden)]
pub names: &'static [Option<&'static str>],
pub names: &'static &'static [Option<&'static str>],
#[doc(hidden)]
pub prog: fn(MatchKind, &str, uint, uint) -> Vec<Option<uint>>
}
+1 -1
View File
@@ -324,7 +324,7 @@ fn groups<'r>(&'r mut self, i: uint) -> &'r mut Captures {
::regex::native::Native(::regex::native::ExNative {
original: $regex,
names: CAP_NAMES,
names: &CAP_NAMES,
prog: exec,
})
})
+5 -5
View File
@@ -55,22 +55,22 @@
// This is the "magic number" expected at the beginning of a LLVM bytecode
// object in an rlib.
pub static RLIB_BYTECODE_OBJECT_MAGIC: &'static [u8] = b"RUST_OBJECT";
pub const RLIB_BYTECODE_OBJECT_MAGIC: &'static [u8] = b"RUST_OBJECT";
// The version number this compiler will write to bytecode objects in rlibs
pub static RLIB_BYTECODE_OBJECT_VERSION: u32 = 1;
pub const RLIB_BYTECODE_OBJECT_VERSION: u32 = 1;
// The offset in bytes the bytecode object format version number can be found at
pub static RLIB_BYTECODE_OBJECT_VERSION_OFFSET: uint = 11;
pub const RLIB_BYTECODE_OBJECT_VERSION_OFFSET: uint = 11;
// The offset in bytes the size of the compressed bytecode can be found at in
// format version 1
pub static RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: uint =
pub const RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: uint =
RLIB_BYTECODE_OBJECT_VERSION_OFFSET + 4;
// The offset in bytes the compressed LLVM bytecode can be found at in format
// version 1
pub static RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET + 8;
+3 -3
View File
@@ -154,10 +154,10 @@ pub enum CrateType {
macro_rules! debugging_opts(
([ $opt:ident ] $cnt:expr ) => (
pub static $opt: u64 = 1 << $cnt;
pub const $opt: u64 = 1 << $cnt;
);
([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => (
pub static $opt: u64 = 1 << $cnt;
pub const $opt: u64 = 1 << $cnt;
debugging_opts!([ $($rest),* ] $cnt + 1)
)
)
@@ -268,7 +268,7 @@ pub fn basic_codegen_options() -> CodegenOptions {
}
pub type CodegenSetter = fn(&mut CodegenOptions, v: Option<&str>) -> bool;
pub static CG_OPTIONS: &'static [(&'static str, CodegenSetter,
pub const CG_OPTIONS: &'static [(&'static str, CodegenSetter,
&'static str)] =
&[ $( (stringify!($opt), cgsetters::$opt, $desc) ),* ];
+3 -2
View File
@@ -978,7 +978,8 @@ fn get_lints(&self) -> LintArray {
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
match it.node {
// only check static constants
ast::ItemStatic(_, ast::MutImmutable, _) => {
ast::ItemStatic(_, ast::MutImmutable, _) |
ast::ItemConst(..) => {
let s = token::get_ident(it.ident);
// check for lowercase letters rather than non-uppercase
// ones (some scripts don't have a concept of
@@ -998,7 +999,7 @@ fn check_item(&mut self, cx: &Context, it: &ast::Item) {
fn check_pat(&mut self, cx: &Context, p: &ast::Pat) {
// Lint for constants that look like binding identifiers (#7526)
match (&p.node, cx.tcx.def_map.borrow().find(&p.id)) {
(&ast::PatIdent(_, ref path1, _), Some(&def::DefStatic(_, false))) => {
(&ast::PatIdent(_, ref path1, _), Some(&def::DefConst(..))) => {
let s = token::get_ident(path1.node);
if s.get().chars().any(|c| c.is_lowercase()) {
cx.span_lint(NON_UPPERCASE_STATICS, path1.span,
+2 -2
View File
@@ -112,9 +112,9 @@ pub fn get_lint_groups<'t>(&'t self) -> Vec<(&'static str, Vec<LintId>, bool)> {
pub fn register_pass(&mut self, sess: Option<&Session>,
from_plugin: bool, pass: LintPassObject) {
for &lint in pass.get_lints().iter() {
self.lints.push((lint, from_plugin));
self.lints.push((*lint, from_plugin));
let id = LintId::of(lint);
let id = LintId::of(*lint);
if !self.by_name.insert(lint.name_lower(), id) {
let msg = format!("duplicate specification of lint {}", lint.name_lower());
match (sess, from_plugin) {
+2 -2
View File
@@ -99,12 +99,12 @@ macro_rules! declare_lint (
macro_rules! lint_array ( ($( $lint:expr ),*) => (
{
#[allow(non_uppercase_statics)]
static array: LintArray = &[ $( $lint ),* ];
static array: LintArray = &[ $( &$lint ),* ];
array
}
))
pub type LintArray = &'static [&'static Lint];
pub type LintArray = &'static [&'static &'static Lint];
/// Trait for types providing lint checks.
///
+100 -100
View File
@@ -15,83 +15,83 @@
// EBML enum definitions and utils shared by the encoder and decoder
pub static tag_items: uint = 0x00;
pub const tag_items: uint = 0x00;
pub static tag_paths_data_name: uint = 0x01;
pub const tag_paths_data_name: uint = 0x01;
pub static tag_def_id: uint = 0x02;
pub const tag_def_id: uint = 0x02;
pub static tag_items_data: uint = 0x03;
pub const tag_items_data: uint = 0x03;
pub static tag_items_data_item: uint = 0x04;
pub const tag_items_data_item: uint = 0x04;
pub static tag_items_data_item_family: uint = 0x05;
pub const tag_items_data_item_family: uint = 0x05;
pub static tag_items_data_item_type: uint = 0x07;
pub const tag_items_data_item_type: uint = 0x07;
pub static tag_items_data_item_symbol: uint = 0x08;
pub const tag_items_data_item_symbol: uint = 0x08;
pub static tag_items_data_item_variant: uint = 0x09;
pub const tag_items_data_item_variant: uint = 0x09;
pub static tag_items_data_parent_item: uint = 0x0a;
pub const tag_items_data_parent_item: uint = 0x0a;
pub static tag_items_data_item_is_tuple_struct_ctor: uint = 0x0b;
pub const tag_items_data_item_is_tuple_struct_ctor: uint = 0x0b;
pub static tag_index: uint = 0x0c;
pub const tag_index: uint = 0x0c;
pub static tag_index_buckets: uint = 0x0d;
pub const tag_index_buckets: uint = 0x0d;
pub static tag_index_buckets_bucket: uint = 0x0e;
pub const tag_index_buckets_bucket: uint = 0x0e;
pub static tag_index_buckets_bucket_elt: uint = 0x0f;
pub const tag_index_buckets_bucket_elt: uint = 0x0f;
pub static tag_index_table: uint = 0x10;
pub const tag_index_table: uint = 0x10;
pub static tag_meta_item_name_value: uint = 0x11;
pub const tag_meta_item_name_value: uint = 0x11;
pub static tag_meta_item_name: uint = 0x12;
pub const tag_meta_item_name: uint = 0x12;
pub static tag_meta_item_value: uint = 0x13;
pub const tag_meta_item_value: uint = 0x13;
pub static tag_attributes: uint = 0x14;
pub const tag_attributes: uint = 0x14;
pub static tag_attribute: uint = 0x15;
pub const tag_attribute: uint = 0x15;
pub static tag_meta_item_word: uint = 0x16;
pub const tag_meta_item_word: uint = 0x16;
pub static tag_meta_item_list: uint = 0x17;
pub const tag_meta_item_list: uint = 0x17;
// The list of crates that this crate depends on
pub static tag_crate_deps: uint = 0x18;
pub const tag_crate_deps: uint = 0x18;
// A single crate dependency
pub static tag_crate_dep: uint = 0x19;
pub const tag_crate_dep: uint = 0x19;
pub static tag_crate_hash: uint = 0x1a;
pub static tag_crate_crate_name: uint = 0x1b;
pub const tag_crate_hash: uint = 0x1a;
pub const tag_crate_crate_name: uint = 0x1b;
pub static tag_crate_dep_crate_name: uint = 0x1d;
pub static tag_crate_dep_hash: uint = 0x1e;
pub const tag_crate_dep_crate_name: uint = 0x1d;
pub const tag_crate_dep_hash: uint = 0x1e;
pub static tag_mod_impl: uint = 0x1f;
pub const tag_mod_impl: uint = 0x1f;
pub static tag_item_trait_item: uint = 0x20;
pub const tag_item_trait_item: uint = 0x20;
pub static tag_item_trait_ref: uint = 0x21;
pub static tag_item_super_trait_ref: uint = 0x22;
pub const tag_item_trait_ref: uint = 0x21;
pub const tag_item_super_trait_ref: uint = 0x22;
// discriminator value for variants
pub static tag_disr_val: uint = 0x23;
pub const tag_disr_val: uint = 0x23;
// used to encode ast_map::PathElem
pub static tag_path: uint = 0x24;
pub static tag_path_len: uint = 0x25;
pub static tag_path_elem_mod: uint = 0x26;
pub static tag_path_elem_name: uint = 0x27;
pub static tag_item_field: uint = 0x28;
pub static tag_item_field_origin: uint = 0x29;
pub const tag_path: uint = 0x24;
pub const tag_path_len: uint = 0x25;
pub const tag_path_elem_mod: uint = 0x26;
pub const tag_path_elem_name: uint = 0x27;
pub const tag_item_field: uint = 0x28;
pub const tag_item_field_origin: uint = 0x29;
pub static tag_item_variances: uint = 0x2a;
pub const tag_item_variances: uint = 0x2a;
/*
trait items contain tag_item_trait_item elements,
impl items contain tag_item_impl_item elements, and classes
@@ -100,15 +100,15 @@ impl items contain tag_item_impl_item elements, and classes
both, tag_item_trait_item and tag_item_impl_item have to be two
different tags.
*/
pub static tag_item_impl_item: uint = 0x30;
pub static tag_item_trait_method_explicit_self: uint = 0x31;
pub const tag_item_impl_item: uint = 0x30;
pub const tag_item_trait_method_explicit_self: uint = 0x31;
// Reexports are found within module tags. Each reexport contains def_ids
// and names.
pub static tag_items_data_item_reexport: uint = 0x38;
pub static tag_items_data_item_reexport_def_id: uint = 0x39;
pub static tag_items_data_item_reexport_name: uint = 0x3a;
pub const tag_items_data_item_reexport: uint = 0x38;
pub const tag_items_data_item_reexport_def_id: uint = 0x39;
pub const tag_items_data_item_reexport_name: uint = 0x3a;
// used to encode crate_ctxt side tables
#[deriving(PartialEq)]
@@ -153,15 +153,15 @@ pub fn from_uint(value : uint) -> Option<astencode_tag> {
}
}
pub static tag_item_trait_item_sort: uint = 0x60;
pub const tag_item_trait_item_sort: uint = 0x60;
pub static tag_item_trait_parent_sort: uint = 0x61;
pub const tag_item_trait_parent_sort: uint = 0x61;
pub static tag_item_impl_type_basename: uint = 0x62;
pub const tag_item_impl_type_basename: uint = 0x62;
pub static tag_crate_triple: uint = 0x66;
pub const tag_crate_triple: uint = 0x66;
pub static tag_dylib_dependency_formats: uint = 0x67;
pub const tag_dylib_dependency_formats: uint = 0x67;
// Language items are a top-level directory (for speed). Hierarchy:
//
@@ -170,51 +170,51 @@ pub fn from_uint(value : uint) -> Option<astencode_tag> {
// - tag_lang_items_item_id: u32
// - tag_lang_items_item_node_id: u32
pub static tag_lang_items: uint = 0x70;
pub static tag_lang_items_item: uint = 0x71;
pub static tag_lang_items_item_id: uint = 0x72;
pub static tag_lang_items_item_node_id: uint = 0x73;
pub static tag_lang_items_missing: uint = 0x74;
pub const tag_lang_items: uint = 0x70;
pub const tag_lang_items_item: uint = 0x71;
pub const tag_lang_items_item_id: uint = 0x72;
pub const tag_lang_items_item_node_id: uint = 0x73;
pub const tag_lang_items_missing: uint = 0x74;
pub static tag_item_unnamed_field: uint = 0x75;
pub static tag_items_data_item_visibility: uint = 0x76;
pub const tag_item_unnamed_field: uint = 0x75;
pub const tag_items_data_item_visibility: uint = 0x76;
pub static tag_item_method_tps: uint = 0x79;
pub static tag_item_method_fty: uint = 0x7a;
pub const tag_item_method_tps: uint = 0x79;
pub const tag_item_method_fty: uint = 0x7a;
pub static tag_mod_child: uint = 0x7b;
pub static tag_misc_info: uint = 0x7c;
pub static tag_misc_info_crate_items: uint = 0x7d;
pub const tag_mod_child: uint = 0x7b;
pub const tag_misc_info: uint = 0x7c;
pub const tag_misc_info_crate_items: uint = 0x7d;
pub static tag_item_method_provided_source: uint = 0x7e;
pub static tag_item_impl_vtables: uint = 0x7f;
pub const tag_item_method_provided_source: uint = 0x7e;
pub const tag_item_impl_vtables: uint = 0x7f;
pub static tag_impls: uint = 0x80;
pub static tag_impls_impl: uint = 0x81;
pub const tag_impls: uint = 0x80;
pub const tag_impls_impl: uint = 0x81;
pub static tag_items_data_item_inherent_impl: uint = 0x82;
pub static tag_items_data_item_extension_impl: uint = 0x83;
pub const tag_items_data_item_inherent_impl: uint = 0x82;
pub const tag_items_data_item_extension_impl: uint = 0x83;
// GAP 0x84, 0x85, 0x86
pub static tag_native_libraries: uint = 0x87;
pub static tag_native_libraries_lib: uint = 0x88;
pub static tag_native_libraries_name: uint = 0x89;
pub static tag_native_libraries_kind: uint = 0x8a;
pub const tag_native_libraries: uint = 0x87;
pub const tag_native_libraries_lib: uint = 0x88;
pub const tag_native_libraries_name: uint = 0x89;
pub const tag_native_libraries_kind: uint = 0x8a;
pub static tag_plugin_registrar_fn: uint = 0x8b;
pub static tag_exported_macros: uint = 0x8c;
pub static tag_macro_def: uint = 0x8d;
pub const tag_plugin_registrar_fn: uint = 0x8b;
pub const tag_exported_macros: uint = 0x8c;
pub const tag_macro_def: uint = 0x8d;
pub static tag_method_argument_names: uint = 0x8e;
pub static tag_method_argument_name: uint = 0x8f;
pub const tag_method_argument_names: uint = 0x8e;
pub const tag_method_argument_name: uint = 0x8f;
pub static tag_reachable_extern_fns: uint = 0x90;
pub static tag_reachable_extern_fn_id: uint = 0x91;
pub const tag_reachable_extern_fns: uint = 0x90;
pub const tag_reachable_extern_fn_id: uint = 0x91;
pub static tag_items_data_item_stability: uint = 0x92;
pub const tag_items_data_item_stability: uint = 0x92;
pub static tag_items_data_item_repr: uint = 0x93;
pub const tag_items_data_item_repr: uint = 0x93;
#[deriving(Clone, Show)]
pub struct LinkMeta {
@@ -222,29 +222,29 @@ pub struct LinkMeta {
pub crate_hash: Svh,
}
pub static tag_unboxed_closures: uint = 0x95;
pub static tag_unboxed_closure: uint = 0x96;
pub static tag_unboxed_closure_type: uint = 0x97;
pub static tag_unboxed_closure_kind: uint = 0x98;
pub const tag_unboxed_closures: uint = 0x95;
pub const tag_unboxed_closure: uint = 0x96;
pub const tag_unboxed_closure_type: uint = 0x97;
pub const tag_unboxed_closure_kind: uint = 0x98;
pub static tag_struct_fields: uint = 0x99;
pub static tag_struct_field: uint = 0x9a;
pub static tag_struct_field_id: uint = 0x9b;
pub const tag_struct_fields: uint = 0x99;
pub const tag_struct_field: uint = 0x9a;
pub const tag_struct_field_id: uint = 0x9b;
pub static tag_attribute_is_sugared_doc: uint = 0x9c;
pub const tag_attribute_is_sugared_doc: uint = 0x9c;
pub static tag_trait_def_bounds: uint = 0x9d;
pub const tag_trait_def_bounds: uint = 0x9d;
pub static tag_items_data_region: uint = 0x9e;
pub const tag_items_data_region: uint = 0x9e;
pub static tag_region_param_def: uint = 0xa0;
pub static tag_region_param_def_ident: uint = 0xa1;
pub static tag_region_param_def_def_id: uint = 0xa2;
pub static tag_region_param_def_space: uint = 0xa3;
pub static tag_region_param_def_index: uint = 0xa4;
pub const tag_region_param_def: uint = 0xa0;
pub const tag_region_param_def_ident: uint = 0xa1;
pub const tag_region_param_def_def_id: uint = 0xa2;
pub const tag_region_param_def_space: uint = 0xa3;
pub const tag_region_param_def_index: uint = 0xa4;
pub static tag_type_param_def: uint = 0xa5;
pub const tag_type_param_def: uint = 0xa5;
pub static tag_item_generics: uint = 0xa6;
pub static tag_method_ty_generics: uint = 0xa7;
pub const tag_item_generics: uint = 0xa6;
pub const tag_method_ty_generics: uint = 0xa7;
+4 -1
View File
@@ -126,12 +126,14 @@ enum Family {
Trait, // I
Struct, // S
PublicField, // g
InheritedField // N
InheritedField, // N
Constant, // C
}
fn item_family(item: rbml::Doc) -> Family {
let fam = reader::get_doc(item, tag_items_data_item_family);
match reader::doc_as_u8(fam) as char {
'C' => Constant,
'c' => ImmStatic,
'b' => MutStatic,
'f' => Fn,
@@ -303,6 +305,7 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
-> DefLike {
let fam = item_family(item);
match fam {
Constant => DlDef(def::DefConst(did)),
ImmStatic => DlDef(def::DefStatic(did, false)),
MutStatic => DlDef(def::DefStatic(did, true)),
Struct => DlDef(def::DefStruct(did)),
+15 -11
View File
@@ -69,7 +69,6 @@ pub struct EncodeParams<'a, 'tcx: 'a> {
pub tcx: &'a ty::ctxt<'tcx>,
pub reexports2: &'a middle::resolve::ExportMap2,
pub item_symbols: &'a RefCell<NodeMap<String>>,
pub non_inlineable_statics: &'a RefCell<NodeSet>,
pub link_meta: &'a LinkMeta,
pub cstore: &'a cstore::CStore,
pub encode_inlined_item: EncodeInlinedItem<'a>,
@@ -81,7 +80,6 @@ pub struct EncodeContext<'a, 'tcx: 'a> {
pub tcx: &'a ty::ctxt<'tcx>,
pub reexports2: &'a middle::resolve::ExportMap2,
pub item_symbols: &'a RefCell<NodeMap<String>>,
pub non_inlineable_statics: &'a RefCell<NodeSet>,
pub link_meta: &'a LinkMeta,
pub cstore: &'a cstore::CStore,
pub encode_inlined_item: RefCell<EncodeInlinedItem<'a>>,
@@ -1069,12 +1067,20 @@ fn add_to_index(item: &Item, rbml_w: &Encoder,
encode_symbol(ecx, rbml_w, item.id);
encode_name(rbml_w, item.ident.name);
encode_path(rbml_w, path);
let inlineable = !ecx.non_inlineable_statics.borrow().contains(&item.id);
if inlineable {
encode_inlined_item(ecx, rbml_w, IIItemRef(item));
}
encode_visibility(rbml_w, vis);
encode_stability(rbml_w, stab);
encode_attributes(rbml_w, item.attrs.as_slice());
rbml_w.end_tag();
}
ItemConst(_, _) => {
add_to_index(item, rbml_w, index);
rbml_w.start_tag(tag_items_data_item);
encode_def_id(rbml_w, def_id);
encode_family(rbml_w, 'C');
encode_bounds_and_type(rbml_w, ecx, &lookup_item_type(tcx, def_id));
encode_name(rbml_w, item.ident.name);
encode_path(rbml_w, path);
encode_inlined_item(ecx, rbml_w, IIItemRef(item));
encode_visibility(rbml_w, vis);
encode_stability(rbml_w, stab);
rbml_w.end_tag();
@@ -2029,7 +2035,7 @@ fn encode_dylib_dependency_formats(rbml_w: &mut Encoder, ecx: &EncodeContext) {
// NB: Increment this as you change the metadata encoding version.
#[allow(non_uppercase_statics)]
pub static metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 1 ];
pub const metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 1 ];
pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> Vec<u8> {
let mut wr = SeekableMemWriter::new();
@@ -2076,7 +2082,6 @@ struct Stats {
cstore,
encode_inlined_item,
link_meta,
non_inlineable_statics,
reachable,
..
} = parms;
@@ -2085,7 +2090,6 @@ struct Stats {
tcx: tcx,
reexports2: reexports2,
item_symbols: item_symbols,
non_inlineable_statics: non_inlineable_statics,
link_meta: link_meta,
cstore: cstore,
encode_inlined_item: RefCell::new(encode_inlined_item),
+12 -12
View File
@@ -241,23 +241,23 @@
use flate;
use time;
pub static MACOS_DLL_PREFIX: &'static str = "lib";
pub static MACOS_DLL_SUFFIX: &'static str = ".dylib";
pub const MACOS_DLL_PREFIX: &'static str = "lib";
pub const MACOS_DLL_SUFFIX: &'static str = ".dylib";
pub static WIN32_DLL_PREFIX: &'static str = "";
pub static WIN32_DLL_SUFFIX: &'static str = ".dll";
pub const WIN32_DLL_PREFIX: &'static str = "";
pub const WIN32_DLL_SUFFIX: &'static str = ".dll";
pub static LINUX_DLL_PREFIX: &'static str = "lib";
pub static LINUX_DLL_SUFFIX: &'static str = ".so";
pub const LINUX_DLL_PREFIX: &'static str = "lib";
pub const LINUX_DLL_SUFFIX: &'static str = ".so";
pub static FREEBSD_DLL_PREFIX: &'static str = "lib";
pub static FREEBSD_DLL_SUFFIX: &'static str = ".so";
pub const FREEBSD_DLL_PREFIX: &'static str = "lib";
pub const FREEBSD_DLL_SUFFIX: &'static str = ".so";
pub static DRAGONFLY_DLL_PREFIX: &'static str = "lib";
pub static DRAGONFLY_DLL_SUFFIX: &'static str = ".so";
pub const DRAGONFLY_DLL_PREFIX: &'static str = "lib";
pub const DRAGONFLY_DLL_SUFFIX: &'static str = ".so";
pub static ANDROID_DLL_PREFIX: &'static str = "lib";
pub static ANDROID_DLL_SUFFIX: &'static str = ".so";
pub const ANDROID_DLL_PREFIX: &'static str = "lib";
pub const ANDROID_DLL_SUFFIX: &'static str = ".so";
pub struct CrateMismatch {
path: Path,
+1
View File
@@ -460,6 +460,7 @@ fn tr(&self, dcx: &DecodeContext) -> def::Def {
def::DefMod(did) => { def::DefMod(did.tr(dcx)) }
def::DefForeignMod(did) => { def::DefForeignMod(did.tr(dcx)) }
def::DefStatic(did, m) => { def::DefStatic(did.tr(dcx), m) }
def::DefConst(did) => { def::DefConst(did.tr(dcx)) }
def::DefLocal(nid) => { def::DefLocal(dcx.tr_id(nid)) }
def::DefVariant(e_did, v_did, is_s) => {
def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s)
@@ -169,15 +169,11 @@ fn check_aliasability(bccx: &BorrowckCtxt,
// Borrow of an immutable static item:
match safety {
mc::InteriorUnsafe => {
// If the static item contains an Unsafe<T>, it has interior mutability.
// In such cases, we cannot permit it to be borrowed, because the
// static item resides in immutable memory and mutating it would
// cause segfaults.
bccx.tcx.sess.span_err(borrow_span,
"borrow of immutable static items \
with unsafe interior is not \
allowed");
Err(())
// If the static item contains an Unsafe<T>, it has interior
// mutability. In such cases, another phase of the compiler
// will ensure that the type is `Sync` and then trans will
// not put it in rodata, so this is ok to allow.
Ok(())
}
mc::InteriorSafe => {
// Immutable static can be borrowed, no problem.
+2 -1
View File
@@ -106,7 +106,8 @@ fn borrowck_item(this: &mut BorrowckCtxt, item: &ast::Item) {
// loan step is intended for things that have a data
// flow dependent conditions.
match item.node {
ast::ItemStatic(_, _, ref ex) => {
ast::ItemStatic(_, _, ref ex) |
ast::ItemConst(_, ref ex) => {
gather_loans::gather_loans_in_static_initializer(this, &**ex);
}
_ => {
+81 -67
View File
@@ -47,7 +47,9 @@ fn visit_pat(&mut self, p: &Pat) {
check_pat(self, p);
}
fn visit_expr(&mut self, ex: &Expr) {
check_expr(self, ex);
if check_expr(self, ex) {
visit::walk_expr(self, ex);
}
}
}
@@ -59,7 +61,8 @@ pub fn check_crate(tcx: &ty::ctxt) {
fn check_item(v: &mut CheckCrateVisitor, it: &Item) {
match it.node {
ItemStatic(_, _, ref ex) => {
ItemStatic(_, _, ref ex) |
ItemConst(_, ref ex) => {
v.inside_const(|v| v.visit_expr(&**ex));
}
ItemEnum(ref enum_definition, _) => {
@@ -96,73 +99,81 @@ fn is_str(e: &Expr) -> bool {
}
}
fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) {
if v.in_const {
match e.node {
ExprUnary(UnDeref, _) => { }
ExprUnary(UnUniq, _) => {
span_err!(v.tcx.sess, e.span, E0010, "cannot do allocations in constant expressions");
return;
}
ExprLit(ref lit) if ast_util::lit_is_str(&**lit) => {}
ExprBinary(..) | ExprUnary(..) => {
fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) -> bool {
if !v.in_const { return true }
match e.node {
ExprUnary(UnDeref, _) => {}
ExprUnary(UnUniq, _) => {
span_err!(v.tcx.sess, e.span, E0010,
"cannot do allocations in constant expressions");
return false;
}
ExprLit(ref lit) if ast_util::lit_is_str(&**lit) => {}
ExprBinary(..) | ExprUnary(..) => {
let method_call = typeck::MethodCall::expr(e.id);
if v.tcx.method_map.borrow().contains_key(&method_call) {
span_err!(v.tcx.sess, e.span, E0011,
"user-defined operators are not allowed in constant expressions");
"user-defined operators are not allowed in constant \
expressions");
}
}
ExprLit(_) => (),
ExprCast(_, _) => {
}
ExprLit(_) => (),
ExprCast(_, _) => {
let ety = ty::expr_ty(v.tcx, e);
if !ty::type_is_numeric(ety) && !ty::type_is_unsafe_ptr(ety) {
span_err!(v.tcx.sess, e.span, E0012,
"can not cast to `{}` in a constant expression",
ppaux::ty_to_string(v.tcx, ety)
);
"can not cast to `{}` in a constant expression",
ppaux::ty_to_string(v.tcx, ety));
}
}
ExprPath(ref pth) => {
}
ExprPath(ref pth) => {
// NB: In the future you might wish to relax this slightly
// to handle on-demand instantiation of functions via
// foo::<bar> in a const. Currently that is only done on
// a path in trans::callee that only works in block contexts.
if !pth.segments.iter().all(|segment| segment.types.is_empty()) {
span_err!(v.tcx.sess, e.span, E0013,
"paths in constants may only refer to items without type parameters");
"paths in constants may only refer to items without \
type parameters");
}
match v.tcx.def_map.borrow().find(&e.id) {
Some(&DefStatic(..)) |
Some(&DefFn(..)) |
Some(&DefVariant(_, _, _)) |
Some(&DefStruct(_)) => { }
Some(&DefStatic(..)) |
Some(&DefConst(..)) |
Some(&DefFn(..)) |
Some(&DefVariant(_, _, _)) |
Some(&DefStruct(_)) => { }
Some(&def) => {
debug!("(checking const) found bad def: {:?}", def);
span_err!(v.tcx.sess, e.span, E0014,
"paths in constants may only refer to constants or functions");
}
None => {
v.tcx.sess.span_bug(e.span, "unbound path in const?!");
}
Some(&def) => {
debug!("(checking const) found bad def: {:?}", def);
span_err!(v.tcx.sess, e.span, E0014,
"paths in constants may only refer to constants \
or functions");
}
None => {
v.tcx.sess.span_bug(e.span, "unbound path in const?!");
}
}
}
ExprCall(ref callee, _) => {
}
ExprCall(ref callee, _) => {
match v.tcx.def_map.borrow().find(&callee.id) {
Some(&DefStruct(..)) |
Some(&DefVariant(..)) => {} // OK.
_ => {
span_err!(v.tcx.sess, e.span, E0015,
"function calls in constants are limited to struct and enum constructors");
"function calls in constants are limited to \
struct and enum constructors");
}
}
}
ExprBlock(ref block) => {
}
ExprBlock(ref block) => {
// Check all statements in the block
for stmt in block.stmts.iter() {
let block_span_err = |span|
span_err!(v.tcx.sess, span, E0016,
"blocks in constants are limited to items and tail expressions");
"blocks in constants are limited to items and \
tail expressions");
match stmt.node {
StmtDecl(ref span, _) => {
match span.node {
@@ -174,40 +185,43 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) {
}
StmtExpr(ref expr, _) => block_span_err(expr.span),
StmtSemi(ref semi, _) => block_span_err(semi.span),
StmtMac(..) => v.tcx.sess.span_bug(e.span,
"unexpanded statement macro in const?!")
StmtMac(..) => {
v.tcx.sess.span_bug(e.span, "unexpanded statement \
macro in const?!")
}
}
}
match block.expr {
Some(ref expr) => check_expr(v, &**expr),
Some(ref expr) => { check_expr(v, &**expr); }
None => {}
}
}
ExprVec(_) |
ExprAddrOf(MutImmutable, _) |
ExprParen(..) |
ExprField(..) |
ExprTupField(..) |
ExprIndex(..) |
ExprTup(..) |
ExprRepeat(..) |
ExprStruct(..) => { }
ExprAddrOf(_, ref inner) => {
match inner.node {
// Mutable slices are allowed.
ExprVec(_) => {}
_ => span_err!(v.tcx.sess, e.span, E0017,
"references in constants may only refer to immutable values")
}
ExprVec(_) |
ExprAddrOf(MutImmutable, _) |
ExprParen(..) |
ExprField(..) |
ExprTupField(..) |
ExprIndex(..) |
ExprTup(..) |
ExprRepeat(..) |
ExprStruct(..) => {}
}
},
ExprAddrOf(_, ref inner) => {
match inner.node {
// Mutable slices are allowed.
ExprVec(_) => {}
_ => span_err!(v.tcx.sess, e.span, E0017,
"references in constants may only refer \
to immutable values")
_ => {
span_err!(v.tcx.sess, e.span, E0019,
"constant contains unimplemented expression type");
return;
}
}
}
_ => {
span_err!(v.tcx.sess, e.span, E0019,
"constant contains unimplemented expression type");
return false;
}
}
visit::walk_expr(v, e);
true
}
+37 -27
View File
@@ -32,7 +32,7 @@
use syntax::visit::{mod, Visitor, FnKind};
use util::ppaux::ty_to_string;
static DUMMY_WILD_PAT: Pat = Pat {
pub const DUMMY_WILD_PAT: Pat = Pat {
id: DUMMY_NODE_ID,
node: PatWild(PatWildSingle),
span: DUMMY_SP
@@ -299,9 +299,10 @@ fn raw_pat<'a>(p: &'a Pat) -> &'a Pat {
fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, matrix: &Matrix) {
match is_useful(cx, matrix, &[&DUMMY_WILD_PAT], ConstructWitness) {
UsefulWithWitness(pats) => {
let dummy = DUMMY_WILD_PAT.clone();
let witness = match pats.as_slice() {
[ref witness] => &**witness,
[] => &DUMMY_WILD_PAT,
[] => &dummy,
_ => unreachable!()
};
span_err!(cx.tcx.sess, sp, E0004,
@@ -349,7 +350,7 @@ fn fold_pat(&mut self, pat: P<Pat>) -> P<Pat> {
PatIdent(..) | PatEnum(..) => {
let def = self.tcx.def_map.borrow().find_copy(&pat.id);
match def {
Some(DefStatic(did, _)) => match lookup_const_by_id(self.tcx, did) {
Some(DefConst(did)) => match lookup_const_by_id(self.tcx, did) {
Some(const_expr) => {
const_expr_to_pat(self.tcx, const_expr).map(|mut new_pat| {
new_pat.span = pat.span;
@@ -359,7 +360,7 @@ fn fold_pat(&mut self, pat: P<Pat>) -> P<Pat> {
None => {
self.failed = true;
span_err!(self.tcx.sess, pat.span, E0158,
"extern statics cannot be referenced in patterns");
"statics cannot be referenced in patterns");
pat
}
},
@@ -555,8 +556,9 @@ fn is_useful(cx: &MatchCheckCtxt,
let arity = constructor_arity(cx, &c, left_ty);
let mut result = {
let pat_slice = pats.as_slice();
let dummy = DUMMY_WILD_PAT.clone();
let subpats = Vec::from_fn(arity, |i| {
pat_slice.get(i).map_or(&DUMMY_WILD_PAT, |p| &**p)
pat_slice.get(i).map_or(&dummy, |p| &**p)
});
vec![construct_witness(cx, &c, subpats, left_ty)]
};
@@ -578,8 +580,9 @@ fn is_useful(cx: &MatchCheckCtxt,
}).collect();
match is_useful(cx, &matrix, v.tail(), witness) {
UsefulWithWitness(pats) => {
let dummy = DUMMY_WILD_PAT.clone();
let arity = constructor_arity(cx, &constructor, left_ty);
let wild_pats = Vec::from_elem(arity, &DUMMY_WILD_PAT);
let wild_pats = Vec::from_elem(arity, &dummy);
let enum_pat = construct_witness(cx, &constructor, wild_pats, left_ty);
let mut new_pats = vec![enum_pat];
new_pats.extend(pats.into_iter());
@@ -600,10 +603,11 @@ fn is_useful_specialized(cx: &MatchCheckCtxt, &Matrix(ref m): &Matrix,
v: &[&Pat], ctor: Constructor, lty: ty::t,
witness: WitnessPreference) -> Usefulness {
let arity = constructor_arity(cx, &ctor, lty);
let dummy = DUMMY_WILD_PAT.clone();
let matrix = Matrix(m.iter().filter_map(|r| {
specialize(cx, r.as_slice(), &ctor, 0u, arity)
specialize(cx, r.as_slice(), &dummy, &ctor, 0u, arity)
}).collect());
match specialize(cx, v, &ctor, 0u, arity) {
match specialize(cx, v, &dummy, &ctor, 0u, arity) {
Some(v) => is_useful(cx, &matrix, v.as_slice(), witness),
None => NotUseful
}
@@ -624,23 +628,26 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
match pat.node {
PatIdent(..) =>
match cx.tcx.def_map.borrow().find(&pat.id) {
Some(&DefStatic(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've been rewritten"),
Some(&DefConst(..)) =>
cx.tcx.sess.span_bug(pat.span, "const pattern should've \
been rewritten"),
Some(&DefStruct(_)) => vec!(Single),
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
_ => vec!()
},
PatEnum(..) =>
match cx.tcx.def_map.borrow().find(&pat.id) {
Some(&DefStatic(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've been rewritten"),
Some(&DefConst(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've \
been rewritten"),
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
_ => vec!(Single)
},
PatStruct(..) =>
match cx.tcx.def_map.borrow().find(&pat.id) {
Some(&DefStatic(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've been rewritten"),
Some(&DefConst(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've \
been rewritten"),
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
_ => vec!(Single)
},
@@ -722,7 +729,7 @@ fn range_covered_by_constructor(ctor: &Constructor,
/// different patterns.
/// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing
/// fields filled with wild patterns.
pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat], dummy: &'a Pat,
constructor: &Constructor, col: uint, arity: uint) -> Option<Vec<&'a Pat>> {
let &Pat {
id: pat_id, node: ref node, span: pat_span
@@ -730,32 +737,34 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
let head: Option<Vec<&Pat>> = match node {
&PatWild(_) =>
Some(Vec::from_elem(arity, &DUMMY_WILD_PAT)),
Some(Vec::from_elem(arity, dummy)),
&PatIdent(_, _, _) => {
let opt_def = cx.tcx.def_map.borrow().find_copy(&pat_id);
match opt_def {
Some(DefStatic(..)) =>
cx.tcx.sess.span_bug(pat_span, "static pattern should've been rewritten"),
Some(DefConst(..)) =>
cx.tcx.sess.span_bug(pat_span, "const pattern should've \
been rewritten"),
Some(DefVariant(_, id, _)) => if *constructor == Variant(id) {
Some(vec!())
} else {
None
},
_ => Some(Vec::from_elem(arity, &DUMMY_WILD_PAT))
_ => Some(Vec::from_elem(arity, dummy))
}
}
&PatEnum(_, ref args) => {
let def = cx.tcx.def_map.borrow().get_copy(&pat_id);
match def {
DefStatic(..) =>
cx.tcx.sess.span_bug(pat_span, "static pattern should've been rewritten"),
DefConst(..) =>
cx.tcx.sess.span_bug(pat_span, "const pattern should've \
been rewritten"),
DefVariant(_, id, _) if *constructor != Variant(id) => None,
DefVariant(..) | DefStruct(..) => {
Some(match args {
&Some(ref args) => args.iter().map(|p| &**p).collect(),
&None => Vec::from_elem(arity, &DUMMY_WILD_PAT)
&None => Vec::from_elem(arity, dummy)
})
}
_ => None
@@ -766,8 +775,9 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
// Is this a struct or an enum variant?
let def = cx.tcx.def_map.borrow().get_copy(&pat_id);
let class_id = match def {
DefStatic(..) =>
cx.tcx.sess.span_bug(pat_span, "static pattern should've been rewritten"),
DefConst(..) =>
cx.tcx.sess.span_bug(pat_span, "const pattern should've \
been rewritten"),
DefVariant(_, variant_id, _) => if *constructor == Variant(variant_id) {
Some(variant_id)
} else {
@@ -790,7 +800,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
let args = struct_fields.iter().map(|sf| {
match pattern_fields.iter().find(|f| f.ident.name == sf.name) {
Some(ref f) => &*f.pat,
_ => &DUMMY_WILD_PAT
_ => dummy
}
}).collect();
args
@@ -833,13 +843,13 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
// Fixed-length vectors.
Single => {
let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
pats.grow_fn(arity - before.len() - after.len(), |_| &DUMMY_WILD_PAT);
pats.grow_fn(arity - before.len() - after.len(), |_| dummy);
pats.extend(after.iter().map(|p| &**p));
Some(pats)
},
Slice(length) if before.len() + after.len() <= length && slice.is_some() => {
let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
pats.grow_fn(arity - before.len() - after.len(), |_| &DUMMY_WILD_PAT);
pats.grow_fn(arity - before.len() - after.len(), |_| dummy);
pats.extend(after.iter().map(|p| &**p));
Some(pats)
},
+245 -64
View File
@@ -25,48 +25,103 @@
// by borrowck::gather_loans
use middle::ty;
use middle::def;
use middle::typeck;
use middle::traits;
use middle::mem_categorization as mc;
use middle::expr_use_visitor as euv;
use util::nodemap::NodeSet;
use syntax::ast;
use syntax::visit::Visitor;
use syntax::visit;
use syntax::print::pprust;
use syntax::visit::Visitor;
use syntax::codemap::{DUMMY_SP, Span};
use syntax::visit;
fn safe_type_for_static_mut(cx: &ty::ctxt, e: &ast::Expr) -> Option<String> {
let node_ty = ty::node_id_to_type(cx, e.id);
let tcontents = ty::type_contents(cx, node_ty);
debug!("safe_type_for_static_mut(dtor={}, managed={}, owned={})",
tcontents.has_dtor(), tcontents.owns_managed(), tcontents.owns_owned())
let suffix = if tcontents.has_dtor() {
"destructors"
} else if tcontents.owns_managed() {
"managed pointers"
} else if tcontents.owns_owned() {
"owned pointers"
} else {
return None;
};
Some(format!("mutable static items are not allowed to have {}", suffix))
#[deriving(Eq, PartialEq)]
enum Mode {
InConstant,
InStatic,
InStaticMut,
InNothing,
}
struct CheckStaticVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
in_const: bool
mode: Mode,
checker: &'a mut GlobalChecker,
}
struct GlobalVisitor<'a, 'b, 't: 'b>(euv::ExprUseVisitor<'a, 'b, ty::ctxt<'t>>);
struct GlobalChecker {
static_consumptions: NodeSet,
const_borrows: NodeSet,
static_interior_borrows: NodeSet,
}
pub fn check_crate(tcx: &ty::ctxt) {
visit::walk_crate(&mut CheckStaticVisitor { tcx: tcx, in_const: false },
tcx.map.krate())
let mut checker = GlobalChecker {
static_consumptions: NodeSet::new(),
const_borrows: NodeSet::new(),
static_interior_borrows: NodeSet::new(),
};
{
let visitor = euv::ExprUseVisitor::new(&mut checker, tcx);
visit::walk_crate(&mut GlobalVisitor(visitor), tcx.map.krate());
}
visit::walk_crate(&mut CheckStaticVisitor {
tcx: tcx,
mode: InNothing,
checker: &mut checker,
}, tcx.map.krate());
}
impl<'a, 'tcx> CheckStaticVisitor<'a, 'tcx> {
fn with_const(&mut self, in_const: bool, f: |&mut CheckStaticVisitor<'a, 'tcx>|) {
let was_const = self.in_const;
self.in_const = in_const;
fn with_mode(&mut self, mode: Mode, f: |&mut CheckStaticVisitor<'a, 'tcx>|) {
let old = self.mode;
self.mode = mode;
f(self);
self.in_const = was_const;
self.mode = old;
}
fn msg(&self) -> &'static str {
match self.mode {
InConstant => "constants",
InStaticMut | InStatic => "statics",
InNothing => unreachable!(),
}
}
fn check_static_mut_type(&self, e: &ast::Expr) {
let node_ty = ty::node_id_to_type(self.tcx, e.id);
let tcontents = ty::type_contents(self.tcx, node_ty);
let suffix = if tcontents.has_dtor() {
"destructors"
} else if tcontents.owns_owned() {
"owned pointers"
} else {
return
};
self.tcx.sess.span_err(e.span, format!("mutable statics are not allowed \
to have {}", suffix).as_slice());
}
fn check_static_type(&self, e: &ast::Expr) {
let ty = ty::node_id_to_type(self.tcx, e.id);
let infcx = typeck::infer::new_infer_ctxt(self.tcx);
let mut fulfill_cx = traits::FulfillmentContext::new();
let cause = traits::ObligationCause::misc(DUMMY_SP);
let obligation = traits::obligation_for_builtin_bound(self.tcx, cause, ty,
ty::BoundSync);
fulfill_cx.register_obligation(self.tcx, obligation.unwrap());
let env = ty::empty_parameter_environment();
let result = fulfill_cx.select_all_or_error(&infcx, &env, self.tcx).is_ok();
if !result {
self.tcx.sess.span_err(e.span, "shared static items must have a \
type which implements Sync");
}
}
}
@@ -74,22 +129,20 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckStaticVisitor<'a, 'tcx> {
fn visit_item(&mut self, i: &ast::Item) {
debug!("visit_item(item={})", pprust::item_to_string(i));
match i.node {
ast::ItemStatic(_, mutability, ref expr) => {
match mutability {
ast::MutImmutable => {
self.with_const(true, |v| v.visit_expr(&**expr));
}
ast::MutMutable => {
match safe_type_for_static_mut(self.tcx, &**expr) {
Some(msg) => {
self.tcx.sess.span_err(expr.span, msg.as_slice());
}
None => {}
}
}
}
ast::ItemStatic(_, ast::MutImmutable, ref expr) => {
self.check_static_type(&**expr);
self.with_mode(InStatic, |v| v.visit_expr(&**expr));
}
ast::ItemStatic(_, ast::MutMutable, ref expr) => {
self.check_static_mut_type(&**expr);
self.with_mode(InStaticMut, |v| v.visit_expr(&**expr));
}
ast::ItemConst(_, ref expr) => {
self.with_mode(InConstant, |v| v.visit_expr(&**expr));
}
_ => {
self.with_mode(InNothing, |v| visit::walk_item(v, i));
}
_ => self.with_const(false, |v| visit::walk_item(v, i))
}
}
@@ -100,42 +153,170 @@ fn visit_item(&mut self, i: &ast::Item) {
/// of a static item, this method does nothing but walking
/// down through it.
fn visit_expr(&mut self, e: &ast::Expr) {
debug!("visit_expr(expr={})", pprust::expr_to_string(e));
if !self.in_const {
if self.mode == InNothing {
return visit::walk_expr(self, e);
}
match e.node {
ast::ExprField(..) | ast::ExprTupField(..) | ast::ExprVec(..) |
ast::ExprBlock(..) | ast::ExprTup(..) => {
visit::walk_expr(self, e);
let node_ty = ty::node_id_to_type(self.tcx, e.id);
match ty::get(node_ty).sty {
ty::ty_struct(did, _) |
ty::ty_enum(did, _) if ty::has_dtor(self.tcx, did) => {
self.tcx.sess.span_err(e.span,
format!("{} are not allowed to have \
destructors", self.msg()).as_slice())
}
_ => {}
}
// statics cannot be consumed by value at any time, that would imply
// that they're an initializer (what a const is for) or kept in sync
// over time (not feasible), so deny it outright.
if self.checker.static_consumptions.remove(&e.id) {
self.tcx.sess.span_err(e.span, "cannot refer to other statics by \
value, use the address-of operator \
or a constant instead");
}
// Borrowed statics can specifically *only* have their address taken,
// not any number of other borrows such as borrowing fields, reading
// elements of an array, etc.
if self.checker.static_interior_borrows.remove(&e.id) {
self.tcx.sess.span_err(e.span, "cannot refer to the interior of \
another static, use a constant \
instead");
}
// constants cannot be borrowed if they contain interior mutability as
// it means that our "silent insertion of statics" could change
// initializer values (very bad).
if self.checker.const_borrows.remove(&e.id) {
let node_ty = ty::node_id_to_type(self.tcx, e.id);
let tcontents = ty::type_contents(self.tcx, node_ty);
if tcontents.interior_unsafe() {
self.tcx.sess.span_err(e.span, "cannot borrow a constant which \
contains interior mutability, \
create a static instead");
}
}
match e.node {
ast::ExprAddrOf(ast::MutMutable, _) => {
span_err!(self.tcx.sess, e.span, E0020,
"static items are not allowed to have mutable slices");
if self.mode != InStaticMut {
span_err!(self.tcx.sess, e.span, E0020,
"{} are not allowed to have mutable references",
self.msg());
}
},
ast::ExprBox(..) |
ast::ExprUnary(ast::UnUniq, _) => {
span_err!(self.tcx.sess, e.span, E0022,
"static items are not allowed to have custom pointers");
"{} are not allowed to have custom pointers",
self.msg());
}
_ => {
let node_ty = ty::node_id_to_type(self.tcx, e.id);
match ty::get(node_ty).sty {
ty::ty_struct(did, _) |
ty::ty_enum(did, _) => {
if ty::has_dtor(self.tcx, did) {
self.tcx.sess.span_err(e.span,
"static items are not allowed to have destructors");
return;
}
ast::ExprPath(..) => {
match ty::resolve_expr(self.tcx, e) {
def::DefStatic(..) if self.mode == InConstant => {
let msg = "constants cannot refer to other statics, \
insert an intermediate constant \
instead";
self.tcx.sess.span_err(e.span, msg.as_slice());
}
_ => {}
}
visit::walk_expr(self, e);
}
_ => {}
}
visit::walk_expr(self, e);
}
}
impl<'a, 'b, 't, 'v> Visitor<'v> for GlobalVisitor<'a, 'b, 't> {
fn visit_item(&mut self, item: &ast::Item) {
match item.node {
ast::ItemConst(_, ref e) |
ast::ItemStatic(_, _, ref e) => {
let GlobalVisitor(ref mut v) = *self;
v.consume_expr(&**e);
}
_ => {}
}
visit::walk_item(self, item);
}
}
impl euv::Delegate for GlobalChecker {
fn consume(&mut self,
consume_id: ast::NodeId,
_consume_span: Span,
cmt: mc::cmt,
_mode: euv::ConsumeMode) {
let mut cur = &cmt;
loop {
match cur.cat {
mc::cat_static_item => {
self.static_consumptions.insert(consume_id);
break
}
mc::cat_deref(ref cmt, _, _) |
mc::cat_discr(ref cmt, _) |
mc::cat_downcast(ref cmt) |
mc::cat_interior(ref cmt, _) => cur = cmt,
mc::cat_rvalue(..) |
mc::cat_copied_upvar(..) |
mc::cat_upvar(..) |
mc::cat_local(..) => break,
}
}
}
fn borrow(&mut self,
borrow_id: ast::NodeId,
_borrow_span: Span,
cmt: mc::cmt,
_loan_region: ty::Region,
_bk: ty::BorrowKind,
_loan_cause: euv::LoanCause) {
let mut cur = &cmt;
let mut is_interior = false;
loop {
match cur.cat {
mc::cat_rvalue(..) => {
self.const_borrows.insert(borrow_id);
break
}
mc::cat_static_item => {
if is_interior {
self.static_interior_borrows.insert(borrow_id);
}
break
}
mc::cat_deref(ref cmt, _, _) |
mc::cat_interior(ref cmt, _) => {
is_interior = true;
cur = cmt;
}
mc::cat_downcast(..) |
mc::cat_discr(..) |
mc::cat_copied_upvar(..) |
mc::cat_upvar(..) |
mc::cat_local(..) => unreachable!(),
}
}
}
fn decl_without_init(&mut self,
_id: ast::NodeId,
_span: Span) {}
fn mutate(&mut self,
_assignment_id: ast::NodeId,
_assignment_span: Span,
_assignee_cmt: mc::cmt,
_mode: euv::MutateMode) {}
fn consume_pat(&mut self,
_consume_pat: &ast::Pat,
_cmt: mc::cmt,
_mode: euv::ConsumeMode) {}
}
+15 -13
View File
@@ -13,9 +13,9 @@
use driver::session::Session;
use middle::resolve;
use middle::def::DefStatic;
use middle::def::{DefStatic, DefConst};
use syntax::ast::{Crate, Expr, ExprPath, Item, ItemStatic, NodeId};
use syntax::ast;
use syntax::{ast_util, ast_map};
use syntax::visit::Visitor;
use syntax::visit;
@@ -27,13 +27,13 @@ struct CheckCrateVisitor<'a, 'ast: 'a> {
}
impl<'v, 'a, 'ast> Visitor<'v> for CheckCrateVisitor<'a, 'ast> {
fn visit_item(&mut self, i: &Item) {
fn visit_item(&mut self, i: &ast::Item) {
check_item(self, i);
}
}
pub fn check_crate<'ast>(sess: &Session,
krate: &Crate,
krate: &ast::Crate,
def_map: &resolve::DefMap,
ast_map: &ast_map::Map<'ast>) {
let mut visitor = CheckCrateVisitor {
@@ -45,9 +45,10 @@ pub fn check_crate<'ast>(sess: &Session,
sess.abort_if_errors();
}
fn check_item(v: &mut CheckCrateVisitor, it: &Item) {
fn check_item(v: &mut CheckCrateVisitor, it: &ast::Item) {
match it.node {
ItemStatic(_, _, ref ex) => {
ast::ItemStatic(_, _, ref ex) |
ast::ItemConst(_, ref ex) => {
check_item_recursion(v.sess, v.ast_map, v.def_map, it);
visit::walk_expr(v, &**ex)
},
@@ -56,11 +57,11 @@ fn check_item(v: &mut CheckCrateVisitor, it: &Item) {
}
struct CheckItemRecursionVisitor<'a, 'ast: 'a> {
root_it: &'a Item,
root_it: &'a ast::Item,
sess: &'a Session,
ast_map: &'a ast_map::Map<'ast>,
def_map: &'a resolve::DefMap,
idstack: Vec<NodeId>
idstack: Vec<ast::NodeId>
}
// Make sure a const item doesn't recursively refer to itself
@@ -68,7 +69,7 @@ struct CheckItemRecursionVisitor<'a, 'ast: 'a> {
pub fn check_item_recursion<'a>(sess: &'a Session,
ast_map: &'a ast_map::Map,
def_map: &'a resolve::DefMap,
it: &'a Item) {
it: &'a ast::Item) {
let mut visitor = CheckItemRecursionVisitor {
root_it: it,
@@ -81,7 +82,7 @@ pub fn check_item_recursion<'a>(sess: &'a Session,
}
impl<'a, 'ast, 'v> Visitor<'v> for CheckItemRecursionVisitor<'a, 'ast> {
fn visit_item(&mut self, it: &Item) {
fn visit_item(&mut self, it: &ast::Item) {
if self.idstack.iter().any(|x| x == &(it.id)) {
self.sess.span_err(self.root_it.span, "recursive constant");
return;
@@ -91,11 +92,12 @@ fn visit_item(&mut self, it: &Item) {
self.idstack.pop();
}
fn visit_expr(&mut self, e: &Expr) {
fn visit_expr(&mut self, e: &ast::Expr) {
match e.node {
ExprPath(..) => {
ast::ExprPath(..) => {
match self.def_map.borrow().find(&e.id) {
Some(&DefStatic(def_id, _)) if
Some(&DefStatic(def_id, _)) |
Some(&DefConst(def_id)) if
ast_util::is_local(def_id) => {
self.visit_item(&*self.ast_map.expect_item(def_id.node));
}
+3 -3
View File
@@ -87,7 +87,7 @@ pub fn join_all<It: Iterator<constness>>(mut cs: It) -> constness {
fn lookup_const<'a>(tcx: &'a ty::ctxt, e: &Expr) -> Option<&'a Expr> {
let opt_def = tcx.def_map.borrow().find_copy(&e.id);
match opt_def {
Some(def::DefStatic(def_id, false)) => {
Some(def::DefConst(def_id)) => {
lookup_const_by_id(tcx, def_id)
}
Some(def::DefVariant(enum_def, variant_def, _)) => {
@@ -155,7 +155,7 @@ pub fn lookup_const_by_id<'a>(tcx: &'a ty::ctxt, def_id: ast::DefId)
match tcx.map.find(def_id.node) {
None => None,
Some(ast_map::NodeItem(it)) => match it.node {
ItemStatic(_, ast::MutImmutable, ref const_expr) => {
ItemConst(_, ref const_expr) => {
Some(&**const_expr)
}
_ => None
@@ -173,7 +173,7 @@ pub fn lookup_const_by_id<'a>(tcx: &'a ty::ctxt, def_id: ast::DefId)
let expr_id = match csearch::maybe_get_item_ast(tcx, def_id,
|a, b, c, d| astencode::decode_inlined_item(a, b, c, d)) {
csearch::found(&ast::IIItem(ref item)) => match item.node {
ItemStatic(_, ast::MutImmutable, ref const_expr) => Some(const_expr.id),
ItemConst(_, ref const_expr) => Some(const_expr.id),
_ => None
},
_ => None
+2 -1
View File
@@ -215,7 +215,8 @@ fn visit_node(&mut self, node: &ast_map::Node) {
ast::ItemFn(..)
| ast::ItemEnum(..)
| ast::ItemTy(..)
| ast::ItemStatic(..) => {
| ast::ItemStatic(..)
| ast::ItemConst(..) => {
visit::walk_item(self, &*item);
}
_ => ()
+2 -1
View File
@@ -20,6 +20,7 @@ pub enum Def {
DefMod(ast::DefId),
DefForeignMod(ast::DefId),
DefStatic(ast::DefId, bool /* is_mutbl */),
DefConst(ast::DefId),
DefLocal(ast::NodeId),
DefVariant(ast::DefId /* enum */, ast::DefId /* variant */, bool /* is_structure */),
DefTy(ast::DefId, bool /* is_enum */),
@@ -61,7 +62,7 @@ pub fn def_id(&self) -> ast::DefId {
DefForeignMod(id) | DefStatic(id, _) |
DefVariant(_, id, _) | DefTy(id, _) | DefAssociatedTy(id) |
DefTyParam(_, id, _) | DefUse(id) | DefStruct(id) | DefTrait(id) |
DefMethod(id, _) => {
DefMethod(id, _) | DefConst(id) => {
id
}
DefLocal(id) |
+1 -1
View File
@@ -267,7 +267,7 @@ fn consume_exprs(&mut self, exprs: &Vec<P<ast::Expr>>) {
}
}
fn consume_expr(&mut self, expr: &ast::Expr) {
pub fn consume_expr(&mut self, expr: &ast::Expr) {
debug!("consume_expr(expr={})", expr.repr(self.tcx()));
let cmt = return_if_err!(self.mc.cat_expr(expr));
+4 -4
View File
@@ -58,20 +58,20 @@ pub struct Edge<E> {
#[deriving(Clone, PartialEq, Show)]
pub struct NodeIndex(pub uint);
#[allow(non_uppercase_statics)]
pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
#[deriving(PartialEq)]
pub struct EdgeIndex(pub uint);
#[allow(non_uppercase_statics)]
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
// Use a private field here to guarantee no more instances are created:
#[deriving(Show)]
pub struct Direction { repr: uint }
#[allow(non_uppercase_statics)]
pub static Outgoing: Direction = Direction { repr: 0 };
pub const Outgoing: Direction = Direction { repr: 0 };
#[allow(non_uppercase_statics)]
pub static Incoming: Direction = Direction { repr: 1 };
pub const Incoming: Direction = Direction { repr: 1 };
impl NodeIndex {
fn get(&self) -> uint { let NodeIndex(v) = *self; v }
+2 -2
View File
@@ -544,7 +544,7 @@ pub fn cat_def(&self,
match def {
def::DefStruct(..) | def::DefVariant(..) | def::DefFn(..) |
def::DefStaticMethod(..) => {
def::DefStaticMethod(..) | def::DefConst(..) => {
Ok(self.cat_rvalue_node(id, span, expr_ty))
}
def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) |
@@ -1104,7 +1104,7 @@ pub fn cat_pattern(&self,
|x,y,z| op(x,y,z)));
}
}
Some(&def::DefStatic(..)) => {
Some(&def::DefConst(..)) => {
for subpat in subpats.iter() {
if_ok!(self.cat_pattern(cmt.clone(), &**subpat, |x,y,z| op(x,y,z)));
}
+1 -1
View File
@@ -46,7 +46,7 @@ pub fn pat_is_const(dm: &resolve::DefMap, pat: &Pat) -> bool {
match pat.node {
PatIdent(_, _, None) | PatEnum(..) => {
match dm.borrow().find(&pat.id) {
Some(&DefStatic(_, false)) => true,
Some(&DefConst(..)) => true,
_ => false
}
}
+3 -2
View File
@@ -805,6 +805,7 @@ fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
def::DefStaticMethod(..) => ck("static method"),
def::DefFn(..) => ck("function"),
def::DefStatic(..) => ck("static"),
def::DefConst(..) => ck("const"),
def::DefVariant(..) => ck("variant"),
def::DefTy(_, false) => ck("type"),
def::DefTy(_, true) => ck("enum"),
@@ -1181,7 +1182,7 @@ fn check_sane_privacy(&self, item: &ast::Item) {
}
}
ast::ItemStatic(..) | ast::ItemStruct(..) |
ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemStruct(..) |
ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
ast::ItemMac(..) => {}
}
@@ -1245,7 +1246,7 @@ fn check_inherited(tcx: &ty::ctxt, sp: Span, vis: ast::Visibility) {
}
}
ast::ItemStatic(..) |
ast::ItemStatic(..) | ast::ItemConst(..) |
ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
ast::ItemMac(..) => {}
}
+16 -23
View File
@@ -27,7 +27,6 @@
use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::{is_local, PostExpansionMethod};
use syntax::ast_util;
use syntax::attr::{InlineAlways, InlineHint, InlineNever, InlineNone};
use syntax::attr;
use syntax::visit::Visitor;
@@ -121,15 +120,14 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
self.worklist.push(def_id.node)
} else {
match def {
// If this path leads to a static, then we may have
// to do some work to figure out whether the static
// is indeed reachable. (Inlineable statics are
// never reachable.)
def::DefStatic(..) => {
// If this path leads to a constant, then we need to
// recurse into the constant to continue finding
// items that are reachable.
def::DefConst(..) => {
self.worklist.push(def_id.node);
}
// If this wasn't a static, then this destination is
// If this wasn't a static, then the destination is
// surely reachable.
_ => {
self.reachable_symbols.insert(def_id.node);
@@ -238,15 +236,14 @@ fn def_id_represents_local_inlined_item(&self, def_id: ast::DefId) -> bool {
fn propagate(&mut self) {
let mut scanned = HashSet::new();
loop {
if self.worklist.len() == 0 {
break
}
let search_item = self.worklist.pop().unwrap();
if scanned.contains(&search_item) {
let search_item = match self.worklist.pop() {
Some(item) => item,
None => break,
};
if !scanned.insert(search_item) {
continue
}
scanned.insert(search_item);
match self.tcx.map.find(search_item) {
Some(ref item) => self.propagate_node(item, search_item),
None if search_item == ast::CRATE_NODE_ID => {}
@@ -297,21 +294,17 @@ fn propagate_node(&mut self, node: &ast_map::Node,
}
}
// Statics with insignificant addresses are not reachable
// because they're inlined specially into all other crates.
ast::ItemStatic(_, mutbl, ref init) => {
if !ast_util::static_has_significant_address(
mutbl,
item.attrs.as_slice()) {
self.reachable_symbols.remove(&search_item);
}
visit::walk_expr(self, &**init);
// Reachable constants will be inlined into other crates
// unconditionally, so we need to make sure that their
// contents are also reachable.
ast::ItemConst(_, ref init) => {
self.visit_expr(&**init);
}
// These are normal, nothing reachable about these
// inherently and their children are already in the
// worklist, as determined by the privacy pass
ast::ItemTy(..) |
ast::ItemTy(..) | ast::ItemStatic(_, _, _) |
ast::ItemMod(..) | ast::ItemForeignMod(..) |
ast::ItemImpl(..) | ast::ItemTrait(..) |
ast::ItemStruct(..) | ast::ItemEnum(..) => {}
+15 -6
View File
@@ -29,7 +29,7 @@
use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic, Generics};
use syntax::ast::{Ident, ImplItem, Item, ItemEnum, ItemFn, ItemForeignMod};
use syntax::ast::{ItemImpl, ItemMac, ItemMod, ItemStatic, ItemStruct};
use syntax::ast::{ItemTrait, ItemTy, LOCAL_CRATE, Local};
use syntax::ast::{ItemTrait, ItemTy, LOCAL_CRATE, Local, ItemConst};
use syntax::ast::{MethodImplItem, Mod, Name, NamedField, NodeId};
use syntax::ast::{Pat, PatEnum, PatIdent, PatLit};
use syntax::ast::{PatRange, PatStruct, Path, PathListIdent, PathListMod};
@@ -1243,6 +1243,12 @@ fn build_reduced_graph_for_item(&mut self,
(DefStatic(local_def(item.id), mutbl), sp, is_public);
parent
}
ItemConst(_, _) => {
self.add_child(ident, parent.clone(), ForbidDuplicateValues, sp)
.define_value(DefConst(local_def(item.id)),
sp, is_public);
parent
}
ItemFn(_, fn_style, _, _, _) => {
let name_bindings =
self.add_child(ident, parent.clone(), ForbidDuplicateValues, sp);
@@ -1829,7 +1835,7 @@ fn handle_external_def(&mut self,
csearch::get_tuple_struct_definition_if_ctor(&self.session.cstore, ctor_id)
.map_or(def, |_| DefStruct(ctor_id)), DUMMY_SP, is_public);
}
DefFn(..) | DefStaticMethod(..) | DefStatic(..) => {
DefFn(..) | DefStaticMethod(..) | DefStatic(..) | DefConst(..) => {
debug!("(building reduced graph for external \
crate) building value (fn/static) {}", final_ident);
child_name_bindings.define_value(def, DUMMY_SP, is_public);
@@ -4216,7 +4222,7 @@ fn resolve_item(&mut self, item: &Item) {
&**block);
}
ItemStatic(..) => {
ItemConst(..) | ItemStatic(..) => {
self.with_constant_rib(|this| {
visit::walk_item(this, item);
});
@@ -5106,6 +5112,7 @@ struct or enum variant",
Some(def @ (DefFn(..), _)) |
Some(def @ (DefVariant(..), _)) |
Some(def @ (DefStruct(..), _)) |
Some(def @ (DefConst(..), _)) |
Some(def @ (DefStatic(..), _)) => {
self.record_def(pattern.id, def);
}
@@ -5193,12 +5200,14 @@ fn resolve_bare_identifier_pattern(&mut self, name: Ident, span: Span)
def @ DefVariant(..) | def @ DefStruct(..) => {
return FoundStructOrEnumVariant(def, LastMod(AllPublic));
}
def @ DefStatic(_, false) => {
def @ DefConst(..) => {
return FoundConst(def, LastMod(AllPublic));
}
DefStatic(_, true) => {
DefStatic(..) => {
self.resolve_error(span,
"mutable static variables cannot be referenced in a pattern");
"static variables cannot be \
referenced in a pattern, \
use a `const` instead");
return BareIdentifierPatternUnresolved;
}
_ => {
+1 -1
View File
@@ -92,7 +92,7 @@ fn visit_item(&mut self, item: &ast::Item) {
ast::ItemMod(..) |
ast::ItemMac(..) |
ast::ItemForeignMod(..) |
ast::ItemStatic(..) => {
ast::ItemStatic(..) | ast::ItemConst(..) => {
self.with(|_, f| f(RootScope), |v| visit::walk_item(v, item));
return;
}
+29
View File
@@ -230,6 +230,7 @@ fn lookup_def_kind(&self, ref_id: NodeId, span: Span) -> Option<recorder::Row> {
def::DefAssociatedTy(..) |
def::DefTrait(_) => Some(recorder::TypeRef),
def::DefStatic(_, _) |
def::DefConst(_) |
def::DefLocal(_) |
def::DefVariant(_, _, _) |
def::DefUpvar(..) => Some(recorder::VarRef),
@@ -521,6 +522,29 @@ fn process_static(&mut self,
self.visit_expr(expr);
}
fn process_const(&mut self,
item: &ast::Item,
typ: &ast::Ty,
expr: &ast::Expr)
{
let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
let sub_span = self.span.sub_span_after_keyword(item.span,
keywords::Const);
self.fmt.static_str(item.span,
sub_span,
item.id,
get_ident(item.ident).get(),
qualname.as_slice(),
"",
ty_to_string(&*typ).as_slice(),
self.cur_scope);
// walk type and init value
self.visit_ty(&*typ);
self.visit_expr(expr);
}
fn process_struct(&mut self,
item: &ast::Item,
def: &ast::StructDef,
@@ -740,6 +764,7 @@ fn process_path(&mut self,
def::DefUpvar(..) |
def::DefLocal(..) |
def::DefStatic(..) |
def::DefConst(..) |
def::DefVariant(..) => self.fmt.ref_str(recorder::VarRef,
ex.span,
sub_span,
@@ -807,6 +832,7 @@ fn process_path(&mut self,
},
def::DefLocal(_) |
def::DefStatic(_,_) |
def::DefConst(..) |
def::DefStruct(_) |
def::DefFn(..) => self.write_sub_paths_truncated(path),
_ => {},
@@ -1008,6 +1034,8 @@ fn visit_item(&mut self, item: &ast::Item) {
self.process_fn(item, &**decl, ty_params, &**body),
ast::ItemStatic(ref typ, mt, ref expr) =>
self.process_static(item, &**typ, mt, &**expr),
ast::ItemConst(ref typ, ref expr) =>
self.process_const(item, &**typ, &**expr),
ast::ItemStruct(ref def, ref ty_params) => self.process_struct(item, &**def, ty_params),
ast::ItemEnum(ref def, ref ty_params) => self.process_enum(item, def, ty_params),
ast::ItemImpl(ref ty_params,
@@ -1386,6 +1414,7 @@ fn visit_arm(&mut self, arm: &ast::Arm) {
self.cur_scope),
// FIXME(nrc) what is this doing here?
def::DefStatic(_, _) => {}
def::DefConst(..) => {}
_ => error!("unexpected definition kind when processing collected paths: {:?}",
*def)
}
View File
+34 -14
View File
@@ -271,14 +271,14 @@ fn trans<'blk, 'tcx>(&self, mut bcx: Block<'blk, 'tcx>) -> OptResult<'blk, 'tcx>
match *self {
ConstantValue(ConstantExpr(lit_expr)) => {
let lit_ty = ty::node_id_to_type(bcx.tcx(), lit_expr.id);
let (llval, _, _) = consts::const_expr(ccx, &*lit_expr, true);
let (llval, _) = consts::const_expr(ccx, &*lit_expr);
let lit_datum = immediate_rvalue(llval, lit_ty);
let lit_datum = unpack_datum!(bcx, lit_datum.to_appropriate_datum(bcx));
SingleResult(Result::new(bcx, lit_datum.val))
}
ConstantRange(ConstantExpr(ref l1), ConstantExpr(ref l2)) => {
let (l1, _, _) = consts::const_expr(ccx, &**l1, true);
let (l2, _, _) = consts::const_expr(ccx, &**l2, true);
let (l1, _) = consts::const_expr(ccx, &**l1);
let (l2, _) = consts::const_expr(ccx, &**l2);
RangeResult(Result::new(bcx, l1), Result::new(bcx, l2))
}
Variant(disr_val, ref repr, _) => {
@@ -350,7 +350,20 @@ struct ArmData<'p, 'blk, 'tcx: 'blk> {
struct Match<'a, 'p: 'a, 'blk: 'a, 'tcx: 'blk> {
pats: Vec<&'p ast::Pat>,
data: &'a ArmData<'p, 'blk, 'tcx>,
bound_ptrs: Vec<(Ident, ValueRef)>
bound_ptrs: Vec<(Ident, ValueRef)>,
// This is a pointer to an instance of check_match::DUMMY_WILD_PAT. The
// check_match code requires that we pass this in (with the same lifetime as
// the patterns passed in). Unfortunately this is required to be propagated
// into this structure in order to get the lifetimes to work.
//
// Lots of the `check_match` code will deal with &DUMMY_WILD_PAT when
// returning references, which used to have the `'static` lifetime before
// const was added to the language. The DUMMY_WILD_PAT does not implement
// Sync, however, so it must be a const, which longer has a static lifetime,
// hence we're passing it in here. This certainly isn't crucial, and if it
// can be removed, please do!
dummy: &'p ast::Pat,
}
impl<'a, 'p, 'blk, 'tcx> Repr for Match<'a, 'p, 'blk, 'tcx> {
@@ -403,21 +416,22 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
*pats.get_mut(col) = pat;
Match {
pats: pats,
dummy: br.dummy,
data: &*br.data,
bound_ptrs: bound_ptrs
}
}).collect()
}
type EnterPatterns<'a> = <'p> |&[&'p ast::Pat]|: 'a -> Option<Vec<&'p ast::Pat>>;
type EnterPatterns<'a, 'p> = |&[&'p ast::Pat]|: 'a -> Option<Vec<&'p ast::Pat>>;
fn enter_match<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
dm: &DefMap,
m: &[Match<'a, 'p, 'blk, 'tcx>],
col: uint,
val: ValueRef,
e: EnterPatterns)
-> Vec<Match<'a, 'p, 'blk, 'tcx>> {
fn enter_match<'a, 'b, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
dm: &DefMap,
m: &[Match<'a, 'p, 'blk, 'tcx>],
col: uint,
val: ValueRef,
e: EnterPatterns<'b, 'p>)
-> Vec<Match<'a, 'p, 'blk, 'tcx>> {
debug!("enter_match(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
@@ -450,6 +464,7 @@ fn enter_match<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
}
Match {
pats: pats,
dummy: br.dummy,
data: br.data,
bound_ptrs: bound_ptrs
}
@@ -544,7 +559,8 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>(
let mcx = check_match::MatchCheckCtxt { tcx: bcx.tcx() };
enter_match(bcx, dm, m, col, val, |pats|
check_match::specialize(&mcx, pats.as_slice(), &ctor, col, variant_size)
check_match::specialize(&mcx, pats.as_slice(), m[0].dummy, &ctor, col,
variant_size)
)
}
@@ -1025,7 +1041,9 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
match adt_vals {
Some(field_vals) => {
let pats = enter_match(bcx, dm, m, col, val, |pats|
check_match::specialize(&mcx, pats, &check_match::Single, col, field_vals.len())
check_match::specialize(&mcx, pats, m[0].dummy,
&check_match::Single, col,
field_vals.len())
);
let vals = field_vals.append(vals_left.as_slice());
compile_submatch(bcx, pats.as_slice(), vals.as_slice(), chk, has_genuine_default);
@@ -1347,6 +1365,7 @@ fn trans_match_inner<'blk, 'tcx>(scope_cx: Block<'blk, 'tcx>,
bindings_map: create_bindings_map(bcx, &**arm.pats.get(0), discr_expr, &*arm.body)
}).collect();
let dummy = check_match::DUMMY_WILD_PAT.clone();
let mut static_inliner = StaticInliner::new(scope_cx.tcx());
let arm_pats: Vec<Vec<P<ast::Pat>>> = arm_datas.iter().map(|arm_data| {
arm_data.arm.pats.iter().map(|p| static_inliner.fold_pat((*p).clone())).collect()
@@ -1355,6 +1374,7 @@ fn trans_match_inner<'blk, 'tcx>(scope_cx: Block<'blk, 'tcx>,
for (arm_data, pats) in arm_datas.iter().zip(arm_pats.iter()) {
matches.extend(pats.iter().map(|p| Match {
pats: vec![&**p],
dummy: &dummy,
data: arm_data,
bound_ptrs: Vec::new(),
}));
+45 -65
View File
@@ -32,7 +32,7 @@
use driver::driver::{CrateAnalysis, CrateTranslation, ModuleTranslation};
use driver::session::Session;
use lint;
use llvm::{BasicBlockRef, ModuleRef, ValueRef, Vector, get_param};
use llvm::{BasicBlockRef, ValueRef, Vector, get_param};
use llvm;
use metadata::{csearch, encoder, loader};
use middle::astencode;
@@ -89,7 +89,7 @@
use std::{i8, i16, i32, i64};
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel, Rust, RustCall};
use syntax::abi::{RustIntrinsic, Abi, OsWindows};
use syntax::ast_util::{local_def, is_local};
use syntax::ast_util::local_def;
use syntax::attr::AttrMetaMethods;
use syntax::attr;
use syntax::codemap::Span;
@@ -317,17 +317,31 @@ pub fn decl_internal_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> Va
llfn
}
pub fn get_extern_const(externs: &mut ExternMap, llmod: ModuleRef,
name: &str, ty: Type) -> ValueRef {
match externs.find_equiv(&name) {
pub fn get_extern_const(ccx: &CrateContext, did: ast::DefId,
t: ty::t) -> ValueRef {
let name = csearch::get_symbol(&ccx.sess().cstore, did);
let ty = type_of(ccx, t);
match ccx.externs().borrow_mut().find(&name) {
Some(n) => return *n,
None => ()
}
unsafe {
let c = name.with_c_str(|buf| {
llvm::LLVMAddGlobal(llmod, ty.to_ref(), buf)
llvm::LLVMAddGlobal(ccx.llmod(), ty.to_ref(), buf)
});
externs.insert(name.to_string(), c);
// Thread-local statics in some other crate need to *always* be linked
// against in a thread-local fashion, so we need to be sure to apply the
// thread-local attribute locally if it was present remotely. If we
// don't do this then linker errors can be generated where the linker
// complains that one object files has a thread local version of the
// symbol and another one doesn't.
ty::each_attr(ccx.tcx(), did, |attr| {
if attr.check_name("thread_local") {
llvm::set_thread_local(c, true);
}
true
});
ccx.externs().borrow_mut().insert(name.to_string(), c);
return c;
}
}
@@ -935,11 +949,7 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val
get_extern_rust_fn(ccx, t, name.as_slice(), did)
}
_ => {
let llty = type_of(ccx, t);
get_extern_const(&mut *ccx.externs().borrow_mut(),
ccx.llmod(),
name.as_slice(),
llty)
get_extern_const(ccx, did, t)
}
}
}
@@ -2228,21 +2238,19 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
ast::ItemEnum(ref enum_definition, _) => {
enum_variant_size_lint(ccx, enum_definition, item.span, item.id);
}
ast::ItemConst(_, ref expr) => {
// Recurse on the expression to catch items in blocks
let mut v = TransItemVisitor{ ccx: ccx };
v.visit_expr(&**expr);
}
ast::ItemStatic(_, m, ref expr) => {
// Recurse on the expression to catch items in blocks
let mut v = TransItemVisitor{ ccx: ccx };
v.visit_expr(&**expr);
let trans_everywhere = attr::requests_inline(item.attrs.as_slice());
for (ref ccx, is_origin) in ccx.maybe_iter(!from_external && trans_everywhere) {
consts::trans_const(ccx, m, item.id);
let g = get_item_val(ccx, item.id);
update_linkage(ccx,
g,
Some(item.id),
if is_origin { OriginalTranslation } else { InlinedCopy });
}
consts::trans_static(ccx, m, item.id);
let g = get_item_val(ccx, item.id);
update_linkage(ccx, g, Some(item.id), OriginalTranslation);
// Do static_assert checking. It can't really be done much earlier
// because we need to get the value of the bool out of LLVM
@@ -2253,7 +2261,7 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
static");
}
let v = ccx.const_values().borrow().get_copy(&item.id);
let v = ccx.static_values().borrow().get_copy(&item.id);
unsafe {
if !(llvm::LLVMConstIntGetZExtValue(v) != 0) {
ccx.sess().span_fatal(expr.span, "static assertion failed");
@@ -2667,23 +2675,21 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
let val = match item {
ast_map::NodeItem(i) => {
let ty = ty::node_id_to_type(ccx.tcx(), i.id);
let sym = exported_name(ccx, id, ty, i.attrs.as_slice());
let sym = || exported_name(ccx, id, ty, i.attrs.as_slice());
let v = match i.node {
ast::ItemStatic(_, mutbl, ref expr) => {
ast::ItemStatic(_, _, ref expr) => {
// If this static came from an external crate, then
// we need to get the symbol from csearch instead of
// using the current crate's name/version
// information in the hash of the symbol
let sym = sym();
debug!("making {}", sym);
let is_local = !ccx.external_srcs().borrow().contains_key(&id);
// We need the translated value here, because for enums the
// LLVM type is not fully determined by the Rust type.
let (v, inlineable, ty) = consts::const_expr(ccx, &**expr, is_local);
ccx.const_values().borrow_mut().insert(id, v);
let mut inlineable = inlineable;
let (v, ty) = consts::const_expr(ccx, &**expr);
ccx.static_values().borrow_mut().insert(id, v);
unsafe {
// boolean SSA values are i1, but they have to be stored in i8 slots,
// otherwise some LLVM optimization passes don't work as expected
@@ -2694,55 +2700,30 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
};
if contains_null(sym.as_slice()) {
ccx.sess().fatal(
format!("Illegal null byte in export_name value: `{}`",
sym).as_slice());
format!("Illegal null byte in export_name \
value: `{}`", sym).as_slice());
}
let g = sym.as_slice().with_c_str(|buf| {
llvm::LLVMAddGlobal(ccx.llmod(), llty, buf)
});
// Apply the `unnamed_addr` attribute if
// requested
if !ast_util::static_has_significant_address(
mutbl,
i.attrs.as_slice()) {
llvm::SetUnnamedAddr(g, true);
// This is a curious case where we must make
// all of these statics inlineable. If a
// global is not tagged as `#[inline(never)]`,
// then LLVM won't coalesce globals unless they
// have an internal linkage type. This means that
// external crates cannot use this global.
// This is a problem for things like inner
// statics in generic functions, because the
// function will be inlined into another
// crate and then attempt to link to the
// static in the original crate, only to
// find that it's not there. On the other
// side of inlining, the crates knows to
// not declare this static as
// available_externally (because it isn't)
inlineable = true;
}
if attr::contains_name(i.attrs.as_slice(),
"thread_local") {
llvm::set_thread_local(g, true);
}
if !inlineable {
debug!("{} not inlined", sym);
ccx.non_inlineable_statics().borrow_mut()
.insert(id);
}
ccx.item_symbols().borrow_mut().insert(i.id, sym);
g
}
}
ast::ItemConst(_, ref expr) => {
let (v, _) = consts::const_expr(ccx, &**expr);
ccx.const_values().borrow_mut().insert(id, v);
v
}
ast::ItemFn(_, _, abi, _, _) => {
let sym = sym();
let llfn = if abi == Rust {
register_fn(ccx, i.span, sym, i.id, ty)
} else {
@@ -2911,7 +2892,6 @@ pub fn crate_ctxt_to_encode_parms<'a, 'tcx>(cx: &'a SharedCrateContext<'tcx>,
tcx: cx.tcx(),
reexports2: cx.exp_map2(),
item_symbols: cx.item_symbols(),
non_inlineable_statics: cx.non_inlineable_statics(),
link_meta: cx.link_meta(),
cstore: &cx.sess().cstore,
encode_inlined_item: ie,
+1
View File
@@ -196,6 +196,7 @@ fn trans_def<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, def: def::Def, ref_expr: &ast::
}
}
def::DefStatic(..) |
def::DefConst(..) |
def::DefLocal(..) |
def::DefUpvar(..) => {
datum_callee(bcx, ref_expr)
+3 -3
View File
@@ -49,9 +49,9 @@ pub struct CustomScopeIndex {
index: uint
}
pub static EXIT_BREAK: uint = 0;
pub static EXIT_LOOP: uint = 1;
pub static EXIT_MAX: uint = 2;
pub const EXIT_BREAK: uint = 0;
pub const EXIT_LOOP: uint = 1;
pub const EXIT_MAX: uint = 2;
pub enum CleanupScopeKind<'blk, 'tcx: 'blk> {
CustomScopeKind,
+106 -100
View File
@@ -33,7 +33,6 @@
use util::ppaux::{Repr, ty_to_string};
use std::c_str::ToCStr;
use std::vec;
use libc::c_uint;
use syntax::{ast, ast_util};
use syntax::ptr::P;
@@ -96,24 +95,20 @@ pub fn const_ptrcast(cx: &CrateContext, a: ValueRef, t: Type) -> ValueRef {
}
}
// Helper function because we don't have tuple-swizzling.
fn first_two<R, S, T>((a, b, _): (R, S, T)) -> (R, S) {
(a, b)
}
fn const_vec(cx: &CrateContext, e: &ast::Expr,
es: &[P<ast::Expr>], is_local: bool) -> (ValueRef, Type, bool) {
es: &[P<ast::Expr>]) -> (ValueRef, Type) {
let vec_ty = ty::expr_ty(cx.tcx(), e);
let unit_ty = ty::sequence_element_type(cx.tcx(), vec_ty);
let llunitty = type_of::type_of(cx, unit_ty);
let (vs, inlineable) = vec::unzip(es.iter().map(|e| first_two(const_expr(cx, &**e, is_local))));
let vs = es.iter().map(|e| const_expr(cx, &**e).val0())
.collect::<Vec<_>>();
// If the vector contains enums, an LLVM array won't work.
let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
C_struct(cx, vs.as_slice(), false)
} else {
C_array(llunitty, vs.as_slice())
};
(v, llunitty, inlineable.iter().fold(true, |a, &b| a && b))
(v, llunitty)
}
pub fn const_addr_of(cx: &CrateContext, cv: ValueRef, mutbl: ast::Mutability) -> ValueRef {
@@ -177,7 +172,7 @@ fn const_deref(cx: &CrateContext, v: ValueRef, t: ty::t, explicit: bool)
}
pub fn get_const_val(cx: &CrateContext,
mut def_id: ast::DefId) -> (ValueRef, bool) {
mut def_id: ast::DefId) -> ValueRef {
let contains_key = cx.const_values().borrow().contains_key(&def_id.node);
if !ast_util::is_local(def_id) || !contains_key {
if !ast_util::is_local(def_id) {
@@ -185,21 +180,17 @@ pub fn get_const_val(cx: &CrateContext,
}
match cx.tcx().map.expect_item(def_id.node).node {
ast::ItemStatic(_, ast::MutImmutable, _) => {
trans_const(cx, ast::MutImmutable, def_id.node);
}
ast::ItemConst(..) => { base::get_item_val(cx, def_id.node); }
_ => {}
}
}
(cx.const_values().borrow().get_copy(&def_id.node),
!cx.non_inlineable_statics().borrow().contains(&def_id.node))
cx.const_values().borrow().get_copy(&def_id.node)
}
pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef, bool, ty::t) {
let (llconst, inlineable) = const_expr_unadjusted(cx, e, is_local);
pub fn const_expr(cx: &CrateContext, e: &ast::Expr) -> (ValueRef, ty::t) {
let llconst = const_expr_unadjusted(cx, e);
let mut llconst = llconst;
let mut inlineable = inlineable;
let ety = ty::expr_ty(cx.tcx(), e);
let mut ety_adjusted = ty::expr_ty_adjusted(cx.tcx(), e);
let opt_adj = cx.tcx().adjustments.borrow().find_copy(&e.id);
@@ -213,7 +204,7 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef
ety_adjusted,
def,
llconst,
is_local);
true);
llconst = C_struct(cx, [wrapper, C_null(Type::i8p(cx))], false)
}
ty::AdjustAddEnv(store) => {
@@ -250,7 +241,6 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef
// Don't copy data to do a deref+ref
// (i.e., skip the last auto-deref).
if adj.autoderefs == 0 {
inlineable = false;
llconst = const_addr_of(cx, llconst, ast::MutImmutable);
}
}
@@ -271,7 +261,6 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef
match ty::get(ty).sty {
ty::ty_vec(unit_ty, Some(len)) => {
inlineable = false;
let llunitty = type_of::type_of(cx, unit_ty);
let llptr = const_ptrcast(cx, llconst, llunitty);
assert_eq!(abi::slice_elt_base, 0);
@@ -314,29 +303,25 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef
e.repr(cx.tcx()), ty_to_string(cx.tcx(), ety),
csize, tsize).as_slice());
}
(llconst, inlineable, ety_adjusted)
(llconst, ety_adjusted)
}
// the bool returned is whether this expression can be inlined into other crates
// if it's assigned to a static.
fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
is_local: bool) -> (ValueRef, bool) {
fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
let map_list = |exprs: &[P<ast::Expr>]| {
exprs.iter().map(|e| first_two(const_expr(cx, &**e, is_local)))
.fold((Vec::new(), true),
|(l, all_inlineable), (val, inlineable)| {
(l.append_one(val), all_inlineable && inlineable)
})
exprs.iter().map(|e| const_expr(cx, &**e).val0())
.fold(Vec::new(), |l, val| l.append_one(val))
};
unsafe {
let _icx = push_ctxt("const_expr");
return match e.node {
ast::ExprLit(ref lit) => {
(consts::const_lit(cx, e, &**lit), true)
consts::const_lit(cx, e, &**lit)
}
ast::ExprBinary(b, ref e1, ref e2) => {
let (te1, _, _) = const_expr(cx, &**e1, is_local);
let (te2, _, _) = const_expr(cx, &**e2, is_local);
let (te1, _) = const_expr(cx, &**e1);
let (te2, _) = const_expr(cx, &**e2);
let te2 = base::cast_shift_const_rhs(b, te1, te2);
@@ -345,7 +330,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
let ty = ty::expr_ty(cx.tcx(), &**e1);
let is_float = ty::type_is_fp(ty);
let signed = ty::type_is_signed(ty);
return (match b {
return match b {
ast::BiAdd => {
if is_float { llvm::LLVMConstFAdd(te1, te2) }
else { llvm::LLVMConstAdd(te1, te2) }
@@ -414,13 +399,13 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
else { ConstICmp(IntUGT, te1, te2) }
}
},
}, true)
}
},
ast::ExprUnary(u, ref e) => {
let (te, _, _) = const_expr(cx, &**e, is_local);
let (te, _) = const_expr(cx, &**e);
let ty = ty::expr_ty(cx.tcx(), &**e);
let is_float = ty::type_is_fp(ty);
return (match u {
return match u {
ast::UnUniq | ast::UnDeref => {
let (dv, _dt) = const_deref(cx, te, ty, true);
dv
@@ -430,26 +415,26 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
if is_float { llvm::LLVMConstFNeg(te) }
else { llvm::LLVMConstNeg(te) }
}
}, true)
}
}
ast::ExprField(ref base, field, _) => {
let (bv, inlineable, bt) = const_expr(cx, &**base, is_local);
let (bv, bt) = const_expr(cx, &**base);
let brepr = adt::represent_type(cx, bt);
expr::with_field_tys(cx.tcx(), bt, None, |discr, field_tys| {
let ix = ty::field_idx_strict(cx.tcx(), field.node.name, field_tys);
(adt::const_get_field(cx, &*brepr, bv, discr, ix), inlineable)
adt::const_get_field(cx, &*brepr, bv, discr, ix)
})
}
ast::ExprTupField(ref base, idx, _) => {
let (bv, inlineable, bt) = const_expr(cx, &**base, is_local);
let (bv, bt) = const_expr(cx, &**base);
let brepr = adt::represent_type(cx, bt);
expr::with_field_tys(cx.tcx(), bt, None, |discr, _| {
(adt::const_get_field(cx, &*brepr, bv, discr, idx.node), inlineable)
adt::const_get_field(cx, &*brepr, bv, discr, idx.node)
})
}
ast::ExprIndex(ref base, ref index) => {
let (bv, inlineable, bt) = const_expr(cx, &**base, is_local);
let (bv, bt) = const_expr(cx, &**base);
let iv = match const_eval::eval_const_expr(cx.tcx(), &**index) {
const_eval::const_int(i) => i as u64,
const_eval::const_uint(u) => u,
@@ -500,13 +485,13 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
cx.sess().span_err(e.span,
"const index-expr is out of bounds");
}
(const_get_elt(cx, arr, [iv as c_uint]), inlineable)
const_get_elt(cx, arr, [iv as c_uint])
}
ast::ExprCast(ref base, _) => {
let ety = ty::expr_ty(cx.tcx(), e);
let llty = type_of::type_of(cx, ety);
let (v, inlineable, basety) = const_expr(cx, &**base, is_local);
return (match (expr::cast_type_kind(cx.tcx(), basety),
let (v, basety) = const_expr(cx, &**base);
return match (expr::cast_type_kind(cx.tcx(), basety),
expr::cast_type_kind(cx.tcx(), ety)) {
(expr::cast_integral, expr::cast_integral) => {
@@ -554,17 +539,38 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
cx.sess().impossible_case(e.span,
"bad combination of types for cast")
}
}, inlineable)
}
}
ast::ExprAddrOf(mutbl, ref sub) => {
let (e, _, _) = const_expr(cx, &**sub, is_local);
(const_addr_of(cx, e, mutbl), false)
// If this is the address of some static, then we need to return
// the actual address of the static itself (short circuit the rest
// of const eval).
let mut cur = sub;
loop {
match cur.node {
ast::ExprParen(ref sub) => cur = sub,
_ => break,
}
}
let opt_def = cx.tcx().def_map.borrow().find_copy(&cur.id);
match opt_def {
Some(def::DefStatic(def_id, _)) => {
let ty = ty::expr_ty(cx.tcx(), e);
return get_static_val(cx, def_id, ty);
}
_ => {}
}
// If this isn't the address of a static, then keep going through
// normal constant evaluation.
let (e, _) = const_expr(cx, &**sub);
const_addr_of(cx, e, mutbl)
}
ast::ExprTup(ref es) => {
let ety = ty::expr_ty(cx.tcx(), e);
let repr = adt::represent_type(cx, ety);
let (vals, inlineable) = map_list(es.as_slice());
(adt::trans_const(cx, &*repr, 0, vals.as_slice()), inlineable)
let vals = map_list(es.as_slice());
adt::trans_const(cx, &*repr, 0, vals.as_slice())
}
ast::ExprStruct(_, ref fs, ref base_opt) => {
let ety = ty::expr_ty(cx.tcx(), e);
@@ -572,36 +578,34 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
let tcx = cx.tcx();
let base_val = match *base_opt {
Some(ref base) => Some(const_expr(cx, &**base, is_local)),
Some(ref base) => Some(const_expr(cx, &**base)),
None => None
};
expr::with_field_tys(tcx, ety, Some(e.id), |discr, field_tys| {
let (cs, inlineable) = vec::unzip(field_tys.iter().enumerate()
.map(|(ix, &field_ty)| {
let cs = field_tys.iter().enumerate()
.map(|(ix, &field_ty)| {
match fs.iter().find(|f| field_ty.ident.name == f.ident.node.name) {
Some(ref f) => first_two(const_expr(cx, &*f.expr, is_local)),
Some(ref f) => const_expr(cx, &*f.expr).val0(),
None => {
match base_val {
Some((bv, inlineable, _)) => {
(adt::const_get_field(cx, &*repr, bv, discr, ix),
inlineable)
}
None => cx.sess().span_bug(e.span, "missing struct field")
Some((bv, _)) => {
adt::const_get_field(cx, &*repr, bv,
discr, ix)
}
None => {
cx.sess().span_bug(e.span,
"missing struct field")
}
}
}
}
}));
(adt::trans_const(cx, &*repr, discr, cs.as_slice()),
inlineable.iter().fold(true, |a, &b| a && b))
}).collect::<Vec<_>>();
adt::trans_const(cx, &*repr, discr, cs.as_slice())
})
}
ast::ExprVec(ref es) => {
let (v, _, inlineable) = const_vec(cx,
e,
es.as_slice(),
is_local);
(v, inlineable)
const_vec(cx, e, es.as_slice()).val0()
}
ast::ExprRepeat(ref elem, ref count) => {
let vec_ty = ty::expr_ty(cx.tcx(), e);
@@ -612,13 +616,12 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
const_eval::const_uint(i) => i as uint,
_ => cx.sess().span_bug(count.span, "count must be integral const expression.")
};
let vs = Vec::from_elem(n, const_expr(cx, &**elem, is_local).val0());
let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
let vs = Vec::from_elem(n, const_expr(cx, &**elem).val0());
if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
C_struct(cx, vs.as_slice(), false)
} else {
C_array(llunitty, vs.as_slice())
};
(v, true)
}
}
ast::ExprPath(ref pth) => {
// Assert that there are no type parameters in this path.
@@ -629,13 +632,13 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
Some(def::DefFn(def_id, _fn_style, _)) => {
if !ast_util::is_local(def_id) {
let ty = csearch::get_type(cx.tcx(), def_id).ty;
(base::trans_external_path(cx, def_id, ty), true)
base::trans_external_path(cx, def_id, ty)
} else {
assert!(ast_util::is_local(def_id));
(base::get_item_val(cx, def_id.node), true)
base::get_item_val(cx, def_id.node)
}
}
Some(def::DefStatic(def_id, false)) => {
Some(def::DefConst(def_id)) => {
get_const_val(cx, def_id)
}
Some(def::DefVariant(enum_did, variant_did, _)) => {
@@ -644,15 +647,16 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
let vinfo = ty::enum_variant_with_id(cx.tcx(),
enum_did,
variant_did);
(adt::trans_const(cx, &*repr, vinfo.disr_val, []), true)
adt::trans_const(cx, &*repr, vinfo.disr_val, [])
}
Some(def::DefStruct(_)) => {
let ety = ty::expr_ty(cx.tcx(), e);
let llty = type_of::type_of(cx, ety);
(C_null(llty), true)
C_null(llty)
}
_ => {
cx.sess().span_bug(e.span, "expected a const, fn, struct, or variant def")
cx.sess().span_bug(e.span, "expected a const, fn, struct, \
or variant def")
}
}
}
@@ -662,9 +666,8 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
Some(def::DefStruct(_)) => {
let ety = ty::expr_ty(cx.tcx(), e);
let repr = adt::represent_type(cx, ety);
let (arg_vals, inlineable) = map_list(args.as_slice());
(adt::trans_const(cx, &*repr, 0, arg_vals.as_slice()),
inlineable)
let arg_vals = map_list(args.as_slice());
adt::trans_const(cx, &*repr, 0, arg_vals.as_slice())
}
Some(def::DefVariant(enum_did, variant_did, _)) => {
let ety = ty::expr_ty(cx.tcx(), e);
@@ -672,20 +675,20 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
let vinfo = ty::enum_variant_with_id(cx.tcx(),
enum_did,
variant_did);
let (arg_vals, inlineable) = map_list(args.as_slice());
(adt::trans_const(cx,
&*repr,
vinfo.disr_val,
arg_vals.as_slice()), inlineable)
let arg_vals = map_list(args.as_slice());
adt::trans_const(cx,
&*repr,
vinfo.disr_val,
arg_vals.as_slice())
}
_ => cx.sess().span_bug(e.span, "expected a struct or variant def")
}
}
ast::ExprParen(ref e) => first_two(const_expr(cx, &**e, is_local)),
ast::ExprParen(ref e) => const_expr(cx, &**e).val0(),
ast::ExprBlock(ref block) => {
match block.expr {
Some(ref expr) => first_two(const_expr(cx, &**expr, is_local)),
None => (C_nil(cx), true)
Some(ref expr) => const_expr(cx, &**expr).val0(),
None => C_nil(cx)
}
}
_ => cx.sess().span_bug(e.span,
@@ -694,13 +697,13 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
}
}
pub fn trans_const(ccx: &CrateContext, m: ast::Mutability, id: ast::NodeId) {
pub fn trans_static(ccx: &CrateContext, m: ast::Mutability, id: ast::NodeId) {
unsafe {
let _icx = push_ctxt("trans_const");
let _icx = push_ctxt("trans_static");
let g = base::get_item_val(ccx, id);
// At this point, get_item_val has already translated the
// constant's initializer to determine its LLVM type.
let v = ccx.const_values().borrow().get_copy(&id);
let v = ccx.static_values().borrow().get_copy(&id);
// boolean SSA values are i1, but they have to be stored in i8 slots,
// otherwise some LLVM optimization passes don't work as expected
let v = if llvm::LLVMTypeOf(v) == Type::i1(ccx).to_ref() {
@@ -710,17 +713,20 @@ pub fn trans_const(ccx: &CrateContext, m: ast::Mutability, id: ast::NodeId) {
};
llvm::LLVMSetInitializer(g, v);
// `get_item_val` left `g` with external linkage, but we just set an
// initializer for it. But we don't know yet if `g` should really be
// defined in this compilation unit, so we set its linkage to
// `AvailableExternallyLinkage`. (It's still a definition, but acts
// like a declaration for most purposes.) If `g` really should be
// declared here, then `trans_item` will fix up the linkage later on.
llvm::SetLinkage(g, llvm::AvailableExternallyLinkage);
// As an optimization, all shared statics which do not have interior
// mutability are placed into read-only memory.
if m != ast::MutMutable {
llvm::LLVMSetGlobalConstant(g, True);
let node_ty = ty::node_id_to_type(ccx.tcx(), id);
let tcontents = ty::type_contents(ccx.tcx(), node_ty);
if !tcontents.interior_unsafe() {
llvm::LLVMSetGlobalConstant(g, True);
}
}
debuginfo::create_global_var_metadata(ccx, id, g);
}
}
fn get_static_val(ccx: &CrateContext, did: ast::DefId, ty: ty::t) -> ValueRef {
if ast_util::is_local(did) { return base::get_item_val(ccx, did.node) }
base::trans_external_path(ccx, did, ty)
}
+8 -13
View File
@@ -66,10 +66,6 @@ pub struct SharedCrateContext<'tcx> {
reachable: NodeSet,
item_symbols: RefCell<NodeMap<String>>,
link_meta: LinkMeta,
/// A set of static items which cannot be inlined into other crates. This
/// will prevent in IIItem() structures from being encoded into the metadata
/// that is generated
non_inlineable_statics: RefCell<NodeSet>,
symbol_hasher: RefCell<Sha256>,
tcx: ty::ctxt<'tcx>,
stats: Stats,
@@ -121,6 +117,9 @@ pub struct LocalCrateContext {
/// Cache of emitted const values
const_values: RefCell<NodeMap<ValueRef>>,
/// Cache of emitted static values
static_values: RefCell<NodeMap<ValueRef>>,
/// Cache of external const values
extern_const_values: RefCell<DefIdMap<ValueRef>>,
@@ -259,7 +258,6 @@ pub fn new(crate_name: &str,
reachable: reachable,
item_symbols: RefCell::new(NodeMap::new()),
link_meta: link_meta,
non_inlineable_statics: RefCell::new(NodeSet::new()),
symbol_hasher: RefCell::new(symbol_hasher),
tcx: tcx,
stats: Stats {
@@ -351,10 +349,6 @@ pub fn link_meta<'a>(&'a self) -> &'a LinkMeta {
&self.link_meta
}
pub fn non_inlineable_statics<'a>(&'a self) -> &'a RefCell<NodeSet> {
&self.non_inlineable_statics
}
pub fn symbol_hasher<'a>(&'a self) -> &'a RefCell<Sha256> {
&self.symbol_hasher
}
@@ -414,6 +408,7 @@ fn new(shared: &SharedCrateContext,
const_cstr_cache: RefCell::new(HashMap::new()),
const_globals: RefCell::new(HashMap::new()),
const_values: RefCell::new(NodeMap::new()),
static_values: RefCell::new(NodeMap::new()),
extern_const_values: RefCell::new(DefIdMap::new()),
impl_method_cache: RefCell::new(HashMap::new()),
closure_bare_wrapper_cache: RefCell::new(HashMap::new()),
@@ -610,10 +605,6 @@ pub fn external_srcs<'a>(&'a self) -> &'a RefCell<NodeMap<ast::DefId>> {
&self.local.external_srcs
}
pub fn non_inlineable_statics<'a>(&'a self) -> &'a RefCell<NodeSet> {
&self.shared.non_inlineable_statics
}
pub fn monomorphized<'a>(&'a self) -> &'a RefCell<HashMap<MonoId, ValueRef>> {
&self.local.monomorphized
}
@@ -638,6 +629,10 @@ pub fn const_values<'a>(&'a self) -> &'a RefCell<NodeMap<ValueRef>> {
&self.local.const_values
}
pub fn static_values<'a>(&'a self) -> &'a RefCell<NodeMap<ValueRef>> {
&self.local.static_values
}
pub fn extern_const_values<'a>(&'a self) -> &'a RefCell<DefIdMap<ValueRef>> {
&self.local.extern_const_values
}
+1
View File
@@ -776,6 +776,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
ast_map::NodeItem(item) => {
match item.node {
ast::ItemStatic(..) => (item.ident, item.span),
ast::ItemConst(..) => (item.ident, item.span),
_ => {
cx.sess()
.span_bug(item.span,
+37 -38
View File
@@ -36,7 +36,6 @@
use back::abi;
use llvm;
use llvm::{ValueRef};
use metadata::csearch;
use middle::def;
use middle::mem_categorization::Typer;
use middle::subst;
@@ -839,25 +838,20 @@ fn trans_def<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
trans_def_fn_unadjusted(bcx, ref_expr, def)
}
def::DefStatic(did, _) => {
// There are three things that may happen here:
// There are two things that may happen here:
// 1) If the static item is defined in this crate, it will be
// translated using `get_item_val`, and we return a pointer to
// the result.
// 2) If the static item is defined in another crate, but is
// marked inlineable, then it will be inlined into this crate
// and then translated with `get_item_val`. Again, we return a
// pointer to the result.
// 3) If the static item is defined in another crate and is not
// marked inlineable, then we add (or reuse) a declaration of
// an external global, and return a pointer to that.
// 2) If the static item is defined in another crate then we add
// (or reuse) a declaration of an external global, and return a
// pointer to that.
let const_ty = expr_ty(bcx, ref_expr);
fn get_val<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, did: ast::DefId, const_ty: ty::t)
-> ValueRef {
fn get_val<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, did: ast::DefId,
const_ty: ty::t) -> ValueRef {
// For external constants, we don't inline.
if did.krate == ast::LOCAL_CRATE {
// Case 1 or 2. (The inlining in case 2 produces a new
// DefId in LOCAL_CRATE.)
// Case 1.
// The LLVM global has the type of its initializer,
// which may not be equal to the enum's type for
@@ -866,36 +860,41 @@ fn get_val<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, did: ast::DefId, const_ty: ty::t)
let pty = type_of::type_of(bcx.ccx(), const_ty).ptr_to();
PointerCast(bcx, val, pty)
} else {
// Case 3.
match bcx.ccx().extern_const_values().borrow().find(&did) {
None => {} // Continue.
Some(llval) => {
return *llval;
}
}
unsafe {
let llty = type_of::type_of(bcx.ccx(), const_ty);
let symbol = csearch::get_symbol(
&bcx.ccx().sess().cstore,
did);
let llval = symbol.as_slice().with_c_str(|buf| {
llvm::LLVMAddGlobal(bcx.ccx().llmod(),
llty.to_ref(),
buf)
});
bcx.ccx().extern_const_values().borrow_mut()
.insert(did, llval);
llval
}
// Case 2.
base::get_extern_const(bcx.ccx(), did, const_ty)
}
}
// The DefId produced by `maybe_instantiate_inline`
// may be in the LOCAL_CRATE or not.
let did = inline::maybe_instantiate_inline(bcx.ccx(), did);
let val = get_val(bcx, did, const_ty);
DatumBlock::new(bcx, Datum::new(val, const_ty, LvalueExpr))
}
def::DefConst(did) => {
// First, inline any external constants into the local crate so we
// can be sure to get the LLVM value corresponding to it.
let did = inline::maybe_instantiate_inline(bcx.ccx(), did);
if did.krate != ast::LOCAL_CRATE {
bcx.tcx().sess.span_bug(ref_expr.span,
"cross crate constant could not \
be inlined");
}
let val = base::get_item_val(bcx.ccx(), did.node);
// Next, we need to crate a ByRef rvalue datum to return. We can't
// use the normal .to_ref_datum() function because the type of
// `val` is not actually the same as `const_ty`.
//
// To get around this, we make a custom alloca slot with the
// appropriate type (const_ty), and then we cast it to a pointer of
// typeof(val), store the value, and then hand this slot over to
// the datum infrastructure.
let const_ty = expr_ty(bcx, ref_expr);
let llty = type_of::type_of(bcx.ccx(), const_ty);
let slot = alloca(bcx, llty, "const");
let pty = Type::from_ref(unsafe { llvm::LLVMTypeOf(val) }).ptr_to();
Store(bcx, val, PointerCast(bcx, slot, pty));
let datum = Datum::new(slot, const_ty, Rvalue::new(ByRef));
DatumBlock::new(bcx, datum.to_expr_datum())
}
_ => {
DatumBlock::new(bcx, trans_local_var(bcx, def).to_expr_datum())
}
+1 -16
View File
@@ -17,7 +17,6 @@
use syntax::ast;
use syntax::ast_util::{local_def, PostExpansionMethod};
use syntax::ast_util;
fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
-> Option<ast::DefId> {
@@ -76,21 +75,7 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
}
}
}
ast::ItemStatic(_, mutbl, _) => {
if !ast_util::static_has_significant_address(mutbl, item.attrs.as_slice()) {
// Inlined static items use internal linkage when
// possible, so that LLVM will coalesce globals with
// identical initializers. (It only does this for
// globals with unnamed_addr and either internal or
// private linkage.)
Some(InternalLinkage)
} else {
// The address is significant, so we can't create an
// internal copy of the static. (The copy would have a
// different address from the original.)
Some(AvailableExternallyLinkage)
}
}
ast::ItemConst(..) => None,
_ => unreachable!(),
};
+6 -3
View File
@@ -68,7 +68,7 @@
pub type Disr = u64;
pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0;
pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0;
// Data types
@@ -918,7 +918,7 @@ macro_rules! def_prim_ty(
flags: super::has_ty_err as uint,
};
pub static LAST_PRIMITIVE_ID: uint = 18;
pub const LAST_PRIMITIVE_ID: uint = 18;
}
// NB: If you change this, you'll probably want to change the corresponding
@@ -1374,6 +1374,7 @@ pub fn for_item(cx: &ctxt, id: NodeId) -> ParameterEnvironment {
ast::ItemEnum(..) |
ast::ItemStruct(..) |
ast::ItemImpl(..) |
ast::ItemConst(..) |
ast::ItemStatic(..) => {
let def_id = ast_util::local_def(id);
let pty = ty::lookup_item_type(cx, def_id);
@@ -2199,7 +2200,7 @@ mod $mname {
use middle::ty::TypeContents;
$(
#[allow(non_uppercase_statics)]
pub static $name: TypeContents = TypeContents { bits: $bits };
pub const $name: TypeContents = TypeContents { bits: $bits };
)+
}
}
@@ -3576,6 +3577,8 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
def::DefUpvar(..) |
def::DefLocal(..) => LvalueExpr,
def::DefConst(..) => RvalueDatumExpr,
def => {
tcx.sess.span_bug(
expr.span,
+2 -2
View File
@@ -440,8 +440,8 @@ pub fn ast_path_to_ty_relaxed<'tcx, AC: AstConv<'tcx>,
}
}
pub static NO_REGIONS: uint = 1;
pub static NO_TPS: uint = 2;
pub const NO_REGIONS: uint = 1;
pub const NO_TPS: uint = 2;
fn check_path_args(tcx: &ty::ctxt,
path: &ast::Path,
+4 -2
View File
@@ -677,7 +677,8 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
let _indenter = indenter();
match it.node {
ast::ItemStatic(_, _, ref e) => check_const(ccx, it.span, &**e, it.id),
ast::ItemStatic(_, _, ref e) |
ast::ItemConst(_, ref e) => check_const(ccx, it.span, &**e, it.id),
ast::ItemEnum(ref enum_definition, _) => {
check_enum_variants(ccx,
it.span,
@@ -5083,7 +5084,7 @@ pub fn polytype_for_def(fcx: &FnCtxt,
}
def::DefFn(id, _, _) | def::DefStaticMethod(id, _, _) |
def::DefStatic(id, _) | def::DefVariant(_, id, _) |
def::DefStruct(id) => {
def::DefStruct(id) | def::DefConst(id) => {
return ty::lookup_item_type(fcx.ccx.tcx, id);
}
def::DefTrait(_) |
@@ -5211,6 +5212,7 @@ pub fn instantiate_path(fcx: &FnCtxt,
// Case 2. Reference to a top-level value.
def::DefFn(..) |
def::DefConst(..) |
def::DefStatic(..) => {
segment_spaces = Vec::from_elem(path.segments.len() - 1, None);
segment_spaces.push(Some(subst::FnSpace));
+3
View File
@@ -69,6 +69,9 @@ fn check_item_well_formed(&mut self, ccx: &CrateCtxt, item: &ast::Item) {
ast::ItemStatic(..) => {
self.check_item_type(item);
}
ast::ItemConst(..) => {
self.check_item_type(item);
}
ast::ItemStruct(ref struct_def, _) => {
self.check_type_defn(item, |fcx| {
vec![struct_variant(fcx, &**struct_def)]
+1 -1
View File
@@ -1550,7 +1550,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::Item)
_ => {}
}
match it.node {
ast::ItemStatic(ref t, _, _) => {
ast::ItemStatic(ref t, _, _) | ast::ItemConst(ref t, _) => {
let typ = ccx.to_ty(&ExplicitRscope, &**t);
let pty = no_params(typ);
+13 -13
View File
@@ -57,21 +57,21 @@
use syntax::codemap::Span;
use util::ppaux::{Repr, ty_to_string};
pub static resolve_nested_tvar: uint = 0b0000000001;
pub static resolve_rvar: uint = 0b0000000010;
pub static resolve_ivar: uint = 0b0000000100;
pub static resolve_fvar: uint = 0b0000001000;
pub static resolve_all: uint = 0b0000001111;
pub static force_tvar: uint = 0b0000100000;
pub static force_rvar: uint = 0b0001000000;
pub static force_ivar: uint = 0b0010000000;
pub static force_fvar: uint = 0b0100000000;
pub static force_all: uint = 0b0111100000;
pub const resolve_nested_tvar: uint = 0b0000000001;
pub const resolve_rvar: uint = 0b0000000010;
pub const resolve_ivar: uint = 0b0000000100;
pub const resolve_fvar: uint = 0b0000001000;
pub const resolve_all: uint = 0b0000001111;
pub const force_tvar: uint = 0b0000100000;
pub const force_rvar: uint = 0b0001000000;
pub const force_ivar: uint = 0b0010000000;
pub const force_fvar: uint = 0b0100000000;
pub const force_all: uint = 0b0111100000;
pub static not_regions: uint = !(force_rvar | resolve_rvar);
pub const not_regions: uint = !(force_rvar | resolve_rvar);
pub static try_resolve_tvar_shallow: uint = 0;
pub static resolve_and_force_all_but_regions: uint =
pub const try_resolve_tvar_shallow: uint = 0;
pub const resolve_and_force_all_but_regions: uint =
(resolve_all | force_all) & not_regions;
pub struct ResolveState<'a, 'tcx: 'a> {
+1 -1
View File
@@ -197,7 +197,7 @@ fn search(this: &Env,
}
return match it.node {
ast::ItemStatic(..) | ast::ItemFn(..) |
ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemFn(..) |
ast::ItemForeignMod(..) | ast::ItemTy(..) => {
None
}
+2
View File
@@ -384,6 +384,7 @@ fn visit_item(&mut self, item: &ast::Item) {
ast::ItemImpl(..) |
ast::ItemStatic(..) |
ast::ItemConst(..) |
ast::ItemFn(..) |
ast::ItemMod(..) |
ast::ItemForeignMod(..) |
@@ -528,6 +529,7 @@ fn visit_item(&mut self, item: &ast::Item) {
}
ast::ItemStatic(..) |
ast::ItemConst(..) |
ast::ItemFn(..) |
ast::ItemMod(..) |
ast::ItemForeignMod(..) |
+10 -10
View File
@@ -10,20 +10,20 @@
#![allow(non_uppercase_statics)]
pub static box_field_refcnt: uint = 0u;
pub static box_field_drop_glue: uint = 1u;
pub static box_field_body: uint = 4u;
pub const box_field_refcnt: uint = 0u;
pub const box_field_drop_glue: uint = 1u;
pub const box_field_body: uint = 4u;
pub static tydesc_field_visit_glue: uint = 3u;
pub const tydesc_field_visit_glue: uint = 3u;
// The two halves of a closure: code and environment.
pub static fn_field_code: uint = 0u;
pub static fn_field_box: uint = 1u;
pub const fn_field_code: uint = 0u;
pub const fn_field_box: uint = 1u;
// The two fields of a trait object/trait instance: vtable and box.
// The vtable contains the type descriptor as first element.
pub static trt_field_box: uint = 0u;
pub static trt_field_vtable: uint = 1u;
pub const trt_field_box: uint = 0u;
pub const trt_field_vtable: uint = 1u;
pub static slice_elt_base: uint = 0u;
pub static slice_elt_len: uint = 1u;
pub const slice_elt_base: uint = 0u;
pub const slice_elt_len: uint = 1u;
+28 -28
View File
@@ -43,8 +43,8 @@
pub type Opcode = u32;
pub type Bool = c_uint;
pub static True: Bool = 1 as Bool;
pub static False: Bool = 0 as Bool;
pub const True: Bool = 1 as Bool;
pub const False: Bool = 0 as Bool;
// Consts for the LLVM CallConv type, pre-cast to uint.
@@ -93,32 +93,32 @@ pub enum DiagnosticSeverity {
bitflags! {
flags Attribute : u32 {
static ZExtAttribute = 1 << 0,
static SExtAttribute = 1 << 1,
static NoReturnAttribute = 1 << 2,
static InRegAttribute = 1 << 3,
static StructRetAttribute = 1 << 4,
static NoUnwindAttribute = 1 << 5,
static NoAliasAttribute = 1 << 6,
static ByValAttribute = 1 << 7,
static NestAttribute = 1 << 8,
static ReadNoneAttribute = 1 << 9,
static ReadOnlyAttribute = 1 << 10,
static NoInlineAttribute = 1 << 11,
static AlwaysInlineAttribute = 1 << 12,
static OptimizeForSizeAttribute = 1 << 13,
static StackProtectAttribute = 1 << 14,
static StackProtectReqAttribute = 1 << 15,
static AlignmentAttribute = 31 << 16,
static NoCaptureAttribute = 1 << 21,
static NoRedZoneAttribute = 1 << 22,
static NoImplicitFloatAttribute = 1 << 23,
static NakedAttribute = 1 << 24,
static InlineHintAttribute = 1 << 25,
static StackAttribute = 7 << 26,
static ReturnsTwiceAttribute = 1 << 29,
static UWTableAttribute = 1 << 30,
static NonLazyBindAttribute = 1 << 31,
const ZExtAttribute = 1 << 0,
const SExtAttribute = 1 << 1,
const NoReturnAttribute = 1 << 2,
const InRegAttribute = 1 << 3,
const StructRetAttribute = 1 << 4,
const NoUnwindAttribute = 1 << 5,
const NoAliasAttribute = 1 << 6,
const ByValAttribute = 1 << 7,
const NestAttribute = 1 << 8,
const ReadNoneAttribute = 1 << 9,
const ReadOnlyAttribute = 1 << 10,
const NoInlineAttribute = 1 << 11,
const AlwaysInlineAttribute = 1 << 12,
const OptimizeForSizeAttribute = 1 << 13,
const StackProtectAttribute = 1 << 14,
const StackProtectReqAttribute = 1 << 15,
const AlignmentAttribute = 31 << 16,
const NoCaptureAttribute = 1 << 21,
const NoRedZoneAttribute = 1 << 22,
const NoImplicitFloatAttribute = 1 << 23,
const NakedAttribute = 1 << 24,
const InlineHintAttribute = 1 << 25,
const StackAttribute = 7 << 26,
const ReturnsTwiceAttribute = 1 << 29,
const UWTableAttribute = 1 << 30,
const NonLazyBindAttribute = 1 << 31,
}
}
+25
View File
@@ -300,6 +300,7 @@ pub enum ItemEnum {
ModuleItem(Module),
TypedefItem(Typedef),
StaticItem(Static),
ConstantItem(Constant),
TraitItem(Trait),
ImplItem(Impl),
/// `use` and `extern crate`
@@ -347,6 +348,7 @@ fn clean(&self, cx: &DocContext) -> Item {
self.mods.clean(cx),
self.typedefs.clean(cx),
self.statics.clean(cx),
self.constants.clean(cx),
self.traits.clean(cx),
self.impls.clean(cx),
self.view_items.clean(cx).into_iter()
@@ -1741,6 +1743,29 @@ fn clean(&self, cx: &DocContext) -> Item {
}
}
#[deriving(Clone, Encodable, Decodable)]
pub struct Constant {
pub type_: Type,
pub expr: String,
}
impl Clean<Item> for doctree::Constant {
fn clean(&self, cx: &DocContext) -> Item {
Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.whence.clean(cx),
def_id: ast_util::local_def(self.id),
visibility: self.vis.clean(cx),
stability: self.stab.clean(cx),
inner: ConstantItem(Constant {
type_: self.type_.clean(cx),
expr: self.expr.span.to_src(cx),
}),
}
}
}
#[deriving(Show, Clone, Encodable, Decodable, PartialEq)]
pub enum Mutability {
Mutable,
+13
View File
@@ -30,6 +30,7 @@ pub struct Module {
pub id: NodeId,
pub typedefs: Vec<Typedef>,
pub statics: Vec<Static>,
pub constants: Vec<Constant>,
pub traits: Vec<Trait>,
pub vis: ast::Visibility,
pub stab: Option<attr::Stability>,
@@ -56,6 +57,7 @@ pub fn new(name: Option<Ident>) -> Module {
mods : Vec::new(),
typedefs : Vec::new(),
statics : Vec::new(),
constants : Vec::new(),
traits : Vec::new(),
impls : Vec::new(),
view_items : Vec::new(),
@@ -151,6 +153,17 @@ pub struct Static {
pub whence: Span,
}
pub struct Constant {
pub type_: P<ast::Ty>,
pub expr: P<ast::Expr>,
pub name: Ident,
pub attrs: Vec<ast::Attribute>,
pub vis: ast::Visibility,
pub stab: Option<attr::Stability>,
pub id: ast::NodeId,
pub whence: Span,
}
pub struct Trait {
pub name: Ident,
pub items: Vec<ast::TraitItem>, //should be TraitItem
+16 -16
View File
@@ -38,10 +38,10 @@ pub struct flock {
pub l_sysid: libc::c_int,
}
pub static F_WRLCK: libc::c_short = 1;
pub static F_UNLCK: libc::c_short = 2;
pub static F_SETLK: libc::c_int = 6;
pub static F_SETLKW: libc::c_int = 7;
pub const F_WRLCK: libc::c_short = 1;
pub const F_UNLCK: libc::c_short = 2;
pub const F_SETLK: libc::c_int = 6;
pub const F_SETLKW: libc::c_int = 7;
}
#[cfg(target_os = "freebsd")]
@@ -57,10 +57,10 @@ pub struct flock {
pub l_sysid: libc::c_int,
}
pub static F_UNLCK: libc::c_short = 2;
pub static F_WRLCK: libc::c_short = 3;
pub static F_SETLK: libc::c_int = 12;
pub static F_SETLKW: libc::c_int = 13;
pub const F_UNLCK: libc::c_short = 2;
pub const F_WRLCK: libc::c_short = 3;
pub const F_SETLK: libc::c_int = 12;
pub const F_SETLKW: libc::c_int = 13;
}
#[cfg(target_os = "dragonfly")]
@@ -78,10 +78,10 @@ pub struct flock {
pub l_sysid: libc::c_int,
}
pub static F_UNLCK: libc::c_short = 2;
pub static F_WRLCK: libc::c_short = 3;
pub static F_SETLK: libc::c_int = 8;
pub static F_SETLKW: libc::c_int = 9;
pub const F_UNLCK: libc::c_short = 2;
pub const F_WRLCK: libc::c_short = 3;
pub const F_SETLK: libc::c_int = 8;
pub const F_SETLKW: libc::c_int = 9;
}
#[cfg(any(target_os = "macos", target_os = "ios"))]
@@ -99,10 +99,10 @@ pub struct flock {
pub l_sysid: libc::c_int,
}
pub static F_UNLCK: libc::c_short = 2;
pub static F_WRLCK: libc::c_short = 3;
pub static F_SETLK: libc::c_int = 8;
pub static F_SETLKW: libc::c_int = 9;
pub const F_UNLCK: libc::c_short = 2;
pub const F_WRLCK: libc::c_short = 3;
pub const F_SETLK: libc::c_int = 8;
pub const F_SETLKW: libc::c_int = 9;
}
pub struct Lock {
+3
View File
@@ -39,6 +39,7 @@ pub enum ItemType {
Macro = 15,
Primitive = 16,
AssociatedType = 17,
Constant = 18,
}
impl ItemType {
@@ -62,6 +63,7 @@ pub fn to_static_str(&self) -> &'static str {
Macro => "macro",
Primitive => "primitive",
AssociatedType => "associatedtype",
Constant => "constant",
}
}
}
@@ -86,6 +88,7 @@ pub fn shortty(item: &clean::Item) -> ItemType {
clean::FunctionItem(..) => Function,
clean::TypedefItem(..) => Typedef,
clean::StaticItem(..) => Static,
clean::ConstantItem(..) => Constant,
clean::TraitItem(..) => Trait,
clean::ImplItem(..) => Impl,
clean::ViewItemItem(..) => ViewItem,
+9 -9
View File
@@ -48,16 +48,16 @@
/// table of contents.
pub struct MarkdownWithToc<'a>(pub &'a str);
static DEF_OUNIT: libc::size_t = 64;
static HOEDOWN_EXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 10;
static HOEDOWN_EXT_TABLES: libc::c_uint = 1 << 0;
static HOEDOWN_EXT_FENCED_CODE: libc::c_uint = 1 << 1;
static HOEDOWN_EXT_AUTOLINK: libc::c_uint = 1 << 3;
static HOEDOWN_EXT_STRIKETHROUGH: libc::c_uint = 1 << 4;
static HOEDOWN_EXT_SUPERSCRIPT: libc::c_uint = 1 << 8;
static HOEDOWN_EXT_FOOTNOTES: libc::c_uint = 1 << 2;
const DEF_OUNIT: libc::size_t = 64;
const HOEDOWN_EXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 10;
const HOEDOWN_EXT_TABLES: libc::c_uint = 1 << 0;
const HOEDOWN_EXT_FENCED_CODE: libc::c_uint = 1 << 1;
const HOEDOWN_EXT_AUTOLINK: libc::c_uint = 1 << 3;
const HOEDOWN_EXT_STRIKETHROUGH: libc::c_uint = 1 << 4;
const HOEDOWN_EXT_SUPERSCRIPT: libc::c_uint = 1 << 8;
const HOEDOWN_EXT_FOOTNOTES: libc::c_uint = 1 << 2;
static HOEDOWN_EXTENSIONS: libc::c_uint =
const HOEDOWN_EXTENSIONS: libc::c_uint =
HOEDOWN_EXT_NO_INTRA_EMPHASIS | HOEDOWN_EXT_TABLES |
HOEDOWN_EXT_FENCED_CODE | HOEDOWN_EXT_AUTOLINK |
HOEDOWN_EXT_STRIKETHROUGH | HOEDOWN_EXT_SUPERSCRIPT |
+37 -20
View File
@@ -1471,6 +1471,8 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
(_, &clean::StructItem(..)) => Greater,
(&clean::EnumItem(..), _) => Less,
(_, &clean::EnumItem(..)) => Greater,
(&clean::ConstantItem(..), _) => Less,
(_, &clean::ConstantItem(..)) => Greater,
(&clean::StaticItem(..), _) => Less,
(_, &clean::StaticItem(..)) => Greater,
(&clean::ForeignFunctionItem(..), _) => Less,
@@ -1507,6 +1509,7 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
clean::FunctionItem(..) => ("functions", "Functions"),
clean::TypedefItem(..) => ("types", "Type Definitions"),
clean::StaticItem(..) => ("statics", "Statics"),
clean::ConstantItem(..) => ("constants", "Constants"),
clean::TraitItem(..) => ("traits", "Traits"),
clean::ImplItem(..) => ("impls", "Implementations"),
clean::ViewItemItem(..) => ("reexports", "Reexports"),
@@ -1526,28 +1529,28 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
id = short, name = name));
}
struct Initializer<'a>(&'a str, Item<'a>);
impl<'a> fmt::Show for Initializer<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let Initializer(s, item) = *self;
if s.len() == 0 { return Ok(()); }
try!(write!(f, "<code> = </code>"));
if s.contains("\n") {
match item.href() {
Some(url) => {
write!(f, "<a href='{}'>[definition]</a>",
url)
}
None => Ok(()),
}
} else {
write!(f, "<code>{}</code>", s.as_slice())
}
}
}
match myitem.inner {
clean::StaticItem(ref s) | clean::ForeignStaticItem(ref s) => {
struct Initializer<'a>(&'a str, Item<'a>);
impl<'a> fmt::Show for Initializer<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let Initializer(s, item) = *self;
if s.len() == 0 { return Ok(()); }
try!(write!(f, "<code> = </code>"));
if s.contains("\n") {
match item.href() {
Some(url) => {
write!(f, "<a href='{}'>[definition]</a>",
url)
}
None => Ok(()),
}
} else {
write!(f, "<code>{}</code>", s.as_slice())
}
}
}
try!(write!(w, "
<tr>
<td>{}<code>{}static {}{}: {}</code>{}</td>
@@ -1562,6 +1565,20 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Initializer(s.expr.as_slice(), Item { cx: cx, item: myitem }),
Markdown(blank(myitem.doc_value()))));
}
clean::ConstantItem(ref s) => {
try!(write!(w, "
<tr>
<td>{}<code>{}const {}: {}</code>{}</td>
<td class='docblock'>{}&nbsp;</td>
</tr>
",
ConciseStability(&myitem.stability),
VisSpace(myitem.visibility),
*myitem.name.get_ref(),
s.type_,
Initializer(s.expr.as_slice(), Item { cx: cx, item: myitem }),
Markdown(blank(myitem.doc_value()))));
}
clean::ViewItemItem(ref item) => {
match item.inner {
+3 -1
View File
@@ -569,7 +569,9 @@
"ffi",
"ffs",
"macro",
"primitive"];
"primitive",
"associatedtype",
"constant"];
function itemTypeFromName(typename) {
for (var i = 0; i < itemTypes.length; ++i) {
+2 -1
View File
@@ -134,7 +134,8 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
clean::StructItem(..) | clean::EnumItem(..) |
clean::TraitItem(..) | clean::FunctionItem(..) |
clean::VariantItem(..) | clean::MethodItem(..) |
clean::ForeignFunctionItem(..) | clean::ForeignStaticItem(..) => {
clean::ForeignFunctionItem(..) | clean::ForeignStaticItem(..) |
clean::ConstantItem(..) => {
if ast_util::is_local(i.def_id) &&
!self.exported_items.contains(&i.def_id.node) {
return None;
+13
View File
@@ -308,6 +308,19 @@ pub fn visit_item(&mut self, item: &ast::Item,
};
om.statics.push(s);
},
ast::ItemConst(ref ty, ref exp) => {
let s = Constant {
type_: ty.clone(),
expr: exp.clone(),
id: item.id,
name: name,
attrs: item.attrs.clone(),
whence: item.span,
vis: item.vis,
stab: self.stability(item.id),
};
om.constants.push(s);
},
ast::ItemTrait(ref gen, _, ref b, ref items) => {
let t = Trait {
name: name,
+1 -1
View File
@@ -414,7 +414,7 @@ unsafe fn with_c_str_unchecked<T>(&self, f: |*const libc::c_char| -> T) -> T {
}
// The length of the stack allocated buffer for `vec.with_c_str()`
static BUF_LEN: uint = 128;
const BUF_LEN: uint = 128;
impl<'a> ToCStr for &'a [u8] {
fn to_c_str(&self) -> CString {
+1 -1
View File
@@ -100,7 +100,7 @@ fn spawn_sibling(self: Box<Self>,
/// The default error code of the rust runtime if the main task fails instead
/// of exiting cleanly.
pub static DEFAULT_ERROR_CODE: int = 101;
pub const DEFAULT_ERROR_CODE: int = 101;
/// One-time runtime initialization.
///
+5 -5
View File
@@ -57,19 +57,19 @@ pub enum _Unwind_Reason_Code {
pub type _Unwind_Word = libc::uintptr_t;
#[cfg(target_arch = "x86")]
pub static unwinder_private_data_size: uint = 5;
pub const unwinder_private_data_size: uint = 5;
#[cfg(target_arch = "x86_64")]
pub static unwinder_private_data_size: uint = 6;
pub const unwinder_private_data_size: uint = 6;
#[cfg(all(target_arch = "arm", not(target_os = "ios")))]
pub static unwinder_private_data_size: uint = 20;
pub const unwinder_private_data_size: uint = 20;
#[cfg(all(target_arch = "arm", target_os = "ios"))]
pub static unwinder_private_data_size: uint = 5;
pub const unwinder_private_data_size: uint = 5;
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
pub static unwinder_private_data_size: uint = 2;
pub const unwinder_private_data_size: uint = 2;
#[repr(C)]
pub struct _Unwind_Exception {
+32 -32
View File
@@ -88,7 +88,7 @@ pub struct LockGuard<'a> {
lock: &'a StaticNativeMutex
}
pub static NATIVE_MUTEX_INIT: StaticNativeMutex = StaticNativeMutex {
pub const NATIVE_MUTEX_INIT: StaticNativeMutex = StaticNativeMutex {
inner: imp::MUTEX_INIT,
};
@@ -353,9 +353,9 @@ mod os {
pub type pthread_mutex_t = *mut libc::c_void;
pub type pthread_cond_t = *mut libc::c_void;
pub static PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t =
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t =
0 as pthread_mutex_t;
pub static PTHREAD_COND_INITIALIZER: pthread_cond_t =
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t =
0 as pthread_cond_t;
}
@@ -364,20 +364,20 @@ mod os {
use libc;
#[cfg(target_arch = "x86_64")]
static __PTHREAD_MUTEX_SIZE__: uint = 56;
const __PTHREAD_MUTEX_SIZE__: uint = 56;
#[cfg(target_arch = "x86_64")]
static __PTHREAD_COND_SIZE__: uint = 40;
const __PTHREAD_COND_SIZE__: uint = 40;
#[cfg(target_arch = "x86")]
static __PTHREAD_MUTEX_SIZE__: uint = 40;
const __PTHREAD_MUTEX_SIZE__: uint = 40;
#[cfg(target_arch = "x86")]
static __PTHREAD_COND_SIZE__: uint = 24;
const __PTHREAD_COND_SIZE__: uint = 24;
#[cfg(target_arch = "arm")]
static __PTHREAD_MUTEX_SIZE__: uint = 40;
const __PTHREAD_MUTEX_SIZE__: uint = 40;
#[cfg(target_arch = "arm")]
static __PTHREAD_COND_SIZE__: uint = 24;
const __PTHREAD_COND_SIZE__: uint = 24;
static _PTHREAD_MUTEX_SIG_INIT: libc::c_long = 0x32AAABA7;
static _PTHREAD_COND_SIG_INIT: libc::c_long = 0x3CB0B1BB;
const _PTHREAD_MUTEX_SIG_INIT: libc::c_long = 0x32AAABA7;
const _PTHREAD_COND_SIG_INIT: libc::c_long = 0x3CB0B1BB;
#[repr(C)]
pub struct pthread_mutex_t {
@@ -390,11 +390,11 @@ pub struct pthread_cond_t {
__opaque: [u8, ..__PTHREAD_COND_SIZE__],
}
pub static PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__sig: _PTHREAD_MUTEX_SIG_INIT,
__opaque: [0, ..__PTHREAD_MUTEX_SIZE__],
};
pub static PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__sig: _PTHREAD_COND_SIG_INIT,
__opaque: [0, ..__PTHREAD_COND_SIZE__],
};
@@ -406,25 +406,25 @@ mod os {
// minus 8 because we have an 'align' field
#[cfg(target_arch = "x86_64")]
static __SIZEOF_PTHREAD_MUTEX_T: uint = 40 - 8;
const __SIZEOF_PTHREAD_MUTEX_T: uint = 40 - 8;
#[cfg(target_arch = "x86")]
static __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
const __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
#[cfg(target_arch = "arm")]
static __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
const __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
#[cfg(target_arch = "mips")]
static __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
const __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
#[cfg(target_arch = "mipsel")]
static __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
const __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
#[cfg(target_arch = "x86_64")]
static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
const __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
#[cfg(target_arch = "x86")]
static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
const __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
#[cfg(target_arch = "arm")]
static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
const __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
#[cfg(target_arch = "mips")]
static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
const __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
#[cfg(target_arch = "mipsel")]
static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
const __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
#[repr(C)]
pub struct pthread_mutex_t {
@@ -437,11 +437,11 @@ pub struct pthread_cond_t {
size: [u8, ..__SIZEOF_PTHREAD_COND_T],
}
pub static PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__align: 0,
size: [0, ..__SIZEOF_PTHREAD_MUTEX_T],
};
pub static PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__align: 0,
size: [0, ..__SIZEOF_PTHREAD_COND_T],
};
@@ -455,10 +455,10 @@ pub struct pthread_mutex_t { value: libc::c_int }
#[repr(C)]
pub struct pthread_cond_t { value: libc::c_int }
pub static PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
value: 0,
};
pub static PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
value: 0,
};
}
@@ -468,7 +468,7 @@ pub struct Mutex {
cond: UnsafeCell<pthread_cond_t>,
}
pub static MUTEX_INIT: Mutex = Mutex {
pub const MUTEX_INIT: Mutex = Mutex {
lock: UnsafeCell { value: PTHREAD_MUTEX_INITIALIZER },
cond: UnsafeCell { value: PTHREAD_COND_INITIALIZER },
};
@@ -523,11 +523,11 @@ mod imp {
use libc;
type LPCRITICAL_SECTION = *mut c_void;
static SPIN_COUNT: DWORD = 4000;
const SPIN_COUNT: DWORD = 4000;
#[cfg(target_arch = "x86")]
static CRIT_SECTION_SIZE: uint = 24;
const CRIT_SECTION_SIZE: uint = 24;
#[cfg(target_arch = "x86_64")]
static CRIT_SECTION_SIZE: uint = 40;
const CRIT_SECTION_SIZE: uint = 40;
pub struct Mutex {
// pointers for the lock/cond handles, atomically updated
@@ -535,7 +535,7 @@ pub struct Mutex {
cond: atomic::AtomicUint,
}
pub static MUTEX_INIT: Mutex = Mutex {
pub const MUTEX_INIT: Mutex = Mutex {
lock: atomic::INIT_ATOMIC_UINT,
cond: atomic::INIT_ATOMIC_UINT,
};
+1 -1
View File
@@ -46,7 +46,7 @@
// corresponding prolog, decision was taken to disable segmented
// stack support on iOS.
pub static RED_ZONE: uint = 20 * 1024;
pub const RED_ZONE: uint = 20 * 1024;
/// This function is invoked from rust's current __morestack function. Segmented
/// stacks are currently not enabled as segmented stacks, but rather one giant
+1 -1
View File
@@ -91,7 +91,7 @@ struct Exception {
// Variables used for invoking callbacks when a task starts to unwind.
//
// For more information, see below.
static MAX_CALLBACKS: uint = 16;
const MAX_CALLBACKS: uint = 16;
static mut CALLBACKS: [atomic::AtomicUint, ..MAX_CALLBACKS] =
[atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT,
atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT,
+3 -3
View File
@@ -23,15 +23,15 @@
//
// FIXME: Once the runtime matures remove the `true` below to turn off rtassert,
// etc.
pub static ENFORCE_SANITY: bool = true || !cfg!(rtopt) || cfg!(rtdebug) ||
pub const ENFORCE_SANITY: bool = true || !cfg!(rtopt) || cfg!(rtdebug) ||
cfg!(rtassert);
pub struct Stdio(libc::c_int);
#[allow(non_uppercase_statics)]
pub static Stdout: Stdio = Stdio(libc::STDOUT_FILENO);
pub const Stdout: Stdio = Stdio(libc::STDOUT_FILENO);
#[allow(non_uppercase_statics)]
pub static Stderr: Stdio = Stdio(libc::STDERR_FILENO);
pub const Stderr: Stdio = Stdio(libc::STDERR_FILENO);
impl fmt::FormatWriter for Stdio {
fn write(&mut self, data: &[u8]) -> fmt::Result {
+6 -8
View File
@@ -360,18 +360,16 @@ fn escape_char(writer: &mut io::Writer, v: char) -> Result<(), io::IoError> {
}
fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> {
#[allow(non_uppercase_statics)]
static len: uint = 16;
#[allow(non_uppercase_statics)]
static buf: [u8, ..len] = [b' ', ..len];
const LEN: uint = 16;
static BUF: [u8, ..LEN] = [b' ', ..LEN];
while n >= len {
try!(wr.write(buf));
n -= len;
while n >= LEN {
try!(wr.write(BUF));
n -= LEN;
}
if n > 0 {
wr.write(buf[..n])
wr.write(BUF[..n])
} else {
Ok(())
}
+17 -17
View File
@@ -24,12 +24,12 @@
/// ```{.rust}
/// bitflags! {
/// flags Flags: u32 {
/// static FLAG_A = 0x00000001,
/// static FLAG_B = 0x00000010,
/// static FLAG_C = 0x00000100,
/// static FLAG_ABC = FLAG_A.bits
/// | FLAG_B.bits
/// | FLAG_C.bits,
/// const FLAG_A = 0x00000001,
/// const FLAG_B = 0x00000010,
/// const FLAG_C = 0x00000100,
/// const FLAG_ABC = FLAG_A.bits
/// | FLAG_B.bits
/// | FLAG_C.bits,
/// }
/// }
///
@@ -50,8 +50,8 @@
///
/// bitflags! {
/// flags Flags: u32 {
/// static FLAG_A = 0x00000001,
/// static FLAG_B = 0x00000010,
/// const FLAG_A = 0x00000001,
/// const FLAG_B = 0x00000010,
/// }
/// }
///
@@ -115,7 +115,7 @@
#[macro_export]
macro_rules! bitflags {
($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
$($(#[$Flag_attr:meta])* static $Flag:ident = $value:expr),+
$($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+
}) => {
#[deriving(PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
$(#[$attr])*
@@ -123,7 +123,7 @@ pub struct $BitFlags {
bits: $T,
}
$($(#[$Flag_attr])* pub static $Flag: $BitFlags = $BitFlags { bits: $value };)+
$($(#[$Flag_attr])* pub const $Flag: $BitFlags = $BitFlags { bits: $value };)+
impl $BitFlags {
/// Returns an empty set of flags.
@@ -235,12 +235,12 @@ fn not(&self) -> $BitFlags {
}
};
($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
$($(#[$Flag_attr:meta])* static $Flag:ident = $value:expr),+,
$($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+,
}) => {
bitflags! {
$(#[$attr])*
flags $BitFlags: $T {
$($(#[$Flag_attr])* static $Flag = $value),+
$($(#[$Flag_attr])* const $Flag = $value),+
}
}
};
@@ -259,14 +259,14 @@ mod tests {
#[doc = "> "]
#[doc = "> - Richard Feynman"]
flags Flags: u32 {
static FlagA = 0x00000001,
const FlagA = 0x00000001,
#[doc = "<pcwalton> macros are way better at generating code than trans is"]
static FlagB = 0x00000010,
static FlagC = 0x00000100,
const FlagB = 0x00000010,
const FlagC = 0x00000100,
#[doc = "* cmr bed"]
#[doc = "* strcat table"]
#[doc = "<strcat> wait what?"]
static FlagABC = FlagA.bits
const FlagABC = FlagA.bits
| FlagB.bits
| FlagC.bits,
}
@@ -274,7 +274,7 @@ mod tests {
bitflags! {
flags AnotherSetOfFlags: uint {
static AnotherFlag = 1u,
const AnotherFlag = 1u,
}
}
+2 -2
View File
@@ -41,8 +41,8 @@
SafeHash
};
static INITIAL_LOG2_CAP: uint = 5;
pub static INITIAL_CAPACITY: uint = 1 << INITIAL_LOG2_CAP; // 2^5
const INITIAL_LOG2_CAP: uint = 5;
pub const INITIAL_CAPACITY: uint = 1 << INITIAL_LOG2_CAP; // 2^5
/// The default behavior of HashMap implements a load factor of 90.9%.
/// This behavior is characterized by the following conditions:
+1 -1
View File
@@ -24,7 +24,7 @@
use ptr;
use rt::heap::{allocate, deallocate};
static EMPTY_BUCKET: u64 = 0u64;
const EMPTY_BUCKET: u64 = 0u64;
/// The raw hashtable, providing safe-ish access to the unzipped and highly
/// optimized arrays of hashes, keys, and values.
+33 -33
View File
@@ -283,7 +283,7 @@ fn file_product(p: &Path) -> IoResult<u32> {
/// The default buffer size for various I/O operations
// libuv recommends 64k buffers to maximize throughput
// https://groups.google.com/forum/#!topic/libuv/oQO1HJAIDdA
static DEFAULT_BUF_SIZE: uint = 1024 * 64;
const DEFAULT_BUF_SIZE: uint = 1024 * 64;
/// A convenient typedef of the return value of any I/O action.
pub type IoResult<T> = Result<T, IoError>;
@@ -1803,93 +1803,93 @@ pub struct UnstableFileStat {
#[doc = "A set of permissions for a file or directory is represented"]
#[doc = "by a set of flags which are or'd together."]
flags FilePermission: u32 {
static USER_READ = 0o400,
static USER_WRITE = 0o200,
static USER_EXECUTE = 0o100,
static GROUP_READ = 0o040,
static GROUP_WRITE = 0o020,
static GROUP_EXECUTE = 0o010,
static OTHER_READ = 0o004,
static OTHER_WRITE = 0o002,
static OTHER_EXECUTE = 0o001,
const USER_READ = 0o400,
const USER_WRITE = 0o200,
const USER_EXECUTE = 0o100,
const GROUP_READ = 0o040,
const GROUP_WRITE = 0o020,
const GROUP_EXECUTE = 0o010,
const OTHER_READ = 0o004,
const OTHER_WRITE = 0o002,
const OTHER_EXECUTE = 0o001,
static USER_RWX = USER_READ.bits | USER_WRITE.bits | USER_EXECUTE.bits,
static GROUP_RWX = GROUP_READ.bits | GROUP_WRITE.bits | GROUP_EXECUTE.bits,
static OTHER_RWX = OTHER_READ.bits | OTHER_WRITE.bits | OTHER_EXECUTE.bits,
const USER_RWX = USER_READ.bits | USER_WRITE.bits | USER_EXECUTE.bits,
const GROUP_RWX = GROUP_READ.bits | GROUP_WRITE.bits | GROUP_EXECUTE.bits,
const OTHER_RWX = OTHER_READ.bits | OTHER_WRITE.bits | OTHER_EXECUTE.bits,
#[doc = "Permissions for user owned files, equivalent to 0644 on"]
#[doc = "unix-like systems."]
static USER_FILE = USER_READ.bits | USER_WRITE.bits | GROUP_READ.bits | OTHER_READ.bits,
const USER_FILE = USER_READ.bits | USER_WRITE.bits | GROUP_READ.bits | OTHER_READ.bits,
#[doc = "Permissions for user owned directories, equivalent to 0755 on"]
#[doc = "unix-like systems."]
static USER_DIR = USER_RWX.bits | GROUP_READ.bits | GROUP_EXECUTE.bits |
const USER_DIR = USER_RWX.bits | GROUP_READ.bits | GROUP_EXECUTE.bits |
OTHER_READ.bits | OTHER_EXECUTE.bits,
#[doc = "Permissions for user owned executables, equivalent to 0755"]
#[doc = "on unix-like systems."]
static USER_EXEC = USER_DIR.bits,
const USER_EXEC = USER_DIR.bits,
#[doc = "All possible permissions enabled."]
static ALL_PERMISSIONS = USER_RWX.bits | GROUP_RWX.bits | OTHER_RWX.bits,
const ALL_PERMISSIONS = USER_RWX.bits | GROUP_RWX.bits | OTHER_RWX.bits,
// Deprecated names
#[allow(non_uppercase_statics)]
#[deprecated = "use USER_READ instead"]
static UserRead = USER_READ.bits,
const UserRead = USER_READ.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use USER_WRITE instead"]
static UserWrite = USER_WRITE.bits,
const UserWrite = USER_WRITE.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use USER_EXECUTE instead"]
static UserExecute = USER_EXECUTE.bits,
const UserExecute = USER_EXECUTE.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use GROUP_READ instead"]
static GroupRead = GROUP_READ.bits,
const GroupRead = GROUP_READ.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use GROUP_WRITE instead"]
static GroupWrite = GROUP_WRITE.bits,
const GroupWrite = GROUP_WRITE.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use GROUP_EXECUTE instead"]
static GroupExecute = GROUP_EXECUTE.bits,
const GroupExecute = GROUP_EXECUTE.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use OTHER_READ instead"]
static OtherRead = OTHER_READ.bits,
const OtherRead = OTHER_READ.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use OTHER_WRITE instead"]
static OtherWrite = OTHER_WRITE.bits,
const OtherWrite = OTHER_WRITE.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use OTHER_EXECUTE instead"]
static OtherExecute = OTHER_EXECUTE.bits,
const OtherExecute = OTHER_EXECUTE.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use USER_RWX instead"]
static UserRWX = USER_RWX.bits,
const UserRWX = USER_RWX.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use GROUP_RWX instead"]
static GroupRWX = GROUP_RWX.bits,
const GroupRWX = GROUP_RWX.bits,
#[allow(non_uppercase_statics)]
#[deprecated = "use OTHER_RWX instead"]
static OtherRWX = OTHER_RWX.bits,
const OtherRWX = OTHER_RWX.bits,
#[doc = "Deprecated: use `USER_FILE` instead."]
#[allow(non_uppercase_statics)]
#[deprecated = "use USER_FILE instead"]
static UserFile = USER_FILE.bits,
const UserFile = USER_FILE.bits,
#[doc = "Deprecated: use `USER_DIR` instead."]
#[allow(non_uppercase_statics)]
#[deprecated = "use USER_DIR instead"]
static UserDir = USER_DIR.bits,
const UserDir = USER_DIR.bits,
#[doc = "Deprecated: use `USER_EXEC` instead."]
#[allow(non_uppercase_statics)]
#[deprecated = "use USER_EXEC instead"]
static UserExec = USER_EXEC.bits,
const UserExec = USER_EXEC.bits,
#[doc = "Deprecated: use `ALL_PERMISSIONS` instead"]
#[allow(non_uppercase_statics)]
#[deprecated = "use ALL_PERMISSIONS instead"]
static AllPermissions = ALL_PERMISSIONS.bits,
const AllPermissions = ALL_PERMISSIONS.bits,
}
}
+4 -4
View File
@@ -32,16 +32,16 @@
/// Signal a process to exit, without forcibly killing it. Corresponds to
/// SIGTERM on unix platforms.
#[cfg(windows)] pub static PleaseExitSignal: int = 15;
#[cfg(windows)] pub const PleaseExitSignal: int = 15;
/// Signal a process to exit immediately, forcibly killing it. Corresponds to
/// SIGKILL on unix platforms.
#[cfg(windows)] pub static MustDieSignal: int = 9;
#[cfg(windows)] pub const MustDieSignal: int = 9;
/// Signal a process to exit, without forcibly killing it. Corresponds to
/// SIGTERM on unix platforms.
#[cfg(not(windows))] pub static PleaseExitSignal: int = libc::SIGTERM as int;
#[cfg(not(windows))] pub const PleaseExitSignal: int = libc::SIGTERM as int;
/// Signal a process to exit immediately, forcibly killing it. Corresponds to
/// SIGKILL on unix platforms.
#[cfg(not(windows))] pub static MustDieSignal: int = libc::SIGKILL as int;
#[cfg(not(windows))] pub const MustDieSignal: int = libc::SIGKILL as int;
/// Representation of a running or exited child process.
///
+53 -53
View File
@@ -66,8 +66,8 @@ pub fn num_cpus() -> uint {
}
}
pub static TMPBUF_SZ : uint = 1000u;
static BUF_BYTES : uint = 2048u;
pub const TMPBUF_SZ : uint = 1000u;
const BUF_BYTES : uint = 2048u;
/// Returns the current working directory as a Path.
///
@@ -1672,230 +1672,230 @@ pub fn kind(&self) -> MemoryMapKind { self.kind }
pub mod consts {
pub use os::arch_consts::ARCH;
pub static FAMILY: &'static str = "unix";
pub const FAMILY: &'static str = "unix";
/// A string describing the specific operating system in use: in this
/// case, `linux`.
pub static SYSNAME: &'static str = "linux";
pub const SYSNAME: &'static str = "linux";
/// Specifies the filename prefix used for shared libraries on this
/// platform: in this case, `lib`.
pub static DLL_PREFIX: &'static str = "lib";
pub const DLL_PREFIX: &'static str = "lib";
/// Specifies the filename suffix used for shared libraries on this
/// platform: in this case, `.so`.
pub static DLL_SUFFIX: &'static str = ".so";
pub const DLL_SUFFIX: &'static str = ".so";
/// Specifies the file extension used for shared libraries on this
/// platform that goes after the dot: in this case, `so`.
pub static DLL_EXTENSION: &'static str = "so";
pub const DLL_EXTENSION: &'static str = "so";
/// Specifies the filename suffix used for executable binaries on this
/// platform: in this case, the empty string.
pub static EXE_SUFFIX: &'static str = "";
pub const EXE_SUFFIX: &'static str = "";
/// Specifies the file extension, if any, used for executable binaries
/// on this platform: in this case, the empty string.
pub static EXE_EXTENSION: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(target_os = "macos")]
pub mod consts {
pub use os::arch_consts::ARCH;
pub static FAMILY: &'static str = "unix";
pub const FAMILY: &'static str = "unix";
/// A string describing the specific operating system in use: in this
/// case, `macos`.
pub static SYSNAME: &'static str = "macos";
pub const SYSNAME: &'static str = "macos";
/// Specifies the filename prefix used for shared libraries on this
/// platform: in this case, `lib`.
pub static DLL_PREFIX: &'static str = "lib";
pub const DLL_PREFIX: &'static str = "lib";
/// Specifies the filename suffix used for shared libraries on this
/// platform: in this case, `.dylib`.
pub static DLL_SUFFIX: &'static str = ".dylib";
pub const DLL_SUFFIX: &'static str = ".dylib";
/// Specifies the file extension used for shared libraries on this
/// platform that goes after the dot: in this case, `dylib`.
pub static DLL_EXTENSION: &'static str = "dylib";
pub const DLL_EXTENSION: &'static str = "dylib";
/// Specifies the filename suffix used for executable binaries on this
/// platform: in this case, the empty string.
pub static EXE_SUFFIX: &'static str = "";
pub const EXE_SUFFIX: &'static str = "";
/// Specifies the file extension, if any, used for executable binaries
/// on this platform: in this case, the empty string.
pub static EXE_EXTENSION: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(target_os = "ios")]
pub mod consts {
pub use os::arch_consts::ARCH;
pub static FAMILY: &'static str = "unix";
pub const FAMILY: &'static str = "unix";
/// A string describing the specific operating system in use: in this
/// case, `ios`.
pub static SYSNAME: &'static str = "ios";
pub const SYSNAME: &'static str = "ios";
/// Specifies the filename suffix used for executable binaries on this
/// platform: in this case, the empty string.
pub static EXE_SUFFIX: &'static str = "";
pub const EXE_SUFFIX: &'static str = "";
/// Specifies the file extension, if any, used for executable binaries
/// on this platform: in this case, the empty string.
pub static EXE_EXTENSION: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(target_os = "freebsd")]
pub mod consts {
pub use os::arch_consts::ARCH;
pub static FAMILY: &'static str = "unix";
pub const FAMILY: &'static str = "unix";
/// A string describing the specific operating system in use: in this
/// case, `freebsd`.
pub static SYSNAME: &'static str = "freebsd";
pub const SYSNAME: &'static str = "freebsd";
/// Specifies the filename prefix used for shared libraries on this
/// platform: in this case, `lib`.
pub static DLL_PREFIX: &'static str = "lib";
pub const DLL_PREFIX: &'static str = "lib";
/// Specifies the filename suffix used for shared libraries on this
/// platform: in this case, `.so`.
pub static DLL_SUFFIX: &'static str = ".so";
pub const DLL_SUFFIX: &'static str = ".so";
/// Specifies the file extension used for shared libraries on this
/// platform that goes after the dot: in this case, `so`.
pub static DLL_EXTENSION: &'static str = "so";
pub const DLL_EXTENSION: &'static str = "so";
/// Specifies the filename suffix used for executable binaries on this
/// platform: in this case, the empty string.
pub static EXE_SUFFIX: &'static str = "";
pub const EXE_SUFFIX: &'static str = "";
/// Specifies the file extension, if any, used for executable binaries
/// on this platform: in this case, the empty string.
pub static EXE_EXTENSION: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(target_os = "dragonfly")]
pub mod consts {
pub use os::arch_consts::ARCH;
pub static FAMILY: &'static str = "unix";
pub const FAMILY: &'static str = "unix";
/// A string describing the specific operating system in use: in this
/// case, `dragonfly`.
pub static SYSNAME: &'static str = "dragonfly";
pub const SYSNAME: &'static str = "dragonfly";
/// Specifies the filename prefix used for shared libraries on this
/// platform: in this case, `lib`.
pub static DLL_PREFIX: &'static str = "lib";
pub const DLL_PREFIX: &'static str = "lib";
/// Specifies the filename suffix used for shared libraries on this
/// platform: in this case, `.so`.
pub static DLL_SUFFIX: &'static str = ".so";
pub const DLL_SUFFIX: &'static str = ".so";
/// Specifies the file extension used for shared libraries on this
/// platform that goes after the dot: in this case, `so`.
pub static DLL_EXTENSION: &'static str = "so";
pub const DLL_EXTENSION: &'static str = "so";
/// Specifies the filename suffix used for executable binaries on this
/// platform: in this case, the empty string.
pub static EXE_SUFFIX: &'static str = "";
pub const EXE_SUFFIX: &'static str = "";
/// Specifies the file extension, if any, used for executable binaries
/// on this platform: in this case, the empty string.
pub static EXE_EXTENSION: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(target_os = "android")]
pub mod consts {
pub use os::arch_consts::ARCH;
pub static FAMILY: &'static str = "unix";
pub const FAMILY: &'static str = "unix";
/// A string describing the specific operating system in use: in this
/// case, `android`.
pub static SYSNAME: &'static str = "android";
pub const SYSNAME: &'static str = "android";
/// Specifies the filename prefix used for shared libraries on this
/// platform: in this case, `lib`.
pub static DLL_PREFIX: &'static str = "lib";
pub const DLL_PREFIX: &'static str = "lib";
/// Specifies the filename suffix used for shared libraries on this
/// platform: in this case, `.so`.
pub static DLL_SUFFIX: &'static str = ".so";
pub const DLL_SUFFIX: &'static str = ".so";
/// Specifies the file extension used for shared libraries on this
/// platform that goes after the dot: in this case, `so`.
pub static DLL_EXTENSION: &'static str = "so";
pub const DLL_EXTENSION: &'static str = "so";
/// Specifies the filename suffix used for executable binaries on this
/// platform: in this case, the empty string.
pub static EXE_SUFFIX: &'static str = "";
pub const EXE_SUFFIX: &'static str = "";
/// Specifies the file extension, if any, used for executable binaries
/// on this platform: in this case, the empty string.
pub static EXE_EXTENSION: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(target_os = "windows")]
pub mod consts {
pub use os::arch_consts::ARCH;
pub static FAMILY: &'static str = "windows";
pub const FAMILY: &'static str = "windows";
/// A string describing the specific operating system in use: in this
/// case, `windows`.
pub static SYSNAME: &'static str = "windows";
pub const SYSNAME: &'static str = "windows";
/// Specifies the filename prefix used for shared libraries on this
/// platform: in this case, the empty string.
pub static DLL_PREFIX: &'static str = "";
pub const DLL_PREFIX: &'static str = "";
/// Specifies the filename suffix used for shared libraries on this
/// platform: in this case, `.dll`.
pub static DLL_SUFFIX: &'static str = ".dll";
pub const DLL_SUFFIX: &'static str = ".dll";
/// Specifies the file extension used for shared libraries on this
/// platform that goes after the dot: in this case, `dll`.
pub static DLL_EXTENSION: &'static str = "dll";
pub const DLL_EXTENSION: &'static str = "dll";
/// Specifies the filename suffix used for executable binaries on this
/// platform: in this case, `.exe`.
pub static EXE_SUFFIX: &'static str = ".exe";
pub const EXE_SUFFIX: &'static str = ".exe";
/// Specifies the file extension, if any, used for executable binaries
/// on this platform: in this case, `exe`.
pub static EXE_EXTENSION: &'static str = "exe";
pub const EXE_EXTENSION: &'static str = "exe";
}
#[cfg(target_arch = "x86")]
mod arch_consts {
pub static ARCH: &'static str = "x86";
pub const ARCH: &'static str = "x86";
}
#[cfg(target_arch = "x86_64")]
mod arch_consts {
pub static ARCH: &'static str = "x86_64";
pub const ARCH: &'static str = "x86_64";
}
#[cfg(target_arch = "arm")]
mod arch_consts {
pub static ARCH: &'static str = "arm";
pub const ARCH: &'static str = "arm";
}
#[cfg(target_arch = "mips")]
mod arch_consts {
pub static ARCH: &'static str = "mips";
pub const ARCH: &'static str = "mips";
}
#[cfg(target_arch = "mipsel")]
mod arch_consts {
pub static ARCH: &'static str = "mipsel";
pub const ARCH: &'static str = "mipsel";
}
#[cfg(test)]
+2 -2
View File
@@ -42,10 +42,10 @@ pub struct Path {
}
/// The standard path separator character
pub static SEP: char = '/';
pub const SEP: char = '/';
/// The standard path separator byte
pub static SEP_BYTE: u8 = SEP as u8;
pub const SEP_BYTE: u8 = SEP as u8;
/// Returns whether the given byte is a path separator
#[inline]
+4 -4
View File
@@ -958,14 +958,14 @@ pub fn make_non_verbatim(path: &Path) -> Option<Path> {
}
/// The standard path separator character
pub static SEP: char = '\\';
pub const SEP: char = '\\';
/// The standard path separator byte
pub static SEP_BYTE: u8 = SEP as u8;
pub const SEP_BYTE: u8 = SEP as u8;
/// The alternative path separator character
pub static SEP2: char = '/';
pub const SEP2: char = '/';
/// The alternative path separator character
pub static SEP2_BYTE: u8 = SEP2 as u8;
pub const SEP2_BYTE: u8 = SEP2 as u8;
/// Returns whether the given char is a path separator.
/// Allows both the primary separator '\' and the alternative separator '/'.
+8 -8
View File
@@ -45,8 +45,8 @@ pub fn log_enabled() -> bool {
val == 2
}
#[cfg(target_word_size = "64")] static HEX_WIDTH: uint = 18;
#[cfg(target_word_size = "32")] static HEX_WIDTH: uint = 10;
#[cfg(target_word_size = "64")] const HEX_WIDTH: uint = 18;
#[cfg(target_word_size = "32")] const HEX_WIDTH: uint = 10;
// All rust symbols are in theory lists of "::"-separated identifiers. Some
// assemblers, however, can't handle these characters in symbol names. To get
@@ -273,7 +273,7 @@ fn backtrace(buf: *mut *mut libc::c_void,
try!(writeln!(w, "stack backtrace:"));
// 100 lines should be enough
static SIZE: uint = 100;
const SIZE: uint = 100;
let mut buf: [*mut libc::c_void, ..SIZE] = unsafe {mem::zeroed()};
let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as uint};
@@ -697,10 +697,10 @@ mod imp {
*mut libc::c_void, *mut libc::c_void,
*mut libc::c_void, *mut libc::c_void) -> libc::BOOL;
static MAX_SYM_NAME: uint = 2000;
static IMAGE_FILE_MACHINE_I386: libc::DWORD = 0x014c;
static IMAGE_FILE_MACHINE_IA64: libc::DWORD = 0x0200;
static IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664;
const MAX_SYM_NAME: uint = 2000;
const IMAGE_FILE_MACHINE_I386: libc::DWORD = 0x014c;
const IMAGE_FILE_MACHINE_IA64: libc::DWORD = 0x0200;
const IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664;
#[repr(C)]
struct SYMBOL_INFO {
@@ -772,7 +772,7 @@ struct KDHELP64 {
mod arch {
use libc;
static MAXIMUM_SUPPORTED_EXTENSION: uint = 512;
const MAXIMUM_SUPPORTED_EXTENSION: uint = 512;
#[repr(C)]
pub struct CONTEXT {
+13 -13
View File
@@ -20,23 +20,23 @@
use result::{Result, Ok, Err};
/// The number of nanoseconds in a microsecond.
static NANOS_PER_MICRO: i32 = 1000;
const NANOS_PER_MICRO: i32 = 1000;
/// The number of nanoseconds in a millisecond.
static NANOS_PER_MILLI: i32 = 1000_000;
const NANOS_PER_MILLI: i32 = 1000_000;
/// The number of nanoseconds in seconds.
static NANOS_PER_SEC: i32 = 1_000_000_000;
const NANOS_PER_SEC: i32 = 1_000_000_000;
/// The number of microseconds per second.
static MICROS_PER_SEC: i64 = 1000_000;
const MICROS_PER_SEC: i64 = 1000_000;
/// The number of milliseconds per second.
static MILLIS_PER_SEC: i64 = 1000;
const MILLIS_PER_SEC: i64 = 1000;
/// The number of seconds in a minute.
static SECS_PER_MINUTE: i64 = 60;
const SECS_PER_MINUTE: i64 = 60;
/// The number of seconds in an hour.
static SECS_PER_HOUR: i64 = 3600;
const SECS_PER_HOUR: i64 = 3600;
/// The number of (non-leap) seconds in days.
static SECS_PER_DAY: i64 = 86400;
const SECS_PER_DAY: i64 = 86400;
/// The number of (non-leap) seconds in a week.
static SECS_PER_WEEK: i64 = 604800;
const SECS_PER_WEEK: i64 = 604800;
macro_rules! try_opt(
($e:expr) => (match $e { Some(v) => v, None => return None })
@@ -52,13 +52,13 @@ pub struct Duration {
}
/// The minimum possible `Duration`: `i64::MIN` milliseconds.
pub static MIN: Duration = Duration {
pub const MIN: Duration = Duration {
secs: i64::MIN / MILLIS_PER_SEC - 1,
nanos: NANOS_PER_SEC + (i64::MIN % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI
};
/// The maximum possible `Duration`: `i64::MAX` milliseconds.
pub static MAX: Duration = Duration {
pub const MAX: Duration = Duration {
secs: i64::MAX / MILLIS_PER_SEC,
nanos: (i64::MAX % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI
};
@@ -456,7 +456,7 @@ fn test_duration_num_microseconds() {
assert_eq!(MIN.num_microseconds(), None);
// overflow checks
static MICROS_PER_DAY: i64 = 86400_000_000;
const MICROS_PER_DAY: i64 = 86400_000_000;
assert_eq!(Duration::days(i64::MAX / MICROS_PER_DAY).num_microseconds(),
Some(i64::MAX / MICROS_PER_DAY * MICROS_PER_DAY));
assert_eq!(Duration::days(i64::MIN / MICROS_PER_DAY).num_microseconds(),
@@ -477,7 +477,7 @@ fn test_duration_num_nanoseconds() {
assert_eq!(MIN.num_nanoseconds(), None);
// overflow checks
static NANOS_PER_DAY: i64 = 86400_000_000_000;
const NANOS_PER_DAY: i64 = 86400_000_000_000;
assert_eq!(Duration::days(i64::MAX / NANOS_PER_DAY).num_nanoseconds(),
Some(i64::MAX / NANOS_PER_DAY * NANOS_PER_DAY));
assert_eq!(Duration::days(i64::MIN / NANOS_PER_DAY).num_nanoseconds(),
+3 -3
View File
@@ -43,9 +43,9 @@
use comm::Receiver;
// Various states you can find a port in.
static EMPTY: uint = 0;
static DATA: uint = 1;
static DISCONNECTED: uint = 2;
const EMPTY: uint = 0;
const DATA: uint = 1;
const DISCONNECTED: uint = 2;
pub struct Packet<T> {
// Internal state of the chan/port pair (stores the blocked task as well)
+4 -4
View File
@@ -31,12 +31,12 @@
use atomic;
use mpsc_queue as mpsc;
static DISCONNECTED: int = int::MIN;
static FUDGE: int = 1024;
const DISCONNECTED: int = int::MIN;
const FUDGE: int = 1024;
#[cfg(test)]
static MAX_STEALS: int = 5;
const MAX_STEALS: int = 5;
#[cfg(not(test))]
static MAX_STEALS: int = 1 << 20;
const MAX_STEALS: int = 1 << 20;
pub struct Packet<T> {
queue: mpsc::Queue<T>,

Some files were not shown because too many files have changed in this diff Show More