]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoRegister new snapshots
Alex Crichton [Mon, 3 Mar 2014 21:24:29 +0000 (13:24 -0800)]
Register new snapshots

This should fix the travis builds.

10 years agoauto merge of #12673 : huonw/rust/extendable-vec, r=Aatch
bors [Mon, 3 Mar 2014 22:51:42 +0000 (14:51 -0800)]
auto merge of #12673 : huonw/rust/extendable-vec, r=Aatch

std: add reserve_additional and an Extendable impl to Vec.

10 years agostd: add reserve_additional and an Extendable impl to Vec.
Huon Wilson [Mon, 3 Mar 2014 20:46:24 +0000 (07:46 +1100)]
std: add reserve_additional and an Extendable impl to Vec.

10 years agoauto merge of #12665 : alexcrichton/rust/fix-snap-again, r=huonw
bors [Mon, 3 Mar 2014 13:51:38 +0000 (05:51 -0800)]
auto merge of #12665 : alexcrichton/rust/fix-snap-again, r=huonw

This should get us a passing snapshot again.

10 years agotest: Ignore some more syntax extension tests
Alex Crichton [Mon, 3 Mar 2014 08:08:13 +0000 (00:08 -0800)]
test: Ignore some more syntax extension tests

This should get us a passing snapshot again.

10 years agoauto merge of #12663 : MicahChalmer/rust/emacs-remove-ws-bug-warning, r=brson
bors [Mon, 3 Mar 2014 04:56:30 +0000 (20:56 -0800)]
auto merge of #12663 : MicahChalmer/rust/emacs-remove-ws-bug-warning, r=brson

The incompatibility of rust-mode with global-whitespace-mode warned
about in the README was actually fixed by commit 581b3db3b3.  Remove the
warning from the README and close #3994.

10 years agoEmacs: Remove README warning of old whitespace bug
Micah Chalmer [Mon, 3 Mar 2014 03:02:18 +0000 (22:02 -0500)]
Emacs: Remove README warning of old whitespace bug

The incompatibility of rust-mode with global-whitespace-mode warned
about in the README was actually fixed by commit 581b3db3b3.  Remove the
warning from the README and close #3994.

10 years agoauto merge of #12662 : sfackler/rust/unexported-type, r=cmr
bors [Mon, 3 Mar 2014 01:36:28 +0000 (17:36 -0800)]
auto merge of #12662 : sfackler/rust/unexported-type, r=cmr

10 years agoauto merge of #12659 : alexcrichton/rust/fix-snap, r=sfackler
bors [Mon, 3 Mar 2014 00:21:33 +0000 (16:21 -0800)]
auto merge of #12659 : alexcrichton/rust/fix-snap, r=sfackler

These tests are failing on the snap builders, and are now tagged with a FIXME.

cc #12102

10 years agoMake visible types public in rustc
Steven Fackler [Sun, 2 Mar 2014 23:26:39 +0000 (15:26 -0800)]
Make visible types public in rustc

10 years agoauto merge of #12658 : sfackler/rust/asm-expand, r=alexcrichton
bors [Sun, 2 Mar 2014 23:06:34 +0000 (15:06 -0800)]
auto merge of #12658 : sfackler/rust/asm-expand, r=alexcrichton

A couple of syntax extensions manually expanded expressions, but it
wasn't done universally, most noticably inside of asm!().

There's also a bit of random cleanup.

10 years agotest: Ignore some phase(syntax) tests
Alex Crichton [Sun, 2 Mar 2014 22:32:20 +0000 (14:32 -0800)]
test: Ignore some phase(syntax) tests

These tests are failing on the snap builders, and are now tagged with a FIXME.

cc #12102

10 years agoExpand string literals and exprs inside of macros
Steven Fackler [Sun, 2 Mar 2014 21:38:44 +0000 (13:38 -0800)]
Expand string literals and exprs inside of macros

A couple of syntax extensions manually expanded expressions, but it
wasn't done universally, most noticably inside of asm!().

There's also a bit of random cleanup.

10 years agoauto merge of #12656 : Armavica/rust/terminfo, r=sfackler
bors [Sun, 2 Mar 2014 21:41:28 +0000 (13:41 -0800)]
auto merge of #12656 : Armavica/rust/terminfo, r=sfackler

According to `/etc/terminfo/README`,
```
This directory is for system-local terminfo descriptions. By default,
ncurses will search ${HOME}/.terminfo first, then /etc/terminfo (this
directory), then /lib/terminfo, and last not least /usr/share/terminfo.
```

10 years agoAdd /etc/terminfo to the terminfo search paths
Virgile Andreani [Sun, 2 Mar 2014 20:40:43 +0000 (21:40 +0100)]
Add /etc/terminfo to the terminfo search paths

10 years agoauto merge of #12651 : lucab/rust/llvmdep-ldflags, r=alexcrichton
bors [Sun, 2 Mar 2014 19:21:34 +0000 (11:21 -0800)]
auto merge of #12651 : lucab/rust/llvmdep-ldflags, r=alexcrichton

This commit let librustc automatically pickup LDFLAGS dependencies
inherited from LLVM, which may otherwise result in undefined
references to external symbols under certain linking environment.

A symptom of this issue is eg. a failure when trying to link against
librustc (due to unresolved ffi_* symbols), while using a system-wide
LLVM.

