]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoReplace all ~"" with "".to_owned()
Richo Healey [Wed, 16 Apr 2014 01:17:48 +0000 (18:17 -0700)]
Replace all ~"" with "".to_owned()

10 years agoauto merge of #13600 : brandonw/rust/master, r=brson
bors [Fri, 18 Apr 2014 22:01:22 +0000 (15:01 -0700)]
auto merge of #13600 : brandonw/rust/master, r=brson

When calling a function, or anything with nested parens,
default to cindent's indent. The least error-prone way I
could think of identifying this is to look for a line
that ends with a ',', as well as a non-zero number of
any character except parens before the comma, and
then an open paren.

This will overlap with the previous rule accounting for
function definitions, but that should be fine because
it is also using cindent.

10 years agoauto merge of #13601 : mdinger/rust/readme, r=brson
bors [Fri, 18 Apr 2014 20:01:25 +0000 (13:01 -0700)]
auto merge of #13601 : mdinger/rust/readme, r=brson

Configure required git be installed so this should be added to the dependencies list.  If it's only required when using git, a note could also be added.

10 years agoAdd git to README.md dependency list because configure requires it
mdinger [Fri, 18 Apr 2014 18:50:31 +0000 (14:50 -0400)]
Add git to README.md dependency list because configure requires it

10 years agoauto merge of #13588 : alexcrichton/rust/no-more-growing, r=thestinger
bors [Fri, 18 Apr 2014 18:41:23 +0000 (11:41 -0700)]
auto merge of #13588 : alexcrichton/rust/no-more-growing, r=thestinger

This is all in preparation for DST. This removes all the growable/shrinkable methods from `~[T]`.

10 years agoAdd another case where cindent is correct
Brandon Waskiewicz [Fri, 18 Apr 2014 18:12:50 +0000 (14:12 -0400)]
Add another case where cindent is correct

When calling a function, or anything with nested parens,
default to cindent's indent. The least error-prone way I
could think of identifying this is to look for a line
that ends with a ',', as well as a non-zero number of
any character except parens before the comma, and
then an open paren.

This will overlap with the previous rule accounting for
function definitions, but that should be fine because
it is also using cindent.

10 years agoUpdate the rest of the compiler with ~[T] changes
Alex Crichton [Thu, 17 Apr 2014 22:59:07 +0000 (15:59 -0700)]
Update the rest of the compiler with ~[T] changes

10 years agostd: Make ~[T] no longer a growable vector
Alex Crichton [Thu, 17 Apr 2014 22:28:14 +0000 (15:28 -0700)]
std: Make ~[T] no longer a growable vector

This removes all resizability support for ~[T] vectors in preparation of DST.
The only growable vector remaining is Vec<T>. In summary, the following methods
from ~[T] and various functions were removed. Each method/function has an
equivalent on the Vec type in std::vec unless otherwise stated.

* slice::OwnedCloneableVector
* slice::OwnedEqVector
* slice::append
* slice::append_one
* slice::build (no replacement)
* slice::bytes::push_bytes
* slice::from_elem
* slice::from_fn
* slice::with_capacity
* ~[T].capacity()
* ~[T].clear()
* ~[T].dedup()
* ~[T].extend()
* ~[T].grow()
* ~[T].grow_fn()
* ~[T].grow_set()
* ~[T].insert()
* ~[T].pop()
* ~[T].push()
* ~[T].push_all()
* ~[T].push_all_move()
* ~[T].remove()
* ~[T].reserve()
* ~[T].reserve_additional()
* ~[T].reserve_exect()
* ~[T].retain()
* ~[T].set_len()
* ~[T].shift()
* ~[T].shrink_to_fit()
* ~[T].swap_remove()
* ~[T].truncate()
* ~[T].unshift()
* ~str.clear()
* ~str.set_len()
* ~str.truncate()

Note that no other API changes were made. Existing apis that took or returned
~[T] continue to do so.

[breaking-change]

10 years agoauto merge of #13585 : brandonw/rust/patch-1, r=cmr
bors [Fri, 18 Apr 2014 11:11:19 +0000 (04:11 -0700)]
auto merge of #13585 : brandonw/rust/patch-1, r=cmr

The original text stated that one should only return a unique or managed pointer if you were given one in the first place. This makes it sound as if the function *should* return a unique pointer if it were given a unique pointer. The rest of the section goes on to describe why this is bad, and the example of bad code does exactly what the rule just said to do.

I reworded the original rule into a reference to the more concise rule mentioned at the bottom of the section, which helps add emphasis (a la 'it bears repeating').

10 years agoauto merge of #13581 : DiamondLovesYou/rust/tests-mk-typo, r=alexcrichton
bors [Fri, 18 Apr 2014 07:01:22 +0000 (00:01 -0700)]
auto merge of #13581 : DiamondLovesYou/rust/tests-mk-typo, r=alexcrichton

I spotted this while working on https://github.com/mozilla/rust/pull/13450.

10 years agoauto merge of #13580 : DiamondLovesYou/rust/std-result-hash, r=alexcrichton
bors [Fri, 18 Apr 2014 05:41:22 +0000 (22:41 -0700)]
auto merge of #13580 : DiamondLovesYou/rust/std-result-hash, r=alexcrichton

Title says it all.

10 years agoauto merge of #13525 : Ryman/rust/issue_5997, r=alexcrichton
bors [Fri, 18 Apr 2014 04:21:24 +0000 (21:21 -0700)]
auto merge of #13525 : Ryman/rust/issue_5997, r=alexcrichton

Closes #5997.

