Commit graph

30780 commits

Author SHA1 Message Date
Jonas Hietala
f4d9dca10d Group union, intersect and difference in Bitv. 2014-07-21 09:54:31 -07:00
Jonas Hietala
2e40078fc3 Place union as the first function, for consistency. 2014-07-21 09:54:31 -07:00
Jonas Hietala
9aaaa6b31e Move in-place functions below their iterator variants. 2014-07-21 09:54:31 -07:00
Jonas Hietala
c86873bda4 Document Deque. 2014-07-21 09:54:31 -07:00
Tom Jakubowski
ec70f2bb6e rustdoc: Add an --extern flag analagous to rustc's
This adds an `--extern` flag to `rustdoc` much like the compiler's to
specify the path where a given crate can be found.
2014-07-21 09:54:29 -07:00
Brian Anderson
97ca98f5cc Address review feedback 2014-07-21 09:54:27 -07:00
Brian Anderson
ec0f1cb709 rustc: Allow the crate linked to as 'std' to be customized
This adds the alt_std_name field to the Session's Options type.
I'm using this in an external tool to control which libraries
a crate links to.
2014-07-21 09:54:27 -07:00
Brian Anderson
c88bf10c37 rustc: Pass optional additional plugins to compile_input
This provides a way for clients of the rustc library to add
their own features to the pipeline.
2014-07-21 09:54:26 -07:00
Brian Anderson
1c3655bed1 rustc: Extract --crate-type parsing to its own function
Helpful for users of rustc as a library.
2014-07-21 09:54:26 -07:00
Brian Anderson
9631bf2e25 rustc: Make monitor public.
It's harder to run rustc correctly without it.
2014-07-21 09:54:26 -07:00
Ilya Dmitrichenko
d32fe7e51b rlibc: add unit tests 2014-07-21 09:54:23 -07:00
Ilya Dmitrichenko
fcaee85ced rlibc: fix bug in memcmp() 2014-07-21 09:54:23 -07:00
Alex Crichton
a491551597 rustc: Print a smaller hash on -v
The long hash just takes up space and you can discover the main hash through the
`rustc --version verbose` command.
2014-07-21 09:54:10 -07:00
John Clements
1607064cfe repair macro docs
In f1ad425199, I changed the handling
of macros, to prevent macro invocations from occurring in fully expanded
source. Instead, I added a side table. It contained only the
spans of the macros, because this was the only information required
in order to make macro export work.

However, librustdoc was also affected by this change, since it
extracts macro information in a similar way. As a result of the earlier
change, exported macros were no longer documented.

In order to repair this, I've adjusted the side table to contain whole
items, rather than just the spans.
2014-07-21 09:54:07 -07:00
Steve Klabnik
e8c9d21130 Guessing game explanation
We now build the game at the end of the first section.

I wanted to do it as we went along, but it's too hard with these fundamentals
not in place. The rest will do the 'as we go' approach, but I think this is
better.
2014-07-21 09:54:03 -07:00
Steve Klabnik
fca79e4726 Guide: improve error handling 2014-07-21 09:53:58 -07:00
bors
f15d6d2839 auto merge of #15810 : SimonSapin/rust/base64-from-bytes, r=alexcrichton
The algorithm was already based on bytes internally.

Also use byte literals instead of casting u8 to char for matching.

[breaking-change] The `InvalidBase64Character` variant of the `FromBase64Error` enum was renamed to `InvalidBase64Byte`, and contains a `u8` instead of a `char`.

r? @alexcrichton
2014-07-20 22:46:29 +00:00
bors
8748a69e6c auto merge of #15808 : jakub-/rust/use-mod, r=alexcrichton
Implements RFC #168.
2014-07-20 21:06:32 +00:00
bors
c4dd47df34 auto merge of #15805 : Sawyer47/rust/issue-8709, r=alexcrichton
Closes #8709
2014-07-20 19:26:31 +00:00
bors
3a37ed4412 auto merge of #15806 : treeman/rust/std-doc, r=alexcrichton
Used `HashMap` and `HashSet` as the base of most examples. Could change it up with different containers, but I don't think it's a big deal.
2014-07-20 17:46:32 +00:00
bors
df997e53af auto merge of #15814 : kvark/rust/ast, r=huonw
Makes working with syntax deriving a bit more pleasuring. For instance, once can use local (non-static) strings anywhere inside `TraitDef` now.
2014-07-20 16:01:32 +00:00
bors
8859df7fb5 auto merge of #15803 : omp/rust/master, r=alexcrichton
Fix small typo in guide.
2014-07-20 14:21:32 +00:00
bors
e6b28f9ac3 auto merge of #15797 : brson/rust/taskstab, r=alexcrichton
Summary:

