Commit Graph

1135 Commits

Author SHA1 Message Date
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
Patrick Walton
58f248d923 test: Fix tests. rs=tests 2013-03-13 20:08:35 -07:00
Patrick Walton
8fa66e8e07 librustc: Remove implicit self from the language, except for old-style drop blocks. 2013-03-13 20:07:10 -07:00
Patrick Walton
b1c699815d librustc: Don't accept as Trait anymore; fix all occurrences of it. 2013-03-13 20:07:09 -07:00
Brian Anderson
82f190355b Remove uses of log 2013-03-11 23:19:42 -07:00
Patrick Walton
08c840205e librustc: Lint the old drop destructor notation off 2013-03-11 09:36:00 -07:00
Patrick Walton
1fcb0443cf doc: Remove documentation on newtype enums. 2013-03-11 09:35:59 -07:00
Patrick Walton
d7e74b5e91 librustc: Convert all uses of assert over to fail_unless! 2013-03-07 22:37:57 -08:00
Niko Matsakis
3168fe06ff Add manual &self/ and &static/ and /&self declarations that
are currently inferred.  New rules are coming that will require
them to be explicit.  All add some explicit self declarations.
2013-03-06 15:12:57 -05:00
Patrick Walton
30bb09c0e7 test: Remove fn@, fn~, and fn& from the test suite. rs=defun 2013-03-02 18:47:47 -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
bors
5aca7d6aef auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakis
The fix is straight-forward, but there are several changes
while fixing the issue.

1) disallow `mut` keyword when making a new struct

In code base, there are following code,

```rust
struct Foo { mut a: int };
let a = Foo { mut a: 1 };
```

This is because of structural record, which is
deprecated corrently (see issue #3089) In structural
record, `mut` keyword should be allowd to control
mutability. But without structural record, we don't
need to allow `mut` keyword while constructing struct.

2) disallow structural records in parser level
This is related to 1). With structural records, there
is an ambiguity between empty block and empty struct
To solve the problem, I change parser to stop parsing
structural records. I think this is not a problem,
because structural records are not compiled already.

Misc. issues

There is an ambiguity between empty struct vs. empty match stmt.
with following code,

```rust
match x{} {}
```

Two interpretation is possible, which is listed blow

```rust
match (x{}) {} //  matching with newly-constructed empty struct
(match x{}) {}  //  matching with empty enum(or struct) x
                //  and then empty block
```

It seems that there is no such code in rust code base, but
there is one test which uses empty match statement:
https://github.com/mozilla/rust/blob/incoming/src/test/run-pass/issue-3037.rs

All other cases could be distinguished with look-ahead,
but this can't be. One possible solution is wrapping with
parentheses when matching with an uninhabited type.

```rust
enum what { }
fn match_with_empty(x: what) -> ~str {
    match (x) { //use parentheses to remove the ambiguity
    }
}
```
2013-03-02 04:21:38 -08:00
bors
10faa521ae auto merge of #5188 : ben0x539/rust/doc-call-generic-fn, r=catamorphism
I have seen a few people confused on how to explicitly instantiate generic functions, since the syntax differs from C++'s and C#'s, which is probably where most people asking questions about generic functions are coming from. The only use of the `::<T>` syntax in the reference right now is in the section on paths, which is possibly not where someone trying to find out about generic functions is going to start looking. The tutorial doesn't mention it at all, but I think it's all right to make the reference a tiny bit more redundant and avoid stuffing the tutorial with syntax details.

----

The "Generic functions" subsection mentions that generic functions are instantiated based on context, so let's also mention right away (with a link to the #paths section) that an explicit form is available.

This also adds an example that explicitly instantiates a generic function to the function call expression section.
2013-03-02 01:00:41 -08:00
Jihyun Yu
95bc9ea26d Remove REC, change related tests/docs 2013-03-02 12:57:05 +09:00
Benjamin Herr
382143abd8 doc/rust.md: Demonstrate the f::<T>() syntax more often
The "Generic functions" subsection mentions that generic functions are
instantiated based on context, so let's also mention right away (with a
link to the #paths section) that an explicit form is available.