Signed-off-by: Luca Bruno <lucab@debian.org>
10 years agotravis: remove manually added RUSTFLAGS
Luca Bruno [Sun, 2 Mar 2014 19:02:42 +0000 (20:02 +0100)]
travis: remove manually added RUSTFLAGS

Indirect dependencies should now be picked up through the
autogenerated llvmdeps.rs instead.

Signed-off-by: Luca Bruno <lucab@debian.org>
10 years agoauto merge of #12637 : pcwalton/rust/devecing, r=alexcrichton
bors [Sun, 2 Mar 2014 16:31:33 +0000 (08:31 -0800)]
auto merge of #12637 : pcwalton/rust/devecing, r=alexcrichton

r? @alexcrichton

10 years agolibrustc: add LLVM LDFLAGS to deps
Luca Bruno [Sun, 2 Mar 2014 16:29:54 +0000 (17:29 +0100)]
librustc: add LLVM LDFLAGS to deps

This commit let librustc automatically pickup LDFLAGS dependencies
inherited from LLVM, which may otherwise result in undefined
references to external symbols under certain linking environment.

A symptom of this issue is eg. a failure when trying to link against
librustc (due to unresolved ffi_*i symbols), while using a system-wide
LLVM.

Signed-off-by: Luca Bruno <lucab@debian.org>
10 years agoauto merge of #12647 : huonw/rust/rustdoc-highlight-macros, r=alexcrichton
bors [Sun, 2 Mar 2014 09:41:23 +0000 (01:41 -0800)]
auto merge of #12647 : huonw/rust/rustdoc-highlight-macros, r=alexcrichton

Macro definitions are just their raw source code, and so should be
highlighted where possible. Also, $ident non-terminal substitutions are
special, and so are worthy of a little special treatment.

10 years agoauto merge of #12645 : alexcrichton/rust/invalid-libraries, r=brson
bors [Sun, 2 Mar 2014 08:26:26 +0000 (00:26 -0800)]
auto merge of #12645 : alexcrichton/rust/invalid-libraries, r=brson

When the metadata format changes, old libraries often cause librustc to abort
when reading their metadata. This should all change with the introduction of SVH
markers, but the loader for crates should gracefully handle libraries without
SVH markers still.

This commit adds support for tripping fewer assertions when loading libraries by
using maybe_get_doc when initially parsing metadata. It's still possible for
some libraries to fall through the cracks, but this should deal with a fairly
large number of them up front.

10 years agorustc: Better error when loading invalid libraries
Alex Crichton [Sat, 1 Mar 2014 19:09:30 +0000 (11:09 -0800)]
rustc: Better error when loading invalid libraries

When the metadata format changes, old libraries often cause librustc to abort
when reading their metadata. This should all change with the introduction of SVH
markers, but the loader for crates should gracefully handle libraries without
SVH markers still.

This commit adds support for tripping fewer assertions when loading libraries by
using maybe_get_doc when initially parsing metadata. It's still possible for
some libraries to fall through the cracks, but this should deal with a fairly
large number of them up front.

10 years agolibfourcc: Fix errors arising from the automated `~[T]` conversion
Patrick Walton [Sat, 1 Mar 2014 02:04:40 +0000 (18:04 -0800)]
libfourcc: Fix errors arising from the automated `~[T]` conversion

10 years agolibrustdoc: Fix errors arising from the automated `~[T]` conversion
Patrick Walton [Sat, 1 Mar 2014 01:46:09 +0000 (17:46 -0800)]
librustdoc: Fix errors arising from the automated `~[T]` conversion

10 years agolibrustc: Fix errors arising from the automated `~[T]` conversion
Patrick Walton [Fri, 28 Feb 2014 23:25:15 +0000 (15:25 -0800)]
librustc: Fix errors arising from the automated `~[T]` conversion

10 years agolibsyntax: Fix errors arising from the automated `~[T]` conversion
Patrick Walton [Fri, 28 Feb 2014 20:54:01 +0000 (12:54 -0800)]
libsyntax: Fix errors arising from the automated `~[T]` conversion

10 years agolibsyntax: Mechanically change `~[T]` to `Vec<T>`
Patrick Walton [Fri, 28 Feb 2014 21:09:09 +0000 (13:09 -0800)]
libsyntax: Mechanically change `~[T]` to `Vec<T>`

10 years agolibstd: Add some functionality to `Vec<T>`
Patrick Walton [Fri, 28 Feb 2014 20:55:51 +0000 (12:55 -0800)]
libstd: Add some functionality to `Vec<T>`

10 years agoMerge pull request #12636 from chromatic/fixup_trans_fail
bors [Sun, 2 Mar 2014 03:44:37 +0000 (19:44 -0800)]
Merge pull request #12636 from chromatic/fixup_trans_fail

Cleaned up trans_fail(), per eddyb request.

Reviewed-by: huonw
10 years agorustdoc: syntax highlight macro definitions, colour $... substitutions.
Huon Wilson [Sun, 2 Mar 2014 02:30:28 +0000 (13:30 +1100)]
rustdoc: syntax highlight macro definitions, colour $... substitutions.

Macro definitions are just their raw source code, and so should be
highlighted where possible. Also, $ident non-terminal substitutions are
special, and so are worth of a little special treatment.

10 years agoMerge pull request #12308 from kballard/vim-nested-comments
bors [Sun, 2 Mar 2014 01:36:41 +0000 (17:36 -0800)]
Merge pull request #12308 from kballard/vim-nested-comments

vim: Tweak how comment nesting works

