]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoAdd ToCStr method .with_c_str()
Kevin Ballard [Thu, 15 Aug 2013 02:21:59 +0000 (19:21 -0700)]
Add ToCStr method .with_c_str()

.with_c_str() is a replacement for the old .as_c_str(), to avoid
unnecessary boilerplate.

Replace all usages of .to_c_str().with_ref() with .with_c_str().

10 years agoCheck for interior nulls in .to_c_str()
Kevin Ballard [Thu, 15 Aug 2013 02:19:29 +0000 (19:19 -0700)]
Check for interior nulls in .to_c_str()

Previous dicussions about CString suggested that interior nulls should
throw an error. This was never implemented. Add this now, using a
condition (named null_byte) to allow for recovery.

Add method .to_c_str_unchecked() that skips this check.

10 years agoClarify docs on CString.unwrap()
Kevin Ballard [Thu, 15 Aug 2013 02:18:24 +0000 (19:18 -0700)]
Clarify docs on CString.unwrap()

CString.unwrap() drops ownership of the buffer on the floor. Put this in
the docs.

10 years agoauto merge of #8452 : Kimundi/rust/stuff02, r=bstrie
bors [Wed, 14 Aug 2013 15:35:15 +0000 (08:35 -0700)]
auto merge of #8452 : Kimundi/rust/stuff02, r=bstrie

- Methodyfied the string ascii extionsion functions - They got added recently, I wrapped them in a trait.
- Added `into_owned()` method for vectors - similar to `Str`'s `into_owned()` function, allows to convert to a owned vector without making a copy if the source is a owned vector.
- Added `or_some` method to option - similar to `unwrap_or_default`, but keeps the values wrapped in an `Option`. Useful for `Option` chains, eg Iterator impls.
- Added `DoubleEndedIterator` impl to `Option` - Just for compatibility with generic Iterator functions.
- Renamed nil.rs to unit.rs - the type got renamed ages ago, it's time the source file is as well.

10 years agoauto merge of #8453 : dmanescu/rust/8451, r=cmr
bors [Wed, 14 Aug 2013 13:44:18 +0000 (06:44 -0700)]
auto merge of #8453 : dmanescu/rust/8451, r=cmr

I'm not sure that the supplied tests are suitable.

10 years agoMethodyfied the string ascii extionsion functions
Marvin Löbel [Sun, 11 Aug 2013 02:21:31 +0000 (04:21 +0200)]
Methodyfied the string ascii extionsion functions
Added into_owned() method for vectors
Added DoubleEnded Iterator impl to Option
Renamed nil.rs to unit.rs

10 years agoauto merge of #8440 : sfackler/rust/env-fix, r=pcwalton
bors [Wed, 14 Aug 2013 11:41:20 +0000 (04:41 -0700)]
auto merge of #8440 : sfackler/rust/env-fix, r=pcwalton

The type of the result of option_env! was not fully specified in the
None case, leading to type check failures in the case where the variable
was not defined (e.g. option_env!("FOO").is_none()).

Also cleaned up some compilation warnings.

10 years agoauto merge of #8439 : huonw/rust/hashset-clone, r=cmr
bors [Wed, 14 Aug 2013 09:38:19 +0000 (02:38 -0700)]
auto merge of #8439 : huonw/rust/hashset-clone, r=cmr

Closes #5581.

10 years agoauto merge of #8477 : catamorphism/rust/issue-4096, r=msullivan
bors [Wed, 14 Aug 2013 06:59:18 +0000 (23:59 -0700)]
auto merge of #8477 : catamorphism/rust/issue-4096, r=msullivan

r? @msullivan ...e parameters

In this case, it's likely to be that the user forgot the `self` type, so
say so.

Closes #4096

10 years agoauto merge of #8497 : nikomatsakis/rust/improvements-to-object-coercion, r=pcwalton
bors [Wed, 14 Aug 2013 04:29:20 +0000 (21:29 -0700)]
auto merge of #8497 : nikomatsakis/rust/improvements-to-object-coercion, r=pcwalton

While looking over the code for object coercion, I realized that it wasn't quite handling freezing and reborrowing correctly. Tweak the code, adding tests for the relevant cases.

r? @pcwalton

10 years agoauto merge of #8446 : alexcrichton/rust/ifmt++, r=graydon
bors [Wed, 14 Aug 2013 02:23:21 +0000 (19:23 -0700)]
auto merge of #8446 : alexcrichton/rust/ifmt++, r=graydon

