Skip to content

Refine the link_args that are propagated #5331

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 62 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
dd4d450
Make debug!, etc. macros not require a format string
brson Mar 8, 2013
cf9e958
rm obsolete iter-trait/option.rs file
thestinger Mar 8, 2013
ac3dc66
auto merge of #5284 : thestinger/rust/iter-trait, r=brson
bors Mar 8, 2013
eaed16c
auto merge of #5278 : brson/rust/logplusplus, r=brson
bors Mar 8, 2013
8453f31
rust-mode.el uses the 'cl macros, so it should actually require them
jld Feb 10, 2013
b69fb75
implement BaseIter for dlist (removing iter-trait)
thestinger Mar 8, 2013
ddecef7
auto merge of #5287 : thestinger/rust/iter-trait, r=pcwalton
bors Mar 8, 2013
fdf69dd
Finish de-implicit-selfing everything but the test suite
bstrie Mar 9, 2013
a5fae1d
auto merge of #5290 : bstrie/rust/dis, r=pcwalton
bors Mar 9, 2013
bef5396
core: implement Clone for primitive types
apasel422 Mar 9, 2013
78b6e37
kate: add Not to list of traits
apasel422 Mar 7, 2013
b4f57d4
kate: remove assert keyword
apasel422 Mar 7, 2013
1cde7e6
auto merge of #5294 : apasel422/rust/clone, r=nikomatsakis
bors Mar 9, 2013
06a336a
vec: renovate the BaseIter impl
thestinger Mar 9, 2013
98ce99d
auto merge of #5295 : apasel422/rust/kate, r=brson
bors Mar 9, 2013
788de75
vec: cleanup
thestinger Mar 9, 2013
7cbd4b2
Remove @ast::Region and replace with @ast::Lifetime.
nikomatsakis Feb 28, 2013
a347e9d
auto merge of #5296 : nikomatsakis/rust/region-syntax-expl-lifetimes-…
bors Mar 10, 2013
a90551b
auto merge of #5302 : thestinger/rust/vec, r=nikomatsakis
bors Mar 10, 2013
267f6c2
auto merge of #5285 : jld/rust/emacs-refix, r=brson
bors Mar 10, 2013
80c71c8
add a TotalOrd impl for the unit type
thestinger Mar 9, 2013
62aa8d7
Simplify the interface to check_fn by pulling some of the madness out…
nikomatsakis Mar 8, 2013
1d8596d
auto merge of #5309 : nikomatsakis/rust/simplify_check_fn, r=nikomats…
bors Mar 10, 2013
a363862
Fix formatting and errors in std::getopts example.
wanderview Mar 10, 2013
13e5859
Correct copyright year to be 2012-2013.
wanderview Mar 11, 2013
58618fb
auto merge of #5308 : wanderview/rust/std-getopts-rustdoc-fix, r=luqmana
bors Mar 11, 2013
e6b5e00
Simplify struct representation.
jld Mar 11, 2013
9eaa608
Get rid of the `Unit` enum representation.
jld Mar 11, 2013
9e85589
Implement vector destructuring from tail
sanxiyn Feb 26, 2013
070137c
Add one more test for vector destructuring
sanxiyn Mar 11, 2013
51cdca0
auto merge of #5122 : sanxiyn/rust/vec-match-tail-2, r=nikomatsakis
bors Mar 11, 2013
d18f785
librustc: Replace all uses of `fn()` with `&fn()`. rs=defun
pcwalton Mar 7, 2013
bd2d17e
libsyntax: Stop parsing bare functions in preparation for switching t…
pcwalton Mar 7, 2013
e48446d
test: Remove newtype enums from the test suite. rs=deenum
pcwalton Mar 8, 2013
4faf63e
libstd: Remove all newtype enums from std and core.
pcwalton Mar 8, 2013
dc48699
librustc: Remove newtype enums from librustc
pcwalton Mar 8, 2013
7538450
libsyntax: Remove newtype enums from libsyntax. rs=deenum
pcwalton Mar 8, 2013
1fcb044
doc: Remove documentation on newtype enums.
pcwalton Mar 8, 2013
a34749c
libsyntax: Stop parsing newtype enums
pcwalton Mar 8, 2013
1274d4a
test: Fix tests. rs=tests
pcwalton Mar 8, 2013
7353568
librustc: Remove old-style operator overloading
pcwalton Mar 9, 2013
08c8402
librustc: Lint the old `drop` destructor notation off
pcwalton Mar 9, 2013
2ebb674
auto merge of #5291 : pcwalton/rust/drop-lint, r=pcwalton
bors Mar 11, 2013
ce24ebb
auto merge of #5314 : jld/rust/adt-simplification, r=pcwalton
bors Mar 11, 2013
86cf248
Add deriving_eq to Cell.
jdm Mar 11, 2013
e9a0db6
auto merge of #5318 : jdm/rust/deriving_cell, r=pcwalton
bors Mar 11, 2013
c88ce30
core: Add vec::raw::mut_buf_as_slice
brson Mar 10, 2013
878a310
auto merge of #5305 : brson/rust/mut_buf_as_slice, r=brson
bors Mar 11, 2013
4bc26ce
rt/core: impl os::getcwd() in rust ref #4812
olsonjeffery Feb 14, 2013
53db6c7
core: rt/core: impl os::env() in rust ref #4812
olsonjeffery Feb 15, 2013
a69a2ac
rt/core: port os::list_dir to rust ref #4812
olsonjeffery Feb 21, 2013
25c3c36
core: change import of exchange_alloc for win32 os::_list_dir
olsonjeffery Mar 6, 2013
a04ba76
core: fix broken tests on windows
olsonjeffery Mar 7, 2013
cf82360
core: formatting appeasement
olsonjeffery Mar 8, 2013
5ff66f0
core: link pthreads explicitly in linux build
olsonjeffery Mar 9, 2013
3aa92a9
core: convert asserts to fail_unless!
olsonjeffery Mar 9, 2013
7e59951
core: Convert obsolete fn syntax
brson Mar 11, 2013
f4dba95
auto merge of #5322 : brson/rust/4812, r=brson
bors Mar 11, 2013
a6bb4a0
auto merge of #5292 : thestinger/rust/nil, r=graydon
bors Mar 12, 2013
676e029
core: Add rt mod and add the new scheduler code
brson Feb 4, 2013
48cb9a8
auto merge of #5303 : brson/rust/newsched4, r=brson
bors Mar 12, 2013
1e1efbf
Avoid propagating link_arg values that are unlikely to be resolveable…
jdm Mar 12, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -889,10 +889,10 @@ declared, in an angle-bracket-enclosed, comma-separated list following
the function name.

