]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoMake some NullablePointer enums FFI-compatible with the base pointer type.
Luqman Aden [Mon, 12 May 2014 01:56:53 +0000 (21:56 -0400)]
Make some NullablePointer enums FFI-compatible with the base pointer type.

10 years agoauto merge of #13401 : cmr/rust/docs, r=brson
bors [Fri, 16 May 2014 18:41:30 +0000 (11:41 -0700)]
auto merge of #13401 : cmr/rust/docs, r=brson

Adds docs where previously there were no docs. Also adds windows support to libterm.

10 years agoSome fixes
Corey Richardson [Fri, 16 May 2014 17:59:25 +0000 (10:59 -0700)]
Some fixes

10 years agoFix example
Corey Richardson [Mon, 12 May 2014 00:10:03 +0000 (20:10 -0400)]
Fix example

10 years agoFlush before applying console attributes
Corey Richardson [Mon, 12 May 2014 00:08:49 +0000 (20:08 -0400)]
Flush before applying console attributes

10 years agoAdd a bang
Corey Richardson [Thu, 8 May 2014 17:13:57 +0000 (13:13 -0400)]
Add a bang

10 years agoUpdate for Box
Corey Richardson [Wed, 7 May 2014 15:12:04 +0000 (11:12 -0400)]
Update for Box

10 years agoUpdate for master
Corey Richardson [Wed, 7 May 2014 13:45:53 +0000 (09:45 -0400)]
Update for master

10 years agoAdd WinConsole docs
Corey Richardson [Mon, 14 Apr 2014 14:20:24 +0000 (10:20 -0400)]
Add WinConsole docs

10 years agotest: update for term fallout
Corey Richardson [Tue, 8 Apr 2014 16:18:16 +0000 (12:18 -0400)]
test: update for term fallout

10 years agoworkcache: add crate doc block
Corey Richardson [Tue, 8 Apr 2014 16:07:23 +0000 (12:07 -0400)]
workcache: add crate doc block

10 years agotime: crate description
Corey Richardson [Tue, 8 Apr 2014 16:04:09 +0000 (12:04 -0400)]
time: crate description

10 years agosyntax: update for libterm fallout
Corey Richardson [Tue, 8 Apr 2014 15:54:54 +0000 (11:54 -0400)]
syntax: update for libterm fallout

10 years agoterm: add docs and windows support
Corey Richardson [Tue, 8 Apr 2014 15:18:10 +0000 (11:18 -0400)]
term: add docs and windows support

Closes #2807

10 years agonum: expand crate documentation + add example
Corey Richardson [Sat, 5 Apr 2014 05:08:01 +0000 (01:08 -0400)]
num: expand crate documentation + add example

10 years agoarena: add docs for Arena
Corey Richardson [Fri, 4 Apr 2014 11:57:39 +0000 (07:57 -0400)]
arena: add docs for Arena

10 years agoflate: add documentation
Corey Richardson [Fri, 4 Apr 2014 11:47:16 +0000 (07:47 -0400)]
flate: add documentation

10 years agoauto merge of #14237 : alexcrichton/rust/issue-14144, r=cmr
bors [Fri, 16 May 2014 09:46:25 +0000 (02:46 -0700)]
auto merge of #14237 : alexcrichton/rust/issue-14144, r=cmr

By default, jemalloc is building itself with -g3 if the local compiler supports
it. It looks like this is generating a good deal of debug info that windows
isn't optimizing out (on the order of 18MB). Windows gcc/ld is also not
optimizing this data away, causing hello world to be 18MB in size.

There's no current real need for debugging jemalloc to a great extent, so this
commit manually passes -g1 to override -g3 which jemalloc is using. This is
confirmed to drop the size of executables on windows back to a more reasonable
size (2.0MB, as they were before).

Closes #14144

10 years agoauto merge of #14235 : Ryman/rust/simplify_arcs_doc, r=alexcrichton
bors [Fri, 16 May 2014 08:06:25 +0000 (01:06 -0700)]
auto merge of #14235 : Ryman/rust/simplify_arcs_doc, r=alexcrichton

10 years agoauto merge of #14115 : alexcrichton/rust/core-fmt, r=brson
bors [Fri, 16 May 2014 06:26:26 +0000 (23:26 -0700)]
auto merge of #14115 : alexcrichton/rust/core-fmt, r=brson

This was a more difficult change than I thought it would be, and it is unfortunately a breaking change rather than a drop-in replacement. Most of the rationale can be found in the third commit.

cc #13851

10 years agocore: Update all tests for fmt movement
Alex Crichton [Sun, 11 May 2014 18:14:14 +0000 (11:14 -0700)]
core: Update all tests for fmt movement

10 years agostd: Fix float tests
Alex Crichton [Sat, 10 May 2014 21:41:42 +0000 (14:41 -0700)]
std: Fix float tests

10 years agostd: Delegate some integer formatting to core::fmt
Alex Crichton [Sat, 10 May 2014 21:19:26 +0000 (14:19 -0700)]
std: Delegate some integer formatting to core::fmt

In an attempt to phase out the std::num::strconv module's string formatting
functionality, this commit reimplements some provided methods for formatting
integers on top of format!() instead of the custom (and slower) implementation
inside of num::strconv.

Primarily, this deprecates int_to_str_bytes_common

10 years agocore: Implement f32/f64 formatting
Alex Crichton [Sat, 10 May 2014 21:06:25 +0000 (14:06 -0700)]
core: Implement f32/f64 formatting

