Skip to content

generate dll file name based on target os. issue #4119 #4236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 23 commits into from
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ Grahame Bowland <grahame@angrygoats.net>
Haitao Li <lihaitao@gmail.com>
Huon Wilson <dbau.pp+github@gmail.com>
Ian D. Bollinger <ian.bollinger@gmail.com>
Isaac Aggrey <isaac.aggrey@gmail.com>
Ivano Coppola <rgbfirefox@gmail.com>
Jacob Harris Cryer Kragh <jhckragh@gmail.com>
Jacob Parker <j3parker@csclub.uwaterloo.ca>
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -42,9 +42,9 @@ packages:
Assuming you're on a relatively modern *nix system and have met the
prerequisites, something along these lines should work.

$ wget http://dl.rust-lang.org/dist/rust-0.4.tar.gz
$ tar -xzf rust-0.4.tar.gz
$ cd rust-0.4
$ wget http://dl.rust-lang.org/dist/rust-0.5.tar.gz
$ tar -xzf rust-0.5.tar.gz
$ cd rust-0.5
$ ./configure
$ make && make install

@@ -59,8 +59,8 @@ When complete, `make install` will place several programs into
API-documentation tool, and `cargo`, the Rust package manager.

[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
[tarball]: http://dl.rust-lang.org/dist/rust-0.4.tar.gz
[win-exe]: http://dl.rust-lang.org/dist/rust-0.4-install.exe
[tarball]: http://dl.rust-lang.org/dist/rust-0.5.tar.gz
[win-exe]: http://dl.rust-lang.org/dist/rust-0.5-install.exe


## License
3 changes: 3 additions & 0 deletions RELEASES.txt
Original file line number Diff line number Diff line change
@@ -26,6 +26,9 @@ Version 0.5 (December 2012)
* `&T` may now be coerced to `*T`
* Coercions happen in `let` statements as well as function calls
* `use` statements now take crate-relative paths
* The module and type namespaces have been merged so that static
method names can be resolved under the trait in which they are
declared

* Improved support for language features
* Trait inheritance works in many scenarios
111 changes: 104 additions & 7 deletions doc/rust.md
Original file line number Diff line number Diff line change
@@ -1072,6 +1072,15 @@ let p = Point {x: 10, y: 11};
let px: int = p.x;
~~~~

A _tuple structure_ is a nominal [tuple type](#tuple-types), also defined with the keyword `struct`.
For example:

~~~~
struct Point(int, int);
let p = Point(10, 11);
let px: int = match p { Point(x, _) => x };
~~~~

### Enumerations

An _enumeration_ is a simultaneous definition of a nominal [enumerated type](#enumerated-types) as well as a set of *constructors*,
@@ -1195,8 +1204,34 @@ Values with a trait type can have [methods called](#method-call-expressions) on
for any method in the trait,
and can be used to instantiate type parameters that are bounded by the trait.

Trait methods may be static. Currently implementations of static methods behave like
functions declared in the implentation's module.
Trait methods may be static,
which means that they lack a `self` argument.
This means that they can only be called with function call syntax (`f(x)`)
and not method call syntax (`obj.f()`).
The way to refer to the name of a static method is to qualify it with the trait name,
treating the trait name like a module.
For example:

~~~~
trait Num {
static pure fn from_int(n: int) -> self;
}
impl float: Num {
static pure fn from_int(n: int) -> float { n as float }
}
let x: float = Num::from_int(42);
~~~~

Traits can have _constraints_ for example, in

~~~~
trait Shape { fn area() -> float; }
trait Circle : Shape { fn radius() -> float; }
~~~~

the syntax `Circle : Shape` means that types that implement `Circle` must also have an implementation for `Shape`.
In an implementation of `Circle` for a given type `T`, methods can refer to `Shape` methods,
since the typechecker checks that any type with an implementation of `Circle` also has an implementation of `Shape`.

### Implementations

@@ -1465,6 +1500,14 @@ when evaluated in an _rvalue context_, it denotes the value held _in_ that memor
When an rvalue is used in lvalue context, a temporary un-named lvalue is created and used instead.
A temporary's lifetime equals the largest lifetime of any borrowed pointer that points to it.

#### Moved and copied types

When a [local variable](#memory-slots) is used as an [rvalue](#lvalues-rvalues-and-temporaries)
the variable will either be [moved](#move-expressions) or [copied](#copy-expressions),
depending on its type.
For types that contain mutable fields or [owning pointers](#owning-pointers), the variable is moved.
All other types are copied.


### Literal expressions

@@ -1495,6 +1538,53 @@ values.
("a", 4u, true);
~~~~~~~~

### Structure expressions

~~~~~~~~{.ebnf .gram}
struct_expr : expr_path '{' ident ':' expr
[ ',' ident ':' expr ] *
[ ".." expr ] '}' |
expr_path '(' expr
[ ',' expr ] * ')'
~~~~~~~~

There are several forms of structure expressions.
A _structure expression_ consists of the [path](#paths) of a [structure item](#structures),
followed by a brace-enclosed list of one or more comma-separated name-value pairs,
providing the field values of a new instance of the structure.
A field name can be any identifier, and is separated from its value expression by a colon.
To indicate that a field is mutable, the `mut` keyword is written before its name.

A _tuple structure expression_ constists of the [path](#paths) of a [structure item](#structures),
followed by a parenthesized list of one or more comma-separated expressions
(in other words, the path of a structured item followed by a tuple expression).
The structure item must be a tuple structure item.

The following are examples of structure expressions:

~~~~
# struct Point { x: float, y: float }
# struct TuplePoint(float, float);
# mod game { pub struct User { name: &str, age: uint, mut score: uint } }
# use game;
Point {x: 10f, y: 20f};
TuplePoint(10f, 20f);
let u = game::User {name: "Joe", age: 35u, mut score: 100_000};
~~~~

A structure expression forms a new value of the named structure type.

A structure expression can terminate with the syntax `..` followed by an expression to denote a functional update.
The expression following `..` (the base) must be of the same structure type as the new structure type being formed.
A new structure will be created, of the same type as the base expression, with the given values for the fields that were explicitly specified,
and the values in the base record for all other fields.

~~~~
# struct Point3d { x: int, y: int, z: int }
let base = Point3d {x: 1, y: 2, z: 3};
Point3d {y: 0, z: 10, .. base};
~~~~

### Record expressions

~~~~~~~~{.ebnf .gram}
@@ -1503,9 +1593,11 @@ rec_expr : '{' ident ':' expr
[ ".." expr ] '}'
~~~~~~~~

> **Note:** In future versions of Rust, record expressions and [record types](#record-types) will be removed.

A [_record_](#record-types) _expression_ is one or more comma-separated
name-value pairs enclosed by braces. A fieldname can be any identifier
(including keywords), and is separated from its value expression by a
name-value pairs enclosed by braces. A fieldname can be any identifier,
and is separated from its value expression by a
colon. To indicate that a field is mutable, the `mut` keyword is
written before its name.

@@ -1787,7 +1879,7 @@ y.z <-> b.c;
An _assignment expression_ consists of an [lvalue](#lvalues-rvalues-and-temporaries) expression followed by an
equals sign (`=`) and an [rvalue](#lvalues-rvalues-and-temporaries) expression.

Evaluating an assignment expression copies the expression on the right-hand side and stores it in the location on the left-hand side.
Evaluating an assignment expression [either copies or moves](#moved-and-copied-types) its right-hand operand to its left-hand operand.

~~~~
# let mut x = 0;
@@ -1860,7 +1952,7 @@ copy.
as are raw and borrowed pointers.
[Owned boxes](#pointer-types), [owned vectors](#vector-types) and similar owned types are deep-copied.

Since the binary [assignment operator](#assignment-expressions) `=` performs a copy implicitly,
Since the binary [assignment operator](#assignment-expressions) `=` performs a copy or move implicitly,
the unary copy operator is typically only used to cause an argument to a function to be copied and passed by value.

An example of a copy expression:
@@ -1884,13 +1976,17 @@ move_expr : "move" expr ;
~~~~~~~~

A _unary move expression_ is similar to a [unary copy](#unary-copy-expressions) expression,
except that it can only be applied to an [lvalue](#lvalues-rvalues-and-temporaries),
except that it can only be applied to a [local variable](#memory-slots),
and it performs a _move_ on its operand, rather than a copy.
That is, the memory location denoted by its operand is de-initialized after evaluation,
and the resulting value is a shallow copy of the operand,
even if the operand is an [owning type](#type-kinds).


> **Note:** In future versions of Rust, `move` may be removed as a separate operator;
> moves are now [automatically performed](#moved-and-copied-types) for most cases `move` would be appropriate.


### Call expressions

~~~~~~~~ {.abnf .gram}
@@ -2520,6 +2616,7 @@ the resulting `struct` value will always be laid out in memory in the order spec
The fields of a `struct` may be qualified by [visibility modifiers](#visibility-modifiers),
to restrict access to implementation-private data in a structure.

A `tuple struct` type is just like a structure type, except that the fields are anonymous.

### Enumerated types

87 changes: 81 additions & 6 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
@@ -100,9 +100,9 @@ If you've fulfilled those prerequisites, something along these lines
should work.

~~~~ {.notrust}
$ curl -O http://dl.rust-lang.org/dist/rust-0.4.tar.gz
$ tar -xzf rust-0.4.tar.gz
$ cd rust-0.4
$ curl -O http://dl.rust-lang.org/dist/rust-0.5.tar.gz
$ tar -xzf rust-0.5.tar.gz
$ cd rust-0.5
$ ./configure
$ make && make install
~~~~
@@ -118,8 +118,8 @@ When complete, `make install` will place several programs into
API-documentation tool, and `cargo`, the Rust package manager.

[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
[tarball]: http://dl.rust-lang.org/dist/rust-0.4.tar.gz
[win-exe]: http://dl.rust-lang.org/dist/rust-0.4-install.exe
[tarball]: http://dl.rust-lang.org/dist/rust-0.5.tar.gz
[win-exe]: http://dl.rust-lang.org/dist/rust-0.5-install.exe

## Compiling your first program

@@ -902,6 +902,22 @@ match mytup {
}
~~~~

## Tuple structs

Rust also has _nominal tuples_, which behave like both structs and tuples,
except that nominal tuple types have names
(so `Foo(1, 2)` has a different type from `Bar(1, 2)`),
and nominal tuple types' _fields_ do not have names.

For example:
~~~~
struct MyTup(int, int, float);
let mytup: MyTup = MyTup(10, 20, 30.0);
match mytup {
MyTup(a, b, c) => log(info, a + b + (c as int))
}
~~~~

# Functions and methods

We've already seen several function definitions. Like all other static
@@ -1924,7 +1940,7 @@ types by the compiler, and may not be overridden:

Additionally, the `Drop` trait is used to define destructors. This
trait defines one method called `finalize`, which is automatically
called when value of the a type that implements this trait is
called when a value of the type that implements this trait is
destroyed, either because the value went out of scope or because the
garbage collector reclaimed it.

@@ -2076,6 +2092,65 @@ the preferred way to use traits polymorphically.

This usage of traits is similar to Haskell type classes.

## Static methods

Traits can define _static_ methods, which don't have an implicit `self` argument.
The `static` keyword distinguishes static methods from methods that have a `self`:

~~~~
trait Shape {
fn area() -> float;
static fn new_shape(area: float) -> Shape;
}
~~~~

Constructors are one application for static methods, as in `new_shape` above.
To call a static method, you have to prefix it with the trait name and a double colon:

~~~~
# trait Shape { static fn new_shape(area: float) -> self; }
# use float::consts::pi;
# use float::sqrt;
struct Circle { radius: float }
impl Circle: Shape {
static fn new_shape(area: float) -> Circle { Circle { radius: sqrt(area / pi) } }
}
let s: Circle = Shape::new_shape(42.5);
~~~~

## Trait constraints

We can write a trait declaration that is _constrained_ to only be implementable on types that
also implement some other trait.

For example, we can define a `Circle` trait that only types that also have the `Shape` trait can have:

~~~~
trait Shape { fn area() -> float; }
trait Circle : Shape { fn radius() -> float; }
~~~~

Now, implementations of `Circle` methods can call `Shape` methods:

~~~~
# trait Shape { fn area() -> float; }
# trait Circle : Shape { fn radius() -> float; }
# struct Point { x: float, y: float }
# use float::consts::pi;
# use float::sqrt;
# fn square(x: float) -> float { x * x }
struct CircleStruct { center: Point, radius: float }
impl CircleStruct: Circle {
fn radius() -> float { sqrt(self.area() / pi) }
}
impl CircleStruct: Shape {
fn area() -> float { pi * square(self.radius) }
}
~~~~

This is a silly way to compute the radius of a circle
(since we could just return the `circle` field), but you get the idea.

## Trait objects and dynamic method dispatch

The above allows us to define functions that polymorphically act on
3 changes: 3 additions & 0 deletions src/libcore/dvec.rs
Original file line number Diff line number Diff line change
@@ -110,6 +110,9 @@ priv impl<A> DVec<A> {
self.data = move data;
}
}

#[inline(always)]
fn unwrap(self) -> ~[A] { unwrap(self) }
}

// In theory, most everything should work with any A, but in practice
8 changes: 8 additions & 0 deletions src/libcore/either.rs
Original file line number Diff line number Diff line change
@@ -142,6 +142,14 @@ pub pure fn unwrap_right<T,U>(eith: Either<T,U>) -> U {
}
}

impl<T, U> Either<T, U> {
#[inline(always)]
fn unwrap_left(self) -> T { unwrap_left(self) }

#[inline(always)]
fn unwrap_right(self) -> U { unwrap_right(self) }
}

#[test]
fn test_either_left() {
let val = Left(10);
3 changes: 3 additions & 0 deletions src/libcore/mutable.rs
Original file line number Diff line number Diff line change
@@ -73,6 +73,9 @@ impl<T> Data<T> {
op(unsafe{transmute_immut(&mut self.value)})
}
}

#[inline(always)]
fn unwrap(self) -> T { unwrap(self) }
}

#[test]
Loading