Reviewed-by: brson
10 years agoauto merge of #12630 : alexcrichton/rust/flush-buffered, r=brson
bors [Sat, 1 Mar 2014 19:41:30 +0000 (11:41 -0800)]
auto merge of #12630 : alexcrichton/rust/flush-buffered, r=brson

Now that we can call `flush()` in destructors, I think that it's appropriate for stdout/stderr to return buffered writers by default.

This doesn't enable certain functionality like a buffered stdin does, but it's what you want 90% of the time for performance reasons.

10 years agoauto merge of #12641 : sfackler/rust/issue-11552, r=huonw
bors [Sat, 1 Mar 2014 18:26:34 +0000 (10:26 -0800)]
auto merge of #12641 : sfackler/rust/issue-11552, r=huonw

Closes #11552

10 years agostd: Switch stdout/stderr to buffered by default
Alex Crichton [Fri, 28 Feb 2014 20:55:30 +0000 (12:55 -0800)]
std: Switch stdout/stderr to buffered by default

Similarly to #12422 which made stdin buffered by default, this commit makes the
output streams also buffered by default. Now that buffered writers will flush
their contents when they are dropped, I don't believe that there's no reason why
the output shouldn't be buffered by default, which is what you want in 90% of
cases.

As with stdin, there are new stdout_raw() and stderr_raw() functions to get
unbuffered streams to stdout/stderr.

10 years agoAdd a test for #11552
Steven Fackler [Sat, 1 Mar 2014 06:05:49 +0000 (22:05 -0800)]
Add a test for #11552

Closes #11552

10 years agostd: Flush when buffered writers are dropped
Alex Crichton [Fri, 28 Feb 2014 20:46:46 +0000 (12:46 -0800)]
std: Flush when buffered writers are dropped

It's still not entirely clear what should happen if there was an error when
flushing, but I'm deferring that decision to #12628. I believe that it's crucial
for the usefulness of buffered writers to be able to flush on drop. It's just
too easy to forget to flush them in small one-off use cases.

cc #12628

10 years agoauto merge of #12639 : luqmana/rust/struct-variant-pat, r=pcwalton
bors [Sat, 1 Mar 2014 11:06:31 +0000 (03:06 -0800)]
auto merge of #12639 : luqmana/rust/struct-variant-pat, r=pcwalton

We weren't passing the node id for the enum and hence it couldn't retrieve the field types for the struct variant we were trying to destructure.

Fixes #11577.

10 years agoauto merge of #12638 : luqmana/rust/op-no-ref, r=alexcrichton
bors [Sat, 1 Mar 2014 09:51:35 +0000 (01:51 -0800)]
auto merge of #12638 : luqmana/rust/op-no-ref, r=alexcrichton

From my comment on #11450:

The reason for the ICE is because for operators `rustc` does a little bit of magic. Notice that while you implement the `Mul` trait for some type `&T` (i.e a reference to some T), you can simply do `Vec2 {..} * 2.0f32`. That is, `2.0f32` is `f32` and not `&f32`. This works because `rustc` will automatically take a reference. So what's happening is that with `foo * T`, the compiler is expecting the `mul` method to take some `&U` and then it can compare to make sure `T == U` (or more specifically that `T` coerces to `U`). But in this case, the argument of the `mul` method is not a reference and hence the "no ref" error.

I don't think we should ICE in this case since we do catch the mismatched trait/impl method and hence provide a better error message that way.

Fixes #11450

10 years agoauto merge of #12627 : alexcrichton/rust/issue-12623, r=brson
bors [Sat, 1 Mar 2014 08:36:35 +0000 (00:36 -0800)]
auto merge of #12627 : alexcrichton/rust/issue-12623, r=brson

This helps prevent the unfortunate interleavings found in #12623.

10 years agoauto merge of #12626 : alexcrichton/rust/assert-eq, r=thestinger
bors [Sat, 1 Mar 2014 07:21:37 +0000 (23:21 -0800)]
auto merge of #12626 : alexcrichton/rust/assert-eq, r=thestinger

Formatting via reflection has been a little questionable for some time now, and
it's a little unfortunate that one of the standard macros will silently use
reflection when you weren't expecting it. This adds small bits of code bloat to
libraries, as well as not always being necessary. In light of this information,
this commit switches assert_eq!() to using {} in the error message instead of
{:?}.

In updating existing code, there were a few error cases that I encountered:

* It's impossible to define Show for [T, ..N]. I think DST will alleviate this
  because we can define Show for [T].