This is a migration of the std::{f32, f64}::to_str* functionality to the core
library. This removes the growable `Vec` used in favor of a large stack buffer.
The maximum base 10 exponent for f64 is 308, so a stack buffer of 512 bytes
should be sufficient to store all floats.

10 years agoUpdates with core::fmt changes
Alex Crichton [Sat, 10 May 2014 21:05:06 +0000 (14:05 -0700)]
Updates with core::fmt changes

1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used
   instead.
2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro
   is preferred wherever possible.
3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.

10 years agostd: Rewrite the `write!` and `writeln!` macros
Alex Crichton [Sat, 10 May 2014 20:57:26 +0000 (13:57 -0700)]
std: Rewrite the `write!` and `writeln!` macros

These are reimplemented using the new `core::fmt` module.

10 years agosyntax: Add a macro, format_args_method!()
Alex Crichton [Sat, 10 May 2014 20:53:40 +0000 (13:53 -0700)]
syntax: Add a macro, format_args_method!()

Currently, the format_args!() macro takes as its first argument an expression
which is the callee of an ExprCall. This means that if format_args!() is used
with calling a method a closure must be used. Consider this code, however:

    format_args!(|args| { foo.writer.write_fmt(args) }, "{}", foo.field)

The closure borrows the entire `foo` structure, disallowing the later borrow of
`foo.field`. To preserve the semantics of the `write!` macro, it is also
impossible to borrow specifically the `writer` field of the `foo` structure
because it must be borrowed mutably, but the `foo` structure is not guaranteed
to be mutable itself.

This new macro is invoked like:

    format_args_method!(foo.writer, write_fmt, "{}", foo.field)

This macro will generate an ExprMethodCall which allows the borrow checker to
understand that `writer` and `field` should be borrowed separately.

This macro is not strictly necessary, with DST or possibly UFCS other
workarounds could be used. For now, though, it looks like this is required to
implement the `write!` macro.

10 years agostd: Add an adaptor for Writer => FormatWriter
Alex Crichton [Sat, 10 May 2014 20:52:26 +0000 (13:52 -0700)]
std: Add an adaptor for Writer => FormatWriter

This new method, write_fmt(), is the one way to write a formatted list of
arguments into a Writer stream. This has a special adaptor to preserve errors
which occur on the writer.

All macros will be updated to use this method explicitly.

10 years agocore: Derive Show impls wherever possible
Alex Crichton [Sat, 10 May 2014 20:49:08 +0000 (13:49 -0700)]
core: Derive Show impls wherever possible

These were temporarily moved to explicit implementations, but now that fmt is in
core it's possible to derive again.

10 years agocore: Implement and export the try! macro
Alex Crichton [Sat, 10 May 2014 20:48:26 +0000 (13:48 -0700)]
core: Implement and export the try! macro

This is used quite extensively by core::fmt

10 years agocore: Allow formatted failure and assert in core
Alex Crichton [Sat, 10 May 2014 20:47:46 +0000 (13:47 -0700)]
core: Allow formatted failure and assert in core

With std::fmt having migrated, the failure macro can be expressed in its full
glory.

10 years agocore: Implement unwrap()/unwrap_err() on Result
Alex Crichton [Sat, 10 May 2014 20:46:05 +0000 (13:46 -0700)]
core: Implement unwrap()/unwrap_err() on Result

Now that std::fmt is in libcore, it's possible to implement this as an inherit
method rather than through extension traits.

This commit also tweaks the failure interface of libcore to libstd to what it
should be, one method taking &fmt::Arguments

10 years agocore: Inherit the std::fmt module
Alex Crichton [Sat, 10 May 2014 20:33:43 +0000 (13:33 -0700)]
core: Inherit the std::fmt module

This commit moves all possible functionality from the standard library's string
formatting utilities into the core library. This is a breaking change, due to a
few tweaks in the semantics of formatting:

1. In order to break the dependency on the std::io module, a new trait,
   FormatWriter was introduced in core::fmt. This is the trait which is used
   (instead of Writer) to format data into a stream.
2. The new FormatWriter trait has one method, write(), which takes some bytes
   and can return an error, but the error contains very little information. The
   intent for this trait is for an adaptor writer to be used around the standard
   library's Writer trait.
3. The fmt::write{,ln,_unsafe} methods no longer take &mut io::Writer, but
   rather &mut FormatWriter. Since this trait is less common, all functions were
   removed except fmt::write, and it is not intended to be invoked directly.

The main API-breaking change here is that the fmt::Formatter structure will no
longer expose its `buf` field. All previous code writing directly to `f.buf`
using writer methods or the `write!` macro will now instead use `f` directly.

The Formatter object itself implements the `Writer` trait itself for
convenience, although it does not implement the `FormatWriter` trait. The
fallout of these changes will be in the following commits.

[breaking-change]

10 years agocore: Move intrinsic float functionality from std
Alex Crichton [Sat, 10 May 2014 20:25:49 +0000 (13:25 -0700)]
core: Move intrinsic float functionality from std

The Float trait in libstd is quite a large trait which has dependencies on cmath
(libm) and such, which libcore cannot satisfy. It also has many functions that
libcore can implement, however, as LLVM has intrinsics or they're just bit
twiddling.

This commit moves what it can of the Float trait from the standard library into
libcore to allow floats to be usable in the core library. The remaining
functions are now resident in a FloatMath trait in the standard library (in the
prelude now). Previous code which was generic over just the Float trait may now
need to be generic over the FloatMath trait.