This also adds an example to the function call expression section that
explicitly instantiates a generic function.
2013-03-02 01:07:01 +01:00
Benjamin Herr
332c046029 docs/rust.md: Mention unit-like structs along with other struct types 2013-03-02 00:25:44 +01:00
Patrick Walton
2859c1ac6d librustc: Enforce cross-crate method privacy 2013-02-28 11:32:26 -08:00
bors
292e946163 auto merge of #5106 : pnkfelix/rust/fix-docs, r=graydon
...s.  I freely admit I have not run a "make check" on this (trivial) change.
2013-02-27 19:03:41 -08:00
Patrick Walton
8d7e6ef772 libsyntax: Forbid ~mut and ~const. rs=demuting 2013-02-27 09:40:15 -08:00
Alex Crichton
df481473da Fix unused imports in the tutorials 2013-02-26 17:52:16 -05:00
bors
0e6d895ed8 auto merge of #5119 : Kimundi/rust/incoming, r=catamorphism
Removed deprecated `str()` functions in int-template.rs and uint-template.rs
2013-02-26 10:54:39 -08:00
Patrick Walton
c9dd917fad doc: Remove references to mut fields. rs=demuting 2013-02-26 10:02:36 -08:00
Marvin Löbel
42b0bacd76 Removed deprecated str() functions in int-template.rs and uint-template.rs 2013-02-26 16:38:30 +01:00
Felix S. Klock II
b8dd2d8c67 Fix typo in grammar: underscore, not minus, can appear amongst hex digits. 2013-02-25 17:30:02 +01:00
Brian Anderson
dab6a85230 core: Extract comm from pipes. #4742 2013-02-21 17:36:54 -08:00
Patrick Walton
c0defda499 librustc: Separate the rest of the trait bounds with + and stop parsing space-separated ones. rs=plussing 2013-02-21 08:29:48 -08:00
Marvin Löbel
34c39bb1c4 Rewrited section about rust tool 2013-02-19 22:19:19 +01:00
Marvin Löbel
8ee2d58683 Give the rust tool an own section in the tutorial. 2013-02-19 20:57:23 +01:00
Marvin Löbel
f684a8a56b Mention rust tool in the tutorial 2013-02-19 18:10:31 +01:00
bors
67ee95e943 auto merge of #5029 : mcpherrinm/rust/master, r=catamorphism
Added a newline to make header be a header.

(re-did pull request because I screwed up the last one)
2013-02-19 00:08:31 -08:00
Matthew McPherrin
b29476374b Missing newline causing title to not be a title 2013-02-18 23:22:36 -05:00
Armin Ronacher
99c4de7300 Fixed a typo in the documentation that points to the wrong macro (ident_to_str -> stringify) 2013-02-18 22:40:01 +00:00
Luqman Aden
178882c98f tests/tutorials: Get rid of move. 2013-02-15 02:49:55 -08:00
Nick Desaulniers
13fe167dbb remove die definition and use in doc tests 2013-02-14 17:33:16 -08:00
Chris Peterson
5a4695d407 update tutorial and manual to use new impl Trait for Type syntax 2013-02-13 23:19:27 -08:00
John Clements
6d09fc2cd8 removed reference to crate file keywords 2013-02-13 15:08:26 -08:00
Olivier Saut
4dec0d5192 Typo s/recusive/recursive/ 2013-02-08 11:45:47 +01:00
Brian Anderson
e08a805b30 Merge remote-tracking branch 'bstrie/rimov' into incoming
Conflicts:
	src/libsyntax/parse/parser.rs
	src/test/bench/graph500-bfs.rs
	src/test/bench/sudoku.rs
	src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs
	src/test/run-pass/empty-mutable-vec.rs
	src/test/run-pass/foreach-nested.rs
	src/test/run-pass/swap-2.rs
2013-02-04 11:58:30 -08:00
Brian Anderson
3b396d17d6 Merge remote-tracking branch 'thestinger/old_map' into incoming
Conflicts:
	src/test/bench/core-map.rs
2013-02-03 17:56:49 -08:00
Marvin Löbel
af4972f3ce Fixed fmt!, tests, doc-tests. 2013-02-03 15:37:25 -08:00
Daniel Micay
319eeb1c79 rename map -> oldmap and mark it as deprecated
LinearMap is quite a bit faster, and is fully owned/sendable without
requiring copies. The older std::map also doesn't use explicit self and
relies on mutable fields.
2013-02-03 15:55:10 -05:00
Brian Anderson
9dc6938292 Merge remote-tracking branch 'nickdesaulniers/issue4524' into nocomm1 2013-02-01 11:18:58 -08:00
Nick Desaulniers
7868b6bf55 Remove fail keyword from lexer & parser and clean up remaining calls to
fail

