Commit Graph

1314 Commits

Author SHA1 Message Date
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
Alex Crichton
e338a4154b Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.

When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.

Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.

Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:

* If both a .dylib and .rlib are found for a rust library, the compiler will
  prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
  overridable by explicitly saying what flavor you'd like (rlib, staticlib,
  dylib).
* If no options are passed to the command line, and no crate_type is found in
  the destination crate, then an executable is generated

With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.

This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.

Closes #552
2013-11-29 18:36:13 -08:00
Alex Crichton
ab387a6838 Register new snapshots 2013-11-28 20:27:56 -08:00
Corey Richardson
b50b162884 Be more strict about doc comments
Previously, `//// foo` and `/*** foo ***/` were accepted as doc comments. This
changes that, so that only `/// foo` and `/** foo ***/` are accepted. This
confuses many newcomers and it seems weird.

Also update the manual for these changes, and modernify the EBNF for comments.

Closes #10638
2013-11-27 18:00:50 -05:00
bors
35ebf03489 auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchton
This provides a building block for fast thread-local storage. It does
not change the safety semantics of `static mut`.

Closes #10310
2013-11-26 13:32:43 -08:00
Daniel Micay
1795ae4e8a add #[thread_local] attribute
This provides a building block for fast thread-local storage. It does
not change the safety semantics of `static mut`.

