Commit Graph

1331 Commits

Author SHA1 Message Date
bors
14c24accbc auto merge of #11271 : adridu59/rust/patch-io, r=huonw 2014-01-04 06:26:52 -08:00
Adrien Tétar
ba801577b9 doc: un-xfail conditions tutorial 2014-01-04 13:06:54 +01:00
bors
239fb1f6ee auto merge of #11283 : brson/rust/doublefailure, r=alexcrichton
Previously this was an `rtabort!`, indicating a runtime bug. Promote
this to a more intentional abort and print a (slightly) more
informative error message.

Can't test this sense our test suite can't handle an abort exit.

I consider this to close #910, and that we should open another issue about implementing less conservative semantics here.
2014-01-04 00:32:09 -08:00
bors
3dd7c49faf auto merge of #11251 : pcwalton/rust/remove-at-mut, r=pcwalton
r? @nikomatsakis 

for the borrow checker changes. Write guards are now eliminated.
2014-01-03 22:36:53 -08:00
Patrick Walton
8092153634 libsyntax: Fix tests. 2014-01-03 22:22:40 -08:00
bors
8bfd2a84cf auto merge of #11277 : brson/rust/more0.9, r=alexcrichton 2014-01-03 17:16:50 -08:00
Patrick Walton
9b35ae75d2 doc: Remove all mentions of @mut from the documentation. 2014-01-03 14:02:01 -08:00
bors
bb9c5c48ef auto merge of #11052 : jvns/rust/testing-tutorial, r=brson
There's no explanation anywhere right now of how to do testing with Rust, so here's a basic explanation of how to write and run a test.
2014-01-02 23:56:53 -08:00
Brian Anderson
649c648d6f Abort on double-failure. #910
Previously this was an rtabort!, indicating a runtime bug. Promote
this to a more intentional abort and print a (slightly) more
informative error message.

Can't test this sense our test suite can't handle an abort exit.
2014-01-02 18:46:29 -08:00
Brian Anderson
1155ee9ee9 Bump more version numbers to 0.9 2014-01-02 10:55:28 -08:00
Julia Evans
f0322371dd Add testing tutorial to docs 2013-12-31 10:34:55 -05:00
a_m0d
7a8ca91e1d Update documentation to remove reference to ::rt logging 2013-12-31 07:25:53 -05:00
bors
6db7e35c59 auto merge of #11190 : eliovir/rust/patch-3, r=alexcrichton
#[ author = "Jane Doe" ]; raises "warning: unknown crate attribute"
replace `pkgid` by `crate_id`
add `comment`
2013-12-30 07:16:48 -08:00
bors
a4f30bf0c0 auto merge of #11185 : huonw/rust/doc-ignore, r=cmr
Currently any line starting with `#` is filtered from the output,
including line like `#[deriving]`; this patch makes it so lines are only
filtered when followed by a space similar to the current behaviour of
the tutorial/manual tester.
2013-12-30 05:51:51 -08:00
Huon Wilson
582ad8ffc2 rustdoc: only filter lines starting with '# ' from the shown code.
Currently any line starting with `#` is filtered from the output,
including line like `#[deriving]`; this patch makes it so lines are only
filtered when followed by a space similar to the current behaviour of
the tutorial/manual tester.
2013-12-30 16:55:49 +11:00
Luis de Bethencourt
51b5f32d33 Update Docs to use crateid 2013-12-29 15:25:43 -05:00
eliovir
466065946f rust.md : update crate attributes.
#[ author = "Jane Doe" ]; raises "warning: unknown crate attribute"
2013-12-29 12:37:51 +01:00
eliovir
743d39293f Update tutorial.md : rename pkgid to crate_id 2013-12-28 10:32:03 +01:00
Alex Crichton
f9b231cd08 Fixing more doc tests 2013-12-23 09:10:37 -08:00
Alex Crichton
316345610a doc: Expand rustdoc's documentation for testing 2013-12-23 09:10:37 -08:00
bors
d5d5c5064b auto merge of #10986 : adridu59/rust/patch-new, r=alexcrichton
Thanks to @huonw for some mentoring. 🍰
2013-12-20 12:41:33 -08:00
Adrien Tétar
bf5f2f2631 doc: forward-port the conditions tutorial + fixup libstd example 2013-12-20 18:40:26 +01:00
bors
d5798b3902 auto merge of #10972 : metajack/rust/pkgid-with-name, r=alexcrichton
This change extends the pkgid attribute to allow of explicit crate names, instead of always inferring them based on the path. This means that if your GitHub repo is called `rust-foo`, you can have your pkgid set your library name to `foo`. You'd do this with a pkgid attribute like `github.com/somewhere/rust-foo#foo:1.0`.

