Commit Graph

31189 Commits

Author SHA1 Message Date
bors
8d2e7161ee auto merge of #16025 : cmr/rust/plugin-fields, r=alexcrichton
Some minor changes to the compiler to expose this information. Very
inconvenient since struct fields aren't an item.
2014-07-28 19:06:34 +00:00
nham
96cf01138b Fix some of the documentation std::io::fs. 2014-07-28 14:14:56 -04:00
joaoxsouls
ef96b54b87 Fix typo in getopts::getopts documentation, return Matches instead of Opt 2014-07-28 17:35:31 +01:00
Jonas Hietala
23b84e55e4 doc: use //! instead of /*! ... */ in std::rand 2014-07-28 17:52:48 +02:00
Jonas Hietala
42ca8a70d6 doc: More efficient Monty Hall simulation 2014-07-28 17:51:06 +02:00
Aaron Turon
f26011d5a0 rustdoc: improvements to stability dashboard
* Makes dashboard width dynamic.
* Colors unmarked items.
* Gives overall crate percentages.
2014-07-28 08:41:53 -07:00
Jonas Hietala
3f56846460 doc: Method examples for String
Reword comments on unsafe methods regarding UTF-8.
2014-07-28 17:03:12 +02:00
Björn Steinbrink
a1c95ecca1 Emit lifetime end markers for allocas for ignored return values 2014-07-28 16:39:53 +02:00
Björn Steinbrink
39135ecb18 Omit unnecessary stack slots for ignored return values
If we have an immediate return value that doesn't need to be dropped, we
don't have to create a stack slot for it.
2014-07-28 16:39:13 +02:00
Jonas Hietala
bf1ba83292 doc: Monty Hall simulation for std::rand
A larger example for std::rand
2014-07-28 13:57:30 +02:00
Corey Richardson
8876ce44c5 rustc: encode is_sugared_doc on ast::Attribute 2014-07-28 01:03:38 -07:00
Corey Richardson
fc08779185 rustdoc: remove extraneous .move_iter().collect()s
The impl of Clean for Vec obsoleted these long, long ago.
2014-07-28 01:03:38 -07:00
Corey Richardson
531a3c680d rustdoc: show struct field docs when inlined
Some minor changes to the compiler to expose this information. Very
inconvenient since struct fields aren't an item. Adds (yet another) table to
metadata.

Closes #15739
2014-07-28 01:03:38 -07:00
nham
8ebd58cedf Implement Ord for TrieMap/TrieSet/SmallIntMap/Bitv/BitvSet 2014-07-28 02:53:44 -04:00
nham
935c88ce1c Implement PartialOrd for Bitv and BitvSet 2014-07-28 00:28:49 -04:00
nham
220f8f6dcb Implement PartialOrd for SmallIntMap 2014-07-28 00:00:29 -04:00
nham
16acc10bf9 Implement PartialOrd for TrieMap and TrieSet 2014-07-27 23:51:28 -04:00
bors
f4ef36ee42 auto merge of #16031 : arielb1/rust/remove_unneeded_fixme, r=kballard
The issue was fixed a month ago - remove the workaround.
2014-07-27 22:41:15 +00:00
bors
79e9f14abf auto merge of #16026 : ruud-v-a/rust/patch-1, r=steveklabnik 2014-07-27 20:51:16 +00:00
bors
70972832b3 auto merge of #16020 : nham/rust/ringbuf_hash_ord, r=alexcrichton
cc #15294
2014-07-27 19:06:16 +00:00
Steven Fackler
97721fa719 Make test expansion induce less reachability
We previously reexported entire modules, which caused private things to
become reachable and trip the dead code and private items in public API
lints.

Closes #15912
2014-07-27 12:02:19 -07:00
nham
e7b41caba8 Implement Hash for tuples of up to arity 12. Also change the style to be consistent with core::tuple 2014-07-27 14:41:33 -04:00
Jonas Hietala
58d3f109f8 doc: Small rewording. 2014-07-27 20:02:06 +02:00
bors
769dae0a00 auto merge of #16030 : treeman/rust/doc-hashset-fix, r=sfackler
Not sure how this could slip by.
2014-07-27 17:06:17 +00:00
nham
9fa4424b71 Hash the length of the RingBuf before hashing elements 2014-07-27 12:37:32 -04:00
Jonas Hietala
53c639184c doc: Main example for TreeMap. 2014-07-27 18:19:04 +02:00
Jonas Hietala
8c34a97b37 doc: TreeMap methods with examples.
Small corrections for TreeSet examples.
2014-07-27 17:44:07 +02:00
Jonas Hietala
034ef079ef doc: TreeSet methods and main example. 2014-07-27 17:04:44 +02:00
Ariel Ben-Yehuda
c6b992a53f Remove an unneeded FIXME in coherence.rs
Also, let f; f = ...; is just wrong.
2014-07-27 18:01:19 +03:00
Jonas Hietala
28d543a40f doc: Correctly onclose code blocks in HashSet 2014-07-27 16:05:53 +02:00
bors
e0d10bb69a auto merge of #16016 : tomjakubowski/rust/rustdoc-fix-15490, r=alexcrichton
Previously, private and `#[doc(hidden)]` struct fields appeared in the
search index despite being hidden from the struct's documentation.

