Commit Graph

31413 Commits

Author SHA1 Message Date
bors
4d4eb10230 auto merge of #16186 : steveklabnik/rust/guide_cargo_new, r=alexcrichton
Two commits here: one to add `cargo new` to the guide, and a second to mention the lockfile that Cargo now generates.
2014-08-02 23:36:09 +00:00
bors
756b7b23c4 auto merge of #16180 : jbcrail/rust/fix-comments, r=steveklabnik 2014-08-02 21:51:10 +00:00
bors
147d117cff auto merge of #16169 : Gankro/rust/simple-docs, r=cmr
<strike>Adds a simple/detailed toggle to api doc pages.
Detailed mode is the current behaviour, simple mode hides all doccomment details leaving only signatures for quick browsing.
</strike>
Adds [expand all] and [collapse all] "links" to all api doc pages. All doccomments are collapsed, leaving only signatures for quick browsing.

In addition, clicking on a <strike>function name</strike> function's [toggle details] link now toggles the visibility of the associated doccomment.

--------

# [Live Build Here](http://cg.scs.carleton.ca/~abeinges/doc/std/vec/struct.Vec.html)

This is something that's been bothering me, and I've seen some people mention in IRC before. The docs are *great* if you want a full in-depth look at an API, but *awful* if you want to scan them. This provides the ability to toggle complexity freely. Interacts perfectly well with noscript, since the static page is effectively unchanged. Collapsing is just hiding divs with css.

I'm not much of a designer, so design input welcome on the actual UX for toggling.

The actual javascript is *a bit* brittle to layout changes, but it always will be without adding lots of extra junk to the actual markup, which didn't seem worth it.
2014-08-02 20:06:11 +00:00
Alexis Beingessner
d9b2e6b74f fix underflow in vec swap_remove
fixes #16200
2014-08-02 14:50:29 -04:00
Alex Crichton
2677e5f4a0 native: Fix utime() for windows
Apparently the units are in milliseconds, not in seconds!
2014-08-02 10:52:49 -07:00
Daniel Brooks
cbf407c8d0 time::Tm should impl Eq in addition to PartialEq 2014-08-02 10:25:32 -07:00
bors
432042ac14 auto merge of #16183 : brson/rust/doctitles, r=alexcrichton 2014-08-02 17:21:09 +00:00
OGINO Masanori
821262f30e Use globs to ignore target directories.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-08-03 02:14:37 +09:00
OGINO Masanori
5ebda6d39d Sort .gitignore.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-08-03 02:14:37 +09:00
Alexis Beingessner
88fe6dfa31 Add hide/show detail toggles to rustdoc
All doccomments are now collapsable via a nearby [-] button
Adds [collapse all] and [expand all] buttons to the top of all api pages
Tweaks some layout to accomadate this
2014-08-02 13:12:12 -04:00
bors
032d5c1dcd auto merge of #16181 : brson/rust/colon, r=kballard 2014-08-02 15:36:09 +00:00
Daniel Hofstetter
867d8e6356 Remove unused tuple struct 2014-08-02 17:28:42 +02:00
bors
87bc22f587 auto merge of #16177 : nham/rust/collections_15294_eq_ord, r=alexcrichton
This implements:

 - Eq and Ord for DList, RingBuf, TreeMap and TreeSet
 - FromIterator and Extendable for BitvSet