This includes a number of improvements to `ifmt!`

* Implements formatting arguments -- `{:0.5x}` works now
* Formatting now works on all integer widths, not just `int` and `uint`
* Added a large doc block to `std::fmt` which should help explain what `ifmt!` is all about
* Added floating point formatters, although they have the same pitfalls from before (they're just proof-of-concept now)

Closed a couple of issues along the way, yay! Once this gets into a snapshot, I'll start looking into removing all of `fmt`

10 years agoAdd `f` formats to `ifmt!`
Alex Crichton [Sun, 11 Aug 2013 01:46:44 +0000 (18:46 -0700)]
Add `f` formats to `ifmt!`

Currently the work just the same as the old `extfmt` versions

10 years agoauto merge of #8329 : michaelwoerister/rust/lexical_scopes_alt, r=graydon
bors [Tue, 13 Aug 2013 23:53:14 +0000 (16:53 -0700)]
auto merge of #8329 : michaelwoerister/rust/lexical_scopes_alt, r=graydon

This pull request re-implements handling of visibility scopes and source code positions in debug info. It should now be very stable and properly handle

+ variable shadowing
+ expanded code (macros and the new for-loop de-sugaring, for example)
+ variables in the middle of nested scopes
+ bindings declared in the head of match statement arms.

all of which did not work at all or did not work reliably before. Those interested in a more detailed description of the problems at hand, I kindly refer to http://michaelwoerister.github.io/2013/08/03/visibility-scopes.html

Why doesn't the `populate_scope_map()` function use `syntax::visit`?
Because it would not improve this particular AST walker (see: https://github.com/michaelwoerister/rust/commit/69dc7908490b8b492e9730cb1c34fa83c2ef30eb#commitcomment-3781426)

Cheers,
Michael

10 years agoauto merge of #8475 : kmcallister/rust/stack_segment, r=brson,brson
bors [Tue, 13 Aug 2013 21:57:24 +0000 (14:57 -0700)]
auto merge of #8475 : kmcallister/rust/stack_segment, r=brson,brson

Servo needs to tell SpiderMonkey about the stack bounds.

r? @brson

10 years agoMerge pull request #8432 from chris-morgan/remove-assert-eq-macro-fail-binary
Graydon Hoare [Tue, 13 Aug 2013 21:51:36 +0000 (14:51 -0700)]
Merge pull request #8432 from chris-morgan/remove-assert-eq-macro-fail-binary

Remove in-tree test binary.

10 years agoReborrow even when passing &Object to &Object, so as to permit freezing
Niko Matsakis [Tue, 13 Aug 2013 19:46:08 +0000 (15:46 -0400)]
Reborrow even when passing &Object to &Object, so as to permit freezing

10 years agoFix freezing of @mut Objects when passing as argument
Niko Matsakis [Tue, 13 Aug 2013 18:59:33 +0000 (14:59 -0400)]
Fix freezing of @mut Objects when passing as argument

10 years agoMake rt::stack public
Keegan McAllister [Tue, 13 Aug 2013 16:10:05 +0000 (09:10 -0700)]
Make rt::stack public

Fixes #8478.

10 years agoauto merge of #8423 : alexcrichton/rust/less-priv-again, r=bstrie
bors [Tue, 13 Aug 2013 14:26:23 +0000 (07:26 -0700)]
auto merge of #8423 : alexcrichton/rust/less-priv-again, r=bstrie

Closes #5495

10 years agoauto merge of #8411 : bblum/rust/assorted-fixes, r=brson
bors [Tue, 13 Aug 2013 11:59:20 +0000 (04:59 -0700)]
auto merge of #8411 : bblum/rust/assorted-fixes, r=brson

Each commit is pretty much what it says on the tin. r anybody.

10 years agoauto merge of #7866 : sstewartgallus/rust/clean, r=cmr
bors [Tue, 13 Aug 2013 09:14:24 +0000 (02:14 -0700)]
auto merge of #7866 : sstewartgallus/rust/clean, r=cmr

Mostly I did simple transformations from imperative style loops to
more functional iterator based transformations.

10 years agodebuginfo: Add some tests for visibiliy scopes within closures.
Michael Woerister [Tue, 6 Aug 2013 22:14:08 +0000 (00:14 +0200)]
debuginfo: Add some tests for visibiliy scopes within closures.

10 years agodebuginfo: Add support for argument shadowing.
Michael Woerister [Tue, 6 Aug 2013 22:13:31 +0000 (00:13 +0200)]
debuginfo: Add support for argument shadowing.

10 years agodebuginfo: Implemented proper handling of lexical scopes and variable shadowing.
Michael Woerister [Mon, 5 Aug 2013 09:12:40 +0000 (11:12 +0200)]
debuginfo: Implemented proper handling of lexical scopes and variable shadowing.

10 years agoauto merge of #8487 : brson/rust/local-opts, r=brson
bors [Tue, 13 Aug 2013 06:56:26 +0000 (23:56 -0700)]
auto merge of #8487 : brson/rust/local-opts, r=brson

I did this once but acciddentally undid it in a later patch.

10 years agoForbid pub/priv where it has no effect
Alex Crichton [Fri, 9 Aug 2013 08:25:24 +0000 (01:25 -0700)]
Forbid pub/priv where it has no effect

Closes #5495

10 years agoExplain what ifmt! is all about
Alex Crichton [Sun, 11 Aug 2013 01:21:34 +0000 (18:21 -0700)]
Explain what ifmt! is all about

10 years agoCorrect the padding on integer types for formatting
Alex Crichton [Sat, 10 Aug 2013 23:50:42 +0000 (16:50 -0700)]
Correct the padding on integer types for formatting

10 years agoDefine integer formats for all widths
Alex Crichton [Sat, 10 Aug 2013 20:38:32 +0000 (13:38 -0700)]
Define integer formats for all widths

Closes #1653

10 years agoImplement formatting arguments for strings and integers
Alex Crichton [Sat, 10 Aug 2013 07:28:47 +0000 (00:28 -0700)]
Implement formatting arguments for strings and integers

Closes #1651

10 years agostd: Re-optimize tls access on local allocation path
Brian Anderson [Tue, 13 Aug 2013 02:09:46 +0000 (19:09 -0700)]
std: Re-optimize tls access on local allocation path

I did this once but acciddentally undid it in a later patch.

10 years agoauto merge of #8476 : thestinger/rust/snapshot, r=brson
bors [Tue, 13 Aug 2013 03:29:22 +0000 (20:29 -0700)]
auto merge of #8476 : thestinger/rust/snapshot, r=brson

10 years agoauto merge of #8450 : alexcrichton/rust/nopt-changes, r=graydon
bors [Tue, 13 Aug 2013 00:59:19 +0000 (17:59 -0700)]
auto merge of #8450 : alexcrichton/rust/nopt-changes, r=graydon

Since the new runtime landed, the *-nopt builders have increased cycle time by roughly an hour. I have a feeling that this is because the entire runtime is in rust and it's not being optimized at all. In that past with an optimized C++ runtime it looks like things ran faster.

This adds the ability to disable optimizations in tests only, not for the entire compiler. This means that the entire compiler and associated libraries will be built with optimizations, but the tests themselves would be built and run without optimizations.

This isn't quite as good of a guarantee as disabling optimizations everywhere, but hopefully it'll improve cycle time for the *-nopt builds to move the queue along faster.

10 years agoauto merge of #8419 : cmr/rust/fix-rtdebug, r=brson
bors [Mon, 12 Aug 2013 22:28:49 +0000 (15:28 -0700)]
auto merge of #8419 : cmr/rust/fix-rtdebug, r=brson

It now actually does logging, and is compiled out when `--cfg rtdebug` is not
given to the libstd build, which it isn't by default. This makes the rt
benchmarks 18-50% faster.

10 years agorustc: Give a hint when a static method call has fewer than expected type parameters
Tim Chevalier [Mon, 12 Aug 2013 21:39:27 +0000 (14:39 -0700)]
rustc: Give a hint when a static method call has fewer than expected type parameters

In this case, it's likely to be that the user forgot the `self` type, so
say so.

Closes #4096

10 years agofix build with the new snapshot compiler
Daniel Micay [Mon, 12 Aug 2013 21:25:14 +0000 (17:25 -0400)]
fix build with the new snapshot compiler

10 years agoregister snapshots
Daniel Micay [Mon, 12 Aug 2013 21:19:09 +0000 (17:19 -0400)]
register snapshots

10 years agort::task: Make current_stack_segment public
Keegan McAllister [Mon, 12 Aug 2013 20:54:38 +0000 (13:54 -0700)]
rt::task: Make current_stack_segment public

Servo needs to tell SpiderMonkey about the stack bounds.

10 years agoClean up transitionary glue in task/spawn.rs. Don't hold kill-little-lock for O(n...
Ben Blum [Mon, 12 Aug 2013 18:54:09 +0000 (14:54 -0400)]
Clean up transitionary glue in task/spawn.rs. Don't hold kill-little-lock for O(n) time, cf #3100, and optimize out several unneeded clone()s.

10 years agoauto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmr
bors [Mon, 12 Aug 2013 18:53:18 +0000 (11:53 -0700)]
auto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmr

Use Eq + Ord for lexicographical ordering of sequences.

For each of <, <=, >= or > as R, use::

    [x, ..xs] R [y, ..ys]  =  if x != y { x R y } else { xs R ys }

Previous code using `a < b` and then `!(b < a)` for short-circuiting
fails on cases such as  [1.0, 2.0] < [0.0/0.0, 3.0], where the first
element was effectively considered equal.

Containers like &[T] did also implement only one comparison operator `<`,
and derived the comparison results from this. This isn't correct either for
Ord.

Implement functions in `std::iterator::order::{lt,le,gt,ge,equal,cmp}` that all
iterable containers can use for lexical order.

We also visit tuple ordering, having the same problem and same solution
(but differing implementation).

10 years agoFix select() in light of the deschedule...and then race. Close #8347.
Ben Blum [Fri, 9 Aug 2013 02:26:23 +0000 (22:26 -0400)]
Fix select() in light of the deschedule...and then race. Close #8347.

10 years agoMake cell with_ref/with_mut_ref use finally. Close #7975.
Ben Blum [Thu, 8 Aug 2013 23:34:08 +0000 (19:34 -0400)]
Make cell with_ref/with_mut_ref use finally. Close #7975.

10 years agoReorganise Select traits to not expose internal runtime types. Close #5160. Pending...
Ben Blum [Thu, 8 Aug 2013 22:34:10 +0000 (18:34 -0400)]
Reorganise Select traits to not expose internal runtime types. Close #5160. Pending #8215.

10 years agoDon't use unkillable in UnsafeArc dtor when there's no unwrapper. Close #8382.
Ben Blum [Thu, 8 Aug 2013 00:26:15 +0000 (20:26 -0400)]
Don't use unkillable in UnsafeArc dtor when there's no unwrapper. Close #8382.

10 years agoauto merge of #8429 : catamorphism/rust/rustpkg-docs, r=catamorphism
bors [Mon, 12 Aug 2013 15:17:14 +0000 (08:17 -0700)]
auto merge of #8429 : catamorphism/rust/rustpkg-docs, r=catamorphism

10 years agoauto merge of #8428 : blake2-ppc/rust/peekable-iterators, r=thestinger
bors [Mon, 12 Aug 2013 11:29:11 +0000 (04:29 -0700)]
auto merge of #8428 : blake2-ppc/rust/peekable-iterators, r=thestinger

Peekable changes by @SimonSapin and original PR is #8396

10 years agoauto merge of #8418 : pnkfelix/rust/fsk-issue3192-improve-parse-error-for-empty-struc...
bors [Mon, 12 Aug 2013 07:32:11 +0000 (00:32 -0700)]
auto merge of #8418 : pnkfelix/rust/fsk-issue3192-improve-parse-error-for-empty-struct-init, r=pcwalton,me

Fix #3192.  r? anyone

There are 4 different new tests, to check some different scenarios for
what the parse context is at the time of recovery, becasue our
compile-fail infrastructure does not appear to handle verifying
error-recovery situations.

Differentiate between unit-like struct definition item and unit-like
struct construction in the error message.

----

More generally, outlines a more generic strategy for parse error
recovery: By committing to an expression/statement at set points in
the parser, we can then do some look-ahead to catch common mistakes
and skip over them.

One detail about this strategy is that you want to avoid emitting the
"helpful" message unless the input is reasonably close to the case of
interest.  (E.g. do not warn about a potential unit struct for an
input of the form `let hmm = do foo { } { };`)

To accomplish this, I added (partial) last_token tracking; used for
`commit_stmt` support.

The check_for_erroneous_unit_struct_expecting fn returns bool to
signal whether it "made progress"; currently unused; this is meant for
use to compose several such recovery checks together in a loop.

10 years agoauto merge of #8410 : luqmana/rust/mcpu, r=sanxiyn
bors [Mon, 12 Aug 2013 03:50:14 +0000 (20:50 -0700)]
auto merge of #8410 : luqmana/rust/mcpu, r=sanxiyn

Adds `--target-cpu` flag which lets you choose a more specific target cpu instead of just passing the default, `generic`. It's more or less akin to `-mcpu`/`-mtune` in clang/gcc.

10 years agoauto merge of #8427 : brson/rust/rustc-stack, r=thestinger
bors [Mon, 12 Aug 2013 00:38:09 +0000 (17:38 -0700)]
auto merge of #8427 : brson/rust/rustc-stack, r=thestinger

A lot of people are hitting stack overflows in rustc. This will make it
easier to experiment with stack size.

10 years agoCleanup librustpkg a little bit.
Steven Stewart-Gallus [Thu, 18 Jul 2013 00:08:13 +0000 (17:08 -0700)]
Cleanup librustpkg a little bit.

Mostly I did simple transformations from imperative style loops to
more functional iterator based transformations.

10 years agoFixed option_env! type
Steven Fackler [Sat, 10 Aug 2013 18:09:30 +0000 (11:09 -0700)]
Fixed option_env! type

The type of the result of option_env! was not fully specified in the
None case, leading to type check failures in the case where the variable
was not defined (e.g. option_env!("FOO").is_none()).

10 years agoauto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon
bors [Sun, 11 Aug 2013 21:17:09 +0000 (14:17 -0700)]
auto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon

Fix #5762 and various other aspects of object invocation.

r? @graydon

10 years agoConvert from transform to map
Niko Matsakis [Sun, 11 Aug 2013 18:56:43 +0000 (14:56 -0400)]
Convert from transform to map

10 years agotests: Add new tests for borrowck/objects and update some existing tests
Niko Matsakis [Sun, 11 Aug 2013 17:58:48 +0000 (13:58 -0400)]
tests: Add new tests for borrowck/objects and update some existing tests

10 years agoUpdate type visitor to use &Visitor and not @Visitor
Niko Matsakis [Sun, 11 Aug 2013 17:58:01 +0000 (13:58 -0400)]
Update type visitor to use &Visitor and not @Visitor

10 years agoborrowck: Integrate AutoBorrowObj into borrowck / mem_categorization
Niko Matsakis [Sun, 11 Aug 2013 17:56:30 +0000 (13:56 -0400)]
borrowck: Integrate AutoBorrowObj into borrowck / mem_categorization

Also cleanup the treatment of mutability in mem_categorization, which still
included the concept of interior mutability. At some point, we should
refactor the types to exclude the possibility of interior mutability rather
than just ignoring the mutability value in those cases.

10 years agotypeck: Modify method resolution to use new object adjustments, and
Niko Matsakis [Sun, 11 Aug 2013 17:44:26 +0000 (13:44 -0400)]
typeck: Modify method resolution to use new object adjustments, and
to favor inherent methods over extension methods.

The reason to favor inherent methods is that otherwise an impl
like

    impl Foo for @Foo { fn method(&self) { self.method() } }

causes infinite recursion.  The current change to favor inherent methods is
rather hacky; the method resolution code is in need of a refactoring.

10 years agotrans: Rely on new AutoBorrowObj adjustment to match up object receivers
Niko Matsakis [Sun, 11 Aug 2013 17:42:26 +0000 (13:42 -0400)]
trans: Rely on new AutoBorrowObj adjustment to match up object receivers

Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)

10 years agoty: Add (but do not yet use) AutoBorrowObject option to adjustments
Niko Matsakis [Sun, 11 Aug 2013 17:39:05 +0000 (13:39 -0400)]
ty: Add (but do not yet use) AutoBorrowObject option to adjustments

Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)