Fix #15490
2014-07-27 09:46:15 +00:00
Ruud van Asseldonk
d7993153a4 docs: Fix typo in container guide. 2014-07-27 10:14:44 +02:00
bors
ad4fa46f5b auto merge of #16001 : Gankro/rust/rawstrings-proof, r=pnkfelix
Stumbled across this and thought it would be cool to prove. I've never used Ogden's Lemma before, but I'm pretty sure I used it right. The pumping lemma definitely doesn't seem sufficient for the job. In particular, when using the pumping lemma, you can always just pump one of the quotes, and it's fine. Ogden's Lemma lets you effectively force the pumper to use certain characters in the string.

@cmr
2014-07-27 08:01:14 +00:00
bors
d114ddac03 auto merge of #15963 : nham/rust/moar_15294, r=alexcrichton
Implements PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and Clone/Show for TrieMap/TrieSet. cc #15294
2014-07-27 06:16:14 +00:00
Alexis Beingessner
6444b5e82b adding proof of context-sensitivy of raw string literals 2014-07-27 02:13:19 -04:00
bors
2de3fad72c auto merge of #16021 : brson/rust/mb, r=pcwalton
No longer does anything.
2014-07-27 04:21:14 +00:00
Brian Anderson
aa48654740 Remove managed_box gate from tests
No longer does anything.
2014-07-26 21:05:29 -07:00
nham
6361577808 Implement PartialOrd for RingBuf 2014-07-26 23:18:56 -04:00
nham
1cfa6569f9 Implement Hash for RingBuf 2014-07-26 22:33:47 -04:00
bors
3d7a7f645f auto merge of #16006 : TeXitoi/rust/relicense-shootout-k-nucleotide, r=brson
Everyone agreed except @thestinger. As @thestinger contribution on this file is trivial,
we can relicense it.

Related to #14248, close #15330

@brson OK?
2014-07-27 00:31:13 +00:00
Tom Jakubowski
c05cfab7f9 rustdoc: Keep hidden struct fields out of search
Previously, private and `#[doc(hidden)]` struct fields appeared in the
search index despite being hidden from the struct's documentation.

Fix #15490
2014-07-26 16:13:01 -07:00
nham
fadbc0b88b Manually implement Hash for SmallIntMap 2014-07-26 18:47:33 -04:00
bors
32e521ffab auto merge of #15941 : treeman/rust/doc-lru, r=alexcrichton 2014-07-26 22:46:13 +00:00
bors
e6e544f261 auto merge of #15936 : alexcrichton/rust/stability, r=brson
This commit applies stability attributes to the contents of these modules,
summarized here:

* The `unit` and `bool` modules have become #[unstable] as they are purely meant
  for documentation purposes and are candidates for removal.

* The `ty` module has been deprecated, and the inner `Unsafe` type has been
  renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
  has been removed as the compiler now always infers `UnsafeCell` to be
  invariant. The `new` method i stable, but the `value` field, `get` and
  `unwrap` methods are all unstable.

* The `tuple` module has its name as stable, the naming of the `TupleN` traits
  as stable while the methods are all #[unstable]. The other impls in the module
  have appropriate stability for the corresponding trait.

* The `arc` module has received the exact same treatment as the `rc` module
  previously did.

* The `any` module has its name as stable. The `Any` trait is also stable, with
  a new private supertrait which now contains the `get_type_id` method. This is
  to make the method a private implementation detail rather than a public-facing
  detail.

  The two extension traits in the module are marked #[unstable] as they will not
  be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
  have been renamed to downcast_{mut,ref} and are #[unstable].

  The extension trait `BoxAny` has been clarified as to why it is unstable as it
  will not be necessary with DST.

This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.

[breaking-change]
2014-07-26 21:01:15 +00:00
Alex Crichton
e5da6a71a6 std: Stabilize unit, bool, ty, tuple, arc, any
This commit applies stability attributes to the contents of these modules,
summarized here:

* The `unit` and `bool` modules have become #[unstable] as they are purely meant
  for documentation purposes and are candidates for removal.

* The `ty` module has been deprecated, and the inner `Unsafe` type has been
  renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
  has been removed as the compiler now always infers `UnsafeCell` to be
  invariant. The `new` method i stable, but the `value` field, `get` and
  `unwrap` methods are all unstable.

