Commit Graph

1294 Commits

Author SHA1 Message Date
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
bors
e7b572952c auto merge of #8469 : gifnksm/rust/tutorial-ja, r=graydon
This PR adds an Japanese translated version of `doc/tutorial.md`.
Other tutorials have not yet translated.
2013-08-14 13:05:22 -07:00
Huon Wilson
53487a0246 std: Move the iterator param on FromIterator and Extendable to the method.
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 01:10:45 +10:00
Corey Richardson
93fab48b52 Remove unnecessary return 2013-08-12 20:52:37 -04:00
gifnksm
8e1440c7d4 tutorial: Add Japanese translation 2013-08-13 00:26:49 +09:00
bors
59434a1b8c auto merge of #8429 : catamorphism/rust/rustpkg-docs, r=catamorphism 2013-08-12 08:17:14 -07:00
gifnksm
e4cfb1d0f5 doc: Generate .po files for Japanse translations 2013-08-12 22:39:31 +09:00
gifnksm
2bc8a9be77 doc: Update .pot files 2013-08-12 22:39:31 +09:00
Erick Tryzelaar
f007a46d37 Merge branch 'master' of https://github.com/MAnyKey/rust into rollup 2013-08-10 13:03:34 -07:00
Erick Tryzelaar
5e1ca23a65 Merge branch 'vec-exh' of https://github.com/stepancheg/rust into rollup 2013-08-10 13:00:20 -07:00
Tim Chevalier
4fb37edd93 docs: In rustpkg manual, note future plans about versions 2013-08-09 18:26:22 -07:00
bors
6f6dce7bbc auto merge of #8176 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Also, notably, make rustpkgtest depend on the rustpkg executable (otherwise, tests that shell out to rustpgk might run when rustpkg doesn't exist).
2013-08-09 16:17:10 -07:00
Tim Chevalier
96fd606ddd std/rustc/rustpkg/syntax: Support the extern mod = ... form
This commit allows you to write:

 extern mod x = "a/b/c";

which means rustc will search in the RUST_PATH for a package with
ID a/b/c, and bind it to the name `x` if it's found.

Incidentally, move get_relative_to from back::rpath into std::path
2013-08-09 14:11:50 -07:00
Maxim Kolganov
b4fe856645 typo in tutorial 2013-08-09 01:43:44 +04:00
bors
8f65dbfcfa auto merge of #8385 : cmr/rust/big-rollup, r=alexcrichton
This is a fairly large rollup, but I've tested everything locally, and none of
it should be platform-specific.

r=alexcrichton (bdfdbdd)
r=brson (d803c18)
r=alexcrichton (a5041d0)
r=bstrie (317412a)
r=alexcrichton (135c85e)
r=thestinger (8805baa)
r=pcwalton (0661178)
r=cmr (9397fe0)
r=cmr (caa4135)
r=cmr (6a21d93)
r=cmr (4dc3379)
r=cmr (0aa5154)
r=cmr (18be261)
r=thestinger (f10be03)
2013-08-08 14:32:02 -07:00
Corey Richardson
878e74e1ce Fix more priv fallout 2013-08-08 17:02:03 -04:00
Alex Crichton
1b103912ea Add some documentation about globals in ffi docs 2013-08-07 22:41:14 -04:00
Brian Anderson
ce95b01014 Disable linked failure tests
The implementation currently contains a race that leads to segfaults.
2013-08-07 16:32:20 -07:00
Brian Anderson
b735e6b104 doc: Fix deadlocks in tutorial due to yield bustage 2013-08-07 16:32:20 -07:00
Stepan Koltsov
828bfb2c61 Fix incorrect non-exhaustive matching for fixed length vecs
Code like this is fixed now:

```
fn foo(p: [u8, ..4]) {
    match p {
        [a, b, c, d] => {}
    };
}
```

Invalid constructors are not reported as errors yet:

```
fn foo(p: [u8, ..4]) {
    match p {
        [_, _, _] => {} // this should be error
        [_, _, _, _, _, .._] => {} // and this
        _ => {}
    }
}
```

Issue #8311 is partially fixed by this commit. Fixed-length arrays in
let statement are not yet allowed:

```
let [a, b, c] = [1, 2, 3]; // still fails
```
2013-08-07 22:07:24 +04:00
Daniel Micay
8f9bbc476d remove extra::iter
This module provided adaptors for the old internal iterator protocol,
but they proved to be quite unreadable and are not generic enough to
handle borrowed pointers well.

Since Rust no longer defines an internal iteration protocol, I don't
think there's going to be any reuse via these adaptors.
2013-08-06 23:41:20 -04:00
Daniel Micay
1008945528 remove obsolete foreach keyword
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
Daniel Micay
87cf2864b1 rm obsolete documentation on for
it is documented in the container/iterator tutorial, not the basic
tutorial
2013-08-03 03:00:42 -04:00
Daniel Micay
b41d04763e make for parse as foreach does
Closes #6997
2013-08-03 03:00:42 -04:00
Patrick Walton
887c656970 librustc: Introduce a new visitor type based on traits and port syntax to it.
This is preparation for removing `@fn`.