This is half of the fix for #10922.
2013-12-17 07:41:40 -08:00
Jack Moffitt
262cc4a2bc Update docs to new syntax. 2013-12-17 07:41:39 -07:00
bors
47c9a35747 auto merge of #10830 : alexcrichton/rust/spsc-queue, r=brson
This pull request completely rewrites std::comm and all associated users. Some major bullet points

* Everything now works natively
* oneshots have been removed
* shared ports have been removed
* try_recv no longer blocks (recv_opt blocks)
* constructors are now Chan::new and SharedChan::new
* failure is propagated on send
* stream channels are 3x faster

I have acquired the following measurements on this patch. I compared against Go, but remember that Go's channels are fundamentally different than ours in that sends are by-default blocking. This means that it's not really a totally fair comparison, but it's good to see ballpark numbers for anyway

```
          oneshot         stream          shared1
std         2.111           3.073          1.730 
my          6.639           1.037          1.238 
native      5.748           1.017          1.250 
go8         1.774           3.575          2.948 
go8-inf     slow            0.837          1.376 
go8-128     4.832           1.430          1.504 
go1         1.528           1.439          1.251 
go2         1.753           3.845          3.166 
```

I had three benchmarks:

* oneshot - N times, create a "oneshot channel", send on it, then receive on it (no task spawning)
* stream - N times, send from one task to another task, wait for both to complete
* shared1 - create N threads, each of which sends M times, and a port receives N*M times.

The rows are as follows:

* `std` - the current libstd implementation (before this pull request)
* `my` - this pull request's implementation (in M:N mode)
* `native` - this pull request's implementation (in 1:1 mode)
* `goN` - go's implementation with GOMAXPROCS=N. The only relevant value is 8 (I had 8 cores on this machine)
* `goN-X` - go's implementation where the channels in question were created with buffers of size `X` to behave more similarly to rust's channels.
2013-12-17 01:16:43 -08:00
Alex Crichton
39a6c9d637 Test fallout from std::comm rewrite 2013-12-16 22:55:49 -08:00
Patrick Walton
865701787c doc: Update the documentation to describe the Pod trait. 2013-12-16 22:38:02 -08:00
bors
9eb89a6c6e auto merge of #10982 : ezyang/rust/lvalue-def, r=pcwalton
Based off of Niko's proposed definition of lvalues.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-15 15:16:28 -08:00
Huon Wilson
164f7a290e std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut []. 2013-12-15 23:37:41 +11:00
Edward Z. Yang
b1b905f30b Correct definition of lvalues, fixes #10890
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-15 20:31:05 +08:00
Huon Wilson
f53292f7ee Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}. 2013-12-15 23:05:30 +11:00
bors
53d1a67bbd auto merge of #10944 : metajack/rust/pkgid-docs, r=cmr 2013-12-14 08:11:29 -08:00
bors
fbbadae80f auto merge of #10849 : adridu59/rust/patch-css, r=alexcrichton
rustdoc:
- fix search-bar layout

