Commit Graph

49 Commits

Author SHA1 Message Date
Huon Wilson
164f7a290e std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut []. 2013-12-15 23:37:41 +11:00
Huon Wilson
f53292f7ee Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}. 2013-12-15 23:05:30 +11:00
Edward Z. Yang
b3e54d5991 Add some more commentary to FFI tutorial.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-09 21:24:47 -08:00
Alex Crichton
d4c40b519b Bring the linkage documentation up-to-date
This includes documentation for all the previous changes done to linking
in #10582. Additionally, this brings the list of feature-gates up-to-date with
the currently recognized list of features.
2013-12-02 11:10:40 -08:00
klutzy
175858519d doc: Fix example on Windows 2013-11-14 14:43:10 +09:00
Alex Crichton
7755ffd013 Remove #[fixed_stack_segment] and #[rust_stack]
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155
2013-11-11 10:40:34 -08:00
Alex Crichton
2fcc70ec9d Add a "system" ABI
This adds an other ABI option which allows a custom selection over the target
architecture and OS. The only current candidate for this change is that kernel32
on win32 uses stdcall, but on win64 it uses the cdecl calling convention.
Otherwise everywhere else this is defined as using the Cdecl calling convention.

cc #10049
Closes #8774
2013-11-09 11:16:09 -08:00
Brian Anderson
34d376f3cf std: Move size/align functions to std::mem. #2240 2013-10-17 17:31:35 -07:00
Steve Klabnik
16fc6a694c Remove unused abi attributes.
They've been replaced by putting the name on the extern block.

  #[abi = "foo"]

goes to

  extern "foo" { }

Closes #9483.
2013-10-14 13:10:36 +02:00
Michael 'devbug' Williams
bcf76ac3ed Fixed typo under 'Segmented stacks and the linter', and removed superfluous trailing whitespace. 2013-10-10 14:00:15 -07:00
Daniel Micay
4e161a4d40 switch Drop to &mut self 2013-09-16 22:19:23 -04:00
Kevin Ballard
fe1beac45e Update FFI tutorial to reference c_str::to_c_str
The FFI tutorial still incorrectly stated that strings were terminated
with \0 and suggested using `str::as_c_str`.
2013-08-22 17:03:06 -07:00
Niko Matsakis
0479d946c8 Add externfn macro and correctly label fixed_stack_segments 2013-08-19 07:13:15 -04:00
Alex Crichton
1b103912ea Add some documentation about globals in ffi docs 2013-08-07 22:41:14 -04:00
Patrick Walton
f9b54541ee librustc: Disallow "mut" from distributing over bindings.
This is the backwards-incompatible part of per-binding-site "mut".
2013-06-28 10:44:15 -04:00
Luqman Aden
ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Patrick Walton
8114d0e950 librustc: Disallow multiple patterns from appearing in a "let" declaration.
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
Daniel Micay
ed93cc1987 fix tutorial lint warnings 2013-05-31 18:20:09 -04:00
Daniel Micay
29aba8033a mv the raw pointer {swap,replace}_ptr to std::ptr 2013-05-31 10:31:26 -04:00
Patrick Walton
206ab89629 librustc: Stop reexporting the standard modules from prelude. 2013-05-29 19:04:53 -07:00
Ted Horst
34cfd2183b more testing fallout from core->std/std->extra move 2013-05-23 15:06:29 -05:00
Patrick Walton
06ef889cdc libsyntax: Remove extern mod foo { ... } from the language. 2013-05-12 16:33:15 -07:00
Alex Crichton
60803e5fc8 Fix tests with the swap operator 2013-05-10 22:51:06 -04:00
Daniel Micay
044abef0e5 fix incorrect region code based on the old 'self
also removes unnecessary casts from the RcMut implementation
2013-05-08 16:00:49 -04:00
Daniel Micay
8f2d71ac00 small fix to the tutorial-ffi destructor example
The previous example was erroneously attempting to destroy
uninitialized memory, which was often zeroed (masking the bug).
2013-05-04 21:57:10 -04:00
Daniel Micay
195911fca4 tutorial-ffi: add example of a custom destructor 2013-04-26 14:07:57 -04:00
bors
8b74efaa7b auto merge of #5852 : thestinger/rust/ffi, r=thestinger 2013-04-12 03:37:00 -07:00
Daniel Micay
53d2228b37 tutorial-ffi: add another missing word 2013-04-12 06:34:25 -04:00
Daniel Micay
a4db39a6fe tutorial-ffi: add missing word 2013-04-12 03:15:07 -04:00
Daniel Micay
1faa3596b0 rewrite the ffi tutorial with snappy as an example
The example with OpenSSL is incorrect, because OpenSSL is using a
static variable for the return value and isn't thread-safe.

The gettimeofday example isn't great because it's not very portable.
2013-04-12 02:12:00 -04:00
Patrick Walton
1e91595520 librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
Patrick Walton
d7e74b5e91 librustc: Convert all uses of assert over to fail_unless! 2013-03-07 22:37:57 -08:00
Patrick Walton
a3f728238b librustc: Forbid chained imports and fix the logic for one-level renaming imports 2013-03-02 16:49:30 -08:00
Patrick Walton
c9dd917fad doc: Remove references to mut fields. rs=demuting 2013-02-26 10:02:36 -08:00
Graydon Hoare
e8f4da78e7 doc: fix tutorial unsafe blocks, r=burningtree. 2013-01-23 23:21:47 -08:00
Tim Chevalier
3fac6f8b54 Revert "doc: Fix tutorial-ffi xfail-tests and update SHA1() to use size_t"
This reverts commit 50c8cbb25a.
2013-01-21 19:39:45 -08:00
Chris Peterson
50c8cbb25a doc: Fix tutorial-ffi xfail-tests and update SHA1() to use size_t 2013-01-20 22:56:45 -08:00
Eric J. Holmes
0100b02b3a Fix example. 2012-12-23 13:26:12 -08:00
Tim Chevalier
140d16ac58 Fix tutorial-ffi tests 2012-10-11 19:45:04 -07:00
Tim Chevalier
cd6f24f9d1 Copyedit FFI tutorial 2012-10-09 16:46:16 -07:00
Brian Anderson
3e47b4f17e Revert "docs: Call () 'unit' instead of 'nil'"
This reverts commit c8ee49a5b6.
2012-10-03 22:18:46 -07:00
Brian Anderson
c8ee49a5b6 docs: Call () 'unit' instead of 'nil' 2012-10-03 20:06:24 -07:00
Tim Chevalier
b18320446e Move over to calling ptr::addr_of
Everything should now call ptr::addr_of instead of
ptr::p2::addr_of. Only the pipes macro code when compiled
by stage0 will call ptr::p2::addr_of. Needs a snapshot to get
rid of that.
2012-10-01 15:12:09 -07:00
Brian Anderson
5424f21d5d docs: Give all tutorials consistent titles and intro sections 2012-09-26 19:00:13 -07:00
Brian Anderson
2891f5abe3 tutorial: Remove all references to 'records'. Misc 2012-09-26 16:41:35 -07:00
Graydon Hoare
dffe188991 Install new pub/priv/export rules as defaults, old rules accessible under #[legacy_exports]; 2012-09-21 18:11:43 -07:00
Brian Anderson
864cca14ee docs: Make supplemental tutorials testable 2012-09-15 18:06:20 -07:00
Patrick Walton
10c533861b doc: "import" -> "use" 2012-09-05 12:39:16 -07:00
Patrick Walton
4e515c14af doc: Split out the FFI part of the tutorial
The tutorial should perhaps contain an FFI section, but this one is too long.
2012-09-05 11:20:04 -07:00