[breaking-change]

10 years agotest: Move syntax extension tests to cfail-full
Alex Crichton [Sat, 10 May 2014 20:24:39 +0000 (13:24 -0700)]
test: Move syntax extension tests to cfail-full

10 years agoauto merge of #14213 : kballard/rust/str_from_utf8_result, r=cmr
bors [Fri, 16 May 2014 04:41:29 +0000 (21:41 -0700)]
auto merge of #14213 : kballard/rust/str_from_utf8_result, r=cmr

Change `str::from_utf8_owned()` and `StrBuf::from_utf8()` to return `Result`.

This allows the vector to be recovered when it contains invalid UTF-8.

10 years agoguide-tasks: Simplify Arc usage to match Arc docs.
Kevin Butler [Thu, 15 May 2014 22:31:28 +0000 (23:31 +0100)]
guide-tasks: Simplify Arc usage to match Arc docs.

10 years agoauto merge of #14196 : chris-morgan/rust/hashmap-mangle, r=cmr
bors [Fri, 16 May 2014 00:36:27 +0000 (17:36 -0700)]
auto merge of #14196 : chris-morgan/rust/hashmap-mangle, r=cmr

This used to be called `mangle` and was removed when the Robin Hood hash map came along, but it is a useful thing to have in certain situations (I just hit it with my Teepee header representation), so I want it back.

The method is renamed to `find_with_or_insert_with`, also with the parameters swapped to make sense—find and then insert, not insert and then find.

/cc @cgaebel

10 years agoWork around parse error caused by #14240.
Chris Morgan [Fri, 16 May 2014 00:07:44 +0000 (10:07 +1000)]
Work around parse error caused by #14240.

10 years agoauto merge of #14234 : alexcrichton/rust/rollup, r=alexcrichton
bors [Thu, 15 May 2014 22:56:54 +0000 (15:56 -0700)]
auto merge of #14234 : alexcrichton/rust/rollup, r=alexcrichton

Let's try this again!

10 years agomk: Don't build jemalloc with -g3
Alex Crichton [Thu, 15 May 2014 22:43:40 +0000 (15:43 -0700)]
mk: Don't build jemalloc with -g3

By default, jemalloc is building itself with -g3 if the local compiler supports
it. It looks like this is generating a good deal of debug info that windows
isn't optimizing out (on the order of 18MB). Windows gcc/ld is also not
optimizing this data away, causing hello world to be 18MB in size.

There's no current real need for debugging jemalloc to a great extent, so this
commit manually passes -g1 to override -g3 which jemalloc is using. This is
confirmed to drop the size of executables on windows back to a more reasonable
size (2.0MB, as they were before).

Closes #14144

10 years agoTest fixes from rollup
Alex Crichton [Thu, 15 May 2014 21:59:01 +0000 (14:59 -0700)]
Test fixes from rollup

Closes #14231 (mk: Don't run benchmarks with `make check`)
Closes #14215 (std: Modify TempDir to not fail on drop. Closes #12628)
Closes #14211 (rustdoc: functions in ffi blocks are unsafe)
Closes #14210 (Make Vec.truncate() resilient against failure in Drop)
Closes #14208 (Make `from_bits` in `bitflags!` safe; add `from_bits_truncate`)
Closes #14206 (Register new snapshots)
Closes #14205 (use sched_yield on linux and freebsd)
Closes #14204 (Add a crate for missing stubs from libcore)
Closes #14203 (shootout-mandelbrot: Either 10-20% or 80-100% improvement.)
Closes #14202 (Add flow-graph visualization (via graphviz) to rustc)
Closes #14201 (Render not_found with an absolute path to the rust stylesheet)
Closes #14200 (std cleanup)
Closes #14189 (Implement cell::clone_ref)

10 years agoImplement cell::clone_ref
Keegan McAllister [Wed, 14 May 2014 00:29:30 +0000 (17:29 -0700)]
Implement cell::clone_ref

Per discussion with @alexcrichton, this is a free function.

10 years agocore: Remove the unit module
Brian Anderson [Tue, 13 May 2014 04:02:27 +0000 (21:02 -0700)]
core: Remove the unit module

10 years agostd: Delete unused file
Brian Anderson [Wed, 14 May 2014 08:36:12 +0000 (01:36 -0700)]
std: Delete unused file

10 years agostd: Remove run_in_bare_thread
Brian Anderson [Wed, 14 May 2014 08:13:29 +0000 (01:13 -0700)]
std: Remove run_in_bare_thread

10 years agoRender not_found with an absolute path to the rust stylesheet
Richo Healey [Wed, 14 May 2014 17:45:51 +0000 (10:45 -0700)]
Render not_found with an absolute path to the rust stylesheet

10 years agoUnit tests for flowgraph pretty printing.
Felix S. Klock II [Mon, 5 May 2014 15:00:14 +0000 (17:00 +0200)]
Unit tests for flowgraph pretty printing.

Each test works by rendering the flowgraph for the last identified
block we see in expanded pretty-printed output, and comparing it (via
`diff`) against a checked in "foo.dot-expected.dot" file.

Each test post-processes the output to remove NodeIds ` (id=NUM)` so
that the expected output is somewhat stable (or at least independent
of how we assign NodeIds) and easier for a human to interpret when
looking at the expected output file itself.

----