10 years agotypeck/check/method: Remove `pub` from most methods
Niko Matsakis [Sun, 11 Aug 2013 17:36:36 +0000 (13:36 -0400)]
typeck/check/method: Remove `pub` from most methods

10 years agoMisc small cleanups
Niko Matsakis [Sun, 11 Aug 2013 17:34:18 +0000 (13:34 -0400)]
Misc small cleanups

10 years agoAdd a field `borrow_offset` to the type descriptor indicating
Niko Matsakis [Sun, 11 Aug 2013 17:29:14 +0000 (13:29 -0400)]
Add a field `borrow_offset` to the type descriptor indicating
what amount a T* pointer must be adjusted to reach the contents
of the box. For `~T` types, this requires knowing the type `T`,
which is not known in the case of objects.

10 years agoauto merge of #8420 : blake2-ppc/rust/shrink-token, r=cmr
bors [Sun, 11 Aug 2013 17:50:10 +0000 (10:50 -0700)]
auto merge of #8420 : blake2-ppc/rust/shrink-token, r=cmr

`enum Token` was 192 bytes (64-bit), as pointed out by pnkfelix; the only
bloating variant being `INTERPOLATED(nonterminal)`.

Updating `enum nonterminal` to use ~ where variants included big types,
shrunk size_of(Token) to 32 bytes (64-bit).