10 years agoauto merge of #13576 : lifthrasiir/rust/double-ref, r=alexcrichton
bors [Fri, 18 Apr 2014 03:01:25 +0000 (20:01 -0700)]
auto merge of #13576 : lifthrasiir/rust/double-ref, r=alexcrichton

Uses the same strategy as `||` and `>>`. Closes #11227.

10 years agoauto merge of #13575 : TeXitoi/rust/shootout-knucleotide-parallel, r=alexcrichton
bors [Fri, 18 Apr 2014 01:41:24 +0000 (18:41 -0700)]
auto merge of #13575 : TeXitoi/rust/shootout-knucleotide-parallel, r=alexcrichton

10 years agoauto merge of #13572 : yuriks/rust/bitv-renames, r=alexcrichton
bors [Fri, 18 Apr 2014 00:21:26 +0000 (17:21 -0700)]
auto merge of #13572 : yuriks/rust/bitv-renames, r=alexcrichton

Renamed the methods in Bitv that test all bits to have names that, ehm, "roll off the tongue" a bit more easily. :)

Also added tests for them while at it, since they seemed to be missing.

10 years agoauto merge of #13565 : alexcrichton/rust/issue-13560, r=brson
bors [Thu, 17 Apr 2014 22:51:27 +0000 (15:51 -0700)]
auto merge of #13565 : alexcrichton/rust/issue-13560, r=brson

Syntax-only crates are no longer registered with the cstore, so there's no need
to allocate crate numbers to them. This ends up leaving gaps in the crate
numbering scheme which is not expected in the rest of the compiler.

Closes #13560

10 years agoRemove rule that is confusing
Brandon Waskiewicz [Thu, 17 Apr 2014 20:59:58 +0000 (16:59 -0400)]
Remove rule that is confusing

The original text stated that one should only return a unique or managed pointer if you were given one in the first place. This makes it sound as if the function *should* return a unique pointer if it were given a unique pointer. The rest of the section goes on to describe why this is bad, and the example of bad code does exactly what the rule just said to do.

I reworded the original rule into a reference to the more concise rule mentioned at the bottom of the section, which helps add emphasis (a la 'it bears repeating').

10 years agoauto merge of #13261 : pnkfelix/rust/fsk-fix-12856, r=nikomatsakis
bors [Thu, 17 Apr 2014 19:46:26 +0000 (12:46 -0700)]
auto merge of #13261 : pnkfelix/rust/fsk-fix-12856, r=nikomatsakis

Fix #12856.

I wanted to put this up first because I wanted to get feedback about the second commit in the series, commit 8599236.  Its the more invasive part of the patch and is largely just belt-and-suspenders assertion checking; in the commit message I mentioned at least one other approach we could take here.  Or we could drop the belt-and-suspenders and just rely on the guard added in the first patch, commit 8d6a005 (which is really quite trivial on its own).

So any feedback on what would be better is appreciated.

r? @nikomatsakis

10 years agoAdd result sanity check to `is_to_be_inferred`.
Felix S. Klock II [Thu, 17 Apr 2014 18:36:19 +0000 (20:36 +0200)]
Add result sanity check to `is_to_be_inferred`.

This version of `is_to_be_inferred` double-checks the result from
`inferred_map` by querying the `named_region_map` and `ast_map` and
then asserts that the `inferred_map` state is consistent with its own
findings.  (See issue 13261 for further discussion of the approaches).

10 years agoauto merge of #13558 : alexcrichton/rust/snapshots, r=brson
bors [Thu, 17 Apr 2014 18:16:31 +0000 (11:16 -0700)]
auto merge of #13558 : alexcrichton/rust/snapshots, r=brson