Test writing style notes:

I usually tried to write the tests in a way that would avoid duplicate
labels in the output rendered flow graph, when possible.

The tests that have string literals "unreachable" in the program text
are deliberately written that way to remind the reader that the
unreachable nodes in the resulting graph are not an error in the
control flow computation, but rather a natural consequence of its
construction.

10 years agoGraphviz based flow graph pretty-printing.
Felix S. Klock II [Thu, 17 Apr 2014 19:00:08 +0000 (21:00 +0200)]
Graphviz based flow graph pretty-printing.

Passing `--pretty flowgraph=<NODEID>` makes rustc print a control flow graph.

In pratice, you will also need to pass the additional option:
`-o <FILE>` to emit output to a `.dot` file for graphviz.

(You can only print the flow-graph for a particular block in the AST.)

----

An interesting implementation detail is the way the code puts both the
node index (`cfg::CFGIndex`) and a reference to the payload
(`cfg::CFGNode`) into the single `Node` type that is used for
labelling and walking the graph.  I had once mistakenly thought that I
only wanted the `cfg::CFGNode`, but for labelling, you really want the
cfg index too, rather than e.g. trying to use the `ast::NodeId` as the
label (which breaks down e.g. due to `ast::DUMMY_NODE_ID`).

----

As a drive-by fix, I had to fix `rustc::middle::cfg::construct`
interface to reflect changes that have happened on the master branch
while I was getting this integrated into the compiler.  (The next
commit actually adds tests of the `--pretty flowgraph` functionality,
so that should ensure that the `rustc::middle::cfg` code does not go
stale again.)

10 years agoBugfixes for rustc::middle::cfg::construct.
Felix S. Klock II [Thu, 8 May 2014 22:07:57 +0000 (00:07 +0200)]
Bugfixes for rustc::middle::cfg::construct.

1. Only insert non-dummy nodes into the exit map.

2. Revise handling of `break` and `continue` forms so that they are
   not treated as if control falls through to the next node (since it
   does not, it just jumps to the end or start of the loop body).

3. Fixed support for return expression in flow graph construction.

10 years agorustc::middle::graph API revisions.
Felix S. Klock II [Tue, 6 May 2014 07:34:29 +0000 (09:34 +0200)]
rustc::middle::graph API revisions.

Refine lifetimes in signature for graph node/edge iteration methods.

Added `pub` `node_id` and `edge_id` methods that correspond to
NodeIndex and EdgeIndex `get` methods (note that the inner index is
already `pub` in the struct definitions).  (I decided that `get()`,
used internally, just looks too generic and that client code is
clearer with more explicit method names.)

10 years agoAdd `IntoMaybeOwned` impl for `StrBuf` to ease conversion to `MaybeOwned`.
Felix S. Klock II [Thu, 8 May 2014 17:11:43 +0000 (19:11 +0200)]
Add `IntoMaybeOwned` impl for `StrBuf` to ease conversion to `MaybeOwned`.

10 years agoAdd `EntryPat` and `NodePat` variants to ast_map.
Felix S. Klock II [Thu, 8 May 2014 13:50:54 +0000 (15:50 +0200)]
Add `EntryPat` and `NodePat` variants to ast_map.

Add `EntryPat` and `NodePat` variants to ast_map, so that lookups for
id 1 in `let S{val: _x /* pat 2 */} /* pat 1 */ = ...` will actually
resolve to the pattern `S{ ... }`, rather than "unknown node", in a
function like `node_id_to_str`.

10 years agoshootout-mandelbrot: Precalc initial values & use SIMD in the main loop. +80-100%
Kevin Butler [Wed, 14 May 2014 18:08:06 +0000 (19:08 +0100)]
shootout-mandelbrot: Precalc initial values & use SIMD in the main loop. +80-100%

10 years agoshootout-mandlebrot: calculate two bits of the result per inner loop, +10-15%
Kevin Butler [Tue, 13 May 2014 20:15:11 +0000 (21:15 +0100)]
shootout-mandlebrot: calculate two bits of the result per inner loop, +10-15%

10 years agoAdd a crate for missing stubs from libcore
Alex Crichton [Wed, 14 May 2014 18:24:12 +0000 (11:24 -0700)]
Add a crate for missing stubs from libcore

The core library in theory has 0 dependencies, but in practice it has some in
order for it to be efficient. These dependencies are in the form of the basic
memory operations provided by libc traditionally, such as memset, memcmp, etc.
These functions are trivial to implement and themselves have 0 dependencies.

This commit adds a new crate, librlibc, which will serve the purpose of
providing these dependencies. The crate is never linked to by default, but is
available to be linked to by downstream consumers. Normally these functions are
provided by the system libc, but in other freestanding contexts a libc may not
be available. In these cases, librlibc will suffice for enabling execution with
libcore.

cc #10116

10 years agouse sched_yield on linux and freebsd
Daniel Micay [Wed, 14 May 2014 19:54:19 +0000 (15:54 -0400)]
use sched_yield on linux and freebsd

pthread_yield is non-standard, while sched_yield is POSIX

The Linux documentation recommends using the standard function. This is
the only feature we're currently using that's present in glibc but not
in musl.

10 years agoRegister new snapshots
Alex Crichton [Wed, 14 May 2014 21:24:41 +0000 (14:24 -0700)]
Register new snapshots