I am unsure if the `nt_ident` variant should have an indirection, with
ast::ident being only 16 bytes (64-bit), but without this, enum Token
would be 40 bytes.

A dumb benchmark says that compilation time is unchanged, while peak
memory usage for compiling std.rs is down 3%

Before::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.00user 0.39system 0:19.41elapsed 99%CPU (0avgtext+0avgdata 627820maxresident)k
    0inputs+28896outputs (0major+228665minor)pagefaults 0swaps
    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.64user 0.34system 0:32.02elapsed 99%CPU (0avgtext+0avgdata 629876maxresident)k
    0inputs+22432outputs (0major+229411minor)pagefaults 0swaps

After::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.07user 0.45system 0:19.55elapsed 99%CPU (0avgtext+0avgdata 609384maxresident)k
    0inputs+28896outputs (0major+221997minor)pagefaults 0swaps

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.90user 0.34system 0:32.28elapsed 99%CPU (0avgtext+0avgdata 612080maxresident)k
    0inputs+22432outputs (0major+223726minor)pagefaults 0swaps

10 years agolibrustc: Convert from `@Object` to `@mut Object` as needed
Niko Matsakis [Sun, 11 Aug 2013 17:26:59 +0000 (13:26 -0400)]
librustc: Convert from `@Object` to `@mut Object` as needed