This does *not* use default methods yet, because I don't know
whether they work. If they do, a forthcoming PR will use them.

This also changes the precedence of `as`.
2013-08-02 21:57:58 -07:00
Daniel Micay
234acad404 replace range with an external iterator 2013-08-02 00:51:14 -04:00
blake2-ppc
78cde5b9fb std: Change Times trait to use do instead of for
Change the former repetition::

    for 5.times { }

to::

    do 5.times { }

.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
2013-08-01 16:54:22 +02:00
Daniel Micay
1fc4db2d08 migrate many for loops to foreach 2013-08-01 05:34:55 -04:00
bors
2830d7d013 auto merge of #8032 : catamorphism/rust/rustpkg-tags, r=graydon
r? @graydon    Package IDs can now be of the form a/b/c#FOO, where (if a/b/c is
    a git repository) FOO is any tag in the repository. Non-numeric
    tags only match against package IDs with the same tag, and aren't
    compared linearly like numeric versions.
    
 While I was at it, refactored the code that calls `git clone`,  and segregated build output properly for different packages.
2013-07-29 11:04:25 -07:00
bors
fddb35e988 auto merge of #7984 : gifnksm/rust/tutorial-links, r=bstrie 2013-07-29 09:16:22 -07:00
Steven Stewart-Gallus
d0b7515aed Change concurrency primitives to standard naming conventions
To be more specific:

`UPPERCASETYPE` was changed to `UppercaseType`
`type_new` was changed to `Type::new`
`type_function(value)` was changed to `value.method()`
2013-07-27 22:06:29 -07:00
Tim Chevalier
7079ec6e2e docs: Talk about tags that aren't versions in the "Package identifiers" section 2013-07-26 20:06:41 -07:00
Alex Crichton
b782d42cba Deny all warnings by default in doc tests
Allow some common ones that are good for examples, however.
2013-07-26 18:04:20 -07:00
Daniel Micay
ba41755069 improve container/iterator tutorial 2013-07-24 18:44:16 -04:00
Daniel Micay
af5a17b7d0 document random-access iterators 2013-07-24 09:45:20 -04:00
Daniel Micay
8c02272512 expand on double-ended iterators in the tutorial 2013-07-24 09:45:20 -04:00
gifnksm
e68697b55e tutorial: Remove the sentence about mutable fields. 2013-07-23 12:18:54 +09:00
gifnksm
9aab7e59d7 tutorial: Fix obsolete names 2013-07-23 11:05:49 +09:00
gifnksm
8fb77c7099 tutorial: Repair broken links 2013-07-23 11:01:21 +09:00
zslayton
49014c8268 Exposed previously hidden 'use' statements in the tutorial's sample code. 2013-07-21 23:40:52 -04:00
maikklein
b082302727 updated manual 2013-07-19 20:43:04 -04:00
bors
78f8b407e3 auto merge of #7846 : alexcrichton/rust/static-mut-dox, r=pnkfelix
It's probably a good idea to at least *mention* them somewhere.
2013-07-18 13:49:36 -07:00
bors
874eb1939b auto merge of #7845 : gifnksm/rust/tutorial-remove-dup, r=cmr
`pandoc` issues warnings.

```
pandoc: Duplicate link reference `[macros]' "source" (line 2151, column 1)
pandoc: Duplicate link reference `[tasks]' "source" (line 2150, column 1)
pandoc: Duplicate link reference `[wiki-start]' "source" (line 92, column 1)
```

This PR also removes unused link references.
2013-07-18 12:04:39 -07:00
Patrick Walton
2dbb3c3887 test: Fix tests. 2013-07-17 14:57:54 -07:00
Alex Crichton
8885b740f6 Add documentation about mutable statics to rust.md 2013-07-17 08:57:08 -07:00
gifnksm
827a6d26e6 tutorial: remove unused link references. 2013-07-17 15:38:26 +09:00
gifnksm
5d4b990fc6 tutorial: remove duplicate link references.
`pandoc` issues warnings.

```
pandoc: Duplicate link reference `[macros]' "source" (line 2151, column 1)
pandoc: Duplicate link reference `[tasks]' "source" (line 2150, column 1)
pandoc: Duplicate link reference `[wiki-start]' "source" (line 92, column 1)
```
2013-07-17 13:29:10 +09:00
OGINO Masanori
ad3a69739f Add project information to l10n templates. 2013-07-17 07:48:30 +09:00
Felix S. Klock II
8515abe0d9 Add doc and examples for attributes allow/warn/deny/forbid.
Fix #7821.
2013-07-16 18:20:49 +02:00
Daniel Micay
2b96408600 extend the iterator tutorial
documents conversion, size hints and double-ended iterators and adds
more of the traits to the prelude
2013-07-12 01:53:50 -04:00
bors
e388a80c23 auto merge of #7117 : jensnockert/rust/freestanding, r=cmr
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16,
u32, u64, float, int, and uint are replaced with generic functions in
num instead.