This is the first snapshot build by mingw-w64 with the win32 threading model I believe (Closes #13501).

Curiously, this successfully built a snapshot on freebsd when the auto builder is continuously segfaulting. Who knew!

10 years agomk/tests.mk: Fix a typo causing make to give compiletest the wrong rt build dir ...
Richard Diamond [Thu, 17 Apr 2014 17:32:44 +0000 (12:32 -0500)]
mk/tests.mk: Fix a typo causing make to give compiletest the wrong rt build dir (target instead of host).

10 years agoCatch forward declarations in default type params at AST conversion.
Kevin Butler [Thu, 17 Apr 2014 00:17:23 +0000 (01:17 +0100)]
Catch forward declarations in default type params at AST conversion.

10 years agoChange error for out of scope type params to be more helpful.
Kevin Butler [Wed, 16 Apr 2014 22:32:00 +0000 (23:32 +0100)]
Change error for out of scope type params to be more helpful.

10 years agoAdd span to error for missing type params on enums.
Kevin Butler [Tue, 15 Apr 2014 12:06:38 +0000 (13:06 +0100)]
Add span to error for missing type params on enums.

10 years agoTests for issue 5997 failure and success conditions.
Kevin Butler [Tue, 15 Apr 2014 04:58:22 +0000 (05:58 +0100)]
Tests for issue 5997 failure and success conditions.

Closes #5997.

10 years agoAdd #[deriving(Hash)] to Result.
Richard Diamond [Thu, 17 Apr 2014 17:22:02 +0000 (12:22 -0500)]
Add #[deriving(Hash)] to Result.

10 years agoauto merge of #13569 : alexcrichton/rust/ignore-bytecode, r=brson
bors [Thu, 17 Apr 2014 13:16:24 +0000 (06:16 -0700)]
auto merge of #13569 : alexcrichton/rust/ignore-bytecode, r=brson

The name of the file changed awhile back and this spot wasn't updated to
continue ignoring the bytecode from rlibs when copying into staticlibs.

10 years agoauto merge of #13567 : iancormac84/rust/libc_windows_guid_fix, r=alexcrichton
bors [Thu, 17 Apr 2014 11:46:50 +0000 (04:46 -0700)]
auto merge of #13567 : iancormac84/rust/libc_windows_guid_fix, r=alexcrichton

structure's Data2 and Data3 members expect WORD types instead of DWORD. I
discovered this discrepancy while experimenting with some bindings to
Microsoft's OLE2 api. The discrepancy was corrupting the contents of the
string returned by UuidToString after I used known GUIDs to test the
accuracy of the function binding. I didn't add test cases because it would
mean adding a dependency to my rather incomplete binding library. However,
the fix produces expected string values when tested.

10 years agoauto merge of #13563 : lifthrasiir/rust/refman-dl, r=alexcrichton
bors [Thu, 17 Apr 2014 10:16:25 +0000 (03:16 -0700)]
auto merge of #13563 : lifthrasiir/rust/refman-dl, r=alexcrichton

Closes #13561. All definition lists have been converted to unordered lists. This is a temporary measure; please revert this when Sundown (or any replacement) gets a support for definition lists in the future.

10 years agoRegression test.
Felix S. Klock II [Wed, 2 Apr 2014 12:30:18 +0000 (14:30 +0200)]
Regression test.

10 years agoDrive-by: `pprust::*_to_str` for TypeMethod, Method, and FnDecl.
Felix S. Klock II [Fri, 11 Apr 2014 09:30:12 +0000 (11:30 +0200)]
Drive-by: `pprust::*_to_str` for TypeMethod, Method, and FnDecl.
10 years agoExtended `syntax::{fold, ast_map}` to include lifetimes.
Felix S. Klock II [Fri, 11 Apr 2014 09:28:43 +0000 (11:28 +0200)]
Extended `syntax::{fold, ast_map}` to include lifetimes.

Part of this required added an override of `fold_type_method` in the
Folder for Ctx impl; it follows the same pattern as `fold_method`.

Also, as a drive-by fix, I moved all of the calls to `folder.new_id`
in syntax::fold's no-op default traversal to really be the first
statement in each function.

  * This is to uphold the invariant that `folder.new_id` is always
    called first (an unfortunate requirement of the current `ast_map`
    code), an invariant that we seemingly were breaking in e.g. the
    previous `noop_fold_block`.

  * Now it should be easier to see when adding new code that this
    invariant must be upheld.

  * (note that the breakage in `noop_fold_block` may not have mattered
    so much previously, since the only thing that blocks can bind are
    lifetimes, which I am only adding support for now.)

10 years agoGuard variance inference for params bound in non-variance context.
Felix S. Klock II [Tue, 1 Apr 2014 16:31:04 +0000 (18:31 +0200)]
Guard variance inference for params bound in non-variance context.

Before adding a variance constrant for a given early-bound param,
check if it was meant to be inferred.

To support the above, added `fn is_to_be_inferred` to
`variance::ConstraintContext`.

10 years agosyntax: Parses `&&` as `& &` whenever appropriate.
Kang Seonghoon [Thu, 17 Apr 2014 08:35:31 +0000 (17:35 +0900)]
syntax: Parses `&&` as `& &` whenever appropriate.

Closes #11227.

10 years agoauto merge of #13557 : FlaPer87/rust/ls-behind-z, r=brson
bors [Thu, 17 Apr 2014 08:31:27 +0000 (01:31 -0700)]
auto merge of #13557 : FlaPer87/rust/ls-behind-z, r=brson

Closes #13549

10 years agoSimplify implementation of Bitv::{all,none} using iter builtins.
Yuri Kunde Schlesner [Thu, 17 Apr 2014 08:21:18 +0000 (05:21 -0300)]
Simplify implementation of Bitv::{all,none} using iter builtins.

10 years agoparallelisation of shootout-k-nucleotide
Guillaume Pinot [Thu, 17 Apr 2014 07:38:55 +0000 (09:38 +0200)]
parallelisation of shootout-k-nucleotide

10 years agoGive reduction-type tests in Bitv more natural names
Yuri Kunde Schlesner [Thu, 17 Apr 2014 05:08:20 +0000 (02:08 -0300)]
Give reduction-type tests in Bitv more natural names

10 years agoauto merge of #13550 : brson/rust/man, r=alexcrichton
bors [Thu, 17 Apr 2014 04:56:22 +0000 (21:56 -0700)]
auto merge of #13550 : brson/rust/man, r=alexcrichton

--no-analysis, --dep-info, -C relocation-model, remove --gen-crate-map

10 years agoauto merge of #13503 : edwardw/rust/lifetime-ice, r=nikomatsakis
bors [Thu, 17 Apr 2014 03:31:25 +0000 (20:31 -0700)]
auto merge of #13503 : edwardw/rust/lifetime-ice, r=nikomatsakis

When instantiating trait default methods for certain implementation,
`typeck` correctly combined type parameters from trait bound with those
from method bound, but didn't do so for lifetime parameters. Applies
the same logic to lifetime parameters.

Closes #13204

10 years agoauto merge of #13499 : brson/rust/resultdocs, r=brson
bors [Thu, 17 Apr 2014 02:11:26 +0000 (19:11 -0700)]
auto merge of #13499 : brson/rust/resultdocs, r=brson

This adds some fairly extensive documentation for `Result`.

I'm using manual links to other rustdoc html pages a bit.

10 years agoauto merge of #13485 : adrientetar/rust/newrustdoc, r=brson
bors [Thu, 17 Apr 2014 00:51:28 +0000 (17:51 -0700)]
auto merge of #13485 : adrientetar/rust/newrustdoc, r=brson

- Cherry-pick from #12996
- Use Fira Sans for headlines and sidebar (Light), Heuristica for the body (Adobe Utopia derivative). Both are licensed under the SIL OFL license.
- A few tweaks

Two examples: [modified `std`](http://adrientetar.legtux.org/cached/rust-docs/std.htm) and [modified `std::io`](http://adrientetar.legtux.org/cached/rust-docs/io.htm).

cc #13484
**Blocked on graydon/rust-www#25 (for hosting of the fonts), that's showcased [here](http://adrientetar.github.io/rust-www/).**

cc @brson, @TheHydroImpulse

10 years agorustc: Fix omission of bytecode in staticlibs
Alex Crichton [Thu, 17 Apr 2014 00:29:08 +0000 (17:29 -0700)]
rustc: Fix omission of bytecode in staticlibs

The name of the file changed awhile back and this spot wasn't updated to
continue ignoring the bytecode from rlibs when copying into staticlibs.

10 years agoauto merge of #13465 : alexcrichton/rust/fix-comm-dox, r=brson
bors [Wed, 16 Apr 2014 23:31:29 +0000 (16:31 -0700)]
auto merge of #13465 : alexcrichton/rust/fix-comm-dox, r=brson

Some of this documentation got a little out of date. There was no mention of a
`SyncSender`, and the entire "Outside the runtime" section isn't really true any
more (or really all that relevant).

This also updates a few other doc blocks and adds some examples.

10 years agoauto merge of #13432 : ruediger/rust/rustmode, r=nikomatsakis
bors [Wed, 16 Apr 2014 21:31:32 +0000 (14:31 -0700)]
auto merge of #13432 : ruediger/rust/rustmode, r=nikomatsakis

* Use `setq-local` instead of `(set (make-local-variable 'var) value)`.  Provides a version for older Emacsen.
* Remove use of `cl.el`.
* Use \' in file regexp instead of line end match $.
* Use type for `defcustom` and add parent group.

10 years agoauto merge of #13418 : ktt3ja/rust/move-out-of, r=brson
bors [Wed, 16 Apr 2014 20:11:30 +0000 (13:11 -0700)]
auto merge of #13418 : ktt3ja/rust/move-out-of, r=brson

This commit changes the way move errors are reported when some value is
captured by a PatIdent. First, we collect all of the "cannot move out
of" errors before reporting them, and those errors with the same "move
source" are reported together. If the move is caused by a PatIdent (that
binds by value), we add a note indicating where it is and suggest the
user to put `ref` if they don't want the value to move. This makes the
"cannot move out of" error in match expression nicer (though the extra
note may not feel that helpful in other places :P). For example, with
the following code snippet,

```rust
enum Foo {
    Foo1(~u32, ~u32),
    Foo2(~u32),
    Foo3,
}

fn main() {
    let f = &Foo1(~1u32, ~2u32);
    match *f {
        Foo1(num1, num2) => (),
        Foo2(num) => (),
        Foo3 => ()
    }
}
```

Errors before the change:

```rust
test.rs:10:9: 10:25 error: cannot move out of dereference of `&`-pointer
test.rs:10         Foo1(num1, num2) => (),
                   ^~~~~~~~~~~~~~~~
test.rs:10:9: 10:25 error: cannot move out of dereference of `&`-pointer
test.rs:10         Foo1(num1, num2) => (),
                   ^~~~~~~~~~~~~~~~
test.rs:11:9: 11:18 error: cannot move out of dereference of `&`-pointer
test.rs:11         Foo2(num) => (),
                   ^~~~~~~~~
```

After:

```rust
test.rs:9:11: 9:13 error: cannot move out of dereference of `&`-pointer
test.rs:9     match *f {
                    ^~
test.rs:10:14: 10:18 note: attempting to move value to here (to prevent the move, use `ref num1` or `ref mut num1` to capture value by reference)
test.rs:10         Foo1(num1, num2) => (),
                        ^~~~
test.rs:10:20: 10:24 note: and here (use `ref num2` or `ref mut num2`)
test.rs:10         Foo1(num1, num2) => (),
                              ^~~~
test.rs:11:14: 11:17 note: and here (use `ref num` or `ref mut num`)
test.rs:11         Foo2(num) => (),
                        ^~~
```

Close #8064

10 years agoThis is a Windows specific fix in libc. According to MSDN, the GUID
iancormac84 [Wed, 16 Apr 2014 19:43:17 +0000 (15:43 -0400)]
This is a Windows specific fix in libc. According to MSDN, the GUID
structure's Data2 and Data3 members expect WORD types instead of DWORD. I
discovered this discrepancy while experimenting with some bindings to
Microsoft's OLE2 api. The discrepancy was corrupting the contents of the
string returned by UuidToString after I used known GUIDs to test the
accuracy of the function binding. I didn't add test cases because it would
mean adding a dependency to my rather incomplete binding library. However,
the fix produces expected string values when tested.

10 years agorustc: Don't allocate a cnum to syntax crates
Alex Crichton [Wed, 16 Apr 2014 18:42:22 +0000 (11:42 -0700)]
rustc: Don't allocate a cnum to syntax crates

Syntax-only crates are no longer registered with the cstore, so there's no need
to allocate crate numbers to them. This ends up leaving gaps in the crate
numbering scheme which is not expected in the rest of the compiler.

Closes #13560

10 years agodoc: Address review feedback
Brian Anderson [Tue, 15 Apr 2014 06:12:34 +0000 (23:12 -0700)]
doc: Address review feedback

10 years agostd: Improve docs for mod 'result'
Brian Anderson [Sat, 12 Apr 2014 23:33:21 +0000 (16:33 -0700)]
std: Improve docs for mod 'result'

10 years agorustc: Slightly reword the --no-analysis description for clarity
Brian Anderson [Wed, 16 Apr 2014 03:33:14 +0000 (20:33 -0700)]
rustc: Slightly reword the --no-analysis description for clarity

10 years agoman: Add missing options to rustc.1
Brian Anderson [Wed, 16 Apr 2014 03:32:54 +0000 (20:32 -0700)]
man: Add missing options to rustc.1

10 years agoauto merge of #13454 : brson/rust/noglobs, r=alexcrichton
bors [Wed, 16 Apr 2014 17:56:31 +0000 (10:56 -0700)]
auto merge of #13454 : brson/rust/noglobs, r=alexcrichton

Them removes all the glob reexports from liblibc. I did it by removing them all, and then adding back per-platform explicit reexports until everything built again.

I realize this isn't the best strategy for determining an API, but this is the lowest-impact change that solves the problem, plus I'm dissatisfied with the design of this library for other reasons and think it needs to be reconsidered from top to bottom (later).

Progress on #11870.

10 years agodoc: Removed all definition lists as Sundown doesn't support them.
Kang Seonghoon [Wed, 16 Apr 2014 17:45:50 +0000 (02:45 +0900)]
doc: Removed all definition lists as Sundown doesn't support them.

Closes #13561. Please revert this commit when Sundown (or any
replacement) gets a support for definition lists in the future.

