]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoauto merge of #15884 : steveklabnik/rust/guide_fix_headings, r=huonw
bors [Tue, 22 Jul 2014 12:31:13 +0000 (12:31 +0000)]
auto merge of #15884 : steveklabnik/rust/guide_fix_headings, r=huonw

I screwed this up a while back, and now that I have no outstanding PRs, it's a good time to fix this.

9 years agoauto merge of #15876 : brson/rust/failfat, r=pcwalton
bors [Tue, 22 Jul 2014 10:46:16 +0000 (10:46 +0000)]
auto merge of #15876 : brson/rust/failfat, r=pcwalton

Adds a new runtime unwinding function that encapsulates the printing of the words "explicit failure" when `fail!()` is called w/o arguments.

The before/after optimized assembly:

```
        leaq    "str\"str\"(1412)"(%rip), %rax
        movq    %rax, 24(%rsp)
        movq    $16, 32(%rsp)
        leaq    "str\"str\"(1413)"(%rip), %rax
        movq    %rax, 8(%rsp)
        movq    $19, 16(%rsp)
        leaq    24(%rsp), %rdi
        leaq    8(%rsp), %rsi
        movl    $11, %edx
        callq   _ZN6unwind12begin_unwind21h15836560661922107792E
```

```
        leaq    "str\"str\"(1369)"(%rip), %rax
        movq    %rax, 8(%rsp)
        movq    $19, 16(%rsp)
        leaq    8(%rsp), %rdi
        movl    $11, %esi
        callq   _ZN6unwind31begin_unwind_no_time_to_explain20hd1c720cdde6a116480dE@PLT
```

Before/after filesizes:

rwxrwxr-x 1 brian brian 21479503 Jul 20 22:09 stage2-old/lib/librustc-4e7c5e5c.so
rwxrwxr-x 1 brian brian 21475415 Jul 20 22:30 x86_64-unknown-linux-gnu/stage2/lib/librustc-4e7c5e5c.so

This is the lowest-hanging fruit in the fail-bloat wars. Further fixes are going to require harder tradeoffs.

r? @pcwalton

9 years agoauto merge of #15871 : dotdash/rust/unnamed_fmtstr, r=pcwalton
bors [Tue, 22 Jul 2014 09:01:17 +0000 (09:01 +0000)]
auto merge of #15871 : dotdash/rust/unnamed_fmtstr, r=pcwalton

9 years agoauto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichton
bors [Tue, 22 Jul 2014 07:16:17 +0000 (07:16 +0000)]
auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichton

9 years agoFix pretty test
Corey Richardson [Tue, 22 Jul 2014 05:53:36 +0000 (22:53 -0700)]
Fix pretty test

9 years agoauto merge of #15870 : jakub-/rust/issue-15793, r=alexcrichton
bors [Tue, 22 Jul 2014 05:21:19 +0000 (05:21 +0000)]
auto merge of #15870 : jakub-/rust/issue-15793, r=alexcrichton

Fixes #15793.

9 years agoDon't run lexer tests by default
Corey Richardson [Tue, 22 Jul 2014 02:26:20 +0000 (19:26 -0700)]
Don't run lexer tests by default

9 years agoauto merge of #15834 : Kimundi/rust/moved_syntax_env, r=cmr
bors [Tue, 22 Jul 2014 02:06:21 +0000 (02:06 +0000)]
auto merge of #15834 : Kimundi/rust/moved_syntax_env, r=cmr

- Made custom syntax extensions capable of expanding custom macros by moving `SyntaxEnv` into `ExtCtx`
- Added convenience method on `ExtCtx` for getting a macro expander.
- Made a few things private to force only a single way to use them (through `ExtCtx`)
- Removed some ancient commented-out code

Closes #14946

9 years agoAdd a ton of ignore-lexer-test
Corey Richardson [Mon, 21 Jul 2014 22:57:14 +0000 (15:57 -0700)]
Add a ton of ignore-lexer-test

9 years agoShuffle around check-lexer conditions
Corey Richardson [Mon, 21 Jul 2014 20:04:35 +0000 (13:04 -0700)]
Shuffle around check-lexer conditions

9 years agoBreak apart long lines in verify.rs
Corey Richardson [Mon, 21 Jul 2014 19:59:25 +0000 (12:59 -0700)]
Break apart long lines in verify.rs

9 years agolexer tests: makefile/configure
Corey Richardson [Tue, 15 Jul 2014 07:18:17 +0000 (00:18 -0700)]
lexer tests: makefile/configure