Fix merge conflicts - Issue 4524
2013-02-01 00:15:42 -08:00
John Clements
53688addaa test cases, cleanup 2013-01-31 23:05:12 -08:00
Brian Anderson
f0c9927c26 Merge pull request #4708 from dforsyth/add_if
add if to borrowed ptr tutorial
2013-01-31 17:01:32 -08:00
Niko Matsakis
0682ad0eb9 Finalize moves-based-on-type implementation.
Changes:

- Refactor move mode computation
- Removes move mode arguments, unary move, capture clauses
  (though they still parse for backwards compatibility)
- Simplify how moves are handled in trans
- Fix a number of illegal copies that cropped up
- Workaround for bug involving def-ids in params
  (see details below)

Future work (I'll open bugs for these...):

- Improve error messages for moves that are due
  to bindings
- Add support for moving owned content like a.b.c
  to borrow check, test in trans (but I think it'll
  "just work")
- Proper fix for def-ids in params

Def ids in params:

Move captures into a map instead of recomputing.

This is a workaround for a larger bug having to do with the def-ids associated
with ty_params, which are not always properly preserved when inlining.  I am
not sure of my preferred fix for the larger bug yet.  This current fix removes
the only code in trans that I know of which relies on ty_param def-ids, but
feels fragile.
2013-01-31 12:09:00 -08:00
David Forsythe
72454f401e add if to borrowed ptr tutorial 2013-01-31 09:10:15 -08:00
Ben Striegel
aa9c28ef47 Repair RIMOV damage to doc tests 2013-01-31 00:21:36 -05:00
Ben Striegel
743c1c37e8 RIMOV, round 11
Last bit of mut removal, manually cleaning up outliers
2013-01-30 23:19:40 -05:00
Patrick Walton
366812a5c3 librustc: Change self as a type to Self everywhere. r=brson 2013-01-30 19:52:45 -08:00
Felix S. Klock II
20af4d7361 Add expected failure annotation on "fixed" example to placate 'make check'. 2013-01-29 13:18:40 +01:00
Felix S. Klock II
2dda6d6f5d Formatting cleanup.
I had put a line break in to try to stress the binding of mycircle,
but generated document looks cleaner without newline.
2013-01-29 11:28:52 +01:00
Felix S. Klock II
6cabe2b902 Fixed two examples of erroneous code so their errors match expectation.
1. In the first case, the previous code was failing during type inference
   due to mismatched structure.  Fix is to use the X structure at both
   points in the code.

2. In the second case, a naive transcription that subsitutes *nothing*
   in for the omitted statements signified by "..." will actually
   compile without an error.  Furthermore, any pure code could also be
   substituted for the ellipsis and the code would compile (as the
   text already states).  So to make the example more illustrative, it
   would be better to include an impure callback, which makes the
   potential for aliasing immediately obvious to the reader.
2013-01-29 11:28:52 +01:00
Felix S. Klock II
88bec09e63 Fix two code examples in main rust tutorial.
1. The section on trait definitions of static methods should include
   a trait with a static method in the generated document.

2. The section on trait inheritance had a expression that appears
   nonsensical ("let mycircle = @mycircle") in the generated document.
   The text would be clearer (IMO) if we continued with the running
   example of CircleStruct.
2013-01-29 11:28:52 +01:00
John Clements
18f1dba510 doc typo 2013-01-25 11:58:33 -08:00
Tim Chevalier
f3ec278e46 Merge pull request #4609 from sonwow/keyword-super
Make `super` a keyword
2013-01-24 11:17:52 -08:00
Graydon Hoare
e8f4da78e7 doc: fix tutorial unsafe blocks, r=burningtree. 2013-01-23 23:21:47 -08:00
Youngsoo Son
4b2aa286d8 Make super a keyword 2013-01-24 16:07:04 +09:00
Tim Chevalier
1d1b81143b Merge pull request #4589 from sanxiyn/doc-vec-match
doc: Document pattern matching on vectors
2013-01-23 14:38:34 -08:00
Seo Sanghyeon
92e52bc95e doc: Document pattern matching on vectors 2013-01-23 22:26:47 +09:00