This means that instead of having to know everywhere what the type is, like

~~~
f64::sin(x)
~~~

You can simply write code that uses the type-generic versions in num instead, this works for all types that implement the corresponding trait in num.

~~~
num::sin(x)
~~~

Note 1: If you were previously using any of those functions, just replace them
with the corresponding function with the same name in num.

Note 2: If you were using a function that corresponds to an operator, use the
operator instead.

Note 3: This is just https://github.com/mozilla/rust/pull/7090 reopened against master.
2013-07-09 13:34:50 -07:00
Jens Nockert
20a2fbd055 I forgot the changes to the docs as well
Apparently yesterday wasn't my day, and I forgot to add the changes to
all the tests apparently, and in the end forgot the docs extra much.
Please documentation, forgive me, I really do love you, I hope you
forgive me.

Next time we'll meet tutorial, I promise to bring cookies and tea. I
really want to be best-friends-forever with you, <3.

XOXO
2013-07-09 18:24:30 +02:00
bors
62bb843e32 auto merge of #7641 : lucab/rust/lucab/po4a, r=catamorphism
As per https://mail.mozilla.org/pipermail/rust-dev/2013-July/004685.html 

This is the initial machinery to setup the l10n infrastructure for markdown documentation.
A new "docs-l10n" target will take care of generating, updating and then building .pot and .po files, and later on the final .md.

This commit includes the .pot for all current .md docs; they can be feed directly to Mozilla Verbatim if wanted.
Please note that po4a only provides the orig.md -> .pot -> l10n.po -> l10n.md flow. The l10n.md -> l10n.html generation is not currently built in the makefile, as no language has been enabled.
2013-07-09 03:25:29 -07:00
Luca Bruno
7a4210a174 Generate initial translatable templates for documentation
These files are automatically genereated by `make docs-l10n` (via po4a),
which will also take of updating them if the original .md changes.

Signed-off-by: Luca Bruno <lucab@debian.org>
2013-07-07 21:17:35 +02:00
Luca Bruno
3177e63dee Use po4a to provide translatable documentation
This commit add a new "docs-l10n" make target which uses po4a to:
* create .pot (PO templates) from markdown doc
* update templates and po for enabled languages
* generate translated markdown for completed (> 80%) translations

Currently, no language has been activated.

Signed-off-by: Luca Bruno <lucab@debian.org>
2013-07-07 21:12:00 +02:00
bors
63f7857697 auto merge of #7582 : mitsuhiko/rust/doc-fixes, r=huonw
Drop is no longer a keyword, removed it from the intro docs.
2013-07-07 01:44:02 -07:00
bors
e89dcb887b auto merge of #7549 : sfackler/rust/docs, r=msullivan
I'm leaving the Sized kind undocumented since it isn't fully implemented
yet.
2013-07-04 19:01:54 -07:00
Armin Ronacher
8cb1a290a8 Removed drop from the keyword list in the docs 2013-07-04 11:56:11 +02:00
Huon Wilson
eee6775642 Implement consuming iterators for ~[], remove vec::{consume, consume_reverse, map_consume}. 2013-07-04 00:46:49 +10:00
bors
55f155521d auto merge of #7523 : huonw/rust/uppercase-statics-lint, r=cmr
Adds a lint for `static some_lowercase_name: uint = 1;`. Warning by default since it causes confusion, e.g. `static a: uint = 1; ... let a = 2;` => `error: only refutable patterns allowed here`.
2013-07-03 04:31:50 -07:00
Steven Fackler
c63b3f8e28 Removing the rename warning
Now that the finalize->drop rename has happened, this hopefully
shouldn't end up changing again.
2013-07-02 09:58:24 -07:00
Steven Fackler
863e75f0a1 Fixed documentation for finalize->drop change 2013-07-02 09:58:18 -07:00
Brian Anderson
a2db7c15ce doc: Update links to 0.7 2013-07-02 09:25:44 -07:00
Steven Fackler
3e265e7842 Small documentation changes
I'm leaving the Sized kind undocumented since it isn't fully implemented
yet.
2013-07-01 23:37:11 -07:00
Huon Wilson
c437a16c5d rustc: add a lint to enforce uppercase statics. 2013-07-01 17:52:57 +10:00
Patrick Walton
a1531ed946 librustc: Remove the broken overloaded assign-ops from the language.
They evaluated the receiver twice. They should be added back with
`AddAssign`, `SubAssign`, etc., traits.
2013-06-28 10:44:16 -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
Daniel Micay
659cd55e75 add a tutorial on containers and iterators 2013-06-28 00:24:09 -04:00
Tim Chevalier
d805859ff5 rustpkg: Update manual 2013-06-27 23:20:43 -04:00
Huon Wilson
29b0649a6a Convert vec::{push, push_all, push_all_move} to methods. 2013-06-28 00:20:42 +10:00
bors
22408d9ad5 auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop.
Closes #4332.
2013-06-25 20:29:06 -07:00
Luqman Aden
ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Daniel Micay
e67c48a591 remove each from vec, HashMap and HashSet 2013-06-25 16:28:02 -04:00
bors
3b126e4d6d auto merge of #7274 : thestinger/rust/size_hint, r=huonw
I ran into a weird lifetime bug blocking updating the `collect` method to use `FromIterator`, but everything here works fine.
2013-06-22 23:07:55 -07:00
Daniel Micay
d2e9912aea vec: remove BaseIter implementation
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
2013-06-23 02:05:20 -04:00
bors
fc83d82fec auto merge of #7204 : alexcrichton/rust/deriving-to-string, r=pcwalton
Closes #7180 and #7179.