9 years agoauto merge of #15217 : steveklabnik/rust/range, r=huonw
bors [Tue, 22 Jul 2014 00:26:21 +0000 (00:26 +0000)]
auto merge of #15217 : steveklabnik/rust/range, r=huonw

Inspired by http://www.reddit.com/r/rust/comments/298js2/what_is_the_rationale_behind_the_second_parameter/

9 years agoGuide: fix headings
Steve Klabnik [Mon, 21 Jul 2014 23:39:16 +0000 (19:39 -0400)]
Guide: fix headings

9 years agoClarify range's exclusivity.
Steve Klabnik [Fri, 27 Jun 2014 16:29:41 +0000 (12:29 -0400)]
Clarify range's exclusivity.

Inspired by http://www.reddit.com/r/rust/comments/298js2/what_is_the_rationale_behind_the_second_parameter/

9 years agoRefactoring: Only use `MacroExpander` for expanding outside of
Marvin Löbel [Sun, 20 Jul 2014 14:25:35 +0000 (16:25 +0200)]
Refactoring: Only use `MacroExpander` for expanding outside of
`syntax::ext::expand`

9 years agoMoved `syntax::ext::base::SyntaxEnv` into `syntax::ext::base::ExtCtx`
Marvin Löbel [Sat, 19 Jul 2014 19:34:24 +0000 (21:34 +0200)]
Moved `syntax::ext::base::SyntaxEnv` into `syntax::ext::base::ExtCtx`

9 years agoUpdate LLVM to address an issue with range metadata in hoisted loads
Jakub Wieczorek [Mon, 21 Jul 2014 19:32:03 +0000 (21:32 +0200)]
Update LLVM to address an issue with range metadata in hoisted loads

Fixes #15793.

9 years agoUse fewer instructions for `fail!`
Brian Anderson [Mon, 21 Jul 2014 20:48:19 +0000 (13:48 -0700)]
Use fewer instructions for `fail!`

Adds a special-case fail function, rustrt::unwind::begin_unwind_no_time_to_explain,
that encapsulates the printing of the words "explicit failure".

The before/after optimized assembly:

```
        leaq    "str\"str\"(1369)"(%rip), %rax
        movq    %rax, 8(%rsp)
        movq    $19, 16(%rsp)
        leaq    8(%rsp), %rdi
        movl    $11, %esi
        callq   _ZN6unwind31begin_unwind_no_time_to_explain20hd1c720cdde6a116480dE@PLT
```

```
        leaq    "str\"str\"(1412)"(%rip), %rax
        movq    %rax, 24(%rsp)
        movq    $16, 32(%rsp)
        leaq    "str\"str\"(1413)"(%rip), %rax
        movq    %rax, 8(%rsp)
        movq    $19, 16(%rsp)
        leaq    24(%rsp), %rdi
        leaq    8(%rsp), %rsi
        movl    $11, %edx
        callq   _ZN6unwind12begin_unwind21h15836560661922107792E
```

Before/after filesizes:

rwxrwxr-x 1 brian brian 21479503 Jul 20 22:09 stage2-old/lib/librustc-4e7c5e5c.so
rwxrwxr-x 1 brian brian 21475415 Jul 20 22:30 x86_64-unknown-linux-gnu/stage2/lib/librustc-4e7c5e5c.so

9 years agoauto merge of #15700 : jakub-/rust/match-fail-removal, r=pcwalton
bors [Mon, 21 Jul 2014 20:41:18 +0000 (20:41 +0000)]
auto merge of #15700 : jakub-/rust/match-fail-removal, r=pcwalton

It's an artifact of the old refutable version of `match` and is no longer necessary.

9 years agoAllow merging of statics generated by format!()
Björn Steinbrink [Mon, 21 Jul 2014 18:57:37 +0000 (20:57 +0200)]
Allow merging of statics generated by format!()

9 years agoauto merge of #15864 : alexcrichton/rust/rollup, r=alexcrichton
bors [Mon, 21 Jul 2014 18:46:46 +0000 (18:46 +0000)]
auto merge of #15864 : alexcrichton/rust/rollup, r=alexcrichton

9 years agoignore-lexer-test to broken files and remove some tray hyphens
Corey Richardson [Tue, 15 Jul 2014 03:46:04 +0000 (20:46 -0700)]
ignore-lexer-test to broken files and remove some tray hyphens

I blame @ChrisMorgan for the hyphens.