Closes #10310
2013-11-26 14:49:10 -05:00
Patrick Walton
749ee53c6d librustc: Make || lambdas not infer to procs 2013-11-26 08:25:27 -08:00
Patrick Walton
38efa17bb8 test: Remove all remaining non-procedure uses of do. 2013-11-26 08:25:27 -08:00
Patrick Walton
9e610573ba librustc: Remove remaining uses of &fn() in favor of ||. 2013-11-26 08:20:58 -08:00
bors
ef70b7666e auto merge of #10668 : vky/rust/closure-doc-update, r=alexcrichton 2013-11-26 04:56:49 -08:00
Marvin Löbel
24b316a3b9 Removed unneccessary _iter suffixes from various APIs 2013-11-26 10:02:26 +01:00
Vijay Korapaty
9c6bba91a8 Updating docs with updated closure syntax, &fn -> || 2013-11-26 00:35:55 -08:00
bors
2cc1e16ac0 auto merge of #10603 : alexcrichton/rust/no-linked-failure, r=brson
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:32:13 -08:00
Alex Crichton
acca9e3834 Remove linked failure from the runtime
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:21:12 -08:00
Daniel Micay
7d9fd62300 minor rewording in the tutorial's Rc coverage 2013-11-22 07:03:11 -05:00
bors
6143400aaa auto merge of #10589 : thestinger/rust/doc, r=pcwalton
This replaces the old section on managed pointers because the syntax is
going to be removed and it's currently feature gated so the examples
don't work out-of-the-box. Dynamic mutability coverage can be added
after the `Mut<T>` work has landed.
2013-11-21 16:06:32 -08:00
Daniel Micay
c06ce4c9bf tutorial: alternatives to ownership
This replaces the old section on managed pointers because the syntax is
going to be removed and it's currently feature gated so the examples
don't work out-of-the-box. Dynamic mutability coverage can be added
after the `Mut<T>` work has landed.
2013-11-21 18:00:31 -05:00
bors
97aaf42462 auto merge of #10587 : thestinger/rust/stack, r=pcwalton 2013-11-21 10:21:37 -08:00
Daniel Micay
1de47cb842 remove segmented stacks from the manual 2013-11-21 12:55:46 -05:00
Isaac Dupree
aa9efa1f7a update manual to reflect &'lifetime syntax 2013-11-20 23:50:10 -05:00
Patrick Walton
ba739b2135 librustc: Convert ~fn() to proc() everywhere. 2013-11-18 18:27:31 -08:00
bors
8eda5d8315 auto merge of #10443 : alexcrichton/rust/meaninless-pub-priv, r=cmr
Closes #10111
2013-11-17 22:21:23 -08:00
Alex Crichton
dab8fec4af Forbid privacy in inner functions
Closes #10111
2013-11-17 21:28:18 -08:00
Chris Morgan
9fa32c07a0 Fix the num_lit grammar in the reference manual.
- Cause `0` to be considered a valid integer literal (it is).
- Add octal literals (missed from #10243).

I have *not* modified doc/po/rust.md.pot or doc/po/ja/rust.md.po at all;
they already seem to be out of date so it's easier to ignore them for
myself. I can update them if desired, of course.
2013-11-16 15:53:56 +11:00
bors
ade310cbb6 auto merge of #10018 : fhahn/rust/check-inferred-ints, r=alexcrichton
I've started working on this issue and pushed a small commit, which adds a range check for integer literals in `middle::const_eval` (no `uint` at the moment) 
At the moment, this patch is just a proof of concept, I'm not sure if there is a better function for the checks in `middle::const_eval`. This patch does not check for overflows after constant folding, eg:

    let x: i8 = 99 + 99;
2013-11-14 13:01:35 -08:00
Noufal Ibrahim
bc698ba3ef Fixes formatting
Without this, a.rs appears as a struck out line.
2013-11-14 21:04:38 +05:30
bors
f9cea4b3a0 auto merge of #10476 : catamorphism/rust/rustpkg-doc-fix, r=catamorphism
spotted by Yurume
2013-11-14 00:16:18 -08:00
Tim Chevalier
8a041e63a5 docs: Change "workspace" to "package directory"
spotted by Yurume
2013-11-13 22:41:50 -08:00
klutzy
175858519d doc: Fix example on Windows 2013-11-14 14:43:10 +09:00
Adrien Tétar
58aa18c8ba doc: add favicon to tutorial/manual
Since tutorial/manual files are stored on static.rust-lang.org, browsers
try to fetch the favicon from there while it should be retrieved from the
main domain.
2013-11-13 09:32:50 +01:00
Adrien Tétar
5a01dbe67b doc: disable parser error highlighting + a few fixes
CodeMirror parser errors are related to #9873.
2013-11-13 09:32:29 +01:00
Adrien Tétar
123e0cefb6 doc: CSS: fix code fonts
Closes #10330.
2013-11-12 21:36:09 +01:00
Florian Hahn
20627c7430 Check inferred integer literals for overflows, closes #4220 2013-11-12 19:36:46 +01:00
Alex Crichton
49ee49296b Move std::rt::io to std::io 2013-11-11 20:44:07 -08:00
bors
88e383ef1e auto merge of #10419 : brson/rust/conditiondocs, r=alexcrichton
Fixes #8553 by just not mentioning TLS, and instead just referring to the 'task-local condition handler'.
2013-11-11 13:16:24 -08: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
Brian Anderson
e34834375d doc: Don't mention TLS in condition tutorial 2013-11-11 04:29:09 -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
bors
9d8dc004a0 auto merge of #10354 : thestinger/rust/vector, r=huonw
This section desperately needs to be expanded, but removing the
misleading/incorrect information is a priority.

Managed vectors/strings are not covered, as they are feature-gated and
are only a micro-optimization to avoid double-indirection.

Closes #6882
2013-11-08 05:46:04 -08:00
Daniel Micay
eca52e682b tutorial: rewrite the section vectors/strings
This section desperately needs to be expanded, but removing the
misleading/incorrect information is a priority.

Managed vectors/strings are not covered, as they are feature-gated and
are only a micro-optimization to avoid double-indirection.

Closes #6882
2013-11-08 04:47:06 -05:00
bors
f00bb2ec04 auto merge of #10243 : mattcarberry/rust/master, r=brson
Associated with Issue #6563.

Useful for Apollo Guidance Computer simulation, Unix file system permissions, and maybe one or two other things.
2013-11-07 17:26:12 -08:00
bors
29359d0efa auto merge of #10252 : huonw/rust/docs, r=alexcrichton 2013-11-03 17:31:20 -08:00
Huon Wilson
da43676e39 docs: Replace std::iterator with std::iter. 2013-11-04 10:01:00 +11:00
Noufal Ibrahim
c118b89ad9 Fixed formatting.
The code block shows up inline without proper formatting without this
newline.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-11-03 22:44:15 +05:30
Matt Carberry
66abb92a47 Grammar error and vim syntax highlighting mistake fixed. 2013-11-02 21:34:29 -07:00
Matt Carberry
519b86b8a8 Added octal literal support. 2013-11-02 21:26:29 -07:00
bors
d04a58cf2d auto merge of #9740 : alexcrichton/rust/concat, r=cmr
This extension can be used to concatenate string literals at compile time. C has
this useful ability when placing string literals lexically next to one another,
but this needs to be handled at the syntax extension level to recursively expand
macros.

The major use case for this is something like:

    macro_rules! mylog( ($fmt:expr $($arg:tt)*) => {
        error2!(concat!(file!(), ":", line!(), " - ", $fmt) $($arg)*);
    })

Where the mylog macro will automatically prepend the filename/line number to the
beginning of every log message.
2013-10-31 17:51:26 -07:00
Alex Crichton
a49e65c2ed Implement a concat!() format extension
This extension can be used to concatenate string literals at compile time. C has
this useful ability when placing string literals lexically next to one another,
but this needs to be handled at the syntax extension level to recursively expand
macros.

The major use case for this is something like:

    macro_rules! mylog( ($fmt:expr $($arg:tt)*) => {
        error2!(concat!(file!(), ":", line!(), " - ", $fmt) $($arg)*);
    })

Where the mylog macro will automatically prepend the filename/line number to the
beginning of every log message.
2013-10-31 13:46:10 -07:00
bors
b2f62acaeb auto merge of #10167 : briantdawn/rust/master, r=cmr
To keep consistency with the word "borrowing" I suppose an alternate way to write this could be "Having an object borrow an immutable pointer freezes it and prevents mutation".
2013-10-31 10:31:56 -07:00
Brian
986fb3c617 Fixed incorrect usage of 'Borrowing'. 2013-10-30 00:47:42 +00:00
Ziad Hatahet
3797f2bfe6 Capitalize statics in f32 and f64 mods
Fixes #10077
2013-10-28 19:35:56 -07:00
Alex Crichton
620ab3853a Test fixes and merge conflicts 2013-10-24 14:21:58 -07:00
Luqman Aden
b2b2095eaf Update the manual. 2013-10-22 21:37:42 -04:00
Michael Letterle
d83c5f7b1b Minor grammatical fixes and removed section on 'rust' tool 2013-10-22 14:30:27 -04:00
Alex Crichton
3ed18bdd42 Remove old logging from the tutorial 2013-10-22 08:10:34 -07:00
Adrien Tétar
22465e9561 doc: fix links to comply with the new rustdoc
Closes #9911.
2013-10-21 04:13:22 +02:00
Adrien Tétar
3995495c4a doc: expand tutorial/manual CSS
Cleanup, edit, add some Bootstrap v3.0.0 elements.
2013-10-21 04:12:58 +02:00
Adrien Tétar
8d97db48d4 doc: tidy and cleanup CSS deps, add tutorial PDF generation 2013-10-21 04:12:12 +02:00
Adrien Tétar
5d1fc864c7 doc/rust.HTML: proper version box 2013-10-19 20:31:53 +02:00
Adrien Tétar
f69795e443 doc: switch pandoc to html5 2013-10-19 20:29:34 +02:00
Sébastien Chauvel
62cb92d4ea doc (en & ja): remove mentions of type float, rust and rusti tools 2013-10-20 01:00:22 +02:00
bors
d052912297 auto merge of #9851 : alexcrichton/rust/include_bin, r=huonw
Previously an ExprLit was created *per byte* causing a huge increase in memory
bloat. This adds a new `lit_binary` to contain a literal of binary data, which
is currently only used by the include_bin! syntax extension. This massively
speeds up compilation times of the shootout-k-nucleotide-pipes test

    before:
        time: 469s
        memory: 6GB
        assertion failure in LLVM (section too large)

    after:
        time: 2.50s
        memory: 124MB

Closes #2598
2013-10-18 09:41:33 -07:00
Alex Crichton
273784e9bf Optimize include_bin! for large inputs
Previously an ExprLit was created *per byte* causing a huge increase in memory
bloat. This adds a new `lit_binary` to contain a literal of binary data, which
is currently only used by the include_bin! syntax extension. This massively
speeds up compilation times of the shootout-k-nucleotide-pipes test

    before:
        time: 469s
        memory: 6GB
        assertion failure in LLVM (section too large)

    after:
        time: 2.50s
        memory: 124MB

Closes #2598
2013-10-18 09:20:08 -07:00
Brian Anderson
34d376f3cf std: Move size/align functions to std::mem. #2240 2013-10-17 17:31:35 -07:00
bors
386fa1d818 auto merge of #9897 : thestinger/rust/rusti, r=alexcrichton
Closes #9818
Closes #9567
Closes #8924
Closes #8910
Closes #8392
Closes #7692
Closes #7499
Closes #7220
Closes #5038
2013-10-17 01:36:33 -07:00
Chris Sainty
88ab38cf06 Removed the -Z once_fns compiler flag and added the new feature directive of the same name to replace it.
Changed the frame_address intrinsic to no longer be a once fn.
This removes the dependency on once_fns from std.
2013-10-17 06:22:48 +02:00
Daniel Micay
7c92435f8f remove the rusti command
Closes #9818
Closes #9567
Closes #8924
Closes #8910
Closes #8392
Closes #7692
Closes #7499
Closes #7220
2013-10-16 22:54:38 -04: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
Erik Lyon
8b65a45879 fix typos in doc/tutorial.md 2013-10-13 10:49:44 -07:00
bors
2e1df8e35b auto merge of #9732 : catamorphism/rust/rustpkg-read-only, r=brson
r? @metajack rustpkg now makes source files that it checks out automatically read-only, and stores
them under build/.

Also, refactored the `PkgSrc` type to keep track of separate source and destination
workspaces, as well as to have a `build_workspace` method that returns the workspace
to put temporary files in (usually the source, sometimes the destination -- see
comments for more details).

Closes #6480
2013-10-10 17:36:21 -07:00
Tim Chevalier
8854b78b55 rustpkg: Make checked-out source files read-only, and overhaul where temporary files are stored
rustpkg now makes source files that it checks out automatically read-only, and stores
them under build/.

Also, refactored the `PkgSrc` type to keep track of separate source and destination
workspaces, as well as to have a `build_workspace` method that returns the workspace
to put temporary files in (usually the source, sometimes the destination -- see
comments for more details).

Closes #6480
2013-10-10 15:16:31 -07: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
bors
c9196290af auto merge of #9674 : ben0x539/rust/raw-str, r=alexcrichton
This branch parses raw string literals as in #9411.
2013-10-07 23:01:39 -07:00
Alex Crichton
7cd6692425 Fix merge fallout of privacy changes 2013-10-07 21:44:02 -07:00
Benjamin Herr
6885c7337f document raw string literals in tutorial.md and rust.md 2013-10-08 01:44:05 +02:00
Alex Crichton
2c76cdae3e Document visibility in the manual/tutorial
This removes the warning "Note" about visibility not being fully defined, as it
should now be considered fully defined with further bugs being considered just
bugs in the implementation.
2013-10-07 13:00:52 -07:00
bors
8eb28bb7dc auto merge of #9703 : alexcrichton/rust/compiler-features, r=cmr
This implements the necessary logic for gating particular features off by default in the compiler. There are a number of issues which have been wanting this form of mechanism, and this initially gates features which we have open issues for.

Additionally, this should unblock #9255
2013-10-06 14:41:28 -07:00
Alex Crichton
dd98f7089f Implement feature-gating for the compiler
A few features are now hidden behind various #[feature(...)] directives. These
include struct-like enum variants, glob imports, and macro_rules! invocations.

Closes #9304
Closes #9305
Closes #9306
Closes #9331
2013-10-05 20:19:33 -07:00
Tim Chevalier
8ba148b295 docs / rustpkg: Document rustpkg test more
Talk about `rustpkg test` in the tutorial, and update its usage message.
2013-10-05 23:17:23 -04:00
Erick Tryzelaar
0feaccf526 syntax: Add #[deriving(FromPrimitive)] syntax extension
Right now this only works for c-style enums.
2013-10-02 07:55:41 -07:00
Daniel Micay
c9d4ad07c4 remove the float type
It is simply defined as `f64` across every platform right now.

A use case hasn't been presented for a `float` type defined as the
highest precision floating point type implemented in hardware on the
platform. Performance-wise, using the smallest precision correct for the
use case greatly saves on cache space and allows for fitting more
numbers into SSE/AVX registers.

If there was a use case, this could be implemented as simply a type
alias or a struct thanks to `#[cfg(...)]`.

Closes #6592

The mailing list thread, for reference:

https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01 14:54:10 -04:00
bors
320af9b157 auto merge of #9645 : dckc/rust/patch-2, r=catamorphism
the switch from package `hello` to `pkg_id` is a little jarring; I'd use `<var>` but I don't see how. ALL_CAPS i.e. PKG_ID seems like a reasonable  poor-man's `<var>`.
2013-10-01 07:36:35 -07:00
Alex Crichton
9ce31f6dd9 tutorial: Remove usage of fmt! 2013-09-30 23:21:20 -07:00
Dan Connolly
398e2c479a clarify that rust_pkg is a place-holder
the switch from package `hello` to `rust_pkg` is a little jarring; I'd use <var> but I don't see how. ALL_CAPS seems like a reasonable  poor-man's <var>.
2013-09-30 22:57:09 -05:00
bors
9883a6250b auto merge of #9589 : thestinger/rust/tutorial, r=alexcrichton 2013-09-28 16:21:04 -07:00
Daniel Micay
6c8e6aad73 tutorial: rewrite the sections on boxes/moves 2013-09-28 17:01:46 -04:00
bors
058a5d97a2 auto merge of #9459 : eliovir/rust/patch-1, r=bstrie
change formula (other solution could be using abs()).
2013-09-28 05:26:04 -07:00
eliovir
835960a333 tutorial.md : correct formula in fn area()
change formula (other solution could be using abs()).
2013-09-24 10:21:18 +02:00
bors
0275b1c404 auto merge of #9450 : jzelinskie/rust/tutorial-tasks-result-signature, r=alexcrichton 2013-09-24 01:06:02 -07:00
bors
df8231e134 auto merge of #9439 : steveklabnik/rust/build_rustpkg_tutorial, r=brson
Three things in this commit:

1. Actually build the rustpkg tutorial. I didn't know I needed this when
   I first wrote it.
2. Link to it rather than the manual from the
   tutorial.
3. Update the headers: most of them were one level too deeply
   nested.
2013-09-23 22:26:06 -07:00
Jimmy Zelinskie
3073ba4ca3 Fix signature of Result in tasks tutorial. Closes #8343 2013-09-23 22:30:42 -04:00
Patrick Walton
90d3da9711 test: Fix rustdoc and tests. 2013-09-23 18:23:22 -07:00
Steve Klabnik
06b11ba172 Add rustpkg tutorial to the official tutorials.
Three things in this commit:

1. Actually build the rustpkg tutorial. I didn't know I needed this when
   I first wrote it.
2. Link to it rather than the manual from the
   tutorial.
3. Update the headers: most of them were one level too deeply
   nested.
2013-09-23 14:36:38 -07:00
bors
eb55348a7c auto merge of #9423 : madjar/rust/patch-1, r=alexcrichton
Just something I noticed while reading the tutorial.
2013-09-23 09:20:56 -07:00
Marvin Löbel
bb7bc6c584 Extended the module tutorial section about files a bit 2013-09-23 16:33:11 +02:00
Georges Dubus
90e1e8fc40 Fixed a small typo in the tutorial
Just something I noticed while reading the tutorial.
2013-09-23 10:04:48 +02:00
Brian Anderson
695cb9fc2b Update version numbers to 0.8 2013-09-21 16:25:08 -07:00
bors
2fd3c07242 auto merge of #9278 : alexcrichton/rust/ndebug, r=brson
Many people will be very confused that their debug! statements aren't working
when they first use rust only to learn that they should have been building with
`--cfg debug` the entire time. This inverts the meaning of the flag to instead
of enabling debug statements, now it disables debug statements.

This way the default behavior is a bit more reasonable, and requires less
end-user configuration. Furthermore, this turns on debug by default when
building the rustc compiler.
2013-09-20 12:46:05 -07:00
Alex Crichton
833a64d76e Invert --cfg debug to --cfg ndebug
Many people will be very confused that their debug! statements aren't working
when they first use rust only to learn that they should have been building with
`--cfg debug` the entire time. This inverts the meaning of the flag to instead
of enabling debug statements, now it disables debug statements.

This way the default behavior is a bit more reasonable, and requires less
end-user configuration. Furthermore, this turns on debug by default when
building the rustc compiler.
2013-09-20 12:10:04 -07:00
bors
b7bbc2eea2 auto merge of #9327 : larsbergstrom/rust/tutorial_installation_tweak, r=catamorphism
I've had multiple people whom I pointed at the Rust tutorial ask me where to download the snapshot compiler, so I made the text more explicit.
2013-09-20 09:56:09 -07:00
bors
c7c769d8c2 auto merge of #9315 : thestinger/rust/doc, r=alexcrichton
This also renames the section, as managed vectors cannot be resized
(since it would invalidate the other references).
2013-09-19 23:11:19 -07:00
Steven Fackler
ff85389344 Modernize extra::future API 2013-09-19 15:19:20 -07:00
Lars Bergstrom
9051a35fc8 Clarify that snapshots are automatically retrieved. 2013-09-19 10:58:26 -05:00
blake2-ppc
f0630fdc8b doc: Fix the tutorial's link to rustpkg docs 2013-09-19 01:43:10 -04:00
blake2-ppc
bf0e2a6f57 doc: Update container tutorial with new names of methods and macros
`deque` -> `ringbuf`, mention `extra::dlist`.

fix reference to vector method `bsearch`. Also convert all output
in example code to use `print!`/`println!`
2013-09-18 23:17:07 -04:00
Daniel Micay
d12e0305b1 clarify vector stub in the container tutorial
This also renames the section, as managed vectors cannot be resized
(since it would invalidate the other references).
2013-09-18 22:26:48 -04:00
Daniel Rosenwasser
604667fa82 Added support for a \0 escape sequence.
This commit adds support for `\0` escapes in character and string literals.

Since `\0` is equivalent to `\x00`, this is a direct translation to the latter
escape sequence. Future builds will be able to compile using `\0` directly.

Also updated the grammar specification and added a test for NUL characters.
2013-09-17 23:52:29 -04:00
Daniel Micay
e12c3bfbf9 document what unsafety means
Closes #9144
2013-09-17 19:13:14 -04:00
bors
29cdf58861 auto merge of #9244 : thestinger/rust/drop, r=catamorphism
This doesn't close any bugs as the goal is to convert the parameter to by-value, but this is a step towards being able to make guarantees about `&T` pointers (where T is Freeze) to LLVM.
2013-09-17 07:15:42 -07:00
bors
7ea85333ff auto merge of #9239 : steveklabnik/rust/rustpkg_tutorial, r=catamorphism
First shot at a new tutorial for rustpkg. /cc @catamorphism

Right now, I'm linking to my sample package on GitHub, I'm not sure that everyone would be comfortable with me having that there. Maybe under the mozilla org? I think having one to install and hold up as a default makes sense.
2013-09-17 04:45:45 -07:00
Daniel Micay
4e161a4d40 switch Drop to &mut self 2013-09-16 22:19:23 -04:00
Steve Klabnik
cf2253ba3f Updating rustpkg tutorial from feedback. 2013-09-16 18:49:47 -07:00
Steve Klabnik
a0b9cc6a8b New rustpkg tutorial. 2013-09-16 16:30:49 -07:00
bors
bc89ade401 auto merge of #9223 : sfackler/rust/tasks-fix, r=catamorphism
This module was removed a while ago, but the tasks tutorial wasn't
updated, and the old docs page for pipes was never deleted so the link
confusingly still worked!
2013-09-16 13:30:42 -07:00
Steven Fackler
555589ef7f Remove references to std::pipes from task tutorial
This module was removed a while ago, but the tasks tutorial wasn't
updated, and the old docs page for pipes was never deleted so the link
confusingly still worked!
2013-09-15 23:37:38 -07:00
blake2-ppc
8522341274 Remove {uint,int,u64,i64,...}::from_str,from_str_radix
Remove these in favor of the two traits themselves and the wrapper
function std::from_str::from_str.

Add the function std::num::from_str_radix in the corresponding role for
the FromStrRadix trait.
2013-09-15 14:29:16 +02:00
bors
2aa578efd9 auto merge of #9115 : erickt/rust/master, r=erickt
This is a series of patches to modernize option and result. The highlights are:

* rename `.unwrap_or_default(value)` and etc to `.unwrap_or(value)`
* add `.unwrap_or_default()` that uses the `Default` trait
* add `Default` implementations for vecs, HashMap, Option
* add  `Option.and(T) -> Option<T>`, `Option.and_then(&fn() -> Option<T>) -> Option<T>`, `Option.or(T) -> Option<T>`, and `Option.or_else(&fn() -> Option<T>) -> Option<T>`
* add `option::ToOption`, `option::IntoOption`, `option::AsOption`, `result::ToResult`, `result::IntoResult`, `result::AsResult`, `either::ToEither`, and `either::IntoEither`, `either::AsEither`
* renamed `Option::chain*` and `Result::chain*` to `and_then` and `or_else` to avoid the eventual collision with `Iterator.chain`.
* Added a bunch of impls of `Default`
* Added a `#[deriving(Default)]` syntax extension
* Removed impls of `Zero` for `Option<T>` and vecs.
2013-09-14 00:01:04 -07:00
Tim Chevalier
24fdb1d102 rustc/rustpkg: Use a target-specific subdirectory in build/ and lib/
As per rustpkg.md, rustpkg now builds in a target-specific
subdirectory of build/, and installs libraries into a target-specific
subdirectory of lib.

Closes #8672
2013-09-13 10:43:22 -07:00
Erick Tryzelaar
7c08abb0ce Document the Zero trait 2013-09-12 18:54:13 -07:00
bors
49eb7bd271 auto merge of #9039 : singingboyo/rust/update-for-expr-docs, r=thestinger
The old documentation for for loops/expressions has been quite wrong since the change to iterators.  This updates the docs to make them relevant to how for loops work now, if not very in-depth.  There may be a need for updates giving more depth on how they work, such as detailing what method calls they make, but I don't know enough about the implementation to include that.
2013-09-11 07:46:04 -07:00
Daniel Micay
6919cf5fe1 rename std::iterator to std::iter
The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.
2013-09-09 03:21:46 -04:00
Brandon Sanderson
8f31377514 Update for_expr docs. 2013-09-07 01:38:35 -07:00
novalis
c891fa326d Fix #6031. Allow symbolic log levels, not just numbers. 2013-09-06 23:30:17 -04:00
Huon Wilson
506f69aed7 Implement support for indicating the stability of items.
There are 6 new compiler recognised attributes: deprecated, experimental,
unstable, stable, frozen, locked (these levels are taken directly from
Node's "stability index"[1]). These indicate the stability of the
item to which they are attached; e.g. `#[deprecated] fn foo() { .. }`
says that `foo` is deprecated.

This comes with 3 lints for the first 3 levels (with matching names) that
will detect the use of items marked with them (the `unstable` lint
includes items with no stability attribute). The attributes can be given
a short text note that will be displayed by the lint. An example:

    #[warn(unstable)]; // `allow` by default

    #[deprecated="use `bar`"]
    fn foo() { }

    #[stable]
    fn bar() { }

    fn baz() { }

    fn main() {
        foo(); // "warning: use of deprecated item: use `bar`"

        bar(); // all fine

        baz(); // "warning: use of unmarked item"
    }

The lints currently only check the "edges" of the AST: i.e. functions,
methods[2], structs and enum variants. Any stability attributes on modules,
enums, traits and impls are not checked.

[1]: http://nodejs.org/api/documentation.html
[2]: the method check is currently incorrect and doesn't work.
2013-09-04 00:12:27 +10:00
bors
7c5398b612 auto merge of #8276 : kballard/rust/iterator-protocol, r=cmr
r? @thestinger
2013-09-01 07:00:44 -07:00
Carlos
c7a269fedc doc/rust.md: Missing in keyword on keyword list. 2013-08-30 13:21:14 +02:00
Kevin Ballard
fb0b388804 Make the iterator protocol more explicit
Document the fact that the iterator protocol only defines behavior up
until the first None is returned. After this point, iterators are free
to behave how they wish.

Add a new iterator adaptor Fuse<T> that modifies iterators to return
None forever if they returned None once.
2013-08-29 22:49:26 -07:00
Brian Anderson
d923f75d79 doc: Remove statement about scheduling randomness
The new scheduler is not currently that random.
2013-08-28 11:23:32 -07:00
Patrick Walton
aac9d6eee9 librustc: Fix merge fallout 2013-08-27 19:09:27 -07:00
bors
4fa09e08ed auto merge of #8777 : Kimundi/rust/doc_stuff, r=cmr 2013-08-27 06:45:50 -07:00
Marvin Löbel
8f17ac9099 Rewrote module tutorial 2013-08-27 04:15:11 +02:00
blake2-ppc
026304cf15 doc: Link condition and error-handling tutorial from main tutorial 2013-08-26 18:10:40 +02:00
Ben Blum
c678b22276 Talk about trait bounds in the tutorial. 2013-08-23 19:20:34 -04:00
bors
943f9aaa4a auto merge of #8692 : kballard/rust/ffi-tutorial-c_str, r=huonw
The FFI tutorial still incorrectly stated that strings were terminated
with
2013-08-23 06:31:19 -07:00
bors
ea32d019c4 auto merge of #8682 : adridu59/rust/master, r=cmr 2013-08-23 02:46:24 -07:00
Brandon Sanderson
35ec01a3f7 Clarify use_decl module resolution docs. 2013-08-22 19:32:22 -07: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
Adrien Tétar
892e8b8ec1 doc: add range iterators in the for loop section 2013-08-22 15:30:04 +02:00
Niko Matsakis
82a9abbf62 Change type of extern fns from *u8 to extern "ABI" fn
cc #3678
2013-08-21 10:50:37 -04:00
bors
c87d798fb0 auto merge of #8585 : jankobler/rust/extract-grammar-01, r=catamorphism
This fixes some errors which extract_grammar.py reports, when called with

python2.7 src/etc/extract_grammar.py <doc/rust.md
2013-08-21 02:22:25 -07:00
Daniel Micay
5f3a637b7c enable tests for the container tutorial 2013-08-20 22:05:46 -04:00
Daniel Micay
7727920ba2 iterator: add a method for reversing a container
this works on any container with a mutable double-ended iterator
2013-08-20 22:05:03 -04:00
Daniel Micay
46fc549fa9 rm obsolete integer to_str{,_radix} free functions 2013-08-20 22:05:03 -04:00
Graydon Hoare
ef5d537010 doc: add condition tutorial 2013-08-19 16:48:48 -07:00
Niko Matsakis
0479d946c8 Add externfn macro and correctly label fixed_stack_segments 2013-08-19 07:13:15 -04:00
Jan Kobler
c5c4a63aeb insert space
in the rust grammar

to avoid error messages like this:

  Exception: non-alpha apparent keyword: pub"

when using extract_grammar.py:

python2.7 src/etc/extract_grammar.py <doc/rust.md

Signed-off-by: Jan Kobler <eng1@koblersystems.de>
2013-08-18 08:00:23 +02:00
Huon Wilson
abe94f9b4d doc: correct spelling in documentation. 2013-08-16 15:41:28 +10:00
Daniel Micay
6a21f22767 update the iterator tutorial 2013-08-15 21:12:34 -04:00
bors
790e6bb397 auto merge of #8490 : huonw/rust/fromiterator-extendable, r=catamorphism
If they are on the trait then it is extremely annoying to use them as
generic parameters to a function, e.g. with the iterator param on the trait
itself, if one was to pass an Extendable<int> to a function that filled it
either from a Range or a Map<VecIterator>, one needs to write something
like:

    fn foo<E: Extendable<int, Range<int>> +
              Extendable<int, Map<&'self int, int, VecIterator<int>>>
          (e: &mut E, ...) { ... }

since using a generic, i.e. `foo<E: Extendable<int, I>, I: Iterator<int>>`
means that `foo` takes 2 type parameters, and the caller has to specify them
(which doesn't work anyway, as they'll mismatch with the iterators used in
`foo` itself).

This patch changes it to:

    fn foo<E: Extendable<int>>(e: &mut E, ...) { ... }
2013-08-15 02:56:08 -07:00
bors
3dde8e0f29 auto merge of #8480 : cmr/rust/tutorial, r=metajack 2013-08-14 18:29:09 -07:00