10 years agoCombine lifetime parameters when instantiating default methods
Edward Wang [Mon, 14 Apr 2014 00:33:04 +0000 (08:33 +0800)]
Combine lifetime parameters when instantiating default methods

When instantiating trait default methods for certain implementation,
`typeck` correctly combined type parameters from trait bound with those
from method bound, but didn't do so for lifetime parameters. Applies
the same logic to lifetime parameters.

Closes #13204

10 years agoauto merge of #13556 : michaelwoerister/rust/various-fixes, r=alexcrichton
bors [Wed, 16 Apr 2014 16:36:33 +0000 (09:36 -0700)]
auto merge of #13556 : michaelwoerister/rust/various-fixes, r=alexcrichton

This is a test case verifying that issue #12886 was indeed fixed by PR #13441 from last week.
Fixes #12886.

10 years agoMove `--ls` behind `-Z ls`
Flavio Percoco [Wed, 16 Apr 2014 14:28:09 +0000 (16:28 +0200)]
Move `--ls` behind `-Z ls`

Closes #13549

10 years agoRegister new snapshots
Alex Crichton [Wed, 16 Apr 2014 15:06:44 +0000 (08:06 -0700)]
Register new snapshots

10 years agoauto merge of #13547 : alexcrichton/rust/remove-priv, r=huonw
bors [Wed, 16 Apr 2014 15:16:35 +0000 (08:16 -0700)]
auto merge of #13547 : alexcrichton/rust/remove-priv, r=huonw

