Skip to content

Commit d2cc0eb

Browse files
committed
---
yaml --- r: 61255 b: refs/heads/try c: 084b134 h: refs/heads/master i: 61253: 6dd5c7f 61251: 253d88a 61247: 9d782c8 v: v3
1 parent af97d94 commit d2cc0eb

File tree

1,055 files changed

+18336
-34142
lines changed

Some content is hidden

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

1,055 files changed

+18336
-34142
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5-
refs/heads/try: 5ce0795de51b5305bcb48e69a5fcf8cb2e169a30
5+
refs/heads/try: 084b1345089b781f8e5fdeea5cd3e634eb244280
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/.gitattributes

Lines changed: 0 additions & 9 deletions
This file was deleted.

branches/try/.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/try/COPYRIGHT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,4 @@ their own copyright notices and license terms:
367367
has chosen for the collective work, enumerated at the top
368368
of this file. The only difference is the retention of
369369
copyright itself, held by the contributor.
370+

branches/try/Makefile.in

Lines changed: 2 additions & 5 deletions
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 += --cfg debug
104+
CFG_RUSTC_FLAGS +=
105105
CFG_GCCISH_CFLAGS += -DRUST_DEBUG
106106
else
107107
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
@@ -110,9 +110,6 @@ 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
116113
ifdef TIME_PASSES
117114
CFG_RUSTC_FLAGS += -Z time-passes
118115
endif
@@ -241,7 +238,7 @@ $(foreach target,$(CFG_TARGET_TRIPLES),\
241238

242239
CORELIB_CRATE := $(S)src/libcore/core.rc
243240
CORELIB_INPUTS := $(wildcard $(addprefix $(S)src/libcore/, \
244-
core.rc *.rs */*.rs */*/*rs */*/*/*rs))
241+
core.rc *.rs */*.rs */*/*rs))
245242

246243
######################################################################
247244
# Standard library variables

branches/try/RELEASES.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Version 0.3 (July 2012)
250250
* Slices and fixed-size, interior-allocated vectors
251251
* #!-comments for lang versioning, shell execution
252252
* Destructors and iface implementation for classes;
253-
type-parameterized classes and class methods
253+
type-parameterized classes and class methods
254254
* 'const' type kind for types that can be used to implement
255255
shared-memory concurrency patterns
256256

@@ -261,7 +261,7 @@ Version 0.3 (July 2012)
261261
'crust', 'native' (now 'extern'), 'cont' (now 'again')
262262

263263
* Constructs: do-while loops ('do' repurposed), fn binding,
264-
resources (replaced by destructors)
264+
resources (replaced by destructors)
265265

266266
* Compiler reorganization
267267
* Syntax-layer of compiler split into separate crate
@@ -276,7 +276,7 @@ Version 0.3 (July 2012)
276276
* Extensive work on libuv interface
277277
* Much vector code moved to libraries
278278
* Syntax extensions: #line, #col, #file, #mod, #stringify,
279-
#include, #include_str, #include_bin
279+
#include, #include_str, #include_bin
280280

281281
* Tool improvements
282282
* Cargo automatically resolves dependencies

branches/try/configure

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

442-
step_msg "looking for target specific programs"
443-
444-
probe CFG_ADB adb
445-
446442
if [ ! -z "$CFG_PANDOC" ]
447443
then
448444
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc ' |

branches/try/doc/README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The markdown docs are only generated by make when node is installed (use
2-
`make doc`). If you don't have node installed you can generate them yourself.
3-
Unfortunately there's no real standard for markdown and all the tools work
2+
`make doc`). If you don't have node installed you can generate them yourself.
3+
Unfortunately there's no real standard for markdown and all the tools work
44
differently. pandoc is one that seems to work well.
55

66
To generate an html version of a doc do something like:
@@ -10,4 +10,4 @@ The syntax for pandoc flavored markdown can be found at:
1010
http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown
1111

1212
A nice quick reference (for non-pandoc markdown) is at:
13-
http://kramdown.rubyforge.org/quickref.html
13+
http://kramdown.rubyforge.org/quickref.html

branches/try/doc/rust.md

Lines changed: 76 additions & 88 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 | extern_block ;
621+
| static_item | trait_item | impl_item | foreign_mod_item ;
622622
~~~~~~~~
623623

624624
An _item_ is a component of a crate; some module items can be defined in crate
@@ -752,11 +752,10 @@ 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
756-
as the `ident` provided in the `extern_mod_decl`.
755+
The external crate is then bound into the declaring scope as the `ident` provided in the `extern_mod_decl`.
757756

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
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
760759
loading at runtime. The `soname` is resolved at compile time by scanning the
761760
compiler's library path and matching the `link_attrs` provided in the
762761
`use_decl` against any `#link` attributes that were declared on the external
@@ -993,10 +992,10 @@ Thus the return type on `f` only needs to reflect the `if` branch of the conditi
993992
#### Extern functions
994993

995994
Extern functions are part of Rust's foreign function interface,
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,
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,
1000999
except that they have the `extern` modifier.
10011000

10021001
~~~
@@ -1012,8 +1011,7 @@ let fptr: *u8 = new_vec;
10121011
~~~
10131012

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

10181016
### Type definitions
10191017

@@ -1310,61 +1308,64 @@ impl Seq<bool> for u32 {
13101308
}
13111309
~~~~
13121310

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

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

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.
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.
13281323

13291324
~~~
13301325
# use core::libc::{c_char, FILE};
13311326
# #[nolink]
13321327
1333-
extern {
1328+
extern mod c {
13341329
fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
13351330
}
13361331
~~~
13371332

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.
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'.
13421343

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

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
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
13491350

13501351
~~~{.xfail-test}
13511352
// Interface to the Windows API
13521353
#[abi = "stdcall"]
1353-
extern { }
1354+
extern mod kernel32 { }
13541355
~~~
13551356

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

13581360
~~~{.xfail-test}
13591361
#[link_name = "crypto"]
1360-
extern { }
1362+
extern mod mycrypto { }
13611363
~~~
13621364

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.
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.
13681369

13691370
## Attributes
13701371

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

14301429
Other attributes may be added or removed during development of the language.
14311430

@@ -1468,8 +1467,8 @@ A complete list of the built-in language items follows:
14681467
: Elements can be subtracted.
14691468
`mul`
14701469
: Elements can be multiplied.
1471-
`div`
1472-
: Elements have a division operation.
1470+
`quot`
1471+
: Elements have a quotient operation.
14731472
`rem`
14741473
: Elements have a remainder operation.
14751474
`neg`
@@ -1527,47 +1526,6 @@ A complete list of the built-in language items follows:
15271526
> **Note:** This list is likely to become out of date. We should auto-generate it
15281527
> from `librustc/middle/lang_items.rs`.
15291528
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`, 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-
15711529
# Statements and expressions
15721530

15731531
Rust is _primarily_ an expression language. This means that most forms of
@@ -1899,7 +1857,7 @@ The default meaning of the operators on standard types is given here.
18991857
Calls the `mul` method on the `core::ops::Mul` trait.
19001858
`/`
19011859
: Quotient.
1902-
Calls the `div` method on the `core::ops::Div` trait.
1860+
Calls the `quot` method on the `core::ops::Quot` trait.
19031861
`%`
19041862
: Remainder.
19051863
Calls the `rem` method on the `core::ops::Rem` trait.
@@ -1988,6 +1946,35 @@ fn avg(v: &[float]) -> float {
19881946
}
19891947
~~~~
19901948

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+
19911978
#### Assignment expressions
19921979

19931980
An _assignment expression_ consists of an [lvalue](#lvalues-rvalues-and-temporaries) expression followed by an
@@ -2028,7 +2015,7 @@ as
20282015
== !=
20292016
&&
20302017
||
2031-
=
2018+
= <->
20322019
~~~~
20332020

20342021
Operators at the same precedence level are evaluated left-to-right.
@@ -2406,7 +2393,7 @@ variables in the arm's block, and control enters the block.
24062393
An example of an `match` expression:
24072394

24082395

2409-
~~~~
2396+
~~~~ {.xfail-test}
24102397
# fn process_pair(a: int, b: int) { }
24112398
# fn process_ten() { }
24122399
@@ -3364,3 +3351,4 @@ Additional specific influences can be seen from the following languages:
33643351
* The typeclass system of Haskell.
33653352
* The lexical identifier rule of Python.
33663353
* The block syntax of Ruby.
3354+

0 commit comments

Comments
 (0)