9 years agoByte/raw binary literal fixes
Corey Richardson [Tue, 15 Jul 2014 03:45:39 +0000 (20:45 -0700)]
Byte/raw binary literal fixes

9 years agoRefine the tooling, handle comments
Corey Richardson [Tue, 15 Jul 2014 00:27:28 +0000 (17:27 -0700)]
Refine the tooling, handle comments

9 years agoFirst pass at line comment correctness
Corey Richardson [Mon, 14 Jul 2014 21:13:38 +0000 (14:13 -0700)]
First pass at line comment correctness

9 years agoAdd raw string literal ambiguity document
Corey Richardson [Mon, 14 Jul 2014 08:56:52 +0000 (01:56 -0700)]
Add raw string literal ambiguity document

9 years agoLexer; subtly wrong; no makefile
Corey Richardson [Mon, 14 Jul 2014 08:52:18 +0000 (01:52 -0700)]
Lexer; subtly wrong; no makefile

9 years agoTest fixes from the rollup
Alex Crichton [Mon, 21 Jul 2014 17:18:17 +0000 (10:18 -0700)]
Test fixes from the rollup

Closes #15690 (Guide: improve error handling)
Closes #15729 (Guide: guessing game)
Closes #15751 (repair macro docs)
Closes #15766 (rustc: Print a smaller hash on -v)
Closes #15815 (Add unit test for rlibc)
Closes #15820 (Minor refactoring and features in rustc driver for embedders)
Closes #15822 (rustdoc: Add an --extern flag analagous to rustc's)
Closes #15824 (Document Deque trait and bitv.)
Closes #15832 (syntax: Join consecutive string literals in format strings together)
Closes #15837 (Update LLVM to include NullCheckElimination pass)
Closes #15841 (Rename to_str to to_string)
Closes #15847 (Purge #[!resolve_unexported] from the compiler)
Closes #15848 (privacy: Add publically-reexported foreign item to exported item set)
Closes #15849 (fix string in from_utf8_lossy_100_multibyte benchmark)
Closes #15850 (Get rid of few warnings in tests)
Closes #15852 (Clarify the std::vec::Vec::with_capacity docs)

9 years agoClarify the std::vec::Vec docs regarding capacity
P1start [Mon, 21 Jul 2014 08:33:20 +0000 (20:33 +1200)]
Clarify the std::vec::Vec docs regarding capacity

9 years agoGet rid of few warnings in tests
Piotr Jawniak [Sun, 20 Jul 2014 15:20:37 +0000 (17:20 +0200)]
Get rid of few warnings in tests

9 years agofix string in from_utf8_lossy_100_multibyte benchmark
Ted Horst [Mon, 21 Jul 2014 05:43:08 +0000 (00:43 -0500)]
fix string in from_utf8_lossy_100_multibyte benchmark

9 years agoprivacy: Add publically-reexported foreign item to exported item set
Kiet Tran [Mon, 21 Jul 2014 05:11:43 +0000 (22:11 -0700)]
privacy: Add publically-reexported foreign item to exported item set

Close #15740

9 years agoDon't create reexport module if there are none
Steven Fackler [Mon, 21 Jul 2014 05:34:09 +0000 (22:34 -0700)]
Don't create reexport module if there are none

9 years agoPurge !resolve_unexported
Steven Fackler [Mon, 21 Jul 2014 05:11:43 +0000 (22:11 -0700)]
Purge !resolve_unexported

9 years agoRestructure test harness
Steven Fackler [Mon, 21 Jul 2014 05:10:11 +0000 (22:10 -0700)]
Restructure test harness

We now build up a set of modules that reexport everything the test
framework needs, instead of turning off privacy.

9 years agoRemove useless RefCells
Steven Fackler [Mon, 21 Jul 2014 01:05:59 +0000 (18:05 -0700)]
Remove useless RefCells

9 years agoRename to_str to to_string
Steven Fackler [Mon, 21 Jul 2014 00:12:40 +0000 (17:12 -0700)]
Rename to_str to to_string

Closes #15796.

[breaking-change]

9 years agoUpdate LLVM to include NullCheckElimination pass
Björn Steinbrink [Sun, 20 Jul 2014 20:19:17 +0000 (22:19 +0200)]
Update LLVM to include NullCheckElimination pass

Fixes #11751

9 years agosyntax: Join consecutive string literals in format strings together
root [Sun, 20 Jul 2014 14:31:43 +0000 (16:31 +0200)]
syntax: Join consecutive string literals in format strings together