* A few types here and there just needed a #[deriving(Show)]
* Type parameters needed a Show bound, I often moved this to `assert!(a == b)`
* `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths.
  I don't think this is much of a regression though because {:?} on paths looks
  awful (it's a byte array).

Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime
significant for smaller binaries.

10 years agostd: Change assert_eq!() to use {} instead of {:?}
Alex Crichton [Fri, 28 Feb 2014 09:23:06 +0000 (01:23 -0800)]
std: Change assert_eq!() to use {} instead of {:?}

Formatting via reflection has been a little questionable for some time now, and
it's a little unfortunate that one of the standard macros will silently use
reflection when you weren't expecting it. This adds small bits of code bloat to
libraries, as well as not always being necessary. In light of this information,
this commit switches assert_eq!() to using {} in the error message instead of
{:?}.

In updating existing code, there were a few error cases that I encountered:

* It's impossible to define Show for [T, ..N]. I think DST will alleviate this
  because we can define Show for [T].
* A few types here and there just needed a #[deriving(Show)]
* Type parameters needed a Show bound, I often moved this to `assert!(a == b)`
* `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths.
  I don't think this is much of a regression though because {:?} on paths looks
  awful (it's a byte array).

Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime
significant for smaller binaries.

10 years agoCleaned up trans_fail functions, per eddyb request.
chromatic [Sat, 1 Mar 2014 02:21:22 +0000 (18:21 -0800)]
Cleaned up trans_fail functions, per eddyb request.

10 years agolibrustc: Don't ICE when operator traits are not implemented properly. Fixes #11450
Luqman Aden [Sat, 1 Mar 2014 03:59:15 +0000 (22:59 -0500)]
librustc: Don't ICE when operator traits are not implemented properly. Fixes #11450

10 years agorustdoc: Capture all output from rustc by default
Alex Crichton [Fri, 28 Feb 2014 20:33:49 +0000 (12:33 -0800)]
rustdoc: Capture all output from rustc by default

This helps prevent interleaving of error messages when running rustdoc tests.
This has an interesting bit of shuffling with I/O handles, but other than that
this is just using the APIs laid out in the previous commit.

Closes #12623

10 years agolibrustc: Pass the node id so we don't fail on destructing struct variants. Fixes...
Luqman Aden [Sat, 1 Mar 2014 04:35:10 +0000 (23:35 -0500)]
librustc: Pass the node id so we don't fail on destructing struct variants. Fixes #11577.

10 years agoauto merge of #12632 : fhahn/rust/issue-12507-rustdoc-std-module, r=alexcrichton
bors [Sat, 1 Mar 2014 03:01:38 +0000 (19:01 -0800)]
auto merge of #12632 : fhahn/rust/issue-12507-rustdoc-std-module, r=alexcrichton

This PR for #12507 marks the top level `Module` in rustdoc as a crate and does render the header accordingly.

10 years agoauto merge of #12616 : alexcrichton/rust/size, r=huonw
bors [Fri, 28 Feb 2014 21:26:30 +0000 (13:26 -0800)]
auto merge of #12616 : alexcrichton/rust/size, r=huonw

I've been playing around with code size when linking to libstd recently, and these were some findings I found that really helped code size. I started out by eliminating all I/O implementations from libnative and instead just return an unimplemented error.

In doing so, a `fn main() {}` executable was ~378K before this patch, and about 170K after the patch. These size wins are all pretty minor, but they all seemed pretty reasonable to me. With native I/O not stubbed out, this takes the size of an LTO executable from 675K to 400K.

10 years agostd: Flag run_fmt() as #[inline(always)]
Alex Crichton [Fri, 28 Feb 2014 05:11:50 +0000 (21:11 -0800)]
std: Flag run_fmt() as #[inline(always)]

This function is a tiny wrapper that LLVM doesn't want to inline, and it ends up
causing more bloat than necessary. The bloat is pretty small, but it's a win of
at least 7k for small executables, and I imagine that the number goes up as
there are more calls to fail!().

10 years agostd: Avoid using "{:?}" in format strings
Alex Crichton [Fri, 28 Feb 2014 04:37:40 +0000 (20:37 -0800)]
std: Avoid using "{:?}" in format strings

This removes all usage of Poly in format strings from libstd. This doesn't
prevent more future strings from coming in, but it at least removes the ones for
now.

10 years agostd: Remove lots of allocations from log settings
Alex Crichton [Fri, 28 Feb 2014 04:25:13 +0000 (20:25 -0800)]
std: Remove lots of allocations from log settings

Most of these are unnecessary because we're only looking at static strings. This
also moves to Vec in a few places instead of ~[T].

This didn't end up getting much of a code size win (update_log_settings is the
third largest function in the executables I'm looking at), but this seems like a
generally nice improvement regardless.

10 years agoauto merge of #12607 : alexcrichton/rust/io++, r=brson
bors [Fri, 28 Feb 2014 20:06:30 +0000 (12:06 -0800)]
auto merge of #12607 : alexcrichton/rust/io++, r=brson

This lowers the #[allow(missing_doc)] directive into some of the lower modules
which are less mature. Most I/O modules now require comprehensive documentation.

10 years agosyntax: Refactor diagnostics to focus on Writers
Alex Crichton [Fri, 28 Feb 2014 19:37:04 +0000 (11:37 -0800)]
syntax: Refactor diagnostics to focus on Writers

This commit alters the diagnostic emission machinery to be focused around a
Writer for emitting errors. This allows it to not hard-code emission of errors
to stderr (useful for other applications).

10 years agoauto merge of #12533 : alexcrichton/rust/svh, r=brson
bors [Fri, 28 Feb 2014 18:51:34 +0000 (10:51 -0800)]
auto merge of #12533 : alexcrichton/rust/svh, r=brson

These hashes are used to detect changes to upstream crates and generate errors which mention that crates possibly need recompilation.

More details can be found in the respective commit messages below. This change is also accompanied with a much needed refactoring of some of the crate loading code to focus more on crate ids instead of name/version pairs.

Closes #12601

10 years agostd: Improve some I/O documentation
Alex Crichton [Mon, 24 Feb 2014 08:31:08 +0000 (00:31 -0800)]
std: Improve some I/O documentation

This lowers the #[allow(missing_doc)] directive into some of the lower modules
which are less mature. Most I/O modules now require comprehensive documentation.

10 years agosyntax: Expand format!() deterministically
Alex Crichton [Fri, 28 Feb 2014 01:07:27 +0000 (17:07 -0800)]
syntax: Expand format!() deterministically

Previously, format!("{a}{b}", a=foo(), b=bar()) has foo() and bar() run in a
nondeterminisc order. This is clearly a non-desirable property, so this commit
uses iteration over a list instead of iteration over a hash map to provide
deterministic code generation of these format arguments.

10 years agorustc: Add the concept of a Strict Version Hash
Alex Crichton [Tue, 25 Feb 2014 03:45:20 +0000 (19:45 -0800)]
rustc: Add the concept of a Strict Version Hash

This new SVH is used to uniquely identify all crates as a snapshot in time of
their ABI/API/publicly reachable state. This current calculation is just a hash
of the entire crate's AST. This is obviously incorrect, but it is currently the
reality for today.

This change threads through the new Svh structure which originates from crate
dependencies. The concept of crate id hash is preserved to provide efficient
matching on filenames for crate loading. The inspected hash once crate metadata
is opened has been changed to use the new Svh.

The goal of this hash is to identify when upstream crates have changed but
downstream crates have not been recompiled. This will prevent the def-id drift
problem where upstream crates were recompiled, thereby changing their metadata,
but downstream crates were not recompiled.

In the future this hash can be expanded to exclude contents of the AST like doc
comments, but limitations in the compiler prevent this change from being made at
this time.

Closes #10207

10 years agorustc: Simplify crate loading constraints
Alex Crichton [Tue, 25 Feb 2014 02:13:51 +0000 (18:13 -0800)]
rustc: Simplify crate loading constraints

The previous code passed around a {name,version} pair everywhere, but this is
better expressed as a CrateId. This patch changes these paths to store and pass
around crate ids instead of these pairs of name/version. This also prepares the
code to change the type of hash that is stored in crates.

10 years agostd: Add cfg(test) to UnsafeArc assertions
Alex Crichton [Fri, 28 Feb 2014 03:53:03 +0000 (19:53 -0800)]
std: Add cfg(test) to UnsafeArc assertions

This is a ubiquitous type in concurrent code, and the assertions are causing
significant code bloat for simple operations such as reading the pointer
(injecting a failure point, etc).

I am testing executable sizes with no I/O implementations (everything stubbed
out to return nothing), and this took the size of a libnative executable from
328K to 207K (37% reduction in size), so I think that this is one assertion
that's well worth configuring off for now.

10 years agoauto merge of #12622 : pnkfelix/rust/fsk-improve-vec-partition-doc, r=huonw
bors [Fri, 28 Feb 2014 15:26:30 +0000 (07:26 -0800)]
auto merge of #12622 : pnkfelix/rust/fsk-improve-vec-partition-doc, r=huonw

Explicitly note in vec `partition` and `partitioned` that the left and
right parts each map to satisfying and non-satisfying elements.

10 years agoauto merge of #12595 : huonw/rust/pub-vis-typ, r=alexcrichton
bors [Fri, 28 Feb 2014 14:06:31 +0000 (06:06 -0800)]
auto merge of #12595 : huonw/rust/pub-vis-typ, r=alexcrichton

These are types that are in exported type signatures, but are not
exported themselves, e.g.

    struct Foo { ... }

    pub fn bar() -> Foo { ... }

will warn about the Foo.

Such types are not listed in documentation, and cannot be named outside
the crate in which they are declared, which is very user-unfriendly.

cc #10573.

10 years agoImprove vec `partition` and `partitioned` method doc.
Felix S. Klock II [Fri, 28 Feb 2014 13:07:42 +0000 (14:07 +0100)]
Improve vec `partition` and `partitioned` method doc.

Explicitly note in vec `partition` and `partitioned` that the left and
right parts each map to satisfying and non-satisfying elements.

10 years agoPublicise types/add #[allow(visible_private_types)] to a variety of places.
Huon Wilson [Thu, 27 Feb 2014 07:48:21 +0000 (18:48 +1100)]
Publicise types/add #[allow(visible_private_types)] to a variety of places.

There's a lot of these types in the compiler libraries, and a few of the
older or private stdlib ones. Some types are obviously meant to be
public, others not so much.

10 years agosync: Rename arc::Condvar to arc::ArcCondvar.
Huon Wilson [Thu, 27 Feb 2014 07:41:55 +0000 (18:41 +1100)]
sync: Rename arc::Condvar to arc::ArcCondvar.

The sync submodule also has a `Condvar` type, and its reexport was
shadowing the `arc` type, making it crate-private.

10 years agorustc: implement a lint for publicly visible private types.
Huon Wilson [Thu, 27 Feb 2014 07:33:03 +0000 (18:33 +1100)]
rustc: implement a lint for publicly visible private types.

These are types that are in exported type signatures, but are not
exported themselves, e.g.

    struct Foo { ... }

    pub fn bar() -> Foo { ... }

will warn about the Foo.

Such types are not listed in documentation, and cannot be named outside
the crate in which they are declared, which is very user-unfriendly.

cc #10573

10 years agoauto merge of #12621 : huonw/rust/time-test-doc, r=pnkfelix
bors [Fri, 28 Feb 2014 12:36:32 +0000 (04:36 -0800)]
auto merge of #12621 : huonw/rust/time-test-doc, r=pnkfelix

Add `time` crate to index, expand docs of `test`.

10 years agoAdd `time` crate to index, expand docs of `test`.
Huon Wilson [Fri, 28 Feb 2014 12:25:44 +0000 (23:25 +1100)]
Add `time` crate to index, expand docs of `test`.

10 years agoauto merge of #12544 : erickt/rust/hash, r=acrichto
bors [Fri, 28 Feb 2014 08:26:34 +0000 (00:26 -0800)]
auto merge of #12544 : erickt/rust/hash, r=acrichto

This PR allows `HashMap`s to work with custom hashers. Also with this patch are:

* a couple generic implementations of `Hash` for a variety of types.
* added `Default`, `Clone` impls to the hashers.
* added a `HashMap::with_hasher()` constructor.

10 years agoauto merge of #12614 : alexcrichton/rust/rollup, r=alexcrichton
bors [Fri, 28 Feb 2014 07:01:55 +0000 (23:01 -0800)]
auto merge of #12614 : alexcrichton/rust/rollup, r=alexcrichton

Closes #12546 (Add new target 'make dist-osx' to create a .pkg installer for OS X) r=brson
Closes #12575 (rustc: Move local native libs back in link-args) r=brson
Closes #12587 (Provide a more helpful error for tests that fail due to noexec) r=brson
Closes #12589 (rustc: Remove codemap and reachable from metadata encoder) r=alexcrichton
Closes #12591 (Fix syntax::ext::deriving{,::*} docs formatting.) r=huonw
Closes #12592 (Miscellaneous Vim improvements) r=alexcrichton
Closes #12596 (path: Implement windows::make_non_verbatim()) r=alexcrichton
Closes #12598 (Improve the ctags function regular expression) r=alexcrichton
Closes #12599 (Tutorial improvement (new variant of PR #12472).) r=pnkfelix
Closes #12603 (std: Export the select! macro) r=pcwalton
Closes #12605 (Fix typo in doc of Binary trait in std::fmt) r=alexcrichton
Closes #12613 (Fix bytepos_to_file_charpos) r=brson

10 years agoauto merge of #12348 : brunoabinader/rust/libcollections-list-refactory, r=alexcrichton
bors [Fri, 28 Feb 2014 05:46:53 +0000 (21:46 -0800)]
auto merge of #12348 : brunoabinader/rust/libcollections-list-refactory, r=alexcrichton

This PR includes:
- Create an iterator for ```List<T>``` called ```Items<T>```;
- Move all list operations inside ```List<T>``` impl;
- Removed functions that are already provided by ```Iterator``` trait;
- Refactor on ```len()``` and ```is_empty``` using ```Container``` trait;
- Bunch of minor fixes;

A replacement for using @ is intended, but still in discussion.

Closes #12344.

10 years agoFix bytepos_to_file_charpos.
Nick Cameron [Thu, 27 Feb 2014 23:53:36 +0000 (12:53 +1300)]
Fix bytepos_to_file_charpos.

Make bytepos_to_charpos relative to the start of the filemap rather than its previous behaviour which was to be realtive to the start of the codemap, but ignoring multi-byte chars in earlier filemaps. Rename to bytepos_to_file_charpos. Add tests for multi-byte chars.

10 years agoFix typo in doc of Binary trait in std::fmt
Mickaël Delahaye [Thu, 27 Feb 2014 20:00:23 +0000 (21:00 +0100)]
Fix typo in doc of Binary trait in std::fmt

10 years agostd: Export the select! macro
Alex Crichton [Mon, 24 Feb 2014 05:30:18 +0000 (21:30 -0800)]
std: Export the select! macro

Mark it as #[experimental] for now. In theory this attribute will be read in the
future. I believe that the implementation is solid enough for general use,
although I would not be surprised if there were bugs in it still. I think that
it's at the point now where public usage of it will start to uncover hopefully
the last few remaining bugs.

Closes #12044

10 years agoMinor modifications to Axel's tutorial improvements (see also #12472).
Felix S. Klock II [Thu, 27 Feb 2014 13:16:31 +0000 (14:16 +0100)]
Minor modifications to Axel's tutorial improvements (see also #12472).

10 years agoDocumentation : Tutorial improvement...
Axel Viala [Sat, 22 Feb 2014 16:54:21 +0000 (17:54 +0100)]
Documentation : Tutorial improvement...

Refactoring examples on implementation of generics for linked list.
Fixing typo of 'Note's for coherancy.

Adding internal links inside the tutorial example with traits,
generics etc...

10 years agoImprove the ctags function regular expression.
Chris Morgan [Thu, 27 Feb 2014 11:34:08 +0000 (22:34 +1100)]
Improve the ctags function regular expression.

Before it would only catch lines starting `fn` or `pub fn`.

Now it can cope with:

- attributes (e.g. `#[test] fn`)
- external functions (e.g. `extern fn`, `extern "C" fn`)
- unsafe functions (e.g. `unsafe fn`)

… and any correct combination of these
(e.g. `#[test] extern "C" unsafe fn`).

10 years agopath: Implement windows::make_non_verbatim()
Kevin Ballard [Thu, 27 Feb 2014 08:25:43 +0000 (00:25 -0800)]
path: Implement windows::make_non_verbatim()

make_non_verbatim() takes a WindowsPath and returns a new one that does
not use the \\?\ verbatim prefix, if possible.

10 years agopath: clean up some lint warnings and an obsolete comment
Kevin Ballard [Thu, 27 Feb 2014 08:19:27 +0000 (00:19 -0800)]
path: clean up some lint warnings and an obsolete comment

Get rid of the unnecessary parenthesies that crept into some macros.
Remove a FIXME that was already fixed.
Fix a comment that wasn't rendering correctly in rustdoc.

10 years agoUpdate Vim syntax file last change date.
Chris Morgan [Thu, 27 Feb 2014 06:02:51 +0000 (17:02 +1100)]
Update Vim syntax file last change date.

10 years agoFix Vim section movements for standard Rust style.
Chris Morgan [Thu, 27 Feb 2014 05:54:54 +0000 (16:54 +1100)]
Fix Vim section movements for standard Rust style.

(Expressed another way: make `[[` et al. work with the curly brace at
the end of a line as is standard Rust style, not just at the start is it
is by default in Vim, from K&R style.)

This came out of #11492, where a simpler but less effective technique
was initially proposed; some discussion of the techniques, ways and
means can be found there.

There are still a few caveats:

- Operator-pending mode behaves differently to the standard behaviour:
  if inside curly braces, it should delete up to and including the
  closing of the outermost curly brace (that doesn't seem to me
  consistent with documented behaviour, but it's what it does). Actual
  behaviour (the more logical and consistent, in my opinion): up to the
  start of the next outermost curly brace.

- With folding enabled (`set fdm=syntax`), `[[` and `]]` do not behave
  as they should: the default behaviour treats an entire closed fold as
  one line for these purposes while this code does not (I explicitly
  `set nofoldenable` in the function—the side-effects are worse with
  folds enabled), leading to unexpected behaviour, the worst of which is
  `[[` and/or `]]` not working in visual mode on a closed fold (visual
  mode keeps it at the extreme end of the region line of the folded
  region, so it's always going back to the opening line of that fold and
  immediately being shoved back to the end by visual mode).

- `[[` and `]]` are operating inside comments, whereas the standard
  behaviour skips comments.

- The viewport position is sometimes changed when it should not be
  necessary.

10 years agoUpdate prelude items in Vim syntax.
Chris Morgan [Thu, 27 Feb 2014 05:51:20 +0000 (16:51 +1100)]
Update prelude items in Vim syntax.

10 years agoDowngrade `do` to a reserved keyword in Vim.
Chris Morgan [Thu, 27 Feb 2014 05:50:35 +0000 (16:50 +1100)]
Downgrade `do` to a reserved keyword in Vim.

This means it gets highlighted as Error by default.

10 years agoHighlight the `mod` in `extern mod x;` as Error.
Chris Morgan [Thu, 27 Feb 2014 05:45:48 +0000 (16:45 +1100)]
Highlight the `mod` in `extern mod x;` as Error.

Just like the bare keyword `crate` is highlighted as Error (a little
dubious, actually, given macros), `mod` is invalid after `extern`: it's
obsolete syntax.

10 years agoFix syntax::ext::deriving{,::*} docs formatting.
Chris Morgan [Thu, 27 Feb 2014 05:30:28 +0000 (16:30 +1100)]
Fix syntax::ext::deriving{,::*} docs formatting.

The most significant fix is for `syntax::ext::deriving::encodable`,
where one of the blocks of code, auspiciously containing `<S>` (recall
that Markdown allows arbitrary HTML to be contained inside it), was not
formatted as a code block, with a fun but messy effect.

10 years agorustc: Remove codemap and reachable from metadata encoder
Brian Anderson [Wed, 26 Feb 2014 10:54:10 +0000 (02:54 -0800)]
rustc: Remove codemap and reachable from metadata encoder

10 years agoProvide a more helpful error for tests that fail due to noexec
Felix Crux [Thu, 27 Feb 2014 01:27:30 +0000 (20:27 -0500)]
Provide a more helpful error for tests that fail due to noexec

The rustdoc tests create and execute a file in a temporary directory. By
default on UNIX-like platforms this is in `/tmp`, which some users mount
with the `noexec` option. In those cases, the tests fail in a mysterious
way. This change adds a note that suggests what the problem might be, if
the error looks like it could have been caused by the `noexec` setup.

Closes #12558

10 years agostd: cut down on the memory usage of `SipHasher`
Erick Tryzelaar [Thu, 27 Feb 2014 04:46:57 +0000 (20:46 -0800)]
std: cut down on the memory usage of `SipHasher`

10 years agorustc: Move local native libs back in link-args
Alex Crichton [Wed, 26 Feb 2014 16:52:08 +0000 (08:52 -0800)]
rustc: Move local native libs back in link-args

With linkers on unix systems, libraries on the right of the command line are
used to resolve symbols in those on the left of the command line. This means
that arguments must have a right-to-left dependency chain (things on the left
depend on things on the right).

This is currently done by ordering the linker arguments as

  1. Local object
  2. Local native libraries
  3. Upstream rust libraries
  4. Upstream native libraries

This commit swaps the order of 2 and 3 so upstream rust libraries have access to
local native libraries. It has been seen that some upstream crates don't specify
the library that they link to because the name varies per platform (e.g.
lua/glfw/etc).

This commit enables building these libraries by allowing the upstream rust crate
to have access to local native libraries. I believe that the failure mode for
this scheme is when an upstream rust crate depends on a symbol in an upstream
library which is then redefined in a local library. This failure mode is
incredibly uncommon, and the failure mode also varies per platform (OSX behaves
differently), so I believe that a change like this is fine to make.

Closes #12446

10 years agoMake OS X installer build from /tmp/dist/pkgroot, and have it be part of the 'make...
Brian Leibig [Wed, 26 Feb 2014 16:59:58 +0000 (08:59 -0800)]
Make OS X installer build from /tmp/dist/pkgroot, and have it be part of the 'make dist' target

10 years agoAdd new target 'make dist-osx' to create a .pkg installer for OS X
Brian Leibig [Tue, 25 Feb 2014 16:47:58 +0000 (08:47 -0800)]
Add new target 'make dist-osx' to create a .pkg installer for OS X

10 years agocollections: allow `HashMap` to work with generic hashers
Erick Tryzelaar [Tue, 25 Feb 2014 16:04:38 +0000 (08:04 -0800)]
collections: allow `HashMap` to work with generic hashers

10 years agoauto merge of #11979 : FlaPer87/rust/static, r=nikomatsakis
bors [Fri, 28 Feb 2014 02:51:53 +0000 (18:51 -0800)]
auto merge of #11979 : FlaPer87/rust/static, r=nikomatsakis

This pull request partially addresses the 2 issues listed before. As part of the work required for this PR, `NonCopyable` was completely removed.

This PR also replaces the content of `type_is_pod` with `TypeContents::is_pod`, although `type_is_content` is currently not being used anywhere. I kept it for consistency with the other functions that exist in this module.

cc #10834
cc #10577

Proposed static restrictions
=====================

Taken from [this](https://github.com/mozilla/rust/pull/11979#issuecomment-35768249) comment.

I expect some code that, at a high-level, works like this:

- For each *mutable* static item, check that the **type**:
    - cannot own any value whose type has a dtor
    - cannot own any values whose type is an owned pointer
- For each *immutable* static item, check that the **value**:
      - does not contain any ~ or box expressions (including ~[1, 2, 3] sort of things, for now)
      - does not contain a struct literal or call to an enum variant / struct constructor where
          - the type of the struct/enum is freeze
          - the type of the struct/enum has a dtor

10 years agoauto merge of #12584 : alexcrichton/rust/windows-files, r=brson
bors [Thu, 27 Feb 2014 22:56:56 +0000 (14:56 -0800)]
auto merge of #12584 : alexcrichton/rust/windows-files, r=brson

These commits fix handling of binary files on windows by using the raw `CreateFile` apis directly, also splitting out the windows/unix implementations to their own files because everything was configured between the two platforms.

With this fix in place, this also switches `rustc` to using libnative instead of libgreen. I have confirmed that this PR passes through try on all bots.

10 years agonative: Recognize EISDIR
Alex Crichton [Wed, 26 Feb 2014 21:06:45 +0000 (13:06 -0800)]
native: Recognize EISDIR

This recognizes the EISDIR error code on both windows and unix platforms to
provide a more descriptive error condition.

10 years agorustc: Use libnative for the compiler
Alex Crichton [Wed, 26 Feb 2014 21:03:40 +0000 (13:03 -0800)]
rustc: Use libnative for the compiler

The compiler itself doesn't necessarily need any features of green threading
such as spawning tasks and lots of I/O, so libnative is slightly more
appropriate for rustc to use itself.

This should also help the rusti bot which is currently incompatible with libuv.

10 years agonative: Improve windows file handling
Alex Crichton [Wed, 26 Feb 2014 20:57:00 +0000 (12:57 -0800)]
native: Improve windows file handling

This commit splits the file implementation into file_unix and file_win32. The
two implementations have diverged to the point that they share almost 0 code at
this point, so it's easier to maintain as separate files.

The other major change accompanied with this commit is that file::open is no
longer based on libc's open function on windows, but rather windows's CreateFile
function. This fixes dealing with binary files on windows (test added in
previous commit).

This also changes the read/write functions to use ReadFile and WriteFile instead
of libc's read/write.

Closes #12406

10 years agostd: Small cleanup and test improvement
Alex Crichton [Wed, 26 Feb 2014 20:55:23 +0000 (12:55 -0800)]
std: Small cleanup and test improvement

This weeds out a bunch of warnings building stdtest on windows, and it also adds
a check! macro to the io::fs tests to help diagnose errors that are cropping up
on windows platforms as well.

cc #12516

10 years agoImmutable static items should be `Freeze` Fixes #12432
Flavio Percoco [Fri, 21 Feb 2014 19:31:50 +0000 (20:31 +0100)]
Immutable static items should be `Freeze` Fixes #12432

10 years agoCloses #7364 Test case
Flavio Percoco [Tue, 18 Feb 2014 00:38:23 +0000 (01:38 +0100)]
Closes #7364 Test case

10 years agoCloses #9243 Test case
Flavio Percoco [Tue, 18 Feb 2014 00:28:29 +0000 (01:28 +0100)]
Closes #9243 Test case

10 years agoForbid certain types for static items
Flavio Percoco [Wed, 26 Feb 2014 18:22:41 +0000 (19:22 +0100)]
Forbid certain types for static items

- For each *mutable* static item, check that the **type**:
    - cannot own any value whose type has a dtor
    - cannot own any values whose type is an owned pointer

- For each *immutable* static item, check that the **value**:
    - does not contain any ~ or box expressions
        (including ~[1, 2, 3] sort of things)
    - does not contain a struct literal or call to an enum
        variant / struct constructor where
        - the type of the struct/enum has a dtor