doc: CSS:
- switch to native pandoc toc depth
- rm some dead code
- clamp width to be readable (we're not Wikipedia!)
- don't background-color titles, it's bloating
- make syntax-highlighting colors inline with rust-lang.org
- space indents

@alexcrichton
2013-12-13 14:21:35 -08:00
Adrien Tétar
1999b25310 doc: CSS changes + commit improved favicon 2013-12-13 21:50:26 +01:00
bors
ae3078ca25 auto merge of #10913 : cmr/rust/rustdoc_man, r=huonw
Clarify that it's sundown, and that we don't support magic
2013-12-13 11:31:57 -08:00
Jack Moffitt
da9a02a189 Update documentation for new pkgid attribute. 2013-12-12 15:22:23 -07:00
Erik Price
5731ca3078 Make 'self lifetime illegal.
Also remove all instances of 'self within the codebase.

This fixes #10889.
2013-12-11 10:54:06 -08:00
Corey Richardson
f0867e0ba2 Some rustdoc manual fixes
Clarify that it's sundown, and that we don't support magic
2013-12-11 06:47:05 -05:00
kud1ing
e08c936120 proto is gone
The following files need to be adjusted, too (i can't do it now):
- doc/po/ja/rust.md.po
- doc/po/rust.md.pot
2013-12-11 06:47:05 -05:00
bors
5aad292fb9 auto merge of #10880 : cmr/rust/tut++, r=pnkfelix
Many of them are small. Will squash on request, but I feel like it's easier
for everyone (easier to see and back out individual changes) this way.
2013-12-10 12:51:22 -08:00
Corey Richardson
c935a88a97 Remove duplication of libstd docs.
This is literally a copy-paste, there's no need to have this duplication.
2013-12-10 09:46:40 -05:00
Corey Richardson
c8f47db8f5 Update Freeze information 2013-12-10 09:43:36 -05:00
Corey Richardson
fab5624eb6 Tiny fixes to linked list section. 2013-12-10 09:43:36 -05:00
Corey Richardson
a44852a2d5 Update Owned to Send, show some types which aren't 2013-12-10 09:43:36 -05:00
Corey Richardson
888144c98d Function declaration takes pats, not exprs. 2013-12-10 09:43:36 -05:00
Corey Richardson
b5122c52ae Clarify newtype 2013-12-10 09:43:36 -05:00
Corey Richardson
d9eff8de8a Clarify arity 2013-12-10 09:43:36 -05:00
Corey Richardson
2750adb5d8 Inherited mutabilty clarification
Also no longer reference mutable fields
2013-12-10 09:43:36 -05:00
Corey Richardson
381c08bf69 loop -> continue 2013-12-10 09:43:36 -05:00
Corey Richardson
f006a10b1e Wildcard changes. 2013-12-10 09:43:35 -05:00
Corey Richardson
079ea00d23 Macro definition is feature gated. 2013-12-10 09:43:35 -05:00
Corey Richardson
eb8739f4f8 Fix tiny formatting error. 2013-12-10 09:43:35 -05:00
Corey Richardson
0f82cbd19a Clarify as, mention transmute. 2013-12-10 09:43:35 -05:00
Corey Richardson
d00a407e00 Clarify that strings aren't magical. 2013-12-10 09:43:35 -05:00
Corey Richardson
b6cf5f5af1 Fix tiny formatting error. 2013-12-10 09:43:35 -05:00
Corey Richardson
94e0a03f5d Add rustdoc documentation. 2013-12-10 09:43:33 -05:00
bors
487e58cca2 auto merge of #10882 : jhasse/rust/patch-1, r=metajack
typo
2013-12-10 05:26:35 -08:00
Corey Richardson
039a5933fb Fix grammar error. 2013-12-10 07:28:24 -05:00
Corey Richardson
d86f8b2fca Add a link to the wiki's package list and refer to git 2013-12-10 07:28:24 -05:00
Corey Richardson
8ae340a026 Note that Rust can be embedded. 2013-12-10 07:28:24 -05:00
Corey Richardson
61e8268645 Fix span. 2013-12-10 07:28:24 -05:00
Corey Richardson
8a8cccd4b6 Explain potentially confusing string example.
Reported be @ElBaha
2013-12-10 07:28:24 -05:00
Edward Z. Yang
b3e54d5991 Add some more commentary to FFI tutorial.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-09 21:24:47 -08:00
Jan Niklas Hasse
6de5b7ab1e Add missing .com 2013-12-09 17:40:10 +01:00
Daniel Micay
c1eb20b5f8 rewrite part of the tutorial
This begins a rewrite of some sections the tutorial as an introduction
to concepts through the implementation of a simple data structure. I
think this would be a good way to introduce references, traits and many
other concepts too. For example, the section introducing alternatives to
ownership can demonstrate a persistent list.
2013-12-04 16:55:03 -05:00
bors
f1ef36ea2f auto merge of #10773 : jvns/rust/patch-1, r=cmr
The section on closure types was missing, so I added one. I'm new to Rust, so there are probably important things to say about closure types that I'm missing here.

I tested the example with the latest Rust nightly.
2013-12-02 23:32:33 -08:00
Julia Evans
94c02af873 Add section on closure types to manual 2013-12-02 14:39:11 -05:00
Alex Crichton
d4c40b519b Bring the linkage documentation up-to-date
This includes documentation for all the previous changes done to linking
in #10582. Additionally, this brings the list of feature-gates up-to-date with
the currently recognized list of features.
2013-12-02 11:10:40 -08:00
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