* The `tuple` module has its name as stable, the naming of the `TupleN` traits
  as stable while the methods are all #[unstable]. The other impls in the module
  have appropriate stability for the corresponding trait.

* The `arc` module has received the exact same treatment as the `rc` module
  previously did.

* The `any` module has its name as stable. The `Any` trait is also stable, with
  a new private supertrait which now contains the `get_type_id` method. This is
  to make the method a private implementation detail rather than a public-facing
  detail.

  The two extension traits in the module are marked #[unstable] as they will not
  be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
  have been renamed to downcast_{mut,ref} and are #[unstable].

  The extension trait `BoxAny` has been clarified as to why it is unstable as it
  will not be necessary with DST.

This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.

[breaking-change]
2014-07-26 13:12:20 -07:00
bors
ecce58c6fd auto merge of #15762 : nham/rust/ringbuf_docs, r=alexcrichton
This adds examples for get(), get_mut(), swap(), iter() and mut_iter()
2014-07-26 19:16:16 +00:00
nham
ebe8097128 Add examples for RingBuf methods get, get_mut, iter, mut_iter 2014-07-26 13:42:55 -04:00
bors
d4dfb7d84c auto merge of #16000 : emkay/rust/lifetimes-guide-typo, r=alexcrichton 2014-07-26 17:31:16 +00:00
nham
3f1c37e96d Small fixes for tests 2014-07-26 12:06:52 -04:00
bors
7aa407958b auto merge of #15998 : luqmana/rust/nmnnbd, r=thestinger
LLVM recently added a new attribute, dereferenceable: http://reviews.llvm.org/D4449

>This patch adds a dereferencable attribute. In some sense, this is a companion to the nonnull attribute, but specifies that the pointer is known to be dereferencable in the same sense as a pointer generated by alloca is known to be dereferencable.

With rust, everywhere that we previously marked `nonnull` we can actually mark as `dereferenceable` (which implies nonnull) since we know the size. That is, except for one case: when generating calls for TyVisitor. It seems like we haven't substituted the self type (so we have `ty_param`) and just treat it as an opaque pointer so I just left that bit as nonnull.

With this, LLVM can for example hoist a load out of a loop where it previously couldn't:

```Rust
pub fn baz(c: &uint, n: uint) -> uint {
    let mut res = 0;
    for i in range(0, n) {
        if i > 0 {
            res += *c * i;
        }
    }
    res
}
```

Before:
```llvm
define i64 @baz(i64* noalias nocapture nonnull readonly, i64) unnamed_addr #0 {
entry-block:
  br label %for_loopback.outer

for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
  %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
  %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
  br label %for_loopback

for_exit:                                         ; preds = %for_loopback
  %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
  ret i64 %res.0.ph.lcssa

for_loopback:                                     ; preds = %for_loopback.outer, %for_body
  %2 = phi i64 [ %4, %for_body ], [ %.ph, %for_loopback.outer ]
  %3 = icmp ult i64 %2, %1
  br i1 %3, label %for_body, label %for_exit

for_body:                                         ; preds = %for_loopback
  %4 = add i64 %2, 1
  %5 = icmp eq i64 %2, 0
  br i1 %5, label %for_loopback, label %then-block-33-

then-block-33-:                                   ; preds = %for_body
  %.lcssa = phi i64 [ %4, %for_body ]
  %.lcssa15 = phi i64 [ %2, %for_body ]
  %6 = load i64* %0, align 8                     ; <------- this load
  %7 = mul i64 %6, %.lcssa15
  %8 = add i64 %7, %res.0.ph
  br label %for_loopback.outer
}
```

After:
```llvm
define i64 @baz(i64* noalias nocapture readonly dereferenceable(8), i64) unnamed_addr #0 {
entry-block:
  %2 = load i64* %0, align 8                    ; <------- load once instead
  br label %for_loopback.outer

for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
  %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
  %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
  br label %for_loopback

for_exit:                                         ; preds = %for_loopback
  %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
  ret i64 %res.0.ph.lcssa

for_loopback:                                     ; preds = %for_loopback.outer, %for_body
  %3 = phi i64 [ %5, %for_body ], [ %.ph, %for_loopback.outer ]
  %4 = icmp ult i64 %3, %1
  br i1 %4, label %for_body, label %for_exit

for_body:                                         ; preds = %for_loopback
  %5 = add i64 %3, 1
  %6 = icmp eq i64 %3, 0
  br i1 %6, label %for_loopback, label %then-block-33-

then-block-33-:                                   ; preds = %for_body
  %.lcssa = phi i64 [ %5, %for_body ]
  %.lcssa15 = phi i64 [ %3, %for_body ]
  %7 = mul i64 %2, %.lcssa15
  %8 = add i64 %7, %res.0.ph
  br label %for_loopback.outer
}
```
2014-07-26 15:46:18 +00:00