* alloc::rc module stable
* Rc type stable
* Functions relating to weak references experimental
* core::cmp module stable
* PartialEq/Eq/PartialOrd/Ord unstable because trait reform will make them change again
* Equiv experimental because there may be better sol'ns
* lexical_ordering deprecated because it can be done trivially with the Ord trait
* min/max stable
* std::task module stable
* TaskBuilder::stdout/stderr experimental because we aren't certain we want to configure the environment this way
* try_future experimental because Future is experimental
* try unstable because the error type might change
* deschedule/failing unstable

The major thing I did differently than previously-discussed is that I made `try` experimental: there's been discussion that the error type `Box<Any + Send>` is not sufficient.


Per https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-07-16.md.
2014-07-20 12:01:31 +00:00
Steve Klabnik
343a52f6b5 small typo 2014-07-20 04:57:49 -07:00
Jakub Wieczorek
4b9bc2e8f2 Implement new mod import sugar
Implements RFC #168.
2014-07-20 12:40:08 +02:00
bors
4f55b52b1a auto merge of #15785 : treeman/rust/fix-15780, r=alexcrichton
Fix for #15780.
2014-07-20 09:31:29 +00:00
bors
50481f5503 auto merge of #15784 : dotdash/rust/unreach, r=luqmana
`call_visit_glue` is only ever called from trans_intrinsic, and the
block won't be unreachable there. Also, the comment doesn't make sense
anymore. When the code was introduced in 38fee9526a the function was
also responsible for the cleanup glue, which is no longer the case.

While we're at it, also fixed the debug message to output the right
function name.
2014-07-20 07:51:32 +00:00
Piotr Jawniak
20df4ccafe Correctly stringify! types and paths inside macros
Closes #8709
2014-07-20 08:47:14 +02:00
bors
320dbc18d8 auto merge of #15745 : treeman/rust/tutorial-fixup, r=steveklabnik
Simplify example in 5.2 to remove hidden `#[deriving(Show)]`. Traits haven't been introduced yet and now it's easier to just type in the code and expect it to work. Add in some examples for constructing the enum types. Explicitly expose `#![feature(struct_variant)]` in the code to make it more transparent, this bit me when I worked through the tutorial.

Add references in chapter 8 to later chapters describing `Rc`, `Gc` and `Send`. This is a simple fix for #15293.

Simplify vector indexing example in chapter 13 and removed hidden, unnecessary, code. Gave an example usage of the derived `Rand` trait in chapter 17.

Removed references to removed 'extra' crate.
2014-07-20 06:11:32 +00:00
bors
7d0a613d0c auto merge of #15776 : alexcrichton/rust/snapshots, r=huonw 2014-07-20 04:31:33 +00:00
Alex Crichton
707cf47ac8 Register new snapshots 2014-07-19 20:38:00 -07:00
bors
56fafe28ee auto merge of #15767 : pcwalton/rust/lifetime-elision, r=nick29581
This implements RFC 39. Omitted lifetimes in return values will now be
inferred to more useful defaults, and an error is reported if a lifetime
in a return type is omitted and one of the two lifetime elision rules
does not specify what it should be.

This primarily breaks two uncommon code patterns. The first is this:

    unsafe fn get_foo_out_of_thin_air() -> &Foo {
        ...
    }

This should be changed to:

    unsafe fn get_foo_out_of_thin_air() -> &'static Foo {
        ...
    }

The second pattern that needs to be changed is this:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed {
        Owned(format!("hello world"))
    }

Change code like this to:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed<'static> {
        Owned(format!("hello world"))
    }

Closes #15552.

[breaking-change]

r? @nick29581
2014-07-20 02:46:34 +00:00
bors
5e0a597a1a auto merge of #15764 : alexcrichton/rust/issue-15761, r=kballard
This branch of try_send() just forgot to wake up any receiver waiting for data.

Closes #15761
2014-07-20 01:06:36 +00:00
bors
d8652de942 auto merge of #15746 : steveklabnik/rust/docs_random, r=alexcrichton
This is now linked to in the guide, so I want to make sure it's good. This
adds a bit more explanation, and brings usage in line with current good style.
2014-07-19 23:26:37 +00:00
bors
8672a235dd auto merge of #15650 : jakub-/rust/patterns-statics, r=pcwalton
This is accomplished by rewriting static expressions into equivalent patterns.
This way, patterns referencing static variables can both participate
in exhaustiveness analysis as well as be compiled down into the appropriate
branch of the decision trees that match expressions are codegened to.

Fixes #6533.
Fixes #13626.
Fixes #13731.
Fixes #14576.
Fixes #15393.
2014-07-19 21:46:37 +00:00
Dzmitry Malyshau
a2467b945c Fixed lifetimes on syntax deriving structs, implemented Clone 2014-07-19 17:33:17 -04:00
Patrick Walton
6f99a27886 librustc: Implement lifetime elision.
This implements RFC 39. Omitted lifetimes in return values will now be
inferred to more useful defaults, and an error is reported if a lifetime
in a return type is omitted and one of the two lifetime elision rules
does not specify what it should be.