~~~~ {.xfail-test}
fn iter<T>(seq: &[T], f: fn(T)) {
fn iter<T>(seq: &[T], f: &fn(T)) {
for seq.each |elt| { f(elt); }
}
fn map<T, U>(seq: &[T], f: fn(T) -> U) -> ~[U] {
fn map<T, U>(seq: &[T], f: &fn(T) -> U) -> ~[U] {
let mut acc = ~[];
for seq.each |elt| { acc.push(f(elt)); }
acc
Expand Down Expand Up @@ -1198,7 +1198,7 @@ These appear after the trait name, using the same syntax used in [generic functi
trait Seq<T> {
fn len() -> uint;
fn elt_at(n: uint) -> T;
fn iter(fn(T));
fn iter(&fn(T));
}
~~~~

Expand Down Expand Up @@ -2074,7 +2074,7 @@ and moving values from the environment into the lambda expression's captured env
An example of a lambda expression:

~~~~
fn ten_times(f: fn(int)) {
fn ten_times(f: &fn(int)) {
let mut i = 0;
while i < 10 {
f(i);
Expand Down Expand Up @@ -2177,7 +2177,7 @@ If the `expr` is a [field expression](#field-expressions), it is parsed as thoug
In this example, both calls to `f` are equivalent:

~~~~
# fn f(f: fn(int)) { }
# fn f(f: &fn(int)) { }
# fn g(i: int) { }

f(|j| g(j));
Expand Down Expand Up @@ -2755,7 +2755,7 @@ and the cast expression in `main`.
Within the body of an item that has type parameter declarations, the names of its type parameters are types:

~~~~~~~
fn map<A: Copy, B: Copy>(f: fn(A) -> B, xs: &[A]) -> ~[B] {
fn map<A: Copy, B: Copy>(f: &fn(A) -> B, xs: &[A]) -> ~[B] {
if xs.len() == 0 { return ~[]; }
let first: B = f(xs[0]);
let rest: ~[B] = map(f, xs.slice(1, xs.len()));
Expand Down
98 changes: 45 additions & 53 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,45 +681,6 @@ the value of `North` is 0, `East` is 1, `South` is 2, and `West` is 3.
When an enum is C-like, you can apply the `as` cast operator to
convert it to its discriminator value as an `int`.

<a name="single_variant_enum"></a>

There is a special case for enums with a single variant, which are
sometimes called "newtype-style enums" (after Haskell's "newtype"
feature). These are used to define new types in such a way that the
new name is not just a synonym for an existing type, but its own
distinct type: `type` creates a structural synonym, while this form of
`enum` creates a nominal synonym. If you say:

~~~~
enum GizmoId = int;
~~~~

That is a shorthand for this:

~~~~
enum GizmoId { GizmoId(int) }
~~~~

You can extract the contents of such an enum type with the
dereference (`*`) unary operator:

~~~~
# enum GizmoId = int;
let my_gizmo_id: GizmoId = GizmoId(10);
let id_int: int = *my_gizmo_id;
~~~~

Types like this can be useful to differentiate between data that have
the same type but must be used in different ways.

~~~~
enum Inches = int;
enum Centimeters = int;
~~~~

The above definitions allow for a simple way for programs to avoid
confusing numbers that correspond to different units.

For enum types with multiple variants, destructuring is the only way to
get at their contents. All variant constructors can be used as
patterns, as in this definition of `area`:
Expand Down Expand Up @@ -789,10 +750,10 @@ 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.
Rust also has _tuple structs_, which behave like both structs and tuples,
except that, unlike tuples, tuple structs have names (so `Foo(1, 2)` has a
different type from `Bar(1, 2)`), and tuple structs' _fields_ do not have
names.

For example:
~~~~
Expand All @@ -803,6 +764,37 @@ match mytup {
}
~~~~

<a name="newtype"></a>

There is a special case for tuple structs with a single field, which are
sometimes called "newtypes" (after Haskell's "newtype" feature). These are
used to define new types in such a way that the new name is not just a
synonym for an existing type but is rather its own distinct type.

~~~~
struct GizmoId(int);
~~~~

For convenience, you can extract the contents of such a struct with the
dereference (`*`) unary operator:

~~~~
# struct GizmoId(int);
let my_gizmo_id: GizmoId = GizmoId(10);
let id_int: int = *my_gizmo_id;
~~~~

Types like this can be useful to differentiate between data that have
the same type but must be used in different ways.

~~~~
struct Inches(int);
struct Centimeters(int);
~~~~

The above definitions allow for a simple way for programs to avoid
confusing numbers that correspond to different units.

# Functions

We've already seen several function definitions. Like all other static
Expand Down Expand Up @@ -1369,7 +1361,7 @@ the enclosing scope.

~~~~
# use println = core::io::println;
fn call_closure_with_ten(b: fn(int)) { b(10); }
fn call_closure_with_ten(b: &fn(int)) { b(10); }

let captured_var = 20;
let closure = |arg| println(fmt!("captured_var=%d, arg=%d", captured_var, arg));
Expand Down Expand Up @@ -1455,7 +1447,7 @@ should almost always declare the type of that argument as `fn()`. That way,
callers may pass any kind of closure.

~~~~
fn call_twice(f: fn()) { f(); f(); }
fn call_twice(f: &fn()) { f(); f(); }
let closure = || { "I'm a closure, and it doesn't matter what type I am"; };
fn function() { "I'm a normal function"; }
call_twice(closure);
Expand All @@ -1475,7 +1467,7 @@ Consider this function that iterates over a vector of
integers, passing in a pointer to each integer in the vector:

~~~~
fn each(v: &[int], op: fn(v: &int)) {
fn each(v: &[int], op: &fn(v: &int)) {
let mut n = 0;
while n < v.len() {
op(&v[n]);
Expand All @@ -1496,7 +1488,7 @@ argument, we can write it in a way that has a pleasant, block-like
structure.

~~~~
# fn each(v: &[int], op: fn(v: &int)) { }
# fn each(v: &[int], op: &fn(v: &int)) { }
# fn do_some_work(i: &int) { }
each([1, 2, 3], |n| {
do_some_work(n);
Expand All @@ -1507,7 +1499,7 @@ This is such a useful pattern that Rust has a special form of function
call that can be written more like a built-in control structure:

~~~~
# fn each(v: &[int], op: fn(v: &int)) { }
# fn each(v: &[int], op: &fn(v: &int)) { }
# fn do_some_work(i: &int) { }
do each([1, 2, 3]) |n| {
do_some_work(n);
Expand Down Expand Up @@ -1554,7 +1546,7 @@ Consider again our `each` function, this time improved to
break early when the iteratee returns `false`:

~~~~
fn each(v: &[int], op: fn(v: &int) -> bool) {
fn each(v: &[int], op: &fn(v: &int) -> bool) {
let mut n = 0;
while n < v.len() {
if !op(&v[n]) {
Expand Down Expand Up @@ -1778,7 +1770,7 @@ vector consisting of the result of applying `function` to each element
of `vector`:

~~~~
fn map<T, U>(vector: &[T], function: fn(v: &T) -> U) -> ~[U] {
fn map<T, U>(vector: &[T], function: &fn(v: &T) -> U) -> ~[U] {
let mut accumulator = ~[];
for vec::each(vector) |element| {
accumulator.push(function(element));
Expand Down Expand Up @@ -1977,12 +1969,12 @@ types might look like the following:
~~~~
trait Seq<T> {
fn len(&self) -> uint;
fn iter(&self, b: fn(v: &T));
fn iter(&self, b: &fn(v: &T));
}

impl<T> Seq<T> for ~[T] {
fn len(&self) -> uint { vec::len(*self) }
fn iter(&self, b: fn(v: &T)) {
fn iter(&self, b: &fn(v: &T)) {
for vec::each(*self) |elt| { b(elt); }
}
}
Expand Down Expand Up @@ -2294,7 +2286,7 @@ struct level. Note that fields and methods are _public_ by default.
pub mod farm {
# pub type Chicken = int;
# type Cow = int;
# enum Human = int;
# struct Human(int);
# impl Human { fn rest(&self) { } }
# pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], cows: ~[], farmer: Human(0) } }
pub struct Farm {
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn is_test_ignored(config: config, testfile: &Path) -> bool {
}
}

fn iter_header(testfile: &Path, it: fn(~str) -> bool) -> bool {
fn iter_header(testfile: &Path, it: &fn(~str) -> bool) -> bool {
let rdr = io::file_reader(testfile).get();
while !rdr.eof() {
let ln = rdr.read_line();
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ fn compose_and_run(config: config, testfile: &Path,
}

fn make_compile_args(config: config, props: TestProps, extras: ~[~str],
xform: fn(config, (&Path)) -> Path,
xform: &fn(config, (&Path)) -> Path,
testfile: &Path) -> ProcArgs {
let prog = config.rustc_path;
let mut args = ~[testfile.to_str(),
Expand Down
1 change: 1 addition & 0 deletions src/etc/emacs/rust-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

(require 'cm-mode)
(require 'cc-mode)
(eval-when-compile (require 'cl))

(defun rust-electric-brace (arg)
(interactive "*P")
Expand Down
2 changes: 1 addition & 1 deletion src/etc/kate/rust.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
</list>
<list name="keywords">
<item> as </item>
<item> assert </item>
<item> break </item>
<item> const </item>
<item> copy </item>
Expand Down Expand Up @@ -69,6 +68,7 @@
<item> Shl </item>
<item> Shr </item>
<item> Index </item>
<item> Not </item>
</list>
<list name="types">
<item> bool </item>
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/at_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub pure fn capacity<T>(v: @[const T]) -> uint {
*/
#[inline(always)]
pub pure fn build_sized<A>(size: uint,
builder: &fn(push: pure fn(v: A))) -> @[A] {
builder: &fn(push: &pure fn(v: A))) -> @[A] {
let mut vec: @[const A] = @[];
unsafe { raw::reserve(&mut vec, size); }
builder(|+x| unsafe { raw::push(&mut vec, x) });
Expand All @@ -79,7 +79,7 @@ pub pure fn build_sized<A>(size: uint,
* onto the vector being constructed.
*/
#[inline(always)]
pub pure fn build<A>(builder: &fn(push: pure fn(v: A))) -> @[A] {
pub pure fn build<A>(builder: &fn(push: &pure fn(v: A))) -> @[A] {
build_sized(4, builder)
}

Expand All @@ -97,7 +97,7 @@ pub pure fn build<A>(builder: &fn(push: pure fn(v: A))) -> @[A] {
*/
#[inline(always)]
pub pure fn build_sized_opt<A>(size: Option<uint>,
builder: &fn(push: pure fn(v: A))) -> @[A] {
builder: &fn(push: &pure fn(v: A))) -> @[A] {
build_sized(size.get_or_default(4), builder)
}

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub pure fn to_str(v: bool) -> ~str { if v { ~"true" } else { ~"false" } }
* Iterates over all truth values by passing them to `blk` in an unspecified
* order
*/
pub fn all_values(blk: fn(v: bool)) {
pub fn all_values(blk: &fn(v: bool)) {
blk(true);
blk(false);
}
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use prelude::*;
///
/// Similar to a mutable option type, but friendlier.

#[deriving_eq]
pub struct Cell<T> {
mut value: Option<T>
}
Expand Down Expand Up @@ -54,7 +55,7 @@ pub impl<T> Cell<T> {
}

// Calls a closure with a reference to the value.
fn with_ref<R>(&self, op: fn(v: &T) -> R) -> R {
fn with_ref<R>(&self, op: &fn(v: &T) -> R) -> R {
let v = self.take();
let r = op(&v);
self.put_back(v);
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct AnnihilateStats {
n_bytes_freed: uint
}

unsafe fn each_live_alloc(f: fn(box: *mut BoxRepr, uniq: bool) -> bool) {
unsafe fn each_live_alloc(f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
use managed;

let task: *Task = transmute(rustrt::rust_get_task());
Expand Down
28 changes: 28 additions & 0 deletions src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,31 @@ impl Clone for () {
#[inline(always)]
fn clone(&self) -> () { () }
}

macro_rules! clone_impl(
($t:ty) => {
impl Clone for $t {
#[inline(always)]
fn clone(&self) -> $t { *self }
}
}
)

clone_impl!(int)
clone_impl!(i8)
clone_impl!(i16)
clone_impl!(i32)
clone_impl!(i64)

clone_impl!(uint)
clone_impl!(u8)
clone_impl!(u16)
clone_impl!(u32)
clone_impl!(u64)

clone_impl!(float)
clone_impl!(f32)
clone_impl!(f64)

clone_impl!(bool)
clone_impl!(char)
Loading