Emit a single rt::Piece per consecutive string literals. String literals
are split on {{ or }} escapes.

Saves a small amount of static storage and emitted code size.

9 years agoSimplify and cleanup bitv examples.
Jonas Hietala [Sun, 20 Jul 2014 15:09:53 +0000 (17:09 +0200)]
Simplify and cleanup bitv examples.

9 years agoDescribe BitPositions and TwoBitPositions.
Jonas Hietala [Sun, 20 Jul 2014 13:15:48 +0000 (15:15 +0200)]
Describe BitPositions and TwoBitPositions.

9 years agoPolish bitv docs.
Jonas Hietala [Sun, 20 Jul 2014 12:59:13 +0000 (14:59 +0200)]
Polish bitv docs.

9 years agoEnclose None as `None`.
Jonas Hietala [Sun, 20 Jul 2014 12:47:13 +0000 (14:47 +0200)]
Enclose None as `None`.

9 years agoMain bitv example: prime sieve.
Jonas Hietala [Sun, 20 Jul 2014 12:45:33 +0000 (14:45 +0200)]
Main bitv example: prime sieve.

9 years agoMove intersection above difference and symmetric_differance.
Jonas Hietala [Sun, 20 Jul 2014 12:33:27 +0000 (14:33 +0200)]
Move intersection above difference and symmetric_differance.

So all comes in the order union, intersection, difference and
symmetric_difference.

9 years agoDocument BitvSet.
Jonas Hietala [Sun, 20 Jul 2014 12:32:18 +0000 (14:32 +0200)]
Document BitvSet.

9 years agoDocument Bitv.
Jonas Hietala [Sun, 20 Jul 2014 12:28:40 +0000 (14:28 +0200)]
Document Bitv.

9 years agoGroup union, intersect and difference in Bitv.
Jonas Hietala [Sun, 20 Jul 2014 12:21:47 +0000 (14:21 +0200)]
Group union, intersect and difference in Bitv.

9 years agoPlace union as the first function, for consistency.
Jonas Hietala [Sun, 20 Jul 2014 12:18:04 +0000 (14:18 +0200)]
Place union as the first function, for consistency.

9 years agoMove in-place functions below their iterator variants.
Jonas Hietala [Sun, 20 Jul 2014 12:16:47 +0000 (14:16 +0200)]
Move in-place functions below their iterator variants.

9 years agoDocument Deque.
Jonas Hietala [Sun, 20 Jul 2014 12:12:26 +0000 (14:12 +0200)]
Document Deque.

9 years agorustdoc: Add an --extern flag analagous to rustc's
Tom Jakubowski [Sun, 20 Jul 2014 06:02:14 +0000 (23:02 -0700)]
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.

9 years agoAddress review feedback
Brian Anderson [Sun, 20 Jul 2014 23:32:46 +0000 (16:32 -0700)]
Address review feedback

9 years agorustc: Allow the crate linked to as 'std' to be customized
Brian Anderson [Sun, 20 Jul 2014 05:40:39 +0000 (22:40 -0700)]
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.

9 years agorustc: Pass optional additional plugins to compile_input
Brian Anderson [Sun, 20 Jul 2014 04:54:37 +0000 (21:54 -0700)]
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.

9 years agorustc: Extract --crate-type parsing to its own function
Brian Anderson [Sun, 20 Jul 2014 04:11:26 +0000 (21:11 -0700)]
rustc: Extract --crate-type parsing to its own function

Helpful for users of rustc as a library.

9 years agorustc: Make `monitor` public.
Brian Anderson [Sat, 19 Jul 2014 08:29:57 +0000 (01:29 -0700)]
rustc: Make `monitor` public.

It's harder to run rustc correctly without it.

9 years agorlibc: add unit tests
Ilya Dmitrichenko [Sun, 20 Jul 2014 13:05:53 +0000 (14:05 +0100)]
rlibc: add unit tests

9 years agorlibc: fix bug in `memcmp()`
Ilya Dmitrichenko [Sun, 20 Jul 2014 13:05:28 +0000 (14:05 +0100)]
rlibc: fix bug in `memcmp()`

9 years agorustc: Print a smaller hash on -v
Alex Crichton [Fri, 18 Jul 2014 04:34:41 +0000 (21:34 -0700)]
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.

9 years agorepair macro docs
John Clements [Thu, 17 Jul 2014 16:45:31 +0000 (09:45 -0700)]
repair macro docs

In f1ad425199b0d89dab275a8c8f6f29a73d316f70, 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.