This primarily breaks two uncommon code patterns. The first is this:

    unsafe fn get_foo_out_of_thin_air() -> &Foo {
        ...
    }

This should be changed to:

    unsafe fn get_foo_out_of_thin_air() -> &'static Foo {
        ...
    }

The second pattern that needs to be changed is this:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed {
        Owned(format!("hello world"))
    }

Change code like this to:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed<'static> {
        Owned(format!("hello world"))
    }

Closes #15552.

[breaking-change]
2014-07-19 13:10:58 -07:00
bors
ab610226aa auto merge of #15782 : steveklabnik/rust/string_guide_link, r=cmr
Three small changes:

1. Re-organize headers in the Strings guide so they show up correctly.
2. build the strings guide with the other docs
3. include the strings guide in the list of guides
2014-07-19 18:36:37 +00:00
bors
793b1424ac auto merge of #15772 : treeman/rust/hashset-doc, r=alexcrichton
Example how to use the set with a custom type. Fill in examples for the missing methods. Also group implemented traits below `HashSet` method impl.
2014-07-19 16:01:43 +00:00
Simon Sapin
56218f5dfc Implement FromBase64 for &[u8].
The algorithm was already based on bytes internally.

Also use byte literals instead of casting u8 to char for matching.
2014-07-19 16:46:14 +01:00
bors
ca38434829 auto merge of #15638 : blake2-ppc/rust/ptr-arithmetic-chars, r=huonw
Reimplement the string slice's `Iterator<char>` by wrapping the already efficient
slice iterator.

The iterator uses our guarantee that the string contains valid UTF-8, but its only unsafe
code is transmuting the decoded `u32` into `char`.

Benchmarks suggest that the runtime of `Chars` benchmarks are reduced by up to 30%,
runtime of `Chars` reversed reduced by up to 60%.

```
BEFORE
test str::bench::char_indicesator                          ... bench:       124 ns/iter (+/- 1)
test str::bench::char_indicesator_rev                      ... bench:       188 ns/iter (+/- 9)
test str::bench::char_iterator                             ... bench:       122 ns/iter (+/- 2)
test str::bench::char_iterator_ascii                       ... bench:       302 ns/iter (+/- 41)
test str::bench::char_iterator_for                         ... bench:       123 ns/iter (+/- 4)
test str::bench::char_iterator_rev                         ... bench:       189 ns/iter (+/- 14)
test str::bench::char_iterator_rev_for                     ... bench:       177 ns/iter (+/- 4)

AFTER
test str::bench::char_indicesator                          ... bench:        85 ns/iter (+/- 3)
test str::bench::char_indicesator_rev                      ... bench:        82 ns/iter (+/- 2)
test str::bench::char_iterator                             ... bench:       100 ns/iter (+/- 3)
test str::bench::char_iterator_ascii                       ... bench:       317 ns/iter (+/- 3)
test str::bench::char_iterator_for                         ... bench:        86 ns/iter (+/- 2)
test str::bench::char_iterator_rev                         ... bench:        80 ns/iter (+/- 6)
test str::bench::char_iterator_rev_for                     ... bench:        68 ns/iter (+/- 0)
```

Note: Branch name is no longer indicative of the implementation.
2014-07-19 14:06:39 +00:00
root
c5e0736c24 Simplify str CharOffsets iterator
Only one uint is needed to keep track of the offset from the original
full string.
2014-07-19 15:39:02 +02:00
bors
e0a6e2b414 auto merge of #15765 : luqmana/rust/iec, r=pcwalton
Fixes #15400.
2014-07-19 12:26:39 +00:00
Jonas Hietala
41729b83bc Document some trait methods. 2014-07-19 12:26:18 +02:00
bors
f05a2c97b8 auto merge of #15754 : jakub-/rust/diagnostics, r=alexcrichton 2014-07-19 08:51:34 +00:00
bors
fb4c3f0af2 auto merge of #15752 : nham/rust/dlist_docs, r=alexcrichton
Someone rightfully complained in IRC that DList was lacking examples. Here are some.
2014-07-19 07:11:33 +00:00
David Vazgenovich Shakaryan
69127f2f4e Fix typo. 2014-07-18 23:11:25 -07:00
bors
44a71dee37 auto merge of #15686 : alexcrichton/rust/same-crate-name, r=kballard
The first is to require that `#[crate_name]` and `--crate-name` always match (if both are specified). The second is to fix parallel compilation in cargo by mixing in `-C extra-filename` into the temporary outputs of the compiler.
2014-07-19 03:11:34 +00:00
Brian Anderson
0b946f0a90 std: Stabilize task module.
Most stable. deschedule/failing experimental because of concerns about
naming and desirability.

Adds task::name() to replace deprecated task::with_name().
2014-07-18 18:34:38 -07:00
Brian Anderson
cf8bfde9d3 alloc: Stabilize rc module.
Weak pointers experimental. Most everything else stable.
2014-07-18 18:34:38 -07:00