10 years agolibsyntax: Update from `@Object` to `@mut Object` as required
Niko Matsakis [Sun, 11 Aug 2013 17:23:40 +0000 (13:23 -0400)]
libsyntax: Update from `@Object` to `@mut Object` as required

10 years agoFixed #8451 - extra::stats::write_boxplot() applied to negative or zero sample values
David Manescu [Sun, 11 Aug 2013 14:36:24 +0000 (00:36 +1000)]
Fixed #8451 - extra::stats::write_boxplot() applied to negative or zero sample values

10 years agoauto merge of #8421 : alexcrichton/rust/unnamed-addr, r=thestinger
bors [Sun, 11 Aug 2013 14:29:07 +0000 (07:29 -0700)]
auto merge of #8421 : alexcrichton/rust/unnamed-addr, r=thestinger

This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

```
fmt           310k
ifmt (before) 529k
ifmt (after)  202k
```

This now means that ifmt! is both faster and smaller than fmt!, yay!

10 years agoauto merge of #8412 : thestinger/rust/vector-add, r=alexcrichton
bors [Sun, 11 Aug 2013 11:11:08 +0000 (04:11 -0700)]
auto merge of #8412 : thestinger/rust/vector-add, r=alexcrichton

10 years agoauto merge of #8408 : thestinger/rust/checked, r=Aatch
bors [Sun, 11 Aug 2013 07:47:07 +0000 (00:47 -0700)]
auto merge of #8408 : thestinger/rust/checked, r=Aatch