9 years agoGuessing game explanation
Steve Klabnik [Tue, 15 Jul 2014 20:21:51 +0000 (16:21 -0400)]
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.

9 years agoGuide: improve error handling
Steve Klabnik [Tue, 15 Jul 2014 20:05:27 +0000 (16:05 -0400)]
Guide: improve error handling

9 years agoauto merge of #15450 : chris-morgan/rust/vim-misc-2014-07-04, r=kballard
bors [Mon, 21 Jul 2014 16:51:37 +0000 (16:51 +0000)]
auto merge of #15450 : chris-morgan/rust/vim-misc-2014-07-04, r=kballard

9 years agoRemove runtime failure from pattern matching
Jakub Wieczorek [Tue, 15 Jul 2014 20:12:20 +0000 (22:12 +0200)]
Remove runtime failure from pattern matching

It's an artifact of the old refutable version of `match`
and is no longer necessary.

9 years agoFix :syn-include usage of Vim filetype.
Chris Morgan [Fri, 4 Jul 2014 00:47:13 +0000 (10:47 +1000)]
Fix :syn-include usage of Vim filetype.

Here’s what the Vim manual says in *:syn-include*:

    :sy[ntax] include [@{grouplist-name}] {file-name}

All syntax items declared in the included file will have the
"contained" flag added.  In addition, if a group list is
specified, all top-level syntax items in the included file will
be added to that list.

We had two rules for `rustModPath`, one `contained` and the other not.
The effect was that the second (now renamed to `rustModPathInUse`) was
being included in the group list, and thus that all identifiers were
being highlighted as `Include`, which is definitely not what we wanted.

9 years agoHighlight $(…)* and $foo in Vim.
Chris Morgan [Fri, 4 Jul 2014 00:45:36 +0000 (10:45 +1000)]
Highlight $(…)* and $foo in Vim.

9 years agoauto merge of #15810 : SimonSapin/rust/base64-from-bytes, r=alexcrichton
bors [Sun, 20 Jul 2014 22:46:29 +0000 (22:46 +0000)]
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

9 years agoauto merge of #15808 : jakub-/rust/use-mod, r=alexcrichton
bors [Sun, 20 Jul 2014 21:06:32 +0000 (21:06 +0000)]
auto merge of #15808 : jakub-/rust/use-mod, r=alexcrichton

Implements RFC #168.

9 years agoauto merge of #15805 : Sawyer47/rust/issue-8709, r=alexcrichton
bors [Sun, 20 Jul 2014 19:26:31 +0000 (19:26 +0000)]
auto merge of #15805 : Sawyer47/rust/issue-8709, r=alexcrichton

Closes #8709

9 years agoauto merge of #15806 : treeman/rust/std-doc, r=alexcrichton
bors [Sun, 20 Jul 2014 17:46:32 +0000 (17:46 +0000)]
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.

9 years agoauto merge of #15814 : kvark/rust/ast, r=huonw
bors [Sun, 20 Jul 2014 16:01:32 +0000 (16:01 +0000)]
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.

9 years agoauto merge of #15803 : omp/rust/master, r=alexcrichton
bors [Sun, 20 Jul 2014 14:21:32 +0000 (14:21 +0000)]
auto merge of #15803 : omp/rust/master, r=alexcrichton

Fix small typo in guide.

9 years agoauto merge of #15797 : brson/rust/taskstab, r=alexcrichton
bors [Sun, 20 Jul 2014 12:01:31 +0000 (12:01 +0000)]
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.

9 years agosmall typo
Steve Klabnik [Sun, 20 Jul 2014 11:57:49 +0000 (04:57 -0700)]
small typo

9 years agoImplement new mod import sugar
Jakub Wieczorek [Thu, 17 Jul 2014 22:56:56 +0000 (00:56 +0200)]
Implement new mod import sugar

Implements RFC #168.

9 years agoauto merge of #15785 : treeman/rust/fix-15780, r=alexcrichton
bors [Sun, 20 Jul 2014 09:31:29 +0000 (09:31 +0000)]
auto merge of #15785 : treeman/rust/fix-15780, r=alexcrichton

Fix for #15780.

9 years agoauto merge of #15784 : dotdash/rust/unreach, r=luqmana
bors [Sun, 20 Jul 2014 07:51:32 +0000 (07:51 +0000)]
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.

9 years agoCorrectly stringify! types and paths inside macros
Piotr Jawniak [Sat, 19 Jul 2014 09:59:44 +0000 (11:59 +0200)]
Correctly stringify! types and paths inside macros