10 years agoMake `from_bits` in `bitflags!` safe; add `from_bits_truncate`
Aaron Turon [Wed, 14 May 2014 21:39:16 +0000 (14:39 -0700)]
Make `from_bits` in `bitflags!` safe; add `from_bits_truncate`

Previously, the `from_bits` function in the `std::bitflags::bitflags`
macro was marked as unsafe, as it did not check that the bits being
converted actually corresponded to flags.

This patch changes the function to check against the full set of
possible flags and return an `Option` which is `None` if a non-flag bit
is set. It also adds a `from_bits_truncate` function which simply zeros
any bits not corresponding to a flag.

This addresses the concern raised in https://github.com/mozilla/rust/pull/13897

10 years agoMake Vec.truncate() resilient against failure in Drop
Kevin Ballard [Wed, 14 May 2014 21:57:27 +0000 (14:57 -0700)]
Make Vec.truncate() resilient against failure in Drop

If a vector element fails in Drop, Vec needs to make sure it doesn't try
to re-drop any elements it already dropped.

10 years agorustdoc: functions in ffi blocks are unsafe
Corey Richardson [Wed, 14 May 2014 23:33:15 +0000 (16:33 -0700)]
rustdoc: functions in ffi blocks are unsafe

Fixes #14188

10 years agostd: Modify TempDir to not fail on drop. Closes #12628
Brian Anderson [Thu, 15 May 2014 00:49:14 +0000 (17:49 -0700)]
std: Modify TempDir to not fail on drop. Closes #12628

After discussion with Alex, we think the proper policy is for dtors
to not fail. This is consistent with C++. BufferedWriter already
does this, so this patch modifies TempDir to not fail in the dtor,
adding a `close` method for handling errors on destruction.

10 years agomk: Don't run benchmarks with `make check`
Alex Crichton [Thu, 15 May 2014 18:15:35 +0000 (11:15 -0700)]
mk: Don't run benchmarks with `make check`

The current suite of benchmarks for the standard distribution take a significant
amount of time to run, but it's unclear whether we're gaining any benefit from
running them. Some specific pain points:

* No one is looking at the data generated by the benchmarks. We have no graphs
  or analysis of what's happening, so all the data is largely being cast into
  the void.

* No benchmark has ever uncovered a bug, they have always run successfully.

* Benchmarks not only take a significant amount of time to run, but also take a
  significant amount of time to compile. I don't think we should mitigate this
  for now because it's useful to ensure that they do indeed still compile.

This commit disables --bench test runs by default as part of `make check`,
flipping the NO_BENCH environment variable to a PLEASE_BENCH variable which will
manually enable benchmarking. If and when a dedicated bot is set up for
benchmarking, this flag can be enabled on that bot.

10 years agoauto merge of #14040 : hannobraun/rust/force-color-output, r=alexcrichton
bors [Thu, 15 May 2014 20:17:28 +0000 (13:17 -0700)]
auto merge of #14040 : hannobraun/rust/force-color-output, r=alexcrichton

This pull request fixes #12881.

Two caveats:

1. As explained in the commit message, this doesn't include a regression test. If this is unacceptable, please let me know, I'll see what I can do.
1. I'm getting some test failures on make check, all from debuginfo. I suspect this is due to #13680 and  not related to my changes (I have GDB 7.7). This is the list of failed tests:

> [debuginfo-gdb] debuginfo/basic-types-globals.rs
> [debuginfo-gdb] debuginfo/basic-types-mut-globals.rs
> [debuginfo-gdb] debuginfo/basic-types.rs
> [debuginfo-gdb] debuginfo/borrowed-basic.rs
> [debuginfo-gdb] debuginfo/borrowed-managed-basic.rs
> [debuginfo-gdb] debuginfo/borrowed-struct.rs
> [debuginfo-gdb] debuginfo/borrowed-unique-basic.rs
> [debuginfo-gdb] debuginfo/box.rs
> [debuginfo-gdb] debuginfo/by-value-non-immediate-argument.rs
> [debuginfo-gdb] debuginfo/by-value-self-argument-in-trait-impl.rs
> [debuginfo-gdb] debuginfo/closure-in-generic-function.rs
> [debuginfo-gdb] debuginfo/evec-in-struct.rs
> [debuginfo-gdb] debuginfo/function-arg-initialization.rs
> [debuginfo-gdb] debuginfo/function-prologue-stepping-no-split-stack.rs
> [debuginfo-gdb] debuginfo/generic-function.rs
> [debuginfo-gdb] debuginfo/generic-functions-nested.rs
> [debuginfo-gdb] debuginfo/generic-method-on-generic-struct.rs
> [debuginfo-gdb] debuginfo/generic-static-method-on-struct-and-enum.rs
> [debuginfo-gdb] debuginfo/generic-struct.rs
> [debuginfo-gdb] debuginfo/lexical-scope-in-stack-closure.rs
> [debuginfo-gdb] debuginfo/lexical-scope-in-unique-closure.rs
> [debuginfo-gdb] debuginfo/method-on-generic-struct.rs
> [debuginfo-gdb] debuginfo/method-on-tuple-struct.rs
> [debuginfo-gdb] debuginfo/name-shadowing-and-scope-nesting.rs
> [debuginfo-gdb] debuginfo/recursive-struct.rs
> [debuginfo-gdb] debuginfo/self-in-generic-default-method.rs
> [debuginfo-gdb] debuginfo/shadowed-argument.rs
> [debuginfo-gdb] debuginfo/shadowed-variable.rs
> [debuginfo-gdb] debuginfo/simd.rs
> [debuginfo-gdb] debuginfo/simple-lexical-scope.rs
> [debuginfo-gdb] debuginfo/simple-struct.rs
> [debuginfo-gdb] debuginfo/simple-tuple.rs
> [debuginfo-gdb] debuginfo/static-method-on-struct-and-enum.rs
> [debuginfo-gdb] debuginfo/tuple-struct.rs
> [debuginfo-gdb] debuginfo/var-captured-in-nested-closure.rs
> [debuginfo-gdb] debuginfo/var-captured-in-sendable-closure.rs
> [debuginfo-gdb] debuginfo/var-captured-in-stack-closure.rs