10 years agoAllow disabling optimizations in tests only
Alex Crichton [Sun, 11 Aug 2013 07:29:45 +0000 (00:29 -0700)]
Allow disabling optimizations in tests only

10 years agofix unused imports
Daniel Micay [Sun, 11 Aug 2013 07:17:01 +0000 (03:17 -0400)]
fix unused imports

10 years agomove `strdup_uniq` lang item to std::str
Daniel Micay [Sat, 10 Aug 2013 17:42:53 +0000 (13:42 -0400)]
move `strdup_uniq` lang item to std::str

10 years agostr: optimize `with_capacity`
Daniel Micay [Sat, 10 Aug 2013 17:32:05 +0000 (13:32 -0400)]
str: optimize `with_capacity`

before:

test bench_with_capacity ... bench: 104 ns/iter (+/- 4)

after:

test bench_with_capacity ... bench: 56 ns/iter (+/- 1)

10 years agovec: optimize the Add implementation
Daniel Micay [Fri, 9 Aug 2013 03:49:49 +0000 (23:49 -0400)]
vec: optimize the Add implementation

before:

test add ... bench: 164 ns/iter (+/- 1)

after:

test add ... bench: 113 ns/iter (+/- 2)

10 years agodisable 64-bit CheckedMul on 32-bit
Daniel Micay [Sun, 11 Aug 2013 06:58:52 +0000 (02:58 -0400)]
disable 64-bit CheckedMul on 32-bit