Closes #8709

9 years agoauto merge of #15745 : treeman/rust/tutorial-fixup, r=steveklabnik
bors [Sun, 20 Jul 2014 06:11:32 +0000 (06:11 +0000)]
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.

9 years agoauto merge of #15776 : alexcrichton/rust/snapshots, r=huonw
bors [Sun, 20 Jul 2014 04:31:33 +0000 (04:31 +0000)]
auto merge of #15776 : alexcrichton/rust/snapshots, r=huonw

9 years agoRegister new snapshots
Alex Crichton [Wed, 16 Jul 2014 17:28:42 +0000 (10:28 -0700)]
Register new snapshots

9 years agoauto merge of #15767 : pcwalton/rust/lifetime-elision, r=nick29581
bors [Sun, 20 Jul 2014 02:46:34 +0000 (02:46 +0000)]
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

9 years agoauto merge of #15764 : alexcrichton/rust/issue-15761, r=kballard
bors [Sun, 20 Jul 2014 01:06:36 +0000 (01:06 +0000)]
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

9 years agoauto merge of #15746 : steveklabnik/rust/docs_random, r=alexcrichton
bors [Sat, 19 Jul 2014 23:26:37 +0000 (23:26 +0000)]
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.

9 years agoauto merge of #15650 : jakub-/rust/patterns-statics, r=pcwalton
bors [Sat, 19 Jul 2014 21:46:37 +0000 (21:46 +0000)]
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.

9 years agoFixed lifetimes on syntax deriving structs, implemented Clone
Dzmitry Malyshau [Sat, 19 Jul 2014 21:33:17 +0000 (17:33 -0400)]
Fixed lifetimes on syntax deriving structs, implemented Clone

9 years agolibrustc: Implement lifetime elision.
Patrick Walton [Fri, 18 Jul 2014 04:44:59 +0000 (21:44 -0700)]
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]

9 years agoauto merge of #15782 : steveklabnik/rust/string_guide_link, r=cmr
bors [Sat, 19 Jul 2014 18:36:37 +0000 (18:36 +0000)]
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

9 years agoauto merge of #15772 : treeman/rust/hashset-doc, r=alexcrichton
bors [Sat, 19 Jul 2014 16:01:43 +0000 (16:01 +0000)]
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.

9 years agoImplement FromBase64 for &[u8].
Simon Sapin [Sat, 19 Jul 2014 15:46:14 +0000 (16:46 +0100)]
Implement FromBase64 for &[u8].

The algorithm was already based on bytes internally.

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

9 years agoauto merge of #15638 : blake2-ppc/rust/ptr-arithmetic-chars, r=huonw
bors [Sat, 19 Jul 2014 14:06:39 +0000 (14:06 +0000)]
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.

9 years agoSimplify str CharOffsets iterator
root [Sat, 19 Jul 2014 13:39:02 +0000 (15:39 +0200)]
Simplify str CharOffsets iterator

Only one uint is needed to keep track of the offset from the original
full string.

9 years agoauto merge of #15765 : luqmana/rust/iec, r=pcwalton
bors [Sat, 19 Jul 2014 12:26:39 +0000 (12:26 +0000)]
auto merge of #15765 : luqmana/rust/iec, r=pcwalton

Fixes #15400.

9 years agoDocument some trait methods.
Jonas Hietala [Sat, 19 Jul 2014 10:10:09 +0000 (12:10 +0200)]
Document some trait methods.

9 years agoauto merge of #15754 : jakub-/rust/diagnostics, r=alexcrichton
bors [Sat, 19 Jul 2014 08:51:34 +0000 (08:51 +0000)]
auto merge of #15754 : jakub-/rust/diagnostics, r=alexcrichton

9 years agoauto merge of #15752 : nham/rust/dlist_docs, r=alexcrichton
bors [Sat, 19 Jul 2014 07:11:33 +0000 (07:11 +0000)]
auto merge of #15752 : nham/rust/dlist_docs, r=alexcrichton

Someone rightfully complained in IRC that DList was lacking examples. Here are some.

9 years agoFix typo.
David Vazgenovich Shakaryan [Sat, 19 Jul 2014 06:11:25 +0000 (23:11 -0700)]
Fix typo.

9 years agoauto merge of #15686 : alexcrichton/rust/same-crate-name, r=kballard
bors [Sat, 19 Jul 2014 03:11:34 +0000 (03:11 +0000)]
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.