Skip to content

Commit 19c5c4d

Browse files
committed
---
yaml --- r: 144253 b: refs/heads/try2 c: 5e87f2f h: refs/heads/master i: 144251: 94160fb v: v3
1 parent ccb1f86 commit 19c5c4d

File tree

175 files changed

+2400
-7711
lines changed

Some content is hidden

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

175 files changed

+2400
-7711
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: 4e3dbf959a5124481d1e3ec9b0b30f48ac6dd4f0
8+
refs/heads/try2: 5e87f2f89e36250d2066213c47081e631ead9f5f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/configure

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,9 +739,7 @@ do
739739
make_dir $h/test/doc-tutorial-ffi
740740
make_dir $h/test/doc-tutorial-macros
741741
make_dir $h/test/doc-tutorial-borrowed-ptr
742-
make_dir $h/test/doc-tutorial-container
743742
make_dir $h/test/doc-tutorial-tasks
744-
make_dir $h/test/doc-tutorial-conditions
745743
make_dir $h/test/doc-rust
746744
done
747745

branches/try2/doc/rust.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ extern mod complicated_mod = "some-file/in/the-rust/path";
788788
##### Use declarations
789789

790790
~~~~~~~~ {.ebnf .gram}
791-
use_decl : "pub" ? "use" ident [ '=' path
791+
use_decl : "pub"? "use" ident [ '=' path
792792
| "::" path_glob ] ;
793793
794794
path_glob : ident [ "::" path_glob ] ?
@@ -1006,25 +1006,20 @@ code_. They are defined in the same way as any other Rust function,
10061006
except that they have the `extern` modifier.
10071007

10081008
~~~
1009-
// Declares an extern fn, the ABI defaults to "C"
10101009
extern fn new_vec() -> ~[int] { ~[] }
1011-
1012-
// Declares an extern fn with "stdcall" ABI
1013-
extern "stdcall" fn new_vec_stdcall() -> ~[int] { ~[] }
10141010
~~~
10151011

1016-
Unlike normal functions, extern fns have an `extern "ABI" fn()`.
1017-
This is the same type as the functions declared in an extern
1018-
block.
1012+
Extern functions may not be called from Rust code,
1013+
but Rust code may take their value as a raw `u8` pointer.
10191014

10201015
~~~
10211016
# extern fn new_vec() -> ~[int] { ~[] }
1022-
let fptr: extern "C" fn() -> ~[int] = new_vec;
1017+
let fptr: *u8 = new_vec;
10231018
~~~
10241019

1025-
Extern functions may be called from Rust code, but
1026-
caution must be taken with respect to the size of the stack
1027-
segment, just as when calling an extern function normally.
1020+
The primary motivation for extern functions is
1021+
to create callbacks for foreign functions that expect to receive function
1022+
pointers.
10281023

10291024
### Type definitions
10301025

@@ -1389,13 +1384,14 @@ between the Rust ABI and the foreign ABI.
13891384
A number of [attributes](#attributes) control the behavior of external
13901385
blocks.
13911386

1392-
By default external blocks assume that the library they are calling
1393-
uses the standard C "cdecl" ABI. Other ABIs may be specified using
1394-
an `abi` string, as shown here:
1387+
By default external blocks assume
1388+
that the library they are calling uses the standard C "cdecl" ABI.
1389+
Other ABIs may be specified using the `abi` attribute as in
13951390

13961391
~~~{.xfail-test}
13971392
// Interface to the Windows API
1398-
extern "stdcall" { }
1393+
#[abi = "stdcall"]
1394+
extern { }
13991395
~~~
14001396

14011397
The `link_name` attribute allows the name of the library to be specified.
@@ -1411,12 +1407,6 @@ This is particularly useful for creating external blocks for libc,
14111407
which tends to not follow standard library naming conventions
14121408
and is linked to all Rust programs anyway.
14131409

1414-
The type of a function
1415-
declared in an extern block
1416-
is `extern "abi" fn(A1, ..., An) -> R`,
1417-
where `A1...An` are the declared types of its arguments
1418-
and `R` is the decalred return type.
1419-
14201410
## Attributes
14211411

14221412
~~~~~~~~{.ebnf .gram}
@@ -1930,7 +1920,7 @@ it is automatically dereferenced to make the field access possible.
19301920
### Vector expressions
19311921

19321922
~~~~~~~~{.ebnf .gram}
1933-
vec_expr : '[' "mut" ? vec_elems? ']'
1923+
vec_expr : '[' "mut"? vec_elems? ']'
19341924
19351925
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
19361926
~~~~~~~~
@@ -2874,16 +2864,17 @@ the vtable pointer for the `T` implementation of `R`, and the pointer value of `
28742864
An example of an object type:
28752865

28762866
~~~~~~~~
2867+
# use std::int;
28772868
trait Printable {
2878-
fn to_string(&self) -> ~str;
2869+
fn to_str(&self) -> ~str;
28792870
}
28802871
28812872
impl Printable for int {
2882-
fn to_string(&self) -> ~str { self.to_str() }
2873+
fn to_str(&self) -> ~str { int::to_str(*self) }
28832874
}
28842875
28852876
fn print(a: @Printable) {
2886-
println(a.to_string());
2877+
println(a.to_str());
28872878
}
28882879
28892880
fn main() {

0 commit comments

Comments
 (0)