code generation problem reported as issue #8449

10 years agoadd intrinsics for checked overflow add/sub/mul
Daniel Micay [Wed, 7 Aug 2013 19:40:09 +0000 (15:40 -0400)]
add intrinsics for checked overflow add/sub/mul

10 years agosyntax: Shrink enum Token and enum nonterminal
blake2-ppc [Fri, 9 Aug 2013 17:55:15 +0000 (19:55 +0200)]
syntax: Shrink enum Token and enum nonterminal

`enum Token` was 192 bytes (64-bit), as pointed out by pnkfelix; the only
bloating variant being `INTERPOLATED(nonterminal)`.

Updating `enum nonterminal` to use ~ where variants included big types,
shrunk size_of(Token) to 32 bytes (64-bit).

I am unsure if the `nt_ident` variant should have an indirection, with
ast::ident being only 16 bytes (64-bit), but without this, enum Token
would be 40 bytes.

A dumb benchmark says that compilation time is unchanged, while peak
memory usage for compiling std.rs is down 3%

Before::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.00user 0.39system 0:19.41elapsed 99%CPU (0avgtext+0avgdata 627820maxresident)k
    0inputs+28896outputs (0major+228665minor)pagefaults 0swaps
    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.64user 0.34system 0:32.02elapsed 99%CPU (0avgtext+0avgdata 629876maxresident)k
    0inputs+22432outputs (0major+229411minor)pagefaults 0swaps

After::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.07user 0.45system 0:19.55elapsed 99%CPU (0avgtext+0avgdata 609384maxresident)k
    0inputs+28896outputs (0major+221997minor)pagefaults 0swaps

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.90user 0.34system 0:32.28elapsed 99%CPU (0avgtext+0avgdata 612080maxresident)k
    0inputs+22432outputs (0major+223726minor)pagefaults 0swaps

10 years agoauto merge of #8404 : stepancheg/rust/zero-unit-inline, r=alexcrichton
bors [Sun, 11 Aug 2013 02:53:06 +0000 (19:53 -0700)]
auto merge of #8404 : stepancheg/rust/zero-unit-inline, r=alexcrichton

Follow-up to #8155

10 years agoextra::treemap: Use IteratorUtil::peekable
blake2-ppc [Fri, 9 Aug 2013 21:31:57 +0000 (23:31 +0200)]
extra::treemap: Use IteratorUtil::peekable

Replace the previous equivalent iterator adaptor with .peekable().
Refactor the set operation iterators so that they are easier to read.

10 years agoAdd a "peekable" iterator adaptor, with a peek() method that returns the next element.
Simon Sapin [Thu, 8 Aug 2013 19:46:36 +0000 (20:46 +0100)]
Add a "peekable" iterator adaptor, with a peek() method that returns the next element.

10 years agostd::iterator: Rename .peek() to .inspect()
blake2-ppc [Sat, 10 Aug 2013 23:55:34 +0000 (01:55 +0200)]
std::iterator: Rename .peek() to .inspect()

10 years agoauto merge of #8444 : erickt/rust/rollup, r=cmr
bors [Sat, 10 Aug 2013 23:32:18 +0000 (16:32 -0700)]
auto merge of #8444 : erickt/rust/rollup, r=cmr

This merges these PR together:

#8430: r=thestinger
#8370: r=thestinger
#8386: r=bstrie
#8388: r=thestinger
#8390: r=graydon
#8394: r=graydon
#8402: r=thestinger
#8403: r=catamorphism

10 years agorustc: Add --target-cpu flag to select a more specific processor instead of the defau...
Luqman Aden [Fri, 9 Aug 2013 02:16:00 +0000 (22:16 -0400)]
rustc: Add --target-cpu flag to select a more specific processor instead of the default, 'generic'.

10 years agoauto merge of #8430 : erickt/rust/cleanup-iterators, r=erickt
bors [Sat, 10 Aug 2013 20:17:19 +0000 (13:17 -0700)]
auto merge of #8430 : erickt/rust/cleanup-iterators, r=erickt