cc #15294
2014-08-02 13:51:09 +00:00
bors
5bad333fec auto merge of #16175 : EduardoBautista/rust/fix-guessing-game-appearing-early, r=steveklabnik
Solves: https://github.com/rust-lang/rust/issues/16162
2014-08-02 12:06:09 +00:00
bors
1b44c5b0eb auto merge of #16165 : tinaun/rust/newcss, r=alexcrichton
remove unneeded `pre.rust a' selector

move transform into `.test-arrow`

fixes #16138
2014-08-02 10:21:11 +00:00
bors
020b91b436 auto merge of #16164 : anguslees/rust/rfc3999, r=alexcrichton
Fixes #16158
2014-08-02 08:36:09 +00:00
bors
5793b4211c auto merge of #16163 : anguslees/rust/strptime-str, r=alexcrichton
Also modernise a few constructs in match_strs().
2014-08-02 06:51:12 +00:00
Palmer Cox
fd69365ead Rewrite read_u32v_be() and write_u32_be() to make sure that all memory access is properly aligned 2014-08-02 01:21:02 -04:00
bors
71a42807ad auto merge of #16160 : EduardoBautista/rust/use-bang-at-end-of-hello-world, r=alexcrichton
Further into the guide "Hello, world!" is used instead of "Hello, world".
2014-08-02 05:06:11 +00:00
Steve Klabnik
cf279105d5 Fix manual regarding attribute placement.
Fixes #15494.
2014-08-01 23:12:14 -04:00
nham
7e5440ea9d Add a split_at method to slice::ImmutableVector
This method is similar to the mut_split_at method of slice::MutableVector.
2014-08-01 23:05:16 -04:00
Steve Klabnik
2b9c5d2f74 Add note about Cargo.lock 2014-08-01 22:58:16 -04:00
Steve Klabnik
1a80dcbd56 Use cargo new.
Now that this feature exists, we should use it.

Fixes #16078
2014-08-01 22:58:01 -04:00
bors
06727d4720 auto merge of #16128 : steveklabnik/rust/speed_faq, r=brson
Fixes #11174.

I'm open to revising this text, but I figured it gets across the basics.
2014-08-02 02:16:02 +00:00
Simon Persson
6aca20564f Fix alignment tests for ARM on Linux. #14848 2014-08-02 01:38:06 +00:00
Brian Anderson
fe13a9fb59 doc: Make sure all doc titles say 'Rust'. #12466 2014-08-01 17:32:24 -07:00
bors
d7cfc34a22 auto merge of #16119 : steveklabnik/rust/guide_pointers, r=brson
This is the next section of the guide, and it's on pointers. It's not done yet, as I need to write the section on ownership and borrowing, but I figured I'd share the rest now, to get feedback on the rest of it while I take some time to get that right.
2014-08-02 00:31:03 +00:00
Brian Anderson
0ea44fd0aa mk: Add missing colon 2014-08-01 16:48:41 -07:00
Joseph Crail
ad06dfe496 Fix misspelled comments. 2014-08-01 19:42:52 -04:00
bors
292caefb26 auto merge of #15995 : Ryman/rust/sync_spsc_peek, r=alexcrichton
The current spsc implementation doesn't enforce single-producer
single-consumer usage and also allows unsafe memory use through
peek & pop.

For safer usage, `new` now returns a pair of owned objects which
only allow consumer or producer behaviors through an `Arc`.
Through restricting the mutability of the receiver to `mut` the
peek and pop behavior becomes safe again, with the compiler
complaining about usage which could lead to problems.

To fix code broken from this, update:
Queue::new(x) -> unsafe { Queue::unchecked_new(x) }

[breaking-change]

For an example of broken behavior, check the added test which uses the unchecked constructor.
2014-08-01 22:05:58 +00:00
nham
a0438143de collections: Implement FromIterator/Extendable for BitvSet 2014-08-01 16:51:49 -04:00
nham
3737c537c3 collections: Implement Ord for DList, RingBuf, TreeMap, TreeSet 2014-08-01 16:51:26 -04:00
bors
55b24051be auto merge of #15992 : steveklabnik/rust/guide_testing, r=brson
The start of a testing guide. This PR relies on the crates and modules one because I shuffled some stuff around, so sorry about that.

I got stuck with how to import this name with cargo. @wycats and @alexcrichton , any ideas?
2014-08-01 20:21:01 +00:00
nham
25acfde398 collections: Implement Eq for DList, RingBuf, TreeMap, TreeSet 2014-08-01 16:05:03 -04:00
Eduardo Bautista
69267b1e1d Move caret under the 'x' variabe 2014-08-01 14:34:18 -05:00
Eduardo Bautista
ea92a5e90a Use hello_world instead of the guessing_game 2014-08-01 14:30:52 -05:00
Kevin Butler
7b817b6ab9 libsync: Add safer abstraction for SPSC queue.
The current spsc implementation doesn't enforce single-producer
single-consumer usage and also allows unsafe memory use through
peek & pop.

For safer usage, `spsc_queue::queue` now returns a pair of owned objects which
only allow consumer or producer behaviours through an `Arc`.
Through restricting the mutability of the receiver to `mut` the
peek and pop behaviour becomes safe again, with the compiler
complaining about usage which could lead to problems.

To fix code broken from this, update:
Queue::new(x) -> unsafe { Queue::new(x) }

[breaking-change]
2014-08-01 20:09:03 +01:00
bors
6136381ed8 auto merge of #16102 : zwarich/rust/borrowck-unboxed, r=pcwalton
This removes the ability of the borrow checker to determine that repeated dereferences of a Box<T> refer to the same memory object.
2014-08-01 18:36:01 +00:00
bors
f2fa55903e auto merge of #16053 : pcwalton/rust/at-pattern-bindings, r=pnkfelix
This is an alternative to upgrading the way rvalues are handled in the
borrow check. Making rvalues handled more like lvalues in the borrow
check caused numerous problems related to double mutable borrows and
rvalue scopes. Rather than come up with more borrow check rules to try
to solve these problems, I decided to just forbid pattern bindings after
`@`. This affected fewer than 10 lines of code in the compiler and
libraries.

This breaks code like:

    match x {
        y @ z => { ... }
    }

    match a {
        b @ Some(c) => { ... }
    }

Change this code to use nested `match` or `let` expressions. For
example:

    match x {
        y => {
            let z = y;
            ...
        }
    }

    match a {
        Some(c) => {
            let b = Some(c);
            ...
        }
    }

Closes #14587.

[breaking-change]

May need discussion at the meeting, but r? @nikomatsakis anyway
2014-08-01 16:01:04 +00:00
Patrick Walton
5b85c8cbe7 librustc: Forbid pattern bindings after @s, for memory safety.
This is an alternative to upgrading the way rvalues are handled in the
borrow check. Making rvalues handled more like lvalues in the borrow
check caused numerous problems related to double mutable borrows and
rvalue scopes. Rather than come up with more borrow check rules to try
to solve these problems, I decided to just forbid pattern bindings after
`@`. This affected fewer than 10 lines of code in the compiler and
libraries.

This breaks code like:

    match x {
        y @ z => { ... }
    }

    match a {
        b @ Some(c) => { ... }
    }

Change this code to use nested `match` or `let` expressions. For
example:

    match x {
        y => {
            let z = y;
            ...
        }
    }

    match a {
        Some(c) => {
            let b = Some(c);
            ...
        }
    }

Closes #14587.

[breaking-change]
2014-08-01 08:45:22 -07:00
bors
6248858103 auto merge of #16157 : alexcrichton/rust/rustdoc-tests, r=huonw
This ensures that the name of the crate is set from the command line for tests
so the auto-injection of `extern crate <name>` in doc tests works correctly.
2014-08-01 14:16:05 +00:00
bors
51ff6c075a auto merge of #16153 : kballard/rust/fix_gensym_symbols, r=luqmana
When generating a unique symbol for things like closures or glue_drop,
we call token::gensym() to create a crate-unique Name. Recently, Name
changed its Show impl so it no longer prints as a number. This caused
symbols like glue_drop:1542 to become glue_drop:"glue_drop"(1542), or in
mangled form, glue_drop.$x22glue_drop$x22$LP$1542$RP$.
2014-08-01 11:31:05 +00:00
bors
f2153465e4 auto merge of #16101 : kballard/rust/rc_unique_ownership, r=aturon
Add a few new free functions to alloc::rc for manipulating
uniquely-owned Rc values. is_unique() can be used to test if the Rc is
uniquely-owned, try_unwrap() can remove the value from a uniquely-owned
Rc, and get_mut() can return a &mut for a uniquely-owned Rc.

These are all free functions, because smart pointers should avoid having
methods when possible. They can't be static methods because UFCS will
remove that distinction. I think we should probably change downgrade()
and make_unique() into free functions as well, but that's out of scope.
2014-08-01 09:46:06 +00:00
Kevin Ballard
192a8a5db7 Add is_unique(), try_unwrap(), get_mut() to alloc::rc
Add a few new free functions to alloc::rc for manipulating
uniquely-owned Rc values. is_unique() can be used to test if the Rc is
uniquely-owned, try_unwrap() can remove the value from a uniquely-owned
Rc, and get_mut() can return a &mut for a uniquely-owned Rc.

These are all free functions, because smart pointers should avoid having
methods when possible. They can't be static methods because UFCS will
remove that distinction. I think we should probably change downgrade()
and make_unique() into free functions as well, but that's out of scope.
2014-08-01 01:20:20 -07:00
tinaun
42b2dc06b6 Fix API docs css reversing elements that it shouldn't
remove unneeded `pre.rust a' selector

