Commit graph

18825 commits

Author SHA1 Message Date
Alex Crichton
443bf93e48 Fix a typo in the ifmt dox 2013-08-15 14:19:09 -07:00
Alex Crichton
783c6a1fbf Add a bunch of tests for closed issues
Closes #3907
Closes #5493
Closes #4464
Closes #4759
Closes #5666
Closes #5884
Closes #5926
Closes #6318
Closes #6557
Closes #6898
Closes #6919
Closes #7222
2013-08-13 21:32:34 -07:00
bors
7585b34d31 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`
2013-08-13 19:23:21 -07:00
Alex Crichton
36882b3d54 Add f formats to ifmt!
Currently the work just the same as the old `extfmt` versions
2013-08-13 19:16:40 -07:00
bors
433fbe8fcf 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: 69dc790849 (commitcomment-3781426))

Cheers,
Michael
2013-08-13 16:53:14 -07:00
bors
9f379329db auto merge of #8475 : kmcallister/rust/stack_segment, r=brson,brson
Servo needs to tell SpiderMonkey about the stack bounds.

r? @brson
2013-08-13 14:57:24 -07:00
Graydon Hoare
26fd428fae Merge pull request #8432 from chris-morgan/remove-assert-eq-macro-fail-binary
Remove in-tree test binary.
2013-08-13 14:51:36 -07:00
Keegan McAllister
4fd5318594 Make rt::stack public
Fixes #8478.
2013-08-13 09:10:07 -07:00
bors
0d817ee869 auto merge of #8423 : alexcrichton/rust/less-priv-again, r=bstrie
Closes #5495
2013-08-13 07:26:23 -07:00
bors
f02cc6bf0a auto merge of #8411 : bblum/rust/assorted-fixes, r=brson
Each commit is pretty much what it says on the tin. r anybody.
2013-08-13 04:59:20 -07:00
bors
c99b2b932f auto merge of #7866 : sstewartgallus/rust/clean, r=cmr
Mostly I did simple transformations from imperative style loops to
more functional iterator based transformations.
2013-08-13 02:14:24 -07:00
Michael Woerister
983cc777c5 debuginfo: Add some tests for visibiliy scopes within closures. 2013-08-13 11:13:49 +02:00
Michael Woerister
9c7d9eb6fd debuginfo: Add support for argument shadowing. 2013-08-13 11:13:49 +02:00
Michael Woerister
33e7d95e9c debuginfo: Implemented proper handling of lexical scopes and variable shadowing. 2013-08-13 11:13:49 +02:00
bors
4601ea65f8 auto merge of #8487 : brson/rust/local-opts, r=brson
I did this once but acciddentally undid it in a later patch.
2013-08-12 23:56:26 -07:00
Alex Crichton
930885d5e5 Forbid pub/priv where it has no effect
Closes #5495
2013-08-12 23:20:46 -07:00
Alex Crichton
27b4d104c8 Explain what ifmt! is all about 2013-08-12 23:18:51 -07:00
Alex Crichton
1f6afa887b Correct the padding on integer types for formatting 2013-08-12 23:18:51 -07:00
Alex Crichton
6feb58ed84 Define integer formats for all widths
Closes #1653
2013-08-12 23:18:51 -07:00
Alex Crichton
b820748ff5 Implement formatting arguments for strings and integers
Closes #1651
2013-08-12 23:18:51 -07:00
Brian Anderson
95badabaaf std: Re-optimize tls access on local allocation path
I did this once but acciddentally undid it in a later patch.
2013-08-12 22:30:32 -07:00
bors
44675ac6af auto merge of #8476 : thestinger/rust/snapshot, r=brson 2013-08-12 20:29:22 -07:00
bors
59da4e0bc9 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.
2013-08-12 15:28:49 -07:00
Daniel Micay
0cb0ef2ca5 fix build with the new snapshot compiler 2013-08-12 17:37:46 -04:00
Daniel Micay
8b502d60ab register snapshots 2013-08-12 17:37:42 -04:00
Keegan McAllister
2145de8c8f rt::task: Make current_stack_segment public
Servo needs to tell SpiderMonkey about the stack bounds.
2013-08-12 13:54:40 -07:00
Ben Blum
5ac8c57bd4 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. 2013-08-12 15:20:02 -04:00
bors
35040275b3 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).
2013-08-12 11:53:18 -07:00
Ben Blum
ce48e71d28 Fix select() in light of the deschedule...and then race. Close #8347. 2013-08-12 13:54:21 -04:00
Ben Blum
31f9b51592 Make cell with_ref/with_mut_ref use finally. Close #7975. 2013-08-12 13:54:21 -04:00
Ben Blum
c8c09d40fc Reorganise Select traits to not expose internal runtime types. Close #5160. Pending #8215. 2013-08-12 13:54:21 -04:00
Ben Blum
ee5cfb0c2d Don't use unkillable in UnsafeArc dtor when there's no unwrapper. Close #8382. 2013-08-12 13:19:17 -04:00
bors
ecfc9a8223 auto merge of #8428 : blake2-ppc/rust/peekable-iterators, r=thestinger
Peekable changes by @SimonSapin and original PR is #8396
2013-08-12 04:29:11 -07:00
bors
de48274c50 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.
2013-08-12 00:32:11 -07:00
bors
1785841a5b 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.
2013-08-11 20:50:14 -07:00
bors
0679436381 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.
2013-08-11 17:38:09 -07:00
Steven Stewart-Gallus
dcecc6693d Cleanup librustpkg a little bit.
Mostly I did simple transformations from imperative style loops to
more functional iterator based transformations.
2013-08-11 17:33:35 -07:00
bors
b285f1e6c9 auto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon
Fix #5762 and various other aspects of object invocation.

r? @graydon
2013-08-11 14:17:09 -07:00
Niko Matsakis
7343478d67 Convert from transform to map 2013-08-11 14:56:43 -04:00
Niko Matsakis
b402e343e4 tests: Add new tests for borrowck/objects and update some existing tests 2013-08-11 14:01:23 -04:00
Niko Matsakis
df016dc4bf Update type visitor to use &Visitor and not @Visitor 2013-08-11 14:01:23 -04:00
Niko Matsakis
66b8ad5867 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.
2013-08-11 14:01:23 -04:00
Niko Matsakis
1bceb98084 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.
2013-08-11 14:01:23 -04:00
Niko Matsakis
006c6b6be4 trans: Rely on new AutoBorrowObj adjustment to match up object receivers
Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)
2013-08-11 14:01:19 -04:00
Niko Matsakis
6f319812d6 ty: Add (but do not yet use) AutoBorrowObject option to adjustments
Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)
2013-08-11 14:01:19 -04:00
Niko Matsakis
38357ebef4 typeck/check/method: Remove pub from most methods 2013-08-11 13:59:46 -04:00
Niko Matsakis
38b2e2980e Misc small cleanups 2013-08-11 13:59:46 -04:00
Niko Matsakis
6fe59bf877 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.
2013-08-11 13:59:45 -04:00
bors
63c62bea3a 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
2013-08-11 10:50:10 -07:00
Niko Matsakis
3aefb9649d librustc: Convert from @Object to @mut Object as needed 2013-08-11 13:26:59 -04:00