I can provide the full output on request.

10 years agoauto merge of #13948 : huonw/rust/test-regex-filter, r=alexcrichton
bors [Thu, 15 May 2014 18:22:02 +0000 (11:22 -0700)]
auto merge of #13948 : huonw/rust/test-regex-filter, r=alexcrichton

This allows writing a regex to filter tests more precisely, rather than having to list long paths e.g.

```
$ ./stdtest-x86_64-unknown-linux-gnu 'vec.*clone'

running 2 tests
test vec::tests::test_clone ... ok
test vec::tests::test_clone_from ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured
```

The regex change is fully backwards compatible, since test names are Rust
identifiers + `:`, and hence not special regex characters.

(See commits for details.)

10 years agoauto merge of #13954 : aturon/rust/issue-11650, r=alexcrichton
bors [Thu, 15 May 2014 15:36:50 +0000 (08:36 -0700)]
auto merge of #13954 : aturon/rust/issue-11650, r=alexcrichton

## Process API

The existing APIs for spawning processes took strings for the command
and arguments, but the underlying system may not impose utf8 encoding,
so this is overly limiting.

The assumption we actually want to make is just that the command and
arguments are viewable as [u8] slices with no interior NULLs, i.e., as
CStrings. The ToCStr trait is a handy bound for types that meet this
requirement (such as &str and Path).

However, since the commands and arguments are often a mixture of
strings and paths, it would be inconvenient to take a slice with a
single T: ToCStr bound. So this patch revamps the process creation API
to instead use a builder-style interface, called `Command`, allowing
arguments to be added one at a time with differing ToCStr
implementations for each.

The initial cut of the builder API has some drawbacks that can be
addressed once issue #13851 (libstd as a facade) is closed. These are
detailed as FIXMEs.

## Dynamic library API

`std::unstable::dynamic_library::open_external` currently takes a
`Path`, but because `Paths` produce normalized strings, this can
change the semantics of lookups in a given environment. This patch
generalizes the function to take a `ToCStr`-bounded type, which
includes both `Path`s and `str`s.

## ToCStr API