move transform into `.test-arrow`

fixes #16138
2014-08-01 04:01:29 -04:00
bors
cd1216a054 auto merge of #16152 : tshepang/rust/patch-1, r=alexcrichton 2014-08-01 07:56:06 +00:00
Alex Crichton
4dbe3eb657 rustdoc: Use --crate-name with --test
This ensures that the name of the crate is set from the command line for tests
so the auto-injection of `extern crate <name>` in doc tests works correctly.
2014-07-31 23:01:24 -07:00
bors
9f0b91985f auto merge of #16130 : apoelstra/rust/decode-error, r=alexcrichton
A quick and dirty fix for #15036 until we get serious decoder reform.

Right now it is impossible for a `Decodable` to signal a decode error, for example if it has only finitely many allowed values, is a string which must be encoded a certain way, needs a valid checksum, etc. For example in the `libuuid` implementation of `Decodable` an `Option` is unwrapped, meaning that a decode of a malformed UUID will cause the task to fail.
2014-08-01 05:41:05 +00:00
Angus Lees
17d5c64941 Change strptime::match_strs to use borrowed rather than owned strings
Also modernise a few constructs in match_strs().
2014-08-01 15:39:00 +10:00
Andrew Poelstra
dac9a1c520 libuuid: use Decoder::error() rather than failing on bad decode 2014-07-31 21:41:19 -07:00