See [RFC 6](https://github.com/rust-lang/rfcs/blob/e0c741f1c6e372d0fd31c5978fcf8c7bd7c3e973/active/0006-remove-priv.md)

10 years agosyntax: Demote `priv` to a reserved keyword
Alex Crichton [Wed, 16 Apr 2014 02:32:42 +0000 (19:32 -0700)]
syntax: Demote `priv` to a reserved keyword

It is no longer used in rust anywhere.

RFC: 0006-remove-priv

10 years agorustc: Remove private enum variants
Alex Crichton [Wed, 16 Apr 2014 01:02:58 +0000 (18:02 -0700)]
rustc: Remove private enum variants

This removes the `priv` keyword from the language and removes private enum
variants as a result. The remaining use cases of private enum variants were all
updated to be a struct with one private field that is a private enum.

RFC: 0006-remove-priv

Closes #13535

10 years agoauto merge of #13544 : klutzy/rust/pprust, r=alexcrichton
bors [Wed, 16 Apr 2014 12:11:26 +0000 (05:11 -0700)]
auto merge of #13544 : klutzy/rust/pprust, r=alexcrichton

Fixes #12685

10 years agoauto merge of #13539 : Aatch/rust/vector-copy-faster, r=thestinger
bors [Wed, 16 Apr 2014 10:36:27 +0000 (03:36 -0700)]
auto merge of #13539 : Aatch/rust/vector-copy-faster, r=thestinger

LLVM wasn't recognising the loops as memcpy loops and was therefore failing to optimise them properly. While improving LLVM is the "proper" way to fix this, I think that these cases are important enough to warrant a little low-level optimisation.

Fixes #13472

r? @thestinger

---

Benchmark Results:

```
--- Before ---
test clone_owned          ... bench:   6126104 ns/iter (+/- 285962) = 170 MB/s
test clone_owned_to_owned ... bench:   6125054 ns/iter (+/- 271197) = 170 MB/s
test clone_str            ... bench:     80586 ns/iter (+/- 11489) = 13011 MB/s
test clone_vec            ... bench:   3903220 ns/iter (+/- 658556) = 268 MB/s
test test_memcpy          ... bench:     69401 ns/iter (+/- 2168) = 15108 MB/s

--- After ---
test clone_owned          ... bench:     70839 ns/iter (+/- 4931) = 14801 MB/s
test clone_owned_to_owned ... bench:     70286 ns/iter (+/- 4836) = 14918 MB/s
test clone_str            ... bench:     78519 ns/iter (+/- 5511) = 13353 MB/s
test clone_vec            ... bench:     71415 ns/iter (+/- 1999) = 14682 MB/s
test test_memcpy          ... bench:     70980 ns/iter (+/- 2126) = 14772 MB/s
```

10 years agodebuginfo: Add a test case for issue #12886.
Michael Woerister [Wed, 16 Apr 2014 10:22:38 +0000 (12:22 +0200)]
debuginfo: Add a test case for issue #12886.

10 years agoauto merge of #13527 : huonw/rust/macro-expander-trait, r=sfackler
bors [Wed, 16 Apr 2014 09:16:30 +0000 (02:16 -0700)]
auto merge of #13527 : huonw/rust/macro-expander-trait, r=sfackler

There's now one unified way to return things from a macro, instead of
being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr`
variants of the `MacResult` enum. This does simplify the logic handling
the expansions, but the biggest value of this is it makes macros in (for
example) type position easier to implement, as there's this single thing
to modify.

By my measurements (using `-Z time-passes` on libstd and librustc etc.),
this appears to have little-to-no impact on expansion speed. There are
presumably larger costs than the small number of extra allocations and
virtual calls this adds (notably, all `macro_rules!`-defined macros have
not changed in behaviour, since they had to use the `AnyMacro` trait
anyway).

---

Summary of changes for dynamic syntax extension maintainers:

- `MacResult` is now a trait, and is returned as `~MacResult`
- `MRExpr` & `MRItem` are now `MacExpr::new` and `MacItem:new` respectively (which return `~MacResult`s)
- `MacResult::dummy_...` is `DummyResult::any` or `DummyResult::expr`

10 years agoauto merge of #13522 : seanmonstar/rust/sip, r=alexcrichton
bors [Wed, 16 Apr 2014 07:56:30 +0000 (00:56 -0700)]
auto merge of #13522 : seanmonstar/rust/sip, r=alexcrichton

work started from @gereeter's PR: https://github.com/mozilla/rust/pull/13114
but adjusted bits

```
before
test hash::sip::tests::bench_u64                            ... bench:        34 ns/iter (+/- 0)
test hash::sip::tests::bench_str_under_8_bytes              ... bench:        37 ns/iter (+/- 1)
test hash::sip::tests::bench_str_of_8_bytes                 ... bench:        43 ns/iter (+/- 1)
test hash::sip::tests::bench_str_over_8_bytes               ... bench:        50 ns/iter (+/- 1)
test hash::sip::tests::bench_long_str                       ... bench:       613 ns/iter (+/- 14)
test hash::sip::tests::bench_compound_1                     ... bench:       114 ns/iter (+/- 11)

after
test hash::sip::tests::bench_u64                            ... bench:        25 ns/iter (+/- 0)
test hash::sip::tests::bench_str_under_8_bytes              ... bench:        31 ns/iter (+/- 0)
test hash::sip::tests::bench_str_of_8_bytes                 ... bench:        36 ns/iter (+/- 0)
test hash::sip::tests::bench_str_over_8_bytes               ... bench:        40 ns/iter (+/- 0)
test hash::sip::tests::bench_long_str                       ... bench:       600 ns/iter (+/- 14)
test hash::sip::tests::bench_compound_1                     ... bench:        64 ns/iter (+/- 6)
```

Notably it seems smaller keys will hash faster. A long string doesn't see much gains, but compound cuts in half (once compound used a `int` and `u64`).

10 years agosyntax: unify all MacResult's into a single trait.
Huon Wilson [Tue, 15 Apr 2014 12:00:14 +0000 (22:00 +1000)]
syntax: unify all MacResult's into a single trait.

There's now one unified way to return things from a macro, instead of
being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr`
variants of the `MacResult` enum. This does simplify the logic handling
the expansions, but the biggest value of this is it makes macros in (for
example) type position easier to implement, as there's this single thing
to modify.

By my measurements (using `-Z time-passes` on libstd and librustc etc.),
this appears to have little-to-no impact on expansion speed. There are
presumably larger costs than the small number of extra allocations and
virtual calls this adds (notably, all `macro_rules!`-defined macros have
not changed in behaviour, since they had to use the `AnyMacro` trait
anyway).

10 years agopprust: Handle multi-stmt/no-expr `ExprFnBlock`
klutzy [Tue, 15 Apr 2014 07:58:50 +0000 (16:58 +0900)]
pprust: Handle multi-stmt/no-expr `ExprFnBlock`

Fixes #12685

10 years agoauto merge of #13532 : alexcrichton/rust/rollup, r=alexcrichton
bors [Wed, 16 Apr 2014 06:36:58 +0000 (23:36 -0700)]
auto merge of #13532 : alexcrichton/rust/rollup, r=alexcrichton

10 years agoTest fixes from the rollup
Alex Crichton [Tue, 15 Apr 2014 15:32:35 +0000 (08:32 -0700)]
Test fixes from the rollup

Closes #13546 (workcache: Don't assume gcc exists on all platforms)
Closes #13545 (std: Remove pub use globs)
Closes #13530 (test: Un-ignore smallest-hello-world.rs)
Closes #13529 (std: Un-ignore some float tests on windows)
Closes #13528 (green: Add a helper macro for booting libgreen)
Closes #13526 (Remove RUST_LOG="::help" from the docs)
Closes #13524 (dist: Make Windows installer uninstall first. Closes #9563)
Closes #13521 (Change AUTHORS section in the man pages)
Closes #13519 (Update GitHub's Rust projects page.)
Closes #13518 (mk: Change windows to install from stage2)
Closes #13516 (liburl doc: insert missing hyphen)
Closes #13514 (rustdoc: Better sorting criteria for searching.)
Closes #13512 (native: Fix a race in select())
Closes #13506 (Use the unsigned integer types for bitwise intrinsics.)
Closes #13502 (Add a default impl for Set::is_superset)

10 years agoauto merge of #13390 : alexcrichton/rust/run-some-destructors, r=brson
bors [Wed, 16 Apr 2014 04:17:00 +0000 (21:17 -0700)]
auto merge of #13390 : alexcrichton/rust/run-some-destructors, r=brson

Previously, if statements of the form "Foo;" or "let _ = Foo;" were encountered
where Foo had a destructor, the destructors were not run. This changes
the relevant locations in trans to check for ty::type_needs_drop and invokes
trans_to_lvalue instead of trans_into.

Closes #4734
Closes #6892

10 years agogreen: Add a helper macro for booting libgreen
Alex Crichton [Tue, 15 Apr 2014 13:27:09 +0000 (06:27 -0700)]
green: Add a helper macro for booting libgreen

This one-liner should help booting libgreen with librustuv without having to
worry about all the fiddly bits of argc/argv and whatnot.

10 years agostd: Un-ignore some float tests on windows
Alex Crichton [Tue, 15 Apr 2014 13:35:15 +0000 (06:35 -0700)]
std: Un-ignore some float tests on windows

These were fixed in the upgrade from mingw32 to mingw64.

Closes #8663

10 years agotest: Un-ignore smallest-hello-world.rs
Alex Crichton [Tue, 15 Apr 2014 13:41:27 +0000 (06:41 -0700)]
test: Un-ignore smallest-hello-world.rs

Rebased through the ages to bring the test up to date.

Closes #8538

10 years agostd: Remove pub use globs
Brian Anderson [Wed, 16 Apr 2014 01:18:08 +0000 (18:18 -0700)]
std: Remove pub use globs

10 years agoworkcache: Don't assume gcc exists on all platforms
Alex Crichton [Wed, 16 Apr 2014 01:25:38 +0000 (18:25 -0700)]
workcache: Don't assume gcc exists on all platforms

FreeBSD has recently moved to clang by default, and no longer ship gcc. Instead
use "cc" on unix platforms (the default compiler) and "gcc" on windows.

10 years agoMore default impl and docs removal in treemap
Steven Fackler [Mon, 14 Apr 2014 03:30:08 +0000 (20:30 -0700)]
More default impl and docs removal in treemap

10 years agoAdd a default impl for Set::is_superset
Steven Fackler [Mon, 14 Apr 2014 03:22:58 +0000 (20:22 -0700)]
Add a default impl for Set::is_superset

I also deleted a bunch of documentation that was copy/pasted from the
trait definition.

10 years agoUse the unsigned integer types for bitwise intrinsics.
Huon Wilson [Mon, 14 Apr 2014 10:04:14 +0000 (20:04 +1000)]
Use the unsigned integer types for bitwise intrinsics.

Exposing ctpop, ctlz, cttz and bswap as taking signed i8/i16/... is just
exposing the internal LLVM names pointlessly (LLVM doesn't have "signed
integers" or "unsigned integers", it just has sized integer types
with (un)signed *operations*).

These operations are semantically working with raw bytes, which the
unsigned types model better.

10 years agonative: Fix a race in select()
Alex Crichton [Mon, 14 Apr 2014 14:06:14 +0000 (07:06 -0700)]
native: Fix a race in select()

During selection, libnative would erroneously re-acquire ownership of a task
when a separate thread still had ownership of the task. The loop in select()
was rewritten to acknowledge this race and instead block waiting to re-acquire
ownership rather than plowing through.

Closes #13494

10 years agonative: Be more stringent about pattern matching
Alex Crichton [Mon, 14 Apr 2014 14:05:37 +0000 (07:05 -0700)]
native: Be more stringent about pattern matching

Trying to avoid a wildcard where possible.

10 years agostd: Impl Deref/DerefMut for a borrowed task
Alex Crichton [Sun, 13 Apr 2014 21:39:04 +0000 (14:39 -0700)]
std: Impl Deref/DerefMut for a borrowed task

10 years agorustdoc: Better sorting criteria for searching.
Kang Seonghoon [Mon, 14 Apr 2014 18:39:59 +0000 (03:39 +0900)]
rustdoc: Better sorting criteria for searching.

This essentially rewrites the sorting algorithm, which relied on
the implementation-defined handling of non-consistent sorting function
(cf. ECMA-262 5th edition, section 15.4.4.11)
and was also a bit inefficient.

The new criteria expands the prior criteria while adding these ones:

- The current crate is always preferred over other crates.
  (Closes #13178)
- An item with a description is preferred over one without it,
  if item names match. This is a heuristic assuming that
  the documented item is more likely to be relevant.
- An item with no literal occurrence of search query is handled correctly.

10 years agoliburl doc: insert missing hyphen
Chris Shea [Mon, 14 Apr 2014 19:48:30 +0000 (15:48 -0400)]
liburl doc: insert missing hyphen

10 years agomk: Change windows to install from stage2
Alex Crichton [Mon, 14 Apr 2014 20:42:45 +0000 (13:42 -0700)]
mk: Change windows to install from stage2

In the past, windows was installed from stage3 to guarantee convergence between
the host and target artifacts, but syntax extensions on all platforms are
currently relying on convergence, so special casing this one platform has become
less relevant over time.

This will also have the added benefit of dealing with #13474 and #13491. These
issues will be closed after next next nightly is confirmed to fix them.

10 years agoUpdate GitHub's Rust projects page.
Mihnea Dobrescu-Balaur [Mon, 14 Apr 2014 21:03:33 +0000 (23:03 +0200)]
Update GitHub's Rust projects page.

10 years agoChange AUTHORS section in the man pages
Tobias Bucher [Mon, 14 Apr 2014 21:55:40 +0000 (23:55 +0200)]
Change AUTHORS section in the man pages

The man pages no longer contain Graydon Hoare as the project lead.

Fix #13509.

10 years agodist: Make Windows installer uninstall first. Closes #9563
Brian Anderson [Sat, 12 Apr 2014 01:20:10 +0000 (18:20 -0700)]
dist: Make Windows installer uninstall first. Closes #9563

This will remove existing files before installing new ones. Note
that I took some code with no license from stackoverflow, as
indicated in comments.

10 years agoRemove RUST_LOG="::help" from the docs
Tobias Bucher [Tue, 15 Apr 2014 07:56:21 +0000 (09:56 +0200)]
Remove RUST_LOG="::help" from the docs

This feature is no longer present in the current version, it was removed along
with the crate map.

10 years agoMake Vec::clone and slice::to_owned failure-safe
James Miller [Wed, 16 Apr 2014 02:29:36 +0000 (14:29 +1200)]
Make Vec::clone and slice::to_owned failure-safe

10 years agoauto merge of #13498 : johnsoft/rust/fix-transmute-fn-names, r=alexcrichton
bors [Wed, 16 Apr 2014 02:21:57 +0000 (19:21 -0700)]
auto merge of #13498 : johnsoft/rust/fix-transmute-fn-names, r=alexcrichton

Regions were renamed to lifetimes a while back, so these functions should probably be renamed as well.

10 years agoRemove usage of private enum variants
Alex Crichton [Wed, 16 Apr 2014 01:05:38 +0000 (18:05 -0700)]
Remove usage of private enum variants

This replaces all uses of private enum variants with a struct that has
one private field pointing at a private enum.

RFC: 0006-remove-priv

10 years agoauto merge of #13511 : Meyermagic/rust/enum_typeid, r=alexcrichton
bors [Wed, 16 Apr 2014 00:31:54 +0000 (17:31 -0700)]
auto merge of #13511 : Meyermagic/rust/enum_typeid, r=alexcrichton

Fixes #13507.

I haven't familiarized myself with this part of the rust compiler, so hopefully there are no mistakes (despite the simplicity of the commit). It is also 5am.

10 years agoImprove the copying code for slices and Vec
James Miller [Tue, 15 Apr 2014 23:35:18 +0000 (11:35 +1200)]
Improve the copying code for slices and Vec

10 years agooptimized SipHash implementation
Sean McArthur [Mon, 14 Apr 2014 21:43:38 +0000 (14:43 -0700)]
optimized SipHash implementation

work started from @gereeter's PR: https://github.com/mozilla/rust/pull/13114
but adjusted bits

10 years agoauto merge of #13164 : ktt3ja/rust/lifetime-suggestion-method, r=nmatsakis
bors [Tue, 15 Apr 2014 21:16:54 +0000 (14:16 -0700)]
auto merge of #13164 : ktt3ja/rust/lifetime-suggestion-method, r=nmatsakis

This includes a change to the way lifetime names are generated. Say we
figure that `[#0, 'a, 'b]` have to be the same lifetimes, then instead
of just generating a new lifetime `'c` like before to replace them, we
would reuse `'a`. This is done so that when the lifetime name comes
from an impl, we don't give something that's completely off, and we
don't have to do much work to figure out where the name came from. For
example, for the following code snippet:

```rust
struct Baz<'x> {
    bar: &'x int
}

impl<'x> Baz<'x> {
    fn baz1(&self) -> &int {
        self.bar
    }
}
```

`[#1, 'x]` (where `#1` is BrAnon(1) and refers to lifetime of `&int`)
have to be marked the same lifetime. With the old method, we would
generate a new lifetime `'a` and suggest `fn baz1(&self) -> &'a int`
or `fn baz1<'a>(&self) -> &'a int`, both of which are wrong.

10 years agoSupport lifetime suggestion for method
Kiet Tran [Wed, 26 Mar 2014 23:12:50 +0000 (19:12 -0400)]
Support lifetime suggestion for method

This includes a change to the way lifetime names are generated. Say we
figure that `[#0, 'a, 'b]` have to be the same lifetimes, then instead
of just generating a new lifetime `'c` like before to replace them, we
would reuse `'a`. This is done so that when the lifetime name comes
from an impl, we don't give something that's completely off, and we
don't have to do much work to figure out where the name came from. For
example, for the following code snippet:

```rust
struct Baz<'x> {
    bar: &'x int
}

impl<'x> Baz<'x> {
    fn baz1(&self) -> &int {
        self.bar
    }
}
```

`[#1, 'x]` (where `#1` is BrAnon(1) and refers to lifetime of `&int`)
have to be marked the same lifetime. With the old method, we would
generate a new lifetime `'a` and suggest `fn baz1(&self) -> &'a int`
or `fn baz1<'a>(&self) -> &'a int`, both of which are wrong.

10 years agolibc: Deglob reexports. #11870
Brian Anderson [Wed, 9 Apr 2014 03:20:16 +0000 (20:20 -0700)]
libc: Deglob reexports. #11870

10 years agoauto merge of #13489 : JustAPerson/rust/crate-file-name, r=alexcrichton
bors [Tue, 15 Apr 2014 18:02:03 +0000 (11:02 -0700)]
auto merge of #13489 : JustAPerson/rust/crate-file-name, r=alexcrichton

Before, the `--crate-file-name` flag only checked crate attributes for
possible crate types. Now, if any type is specified by one or more
`--crate-type` flags, only the filenames for those types will be
emitted, and any types specified by crate attributes will be ignored.

10 years agostd: Update documentation on the `comm` module
Alex Crichton [Fri, 11 Apr 2014 19:59:30 +0000 (12:59 -0700)]
std: Update documentation on the `comm` module

Some of this documentation got a little out of date. There was no mention of a
`SyncSender`, and the entire "Outside the runtime" section isn't really true any
more (or really all that relevant).

This also updates a few other doc blocks and adds some examples.