This PR does a bunch of cleaning up of various APIs. The major one is that it merges `Iterator` and `IteratorUtil`, and renames functions like `transform` into `map`. I also merged `DoubleEndedIterator` and `DoubleEndedIteratorUtil`, as well as I renamed various .consume* functions to .move_iter(). This helps to implement part of #7887.

10 years agoMerge branch 'match' of https://github.com/msullivan/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:04:16 +0000 (13:04 -0700)]
Merge branch 'match' of https://github.com/msullivan/rust into rollup

10 years agoMerge branch 'master' of https://github.com/MAnyKey/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:03:34 +0000 (13:03 -0700)]
Merge branch 'master' of https://github.com/MAnyKey/rust into rollup

10 years agoMerge branch 'issue-8393-attributes-in-macros' of https://github.com/nikomatsakis...
Erick Tryzelaar [Sat, 10 Aug 2013 20:03:19 +0000 (13:03 -0700)]
Merge branch 'issue-8393-attributes-in-macros' of https://github.com/nikomatsakis/rust into rollup

10 years agoMerge branch 'master' of https://github.com/p2j4d2c/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:02:44 +0000 (13:02 -0700)]
Merge branch 'master' of https://github.com/p2j4d2c/rust into rollup

10 years agoMerge branch 'trie-bound-iters' of https://github.com/dim-an/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:01:20 +0000 (13:01 -0700)]
Merge branch 'trie-bound-iters' of https://github.com/dim-an/rust into rollup

10 years agoMerge branch 'vec-exh' of https://github.com/stepancheg/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:00:20 +0000 (13:00 -0700)]
Merge branch 'vec-exh' of https://github.com/stepancheg/rust into rollup

10 years agoMerge branch 'enum-method-privacy' of https://github.com/michaelwoerister/rust into...
Erick Tryzelaar [Sat, 10 Aug 2013 19:59:52 +0000 (12:59 -0700)]
Merge branch 'enum-method-privacy' of https://github.com/michaelwoerister/rust into rollup

Conflicts:
src/libsyntax/opt_vec.rs

10 years agoMerge remote-tracking branch 'remotes/origin/master' into cleanup-iterators
Erick Tryzelaar [Sat, 10 Aug 2013 19:04:40 +0000 (12:04 -0700)]
Merge remote-tracking branch 'remotes/origin/master' into cleanup-iterators

10 years agoauto merge of #8327 : sstewartgallus/rust/factor_out_waitqueue, r=bblum
bors [Sat, 10 Aug 2013 14:47:14 +0000 (07:47 -0700)]
auto merge of #8327 : sstewartgallus/rust/factor_out_waitqueue, r=bblum

I'm a bit disappointed that I couldn't figure out how to factor out more of the code implementing `extra::sync` but I feel this is an okay start. Also I added some documentation explaining that `WaitQueue` isn't thread safe, and needs an exclusive lock.

@bblum

10 years agosyntax and rustc: fix some warnings
Erick Tryzelaar [Sat, 10 Aug 2013 14:14:10 +0000 (07:14 -0700)]
syntax and rustc: fix some warnings

10 years agostd: fix the non-stage0 str::raw::slice_bytes which broke in a merge
Erick Tryzelaar [Sat, 10 Aug 2013 14:13:47 +0000 (07:13 -0700)]
std: fix the non-stage0 str::raw::slice_bytes which broke in a merge

10 years agostd: Transform.find_ -> .find
Erick Tryzelaar [Sat, 10 Aug 2013 03:49:29 +0000 (20:49 -0700)]
std: Transform.find_ -> .find

10 years agostd: Iterator.len_ -> .len
Erick Tryzelaar [Sat, 10 Aug 2013 03:30:03 +0000 (20:30 -0700)]
std: Iterator.len_ -> .len

10 years agostd: Iterator.last_ -> .last
Erick Tryzelaar [Sat, 10 Aug 2013 03:25:45 +0000 (20:25 -0700)]
std: Iterator.last_ -> .last

10 years agostd: Iterator.chain_ -> .chain
Erick Tryzelaar [Sat, 10 Aug 2013 03:22:59 +0000 (20:22 -0700)]
std: Iterator.chain_ -> .chain

10 years agostd: Iterator.flat_map_ -> .flat_map
Erick Tryzelaar [Sat, 10 Aug 2013 03:20:05 +0000 (20:20 -0700)]
std: Iterator.flat_map_ -> .flat_map