Before, the `deriving(ToStr)` attribute was essentially `fmt!("%?")`. This changes it to recursively invoke `to_str()` on fields instead of relying on `fmt!`-style things. This seems more natural to me and what should actually be expected.
2013-06-22 17:13:51 -07:00
Daniel Micay
ef07d7c46e Merge pull request #7270 from thestinger/doc
accumulated doc pull requests from the queue
2013-06-22 12:56:37 -07:00
Alex Crichton
30d755957a Expand the deriving(ToStr) implementation 2013-06-22 09:53:17 -07:00
Daniel Micay
49c74524e2 vec: rm old_iter implementations, except BaseIter
The removed test for issue #2611 is well covered by the `std::iterator`
module itself.

This adds the `count` method to `IteratorUtil` to replace `EqIter`.
2013-06-21 03:20:22 -04:00
Ralph Bodenner
fd24cb7eae Usable instructions for generating docs from source 2013-06-21 00:56:43 -04:00
Huon Wilson
769c2e5f99 Minor doc updates to reflect #[deriving(Zero)], and small release notes adjustments.
The `extra::fileinput` module landed just after 0.6 was released, and there are many
more derivable traits.
2013-06-21 00:55:13 -04:00
Joris Rehm
87c110506d fix text of tutorials 2013-06-21 00:53:10 -04:00
bors
98bd68343c auto merge of #7184 : smvv/rust/doc_css, r=brson
After reading issue #7077, all header elements had a border. In my opinion those borders are a bit too much distraction. I tried a different approach with increasing the padding and font size, and omitting the borders.

Comparison:
http://smvv.io/rust-doc/std/hashmap.html
http://static.rust-lang.org/doc/std/hashmap.html

Note: the highlighted code blocks are not caused by this commit.

I left the border of the code block / function signature as is. The reason behind that is that code blocks are really block elements, while headers are not. What do you guys think?
2013-06-16 20:16:01 -07:00
Niko Matsakis
bada191309 Correct docs 2013-06-16 12:48:08 -04:00
Niko Matsakis
5fdb0cbb8c Correct tutorial tests 2013-06-16 12:47:36 -04:00
Sander Mathijs van Veen
64ccc60eee Remove h[123] border and increase their padding to better readability 2013-06-16 17:40:45 +02:00
Daniel Micay
7f00ab3df1 fix benchmark and the tutorials 2013-06-16 01:19:43 -04:00
Daniel Micay
d68be89e69 rm MutableIter
replaced with mutable implementations of Iterator
2013-06-14 23:15:42 -04:00
Daniel Micay
585f5f7f79 add IteratorUtil to the prelude 2013-06-14 23:15:42 -04:00
bors
26a5c9768b auto merge of #7077 : SiegeLord/rust/new_css, r=pnkfelix
I was making documentation for my own little Rust project, and I was somewhat unhappy with how the documentation looked. While many of the issues are endemic to how rustdoc generates its output, you can get pretty far in making the documentation readable by using a better CSS style.

