Skip to content

Commit 60c36f7

Browse files
committed
---
yaml --- r: 140927 b: refs/heads/try2 c: d68c027 h: refs/heads/master i: 140925: 70e6467 140923: 7ad4372 140919: 041e7cc 140911: 9f989bc 140895: 8619052 140863: 2e33cec 140799: 6f00978 v: v3
1 parent ee83449 commit 60c36f7

File tree

762 files changed

+32986
-16770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

762 files changed

+32986
-16770
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 48b6262b383365b7319ef76fa9c6d2c63c4d70e1
8+
refs/heads/try2: d68c0279eadc8544a1e3c1d9077185500a36ae66
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
*.diff
4040
*.rej
4141
*.swp
42+
*.swo
4243
*.tmp
4344
*.pyc
4445
*.elc

branches/try2/Makefile.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ endif
101101

102102
ifdef CFG_ENABLE_DEBUG
103103
$(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
104-
CFG_RUSTC_FLAGS +=
104+
CFG_RUSTC_FLAGS += --cfg debug
105105
CFG_GCCISH_CFLAGS += -DRUST_DEBUG
106106
else
107107
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
@@ -110,6 +110,9 @@ endif
110110
ifdef SAVE_TEMPS
111111
CFG_RUSTC_FLAGS += --save-temps
112112
endif
113+
ifdef ASM_COMMENTS
114+
CFG_RUSTC_FLAGS += -z asm-comments
115+
endif
113116
ifdef TIME_PASSES
114117
CFG_RUSTC_FLAGS += -Z time-passes
115118
endif

branches/try2/configure

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ then
439439
probe CFG_ZCAT zcat
440440
fi
441441

442+
step_msg "looking for target specific programs"
443+
444+
probe CFG_ADB adb
445+
442446
if [ ! -z "$CFG_PANDOC" ]
443447
then
444448
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc ' |
@@ -691,6 +695,9 @@ do
691695
# host lib dir
692696
make_dir $h/stage$i/$CFG_LIBDIR
693697

698+
# host test dir
699+
make_dir $h/stage$i/test
700+
694701
# target bin dir
695702
make_dir $h/stage$i/$CFG_LIBDIR/rustc/$t/bin
696703

branches/try2/doc/rust.md

Lines changed: 86 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ each of which may have some number of [attributes](#attributes) attached to it.
618618

619619
~~~~~~~~ {.ebnf .gram}
620620
item : mod_item | fn_item | type_item | struct_item | enum_item
621-
| static_item | trait_item | impl_item | foreign_mod_item ;
621+
| static_item | trait_item | impl_item | extern_block ;
622622
~~~~~~~~
623623

624624
An _item_ is a component of a crate; some module items can be defined in crate
@@ -752,10 +752,11 @@ link_attr : ident '=' literal ;
752752
~~~~~~~~
753753

754754
An _`extern mod` declaration_ specifies a dependency on an external crate.
755-
The external crate is then bound into the declaring scope as the `ident` provided in the `extern_mod_decl`.
755+
The external crate is then bound into the declaring scope
756+
as the `ident` provided in the `extern_mod_decl`.
756757

757-
The external crate is resolved to a specific `soname` at compile time, and a
758-
runtime linkage requirement to that `soname` is passed to the linker for
758+
The external crate is resolved to a specific `soname` at compile time,
759+
and a runtime linkage requirement to that `soname` is passed to the linker for
759760
loading at runtime. The `soname` is resolved at compile time by scanning the
760761
compiler's library path and matching the `link_attrs` provided in the
761762
`use_decl` against any `#link` attributes that were declared on the external
@@ -992,10 +993,10 @@ Thus the return type on `f` only needs to reflect the `if` branch of the conditi
992993
#### Extern functions
993994

994995
Extern functions are part of Rust's foreign function interface,
995-
providing the opposite functionality to [foreign modules](#foreign-modules).
996-
Whereas foreign modules allow Rust code to call foreign code,
997-
extern functions with bodies defined in Rust code _can be called by foreign code_.
998-
They are defined in the same way as any other Rust function,
996+
providing the opposite functionality to [external blocks](#external-blocks).
997+
Whereas external blocks allow Rust code to call foreign code,
998+
extern functions with bodies defined in Rust code _can be called by foreign
999+
code_. They are defined in the same way as any other Rust function,
9991000
except that they have the `extern` modifier.
10001001

10011002
~~~
@@ -1011,7 +1012,8 @@ let fptr: *u8 = new_vec;
10111012
~~~
10121013

10131014
The primary motivation for extern functions is
1014-
to create callbacks for foreign functions that expect to receive function pointers.
1015+
to create callbacks for foreign functions that expect to receive function
1016+
pointers.
10151017

10161018
### Type definitions
10171019

@@ -1308,64 +1310,61 @@ impl Seq<bool> for u32 {
13081310
}
13091311
~~~~
13101312

1311-
### Foreign modules
1313+
### External blocks
13121314

13131315
~~~ {.ebnf .gram}
1314-
foreign_mod_item : "extern mod" ident '{' foreign_mod '} ;
1315-
foreign_mod : [ foreign_fn ] * ;
1316+
extern_block_item : "extern" '{' extern_block '} ;
1317+
extern_block : [ foreign_fn ] * ;
13161318
~~~
13171319

1318-
Foreign modules form the basis for Rust's foreign function interface. A
1319-
foreign module describes functions in external, non-Rust
1320-
libraries.
1321-
Functions within foreign modules are declared in the same way as other Rust functions,
1322-
with the exception that they may not have a body and are instead terminated by a semicolon.
1320+
External blocks form the basis for Rust's foreign function interface.
1321+
Declarations in an external block describe symbols
1322+
in external, non-Rust libraries.
1323+
1324+
Functions within external blocks
1325+
are declared in the same way as other Rust functions,
1326+
with the exception that they may not have a body
1327+
and are instead terminated by a semicolon.
13231328

13241329
~~~
13251330
# use core::libc::{c_char, FILE};
13261331
# #[nolink]
13271332
1328-
extern mod c {
1333+
extern {
13291334
fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
13301335
}
13311336
~~~
13321337

1333-
Functions within foreign modules may be called by Rust code, just like functions defined in Rust.
1334-
The Rust compiler automatically translates between the Rust ABI and the foreign ABI.
1335-
1336-
The name of the foreign module has special meaning to the Rust compiler in
1337-
that it will treat the module name as the name of a library to link to,
1338-
performing the linking as appropriate for the target platform. The name
1339-
given for the foreign module will be transformed in a platform-specific way
1340-
to determine the name of the library. For example, on Linux the name of the
1341-
foreign module is prefixed with 'lib' and suffixed with '.so', so the
1342-
foreign mod 'rustrt' would be linked to a library named 'librustrt.so'.
1338+
Functions within external blocks may be called by Rust code,
1339+
just like functions defined in Rust.
1340+
The Rust compiler automatically translates
1341+
between the Rust ABI and the foreign ABI.
13431342

1344-
A number of [attributes](#attributes) control the behavior of foreign
1345-
modules.
1343+
A number of [attributes](#attributes) control the behavior of external
1344+
blocks.
13461345

1347-
By default foreign modules assume that the library they are calling use the
1348-
standard C "cdecl" ABI. Other ABIs may be specified using the `abi`
1349-
attribute as in
1346+
By default external blocks assume
1347+
that the library they are calling uses the standard C "cdecl" ABI.
1348+
Other ABIs may be specified using the `abi` attribute as in
13501349

13511350
~~~{.xfail-test}
13521351
// Interface to the Windows API
13531352
#[abi = "stdcall"]
1354-
extern mod kernel32 { }
1353+
extern { }
13551354
~~~
13561355

1357-
The `link_name` attribute allows the default library naming behavior to
1358-
be overridden by explicitly specifying the name of the library.
1356+
The `link_name` attribute allows the name of the library to be specified.
13591357

13601358
~~~{.xfail-test}
13611359
#[link_name = "crypto"]
1362-
extern mod mycrypto { }
1360+
extern { }
13631361
~~~
13641362

1365-
The `nolink` attribute tells the Rust compiler not to do any linking for the foreign module.
1366-
This is particularly useful for creating foreign
1367-
modules for libc, which tends to not follow standard library naming
1368-
conventions and is linked to all Rust programs anyway.
1363+
The `nolink` attribute tells the Rust compiler
1364+
not to do any linking for the external block.
1365+
This is particularly useful for creating external blocks for libc,
1366+
which tends to not follow standard library naming conventions
1367+
and is linked to all Rust programs anyway.
13691368

13701369
## Attributes
13711370

@@ -1425,6 +1424,8 @@ names are effectively reserved. Some significant attributes include:
14251424
* The `test` attribute, for marking functions as unit tests.
14261425
* The `allow`, `warn`, `forbid`, and `deny` attributes, for controlling lint checks. Lint checks supported
14271426
by the compiler can be found via `rustc -W help`.
1427+
* The `deriving` attribute, for automatically generating
1428+
implementations of certain traits.
14281429

14291430
Other attributes may be added or removed during development of the language.
14301431

@@ -1526,6 +1527,47 @@ A complete list of the built-in language items follows:
15261527
> **Note:** This list is likely to become out of date. We should auto-generate it
15271528
> from `librustc/middle/lang_items.rs`.
15281529
1530+
### Deriving
1531+
1532+
The `deriving` attribute allows certain traits to be automatically
1533+
implemented for data structures. For example, the following will
1534+
create an `impl` for the `Eq` and `Clone` traits for `Foo`, the type
1535+
parameter `T` will be given the `Eq` or `Clone` constraints for the
1536+
appropriate `impl`:
1537+
1538+
~~~
1539+
#[deriving(Eq, Clone)]
1540+
struct Foo<T> {
1541+
a: int,
1542+
b: T
1543+
}
1544+
~~~
1545+
1546+
The generated `impl` for `Eq` is equivalent to
1547+
1548+
~~~
1549+
# struct Foo<T> { a: int, b: T }
1550+
impl<T: Eq> Eq for Foo<T> {
1551+
fn eq(&self, other: &Foo<T>) -> bool {
1552+
self.a == other.a && self.b == other.b
1553+
}
1554+
1555+
fn ne(&self, other: &Foo<T>) -> bool {
1556+
self.a != other.a || self.b != other.b
1557+
}
1558+
}
1559+
~~~
1560+
1561+
Supported traits for `deriving` are:
1562+
1563+
* Comparison traits: `Eq`, `TotalEq`, `Ord`, `TotalOrd`.
1564+
* Serialization: `Encodable`, `Decodable`. These require `std`.
1565+
* `Clone` and `DeepClone`, to perform (deep) copies.
1566+
* `IterBytes`, to iterate over the bytes in a data type.
1567+
* `Rand`, to create a random instance of a data type.
1568+
* `ToStr`, to convert to a string. For a type with this instance,
1569+
`obj.to_str()` has the same output as `fmt!("%?", obj)`.
1570+
15291571
# Statements and expressions
15301572

15311573
Rust is _primarily_ an expression language. This means that most forms of
@@ -1946,35 +1988,6 @@ fn avg(v: &[float]) -> float {
19461988
}
19471989
~~~~
19481990

1949-
#### Swap expressions
1950-
1951-
A _swap expression_ consists of an [lvalue](#lvalues-rvalues-and-temporaries) followed by a bi-directional arrow (`<->`) and another [lvalue](#lvalues-rvalues-and-temporaries).
1952-
1953-
Evaluating a swap expression causes, as a side effect, the values held in the left-hand-side and right-hand-side [lvalues](#lvalues-rvalues-and-temporaries) to be exchanged indivisibly.
1954-
1955-
Evaluating a swap expression neither changes reference counts,
1956-
nor deeply copies any owned structure pointed to by the moved [rvalue](#lvalues-rvalues-and-temporaries).
1957-
Instead, the swap expression represents an indivisible *exchange of ownership*,
1958-
between the right-hand-side and the left-hand-side of the expression.
1959-
No allocation or destruction is entailed.
1960-
1961-
An example of three different swap expressions:
1962-
1963-
~~~~~~~~
1964-
# let mut x = &mut [0];
1965-
# let mut a = &mut [0];
1966-
# let i = 0;
1967-
# struct S1 { z: int };
1968-
# struct S2 { c: int };
1969-
# let mut y = S1{z: 0};
1970-
# let mut b = S2{c: 0};
1971-
1972-
x <-> a;
1973-
x[i] <-> a[i];
1974-
y.z <-> b.c;
1975-
~~~~~~~~
1976-
1977-
19781991
#### Assignment expressions
19791992

19801993
An _assignment expression_ consists of an [lvalue](#lvalues-rvalues-and-temporaries) expression followed by an
@@ -2015,7 +2028,7 @@ as
20152028
== !=
20162029
&&
20172030
||
2018-
= <->
2031+
=
20192032
~~~~
20202033

20212034
Operators at the same precedence level are evaluated left-to-right.
@@ -2373,9 +2386,9 @@ enum List<X> { Nil, Cons(X, @List<X>) }
23732386
let x: List<int> = Cons(10, @Cons(11, @Nil));
23742387
23752388
match x {
2376-
Cons(_, @Nil) => fail!(~"singleton list"),
2389+
Cons(_, @Nil) => fail!("singleton list"),
23772390
Cons(*) => return,
2378-
Nil => fail!(~"empty list")
2391+
Nil => fail!("empty list")
23792392
}
23802393
~~~~
23812394

0 commit comments

Comments
 (0)