Adds ToCStr impl for &Path and ~str. This is a stopgap until DST (#12938) lands.

Until DST lands, we cannot decompose &str into & and str, so we cannot
usefully take ToCStr arguments by reference (without forcing an
additional & around &str). So we are instead temporarily adding an
instance for &Path and ~str, so that we can take ToCStr as owned. When
DST lands, the &Path instance should be removed, the string instances
should be revisted, and arguments bound by ToCStr should be passed by
reference.

FIXMEs have been added accordingly.

## Tickets closed

Closes #11650.
Closes #7928.

10 years agoauto merge of #14198 : thestinger/rust/valgrind, r=luqmana
bors [Thu, 15 May 2014 14:06:47 +0000 (07:06 -0700)]
auto merge of #14198 : thestinger/rust/valgrind, r=luqmana

10 years agoAdd compiler flag to configure output coloring
Hanno Braun [Thu, 8 May 2014 13:10:03 +0000 (13:10 +0000)]
Add compiler flag to configure output coloring

This adds the flag --color, which allows the user to force coloring or
turn it off. The default behavior stays the same as before (colorize, if
output goes to tty).
Why this is beneficial is explained in issue #12881.

Please note that this commit doesn't include any regression tests. I
thought about how I'd write a test for this and it doesn't seem to be
worth the effort to me for a UI change like this.

Fixes #12881.

10 years agostd:: switch the order in which dynamic_lib adds search paths.
Huon Wilson [Thu, 8 May 2014 13:33:22 +0000 (23:33 +1000)]
std:: switch the order in which dynamic_lib adds search paths.

The compiler needs to be opening e.g. libregex in the correct directory,
which requires getting these in the right order.

10 years agotest: ensure that the extended usage description gets printed.
Huon Wilson [Mon, 5 May 2014 12:44:07 +0000 (22:44 +1000)]
test: ensure that the extended usage description gets printed.

Previously the longer hand-written usage string was never being printed:
theoretically it was trying to detect when precisely `--help` was
passed (but not `-h`), but the getopts framework was considering a check
for the presence of `-h` to be a check for that of `--help` too,
i.e. the code was always going through the `-h` path.

This changes it to print the extended usage for both `-h` and `--help`,
meaning that it does actually appear correctly.

10 years agotest: allow the test filter to be a regex.
Huon Wilson [Mon, 5 May 2014 12:19:38 +0000 (22:19 +1000)]
test: allow the test filter to be a regex.

This is fully backwards compatible, since test names are Rust
identifiers + `:`, and hence not special regex characters.

Fixes #2866.

10 years agotest: implement a no-alloc -> &str method for TestName.
Huon Wilson [Mon, 5 May 2014 09:15:17 +0000 (19:15 +1000)]
test: implement a no-alloc -> &str method for TestName.

This is far cheaper than the `.to_str` technique that was used previously.

10 years agoauto merge of #14174 : stepancheg/rust/once, r=alexcrichton
bors [Thu, 15 May 2014 11:16:47 +0000 (04:16 -0700)]
auto merge of #14174 : stepancheg/rust/once, r=alexcrichton

Submitting PR again, because I cannot reopen #13349, and github does not attach new patch to that PR.

=======

Optimize `Once::doit`: perform optimistic check that initializtion is
already completed.  `load` is much cheaper than `fetch_add` at least
on x86_64.

Verified with this test:

```
static mut o: one::Once = one::ONCE_INIT;
unsafe {
    loop {
        let start = time::precise_time_ns();
        let iters = 50000000u64;
        for _ in range(0, iters) {
            o.doit(|| { println!("once!"); });
        }
        let end = time::precise_time_ns();
        let ps_per_iter = 1000 * (end - start) / iters;
        println!("{} ps per iter", ps_per_iter);

        // confuse the optimizer
        o.doit(|| { println!("once!"); });
    }
}
```

Test executed on Mac, Intel Core i7 2GHz. Result is:
* 20ns per iteration without patch
*  4ns per iteration with this patch applied

Once.doit could be even faster (800ps per iteration), if `doit` function
was split into a pair of `doit`/`doit_slow`, and `doit` marked as
`#[inline]` like this:

```
#[inline(always)]
pub fn doit(&self, f: ||) {
    if self.cnt.load(atomics::SeqCst) < 0 {
        return
    }

    self.doit_slow(f);
}

fn doit_slow(&self, f: ||) { ... }
```

10 years agoauto merge of #14145 : pnkfelix/rust/fsk-better-svh-via-visitor, r=alexcrichton
bors [Thu, 15 May 2014 09:41:50 +0000 (02:41 -0700)]
auto merge of #14145 : pnkfelix/rust/fsk-better-svh-via-visitor, r=alexcrichton

Teach SVH computation to ignore more implementation artifacts.

In particular, this version of strict version hash (SVH) works much
like the deriving(Hash)-based implementation did, except that it
deliberately:

  1. skips over content known not affect the generated crates, and,

  2. uses a content-based hash for names instead of using the value of
     the `Name` index itself, which can differ depending on the order
     in which strings are interned (which in turn is affected by
     e.g. the presence of `--cfg` options on the command line).

Fix #14132.

10 years agoAdded tests checking that changes in type sig are recognized in SVH.
Felix S. Klock II [Wed, 14 May 2014 13:24:10 +0000 (15:24 +0200)]
Added tests checking that changes in type sig are recognized in SVH.

(Only after adding the tests did I realize that this is not really a
special case at the AST level; as far as the visitor is concerned,
`int` and `i32` and `i64` are just idents.)

10 years agoA test case for a bug I found in the new SVH while reviewing it.
Felix S. Klock II [Wed, 14 May 2014 10:36:03 +0000 (12:36 +0200)]
A test case for a bug I found in the new SVH while reviewing it.

Namely: non-pub `use` declarations *are* significant to the SVH
computation, since they can change which traits are part of the method
resolution step, and thus affect which methods get called from the
(potentially inlined) code.

10 years agoSome basic acceptance tests for better SVH.
Felix S. Klock II [Tue, 13 May 2014 09:55:44 +0000 (11:55 +0200)]
Some basic acceptance tests for better SVH.

10 years agoTeach SVH computation to ignore more implementation artifacts.
Felix S. Klock II [Mon, 12 May 2014 17:11:46 +0000 (19:11 +0200)]
Teach SVH computation to ignore more implementation artifacts.

In particular, this version of strict version hash (SVH) works much
like the deriving(Hash)-based implementation did, except that uses a
content-based hash that filters rustc implementation artifacts and
surface syntax artifacts.

Fix #14132.

10 years agosyntax::visit: pub `walk_explicit_self` so impls can call it as defaults do.
Felix S. Klock II [Mon, 12 May 2014 16:58:23 +0000 (18:58 +0200)]
syntax::visit: pub `walk_explicit_self` so impls can call it as defaults do.

drive-by: added some doc.

10 years agoauto merge of #14162 : brson/rust/fixvercmd, r=brson
bors [Thu, 15 May 2014 08:02:11 +0000 (01:02 -0700)]
auto merge of #14162 : brson/rust/fixvercmd, r=brson

Instead of just blindly printing arg[0], use a constant string.

Partial fix for #13582

10 years agoChange dynamic_library::open_external to take ToCStr
Aaron Turon [Mon, 5 May 2014 21:53:57 +0000 (14:53 -0700)]
Change dynamic_library::open_external to take ToCStr

`std::unstable::dynamic_library::open_external` currently takes a
`Path`, but because `Paths` produce normalized strings, this can
change the semantics of lookups in a given environment. This patch
generalizes the function to take a `ToCStr`-bounded type, which
includes both `Path`s and `str`s.

Closes #11650.

10 years agoProcess::new etc should support non-utf8 commands/args
Aaron Turon [Mon, 5 May 2014 21:33:55 +0000 (14:33 -0700)]
Process::new etc should support non-utf8 commands/args

The existing APIs for spawning processes took strings for the command
and arguments, but the underlying system may not impose utf8 encoding,
so this is overly limiting.

The assumption we actually want to make is just that the command and
arguments are viewable as [u8] slices with no interior NULLs, i.e., as
CStrings. The ToCStr trait is a handy bound for types that meet this
requirement (such as &str and Path).

However, since the commands and arguments are often a mixture of
strings and paths, it would be inconvenient to take a slice with a
single T: ToCStr bound. So this patch revamps the process creation API
to instead use a builder-style interface, called `Command`, allowing
arguments to be added one at a time with differing ToCStr
implementations for each.

The initial cut of the builder API has some drawbacks that can be
addressed once issue #13851 (libstd as a facade) is closed. These are
detailed as FIXMEs.

Closes #11650.

[breaking-change]

10 years agoAdd ToCStr impl for &Path and StrBuf
Aaron Turon [Mon, 5 May 2014 21:15:11 +0000 (14:15 -0700)]
Add ToCStr impl for &Path and StrBuf

This is a stopgap until DST (#12938) lands.

Until DST lands, we cannot decompose &str into & and str, so we cannot
usefully take ToCStr arguments by reference (without forcing an
additional & around &str). So we are instead temporarily adding an
instance for &Path and StrBuf, so that we can take ToCStr as owned. When
DST lands, the &Path instance should be removed, the string instances
should be revisted, and arguments bound by ToCStr should be passed by
reference.

FIXMEs have been added accordingly.

10 years agoauto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichton
bors [Thu, 15 May 2014 05:06:50 +0000 (22:06 -0700)]
auto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichton

Also Show, which is useful in assertions. Fixes #14074

10 years agoauto merge of #14170 : pcwalton/rust/detildestr-misclibs, r=alexcrichton
bors [Thu, 15 May 2014 02:31:52 +0000 (19:31 -0700)]
auto merge of #14170 : pcwalton/rust/detildestr-misclibs, r=alexcrichton

r? @brson

10 years agolibnum: Remove all uses of `~str` from `libnum`
Patrick Walton [Wed, 14 May 2014 01:08:40 +0000 (18:08 -0700)]
libnum: Remove all uses of `~str` from `libnum`

10 years agolibcollections: Remove most uses of `~str` from `libcollections`
Patrick Walton [Wed, 14 May 2014 01:01:54 +0000 (18:01 -0700)]
libcollections: Remove most uses of `~str` from `libcollections`

10 years agoliburl: Remove all uses of `~str` from `liburl`
Patrick Walton [Wed, 14 May 2014 00:51:05 +0000 (17:51 -0700)]
liburl: Remove all uses of `~str` from `liburl`

10 years agolibterm: Remove all uses of `~str` from `libterm`
Patrick Walton [Wed, 14 May 2014 00:26:41 +0000 (17:26 -0700)]
libterm: Remove all uses of `~str` from `libterm`

10 years agolibtest: Remove all uses of `~str` from `libtest`.
Patrick Walton [Tue, 13 May 2014 23:44:05 +0000 (16:44 -0700)]
libtest: Remove all uses of `~str` from `libtest`.

10 years agolibsync: Remove all uses of `~str` from `libsync`
Patrick Walton [Tue, 13 May 2014 21:57:26 +0000 (14:57 -0700)]
libsync: Remove all uses of `~str` from `libsync`

10 years agolibrand: Remove all uses of `~str` from `librand`
Patrick Walton [Tue, 13 May 2014 21:38:13 +0000 (14:38 -0700)]
librand: Remove all uses of `~str` from `librand`

10 years agolibtime: Remove all uses of `~str` from `libtime`
Patrick Walton [Tue, 13 May 2014 05:24:20 +0000 (22:24 -0700)]
libtime: Remove all uses of `~str` from `libtime`

10 years agolibsemver: Remove all uses of `~str` from `libsemver`
Patrick Walton [Tue, 13 May 2014 04:39:26 +0000 (21:39 -0700)]
libsemver: Remove all uses of `~str` from `libsemver`

10 years agolibglob: Remove all uses of `~str` from `libglob`
Patrick Walton [Tue, 13 May 2014 04:36:30 +0000 (21:36 -0700)]
libglob: Remove all uses of `~str` from `libglob`

10 years agoliblog: Remove all uses of `~str` from `liblog`
Patrick Walton [Tue, 13 May 2014 04:35:40 +0000 (21:35 -0700)]
liblog: Remove all uses of `~str` from `liblog`

10 years agolibgraphviz: Remove all uses of `~str` from `libgraphviz`.
Patrick Walton [Tue, 13 May 2014 04:14:03 +0000 (21:14 -0700)]
libgraphviz: Remove all uses of `~str` from `libgraphviz`.

10 years agolibregex: Remove all uses of `~str` from `libregex`
Patrick Walton [Tue, 13 May 2014 04:12:50 +0000 (21:12 -0700)]
libregex: Remove all uses of `~str` from `libregex`

10 years agoChange StrBuf::from_utf8() to return Result
Kevin Ballard [Wed, 14 May 2014 23:55:24 +0000 (16:55 -0700)]
Change StrBuf::from_utf8() to return Result

This allows the original vector to be recovered in the event that it is
not UTF-8.

[breaking-change]

10 years agoChange str::from_utf8_owned() to return Result
Kevin Ballard [Wed, 14 May 2014 23:48:05 +0000 (16:48 -0700)]
Change str::from_utf8_owned() to return Result

This allows the original vector to be recovered in the event that it is
not valid UTF-8.

[breaking-change]