This commit alters the CSS style used in Rust's documentation in order to make the various sections stand out more. You can see an example of its usage in my own project's documentation: http://siegelord.github.io/RustGnuplot/#implementation-for-figureself-where-self. I showed it to some people on IRC and they suggested that I make a pull request here. I tested it on the only browser that matters, but also Chrome and Opera.
2013-06-12 15:31:39 -07:00
Huon Wilson
3ac00a9489 std: remove substr & str::count_*, methodise char_len, implement slice_chars.
The confusing mixture of byte index and character count meant that every
use of .substr was incorrect; replaced by slice_chars which only uses
character indices. The old behaviour of `.substr(start, n)` can be emulated
via `.slice_from(start).slice_chars(0, n)`.
2013-06-12 12:21:04 +10:00
SiegeLord
d641b0b575 Alter rust.css to make the documentation look more appealing 2013-06-11 20:43:26 -04:00
Huon Wilson
7e6a5940cb std: convert pow, hypot, atan2, log to take arguments by reference. 2013-06-11 11:36:03 +10:00
Huon Wilson
e8782eeb63 fix tests, remove some warnings 2013-06-11 02:34:14 +10:00
Huon Wilson
a64e886e3c std: remove str::contains in favour of the method 2013-06-10 23:02:55 +10:00
Huon Wilson
c32fb53cf9 std: remove str::{len, slice, is_empty} in favour of methods. 2013-06-10 23:02:54 +10:00
Daniel Micay
de367157b5 remove deprecated vec::{is_empty, len} functions 2013-06-08 23:19:30 -04:00
Huon Wilson
513d2292e5 std: remove foldr and alli methods in vec 2013-06-09 02:22:23 +10:00
Huon Wilson
ed299af625 std: remove fold[lr] in favour of iterators 2013-06-09 02:22:23 +10:00
bors
1cf57f7b67 auto merge of #7003 : alco/rust/tutorial-block-expr, r=bstrie
This is something that's only been briefly mentioned in the beginning of
the tutorial and all of the closure examples within this subsection
include only one expression between { and }.
2013-06-07 23:40:25 -07:00
Alexei Sholik
93b2ddfc88 A reminder that a block is a single expr in closures
This is something that's only been briefly mentioned in the beginning of
the tutorial and all of the closure examples within this subsection
include only one expression between { and }.
2013-06-08 04:10:50 +03:00
Alexei Sholik
83b68a2f69 Mention for in the section on loops
The "4.3 Loops" section only describes `while` and `loop`. We then see `for`
used in a code sample at the end of the "13. Vectors and strings" section,
but it's explained for the first time only in the next section --
"14. Closures".

It is worth mentioning it in "4.3 Loops".
2013-06-08 03:17:56 +03:00
Ramkumar Ramachandra
dd923e3831 tutorial: fix for-loop example
Although in the example function `each` works as expected with
rust-0.6 (the latest release), it fails to even compile with `incoming`
rust (see test/compile-fail/bad-for-loop-2.rs). Change the function to
return a `bool` instead of `()`: this works fine with both versions of
rust, and does not misguide potential contributors.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-06 19:43:16 +05:30
Alexei Sholik
c7b19b04cb Fix duplicate words in the docs 2013-06-06 10:43:58 +03: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
Tim Chevalier
5b09dca90b docs: Mention recently-added rustpkg features in the rustpkg manual 2013-06-02 17:21:01 -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
Gábor Horváth
0d9ea4e2d1 Minor grammar fix. 2013-05-30 15:26:25 +02:00
Gábor Horváth
9fd18a93b7 Minor style fix. 2013-05-30 15:24:08 +02:00
Gábor Horváth
e583d5a6b6 Minor documentation addition. 2013-05-30 15:20:30 +02:00
bors
31b2804fda auto merge of #6825 : caitp/rust/issue-6824, r=Aatch
Show `int_suffix_size` to appear 0 or 1 times
Show `exponent | . dec_lit` to appear 0 or 1 times, to show why `3f;` is a valid number
2013-05-29 22:58:35 -07:00
Caitlin Potter
bfe141c4e1 Fixes #6824 - Correct scan_number() grammar
Show `int_suffix_size` to appear 0 or 1 times
Show `exponent | . dec_lit` to appear 0 or 1 times, to show why `3f;` is a valid number
2013-05-30 00:51:16 -04:00
Patrick Walton
206ab89629 librustc: Stop reexporting the standard modules from prelude. 2013-05-29 19:04:53 -07:00
Olivier Saut
dea6677251 Add a short section on ARC 2013-05-26 19:10:16 +02:00
bors
5787bf3093 auto merge of #6711 : catamorphism/rust/issue-5700, r=thestinger
r? @nikomatsakis
2013-05-24 01:04:40 -07:00
Tim Chevalier
248a669381 docs: Don't mention obsolete move operator, as per #5700 2013-05-23 20:27:56 -07:00
Erick Tryzelaar
cc4fabcb43 Fix some std/extra language in the tutorial 2013-05-23 17:58:30 -07:00
Ted Horst
34cfd2183b more testing fallout from core->std/std->extra move 2013-05-23 15:06:29 -05:00
Corey Richardson
acf920fe4b Add static_assert doc blurb 2013-05-22 13:13:29 -04:00
John Clements
b71a1ecea2 added and rewrote text for 'do' and 'for' loops 2013-05-20 11:49:21 -07:00
bors
9f671698e6 auto merge of #6106 : thestinger/rust/iter, r=bstrie
I don't have a strong opinion on the function vs. method, but there's no point in having both. I'd like to make a `repeat` adaptor like Python/Haskell for turning a value into an infinite stream of the value, so this has to at least be renamed.
2013-05-19 08:13:30 -07:00
Daniel Micay
d953a5ce43 replace old_iter::repeat with the Times trait 2013-05-18 04:57:21 -04:00
Olivier Saut
3e41639a5e Add a small section on futures to the tutorial 2013-05-17 23:11:49 +02:00
Huon Wilson
cd2eb4701f syntax: implement #[deriving(DeepClone)]. Fixes #6514. 2013-05-16 22:55:08 +10:00
bors
2fc6b0998b auto merge of #6475 : sonwow/rust/tutorials, r=brson 2013-05-14 19:08:19 -07:00
Björn Steinbrink
bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
Youngsoo Son
0c082047bc Replace shared/unique by managed/owned in the tutorial 2013-05-14 22:25:55 +09:00
bors
3abc5b3ffb auto merge of #6417 : pcwalton/rust/exprs-in-patterns, r=pcwalton
r? @graydon
2013-05-13 13:25:42 -07:00
Huon Wilson
d43908a3a7 doc: document the #[deriving] attribute.
Closes #4916.
2013-05-13 20:04:03 +10:00
Patrick Walton
06ef889cdc libsyntax: Remove extern mod foo { ... } from the language. 2013-05-12 16:33:15 -07:00
bors
9ee8d506d9 auto merge of #6398 : osaut/rust/master, r=bstrie
I have replaced io::println by println in the tutorial as I do not think it is needed anymore since it is already included in prelude.rs.
2013-05-11 15:10:44 -07:00
Alex Crichton
60803e5fc8 Fix tests with the swap operator 2013-05-10 22:51:06 -04:00
Alex Crichton
63c7e2f991 Remove the '<->' operator from the language 2013-05-10 22:51:06 -04:00
Olivier Saut
017e7e8be1 Replace io::println by println as it is now included in prelude.rs 2013-05-10 21:12:11 +02: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
86efd97a10 add gitattributes and fix whitespace issues 2013-05-03 20:01:42 -04:00
Brendan Zabarauskas
ee26c7c433 Revert rename of Div to Quot 2013-05-01 15:40:05 +10:00
Jed Davis
4701716b56 Revert "doc: XFAIL mysterious failure on bots"
This reverts commit 2c6dae081b.
2013-04-30 12:07:10 -07:00
Patrick Walton
2c6dae081b doc: XFAIL mysterious failure on bots 2013-04-29 14:30:57 -07:00
Patrick Walton
670ab8ac36 librustc: Change labels to use the lifetime notation '. 2013-04-29 14:30:57 -07:00
ILYONG CHO
9d33008da1 tutorial: Fix 'self' to 'Self' 2013-04-29 17:59:25 +09:00
Daniel Micay
46f91a0fa9 make way for a new iter module 2013-04-28 22:31:39 -04:00
Daniel Micay
195911fca4 tutorial-ffi: add example of a custom destructor 2013-04-26 14:07:57 -04:00
Daniel Micay
721e1143a5 tutorial: rework the section on destructors
This removes the comparison to manual memory management examples,
because it requires too much existing knowledge. Implementing custom
destructors can be covered in the FFI tutorial, where `unsafe` is
already well explained.
2013-04-26 14:07:47 -04:00
Marvin Löbel
3759b5711d Fixed typo... And a billion other things. 2013-04-24 22:28:02 +02:00
Tim Chevalier
4508da226a rustpkg: In doc, mention other implicit RUST_PATH entries
as per Graydon's comment
2013-04-22 18:17:32 -07:00
Tim Chevalier
d834c0d59d docs: Sketch out rustpkg manual 2013-04-22 18:17:32 -07:00
Brendan Zabarauskas
01eb5e8ad3 Rename Div operator trait to Quot and Modulo operator trait to Rem 2013-04-22 01:58:53 +10:00
Dan Luu
69f6ac5d31 Fix debug! usage in tutorial 2013-04-19 19:17:34 -04:00
Brian Anderson
decd3901d5 core::comm: Modernize constructors to use new 2013-04-18 14:07:35 -07:00
Dan Luu
7373c64a4c Explain use of debug\! in tutorial 2013-04-17 11:51:43 -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
bors
a425b75c64 auto merge of #5773 : dunsmoreb/rust/incoming, r=bstrie
Updates the tutorial to include a simple definition for tuples in section 4.2. Fixes #5132.
2013-04-10 06:04:00 -07:00
Bryan Dunsmore
08bc392d94 Update destructuring to reference tuples section. 2013-04-10 07:06:18 -05:00
bors
786ae0114b auto merge of #5782 : zofrex/rust/doc-1-tuples, r=thestinger
As per [the 0.6 release notes](https://github.com/mozilla/rust/wiki/Doc-detailed-release-notes#06-april-2013) single-element tuples are legal. I spotted a couple of places in the documentation that said otherwise, and propose these changes to them.
2013-04-08 16:22:03 -07:00
bors
c92936395c auto merge of #5775 : pavpanchekha/rust/patch-1, r=thestinger
Change wrong field name in "Trait Inheritance" section.
2013-04-08 11:10:00 -07:00
Pavel Panchekha
c6d6782906 Fixed typo
Change wrong field name in "Trait Inheritance" section.
2013-04-07 23:19:31 -03:00
Bryan Dunsmore
f0d0cbfff8 Include definition of tuples for destructuring.
Updates the tutorial to include a simple definition for tuples in
section 4.2. Fixes #5132.
2013-04-07 17:09:15 -05:00
zofrex
ac9e694d59 Update manual for single-element tuple types 2013-04-07 22:08:40 +01:00
zofrex
d1e2d295f8 Update manual for single-element tuples 2013-04-07 22:08:34 +01:00
zofrex
621d45b341 Update tutorial: 1-tuples now exist 2013-04-07 22:08:23 +01:00
bors
614d6da828 auto merge of #5721 : dhardy/rust/master, r=graydon
This is some stuff which seemed to be missing to me (though I haven't read everything yet so hope I haven't missed the relevant section).

A similar addition for borrowing handles is needed, but #5720 stumped me.

Comments welcome.
2013-04-05 18:54:52 -07:00
Diggory Hardy
e2a6feb8fe Tutorial: spelling correction and move a failing test to an xfail-test marked code block. 2013-04-05 12:26:47 +02:00
Diggory Hardy
1e483c7b70 Tutorial: fix typo 2013-04-04 22:35:23 +02:00
Diggory Hardy
964fc862e0 Tutorial: comment on how mutability applies to boxes 2013-04-04 18:13:12 +02:00
bors
717ed51f12 auto merge of #5716 : dhardy/rust/master, r=thestinger 2013-04-04 06:12:49 -07:00
Diggory Hardy
cb91e91418 Tutorial: rename variable to avoid confusion. 2013-04-04 15:08:25 +02:00
bors
b5d8224212 auto merge of #5713 : brson/rust/tutorial2, r=thestinger
It doesn't quite reflect reality
2013-04-04 02:18:47 -07:00
bors
1dc330c313 auto merge of #5707 : brettcannon/rust/patch-1, r=thestinger
The sentence "Remember that `(float, float)` is a tuple of two floats"
sounds like you've already read a section on tuples, but that section
comes later. Changing it to "Assuming that ..." makes it more about
taking the writer's word that the syntax is how tuples are defined.
2013-04-04 01:21:50 -07:00
bors
21de574625 auto merge of #5703 : steveklabnik/rust/add_log_docs, r=thestinger
Closes #5699.
2013-04-04 00:18:45 -07:00
Brian Anderson
679b1dcb62 doc: Rewrite task tutorial intro
It doesn't quite reflect reality
2013-04-03 22:54:58 -07:00
bors
aa899c97d9 auto merge of #5710 : ajuckel/rust/patch-1, r=luqmana
One word typo fix
2013-04-03 22:30:45 -07:00
Anthony Juckel
e2c7a4def2 Simple typo fix 2013-04-03 19:10:09 -05:00
Steve Klabnik
a7f0bfbda6 One more typo: dubug -> debug 2013-04-03 16:59:13 -07:00
Brett Cannon
8dd5a70ef4 Update tut. to not sound like I missed a section
The sentence "Remember that `(float, float)` is a tuple of two floats"
sounds like you've already read a section on tuples, but that section
comes later. Changing it to "Assuming that ..." makes it more about
taking the writer's word that the syntax is how tuples are defined.
2013-04-03 18:52:28 -03:00
Steve Klabnik
3044f5e2b6 typo fix: na -> an 2013-04-03 12:44:41 -07:00
Steve Klabnik
d79b22474c Add information about logging macros to the tutorial.
Closes #5699.
2013-04-03 11:40:23 -07:00
Daniel Micay
cc148b58ff rename Linear{Map,Set} => Hash{Map,Set} 2013-04-03 10:30:36 -04:00
Daniel Micay
44029a5bbc hashmap: rm linear namespace 2013-04-03 10:30:18 -04:00
bors
2815742ba5 auto merge of #5669 : graydon/rust/tweaks, r=thestinger
Just some minor cleanup of version strings and copyrights.
2013-04-01 18:00:43 -07:00
Graydon Hoare
951f460aa8 tidy version numbers and copyright dates 2013-04-01 16:15:49 -07:00
bors
d1935898ed auto merge of #5662 : catamorphism/rust/docs, r=catamorphism
r? @brson
2013-04-01 16:03:47 -07:00
Tim Chevalier
ce09645591 docs: Xfail test, it's just for illustration anyway 2013-04-01 15:21:22 -07:00
Brian Anderson
243e601e51 doc: Update tutorial description of core 2013-04-01 14:30:14 -07:00
Tim Chevalier
dbeea18fc5 docs: Document language items, as per #3342 2013-04-01 14:05:03 -07:00
Luqman Aden
d617030d63 Update tutorial.md
Change fn() -> &fn().
2013-03-31 18:34:51 -07:00
Patrick Walton
1e91595520 librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
bors
a17a9d41f6 auto merge of #5624 : thestinger/rust/tutorial, r=pcwalton 2013-03-29 13:30:46 -07:00
Daniel Micay
0189ef3600 tutorial: add an example of freezing a managed box 2013-03-29 15:45:10 -04:00
Daniel Micay
f78af18127 tutorial: improve the managed boxes section 2013-03-29 15:45:10 -04:00
Daniel Micay
85ed840e23 tutorial: improve the owned boxes section 2013-03-29 15:45:07 -04:00
Daniel Micay
777ad8b204 tutorial: use "owned box" consistently 2013-03-29 14:16:52 -04:00
bors
706ed6dd53 auto merge of #5583 : jbclements/rust/docfix-for-block-comment-grammar, r=jbclements
... by adding Kleene '+' in two places, and changing a "non-slash" into "non_slash_or_star".

Closes #1588
2013-03-29 09:39:43 -07:00
bors
5da9e12778 auto merge of #5570 : alexcrichton/rust/fix-unused-imports, r=sanxiyn
Before it wouldn't warn about unused imports in the list if something in the list was used. These commits fix that case, add a test, and remove all unused imports in lists of imports throughout the compiler.
2013-03-29 05:57:44 -07:00
Alex Crichton
be57d745d2 Removing unused imports 2013-03-28 23:56:46 -04:00
Daniel Micay
d4509f270b tutorial: only Owned types can have a Drop impl 2013-03-28 18:41:55 -04:00
Daniel Micay
467502216e tutorial: cleaner libc use statements 2013-03-28 17:53:29 -04:00
John Clements
dcb8fa8f35 added defn of non_slash_or_star 2013-03-28 10:23:20 -07:00
John Clements
81d30ade61 fix another subtle bug in comment regex 2013-03-28 10:19:08 -07:00
John Clements
48cb50af13 fixes stated grammar for block comments, by adding Kleene '+' in two places.
Closes #1588
2013-03-27 10:17:37 -07:00
Patrick Walton
b07b36bbf3 test: Fix tests 2013-03-26 22:45:22 -07:00
Patrick Walton
8b56a8380b librustc: Modify all code to use new lifetime binder syntax 2013-03-26 21:30:17 -07:00
Alex Crichton
31f6e64324 doc: Remove mentions of oldmap::HashMap 2013-03-26 19:20:02 -04:00
bors
7f5d7e1c2e auto merge of #5549 : brson/rust/rustdoc, r=brson
r?
2013-03-26 09:52:14 -07:00
Brian Anderson
4d745c288a rustdoc: Tweak list style 2013-03-26 09:31:44 -07:00
Felix S. Klock II
e1dccf9a73 Updated to reflect alpha-rename of constant/static items section. 2013-03-26 14:36:01 +01:00
Felix S. Klock II
5b10f4e117 Miscellaneous documentation additions.
Added notes explaining how [expr, ..expr] form is used, targeted at
individuals like me who thought it was more general and handled
dynamic repeat expressions.  (I left a TODO for this section in a
comment, but perhaps that is bad form for the manual...)

Added example of `do` syntax with a function of arity > 1; yes, one
should be able to derive this from the text above it, but it is still
a useful detail to compare and contrast against the arity == 1 case.

Added example of using for expression over a uint range, since someone
who is most used to write `for(int i; i < lim; i++) { ... }` will
likely want to know how to translate that form (regardless of whether
it happens to be good style or not for their use-case).

Added note about the semi-strange meaning of "fixed size" of vectors
in the vector type section.
2013-03-26 14:18:48 +01:00
bors
d469212d9d auto merge of #5507 : graydon/rust/fixups2, r=graydon
Just some editing-to-reflect-reality on release notes and manual.
2013-03-25 16:36:58 -07:00
Graydon Hoare
b481829306 docs: update to avoid mention of const. 2013-03-25 15:53:02 -07:00
bors
df171e4b68 auto merge of #5505 : catamorphism/rust/macro-tutorial, r=graydon
r? @jbclements
2013-03-25 15:13:09 -07:00
Patrick Walton
28efc234f4 libcore: Fix obsolete syntax in extfmt 2013-03-22 23:09:15 -07:00
Tim Chevalier
3633ba240f Copyedit macro tutorial 2013-03-22 16:11:27 -07:00
Tim Chevalier
ab2a397ae7 docs: Copyedit my randomly assigned sections of the manual 2013-03-22 14:45:16 -07:00
Luca Bruno
f9bb7b7768 Tutorial: make struct section more coherent
In struct section of tutorial, make everything more coherent and
clear by always using "struct Point". Also, do not prematurely
introduce pointers and arrays. Fixes #5240

Signed-off-by: Luca Bruno <lucab@debian.org>
2013-03-21 21:33:29 +01:00
Daniel Micay
9967dc81fe rewrite the tutorial section on boxes 2013-03-19 16:27:08 -04:00
Patrick Walton
e78f2e2ac5 librustc: Make the compiler ignore purity.
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.
2013-03-18 17:21:16 -07:00