Commit Graph

22259 Commits

Author SHA1 Message Date
Brendan Zabarauskas
0fcb85997d Moved checked trait impls out of std::num
This follows the same pattern as the other numeric trait impls, and reduces the clutter in std::num.
2013-09-08 13:48:15 +10:00
bors
5591dce52e auto merge of #9050 : huonw/rust/unfoldnor, r=thestinger
The `r` is not relevant, since there is only one direction of folding
(unlike Haskell).
2013-09-07 18:10:59 -07:00
Huon Wilson
4c2b480aae std: Rename Unfoldr to Unfold.
The `r` is not relevant, since there is only one direction of folding
(unlike Haskell).
2013-09-08 10:52:19 +10:00
bors
b3d50fc2c0 auto merge of #9015 : MicahChalmer/rust/emacs-fixes-round-2, r=nikomatsakis
Here are fixes for more problems mentioned in #8787.  I think I've addressed everything mentioned there except for @nikomatsakis's comment about match/patterns now.  (This also fixes the bug in struct alignment that @pnkfelix mentioned from my earlier pull request #8872.)

The biggest change here is to make fill-paragraph (M-q) and auto-fill-mode work inside different variations of multi-line and doc comments.  Because of the way emacs paragraph fills work (callbacks interacting with global regexp variables that are used in odd ways) there were quite a few edge cases that I had to work around.

The only way I was able to keep it all straight was to create some regression tests.  They use the emacs lisp regression testing tool ERT, and are included as the last commit here.  I added a few tests for indentation as well.  I have not attempted to integrate the tests into the overall rust compiler build process, since I can't imagine anyone would want the compiler build to have a dependency on emacs.  Maybe at some point tools like this get their own repositories?  Just a thought.

One other thought related to the tests: should there be a place to put these types of style samples that isn't specific to one text editor?  Maybe as part of an official rust style guide, but in a form that would allow tools like this to pull out the samples and use them for tests?
2013-09-07 16:10:58 -07:00
bors
f6b36c676e auto merge of #9046 : thestinger/rust/repr, r=alexcrichton
Closes #8743
2013-09-07 15:01:02 -07:00
bors
7f8ada9acf auto merge of #9043 : sfackler/rust/uuid-from-bytes, r=alexcrichton
This method doesn't deal with utf8. I guess it got caught in a mass
rename.
2013-09-07 13:51:02 -07:00
bors
82b6ef66c2 auto merge of #9041 : alexcrichton/rust/use-python-2, r=thestinger
This is required for systems where /usr/bin/python is actually python 3

I already did this before, but forgot to re-port it once libuv was re-upgraded
2013-09-07 12:41:02 -07:00
Daniel Micay
f87578d9fb fix repr of strings/chars with quotes
Closes #8743
2013-09-07 15:31:48 -04:00
bors
79e78c4b0c auto merge of #8906 : novalis/rust/master, r=alexcrichton
This is a patch to fix #6031.  I didn't see any tests for the C++ library code, so I didn't write a test for my changes.  Did I miss something, or are there really no tests?
2013-09-07 11:31:06 -07:00
Steven Fackler
3eaf750a0d Renamed Uuid::from_utf8 to Uuid::from_bytes
This method doesn't deal with utf8. I guess it got caught in a mass
rename.
2013-09-07 11:05:48 -07:00
Alex Crichton
594531a1c8 Give the libuv makefile generation a dependency
This way the rule isn't always built whenever you fire off a new build
2013-09-07 10:46:47 -07:00
Alex Crichton
75afcffc2f Run gyp with CFG_PYTHON which is python < 3
This is required for systems where /usr/bin/python is actually python 3
2013-09-07 10:22:36 -07:00
bors
aa1d4ef55a auto merge of #9032 : alexcrichton/rust/inline-repr, r=thestinger
This allows cross-crate inlining which is *very* good because this is called a
lot throughout libstd (even when libstd is inlined across crates).

In one of my projects, I have a test case with the following performance characteristics

commit | optimization level | runtime (seconds)
----|------|----
before | O2  | 22s
before | O3  | 107s
after | O2  | 13s
after | O3  | 12s

I'm a bit disturbed by the 107s runtime from O3 before this commit. The performance characteristics of this test involve doing an absurd amount of small operations. A huge portion of this is creating hashmaps which involves allocating vectors.

The worst portions of the profile are:
![screen shot 2013-09-06 at 10 32 15 pm](https://f.cloud.github.com/assets/64996/1100723/e5e8744c-177e-11e3-83fc-ddc5f18c60f9.png)

Which as you can see looks like some *serious* problems with inlining. I would expect the hash map methods to be high up in the profile, but the top 9 callers of `cast::transmute_copy` were `Repr::repr`'s various monomorphized instances.

I wish there we a better way to detect things like this in the future, and it's unfortunate that this is required for performance in the first place. I suppose I'm not entirely sure why this is needed because all of the methods should have been generated in-crate (monomorphized versions of library functions), so they should have gotten inlined? It also could just be that by modifying LLVM's idea of the inline cost of this function it was able to inline it in many more locations.
2013-09-07 09:31:12 -07:00
novalis
c684df103e Handle global log levels (fixes #6033) 2013-09-07 09:14:52 -04:00
Brandon Sanderson
8f31377514 Update for_expr docs. 2013-09-07 01:38:35 -07:00
Alex Crichton
13d33064a6 Remove even more usage of clownshoes in symbols
This removes another large chunk of this odd 'clownshoes' identifier showing up
in symbol names. These all originated from external crates because the encoded
items were encoded independently of the paths calculated in ast_map. The
encoding of these paths now uses the helper function in ast_map to calculate the
"pretty name" for an impl block.

Unfortunately there is still no information about generics in the symbol name,
but it's certainly vastly better than before

    hash::__extensions__::write::_version::v0.8

becomes

    hash::Writer$SipState::write::hversion::v0.8

This also fixes bugs in which lots of methods would show up as `meth_XXX`, they
now only show up as `meth` and throw some extra characters onto the version
string.
2013-09-06 23:56:17 -07:00
bors
124eb2119c auto merge of #9026 : jbclements/rust/let-var-hygiene, r=jbclements
This is a rebase of my approved pull request from ... the end of June? It introduces hygiene for let-bound variables.
2013-09-06 23:35:57 -07:00
John Clements
b6f3d3f245 ident->name in debuginfo 2013-09-06 23:19:11 -07:00
Alex Crichton
739df232fe Flag the Repr::repr function with #[inline]
This allows cross-crate inlining which is *very* good because this is called a
lot throughout libstd (even when libstd is inlined across crates).
2013-09-06 22:29:29 -07:00
bors
3e6de6b7da auto merge of #9016 : sfackler/rust/nanoseconds, r=alexcrichton
The ISO 8601 standard does not mandate any specific precision for
fractional seconds, so this accepts input of any length, ignoring the
part after the nanoseconds place. It may be more correct to round with
the tenths of nanoseconds digit, but then we'd have to deal with
carrying the round through the entire Tm struct (e.g. for a time like
Dec 31 11:59.999999999999).

%f is the format specifier that Python's datetime library uses for
0-padded microseconds so it seemed appropriate here.

cc #2350
2013-09-06 22:25:59 -07:00
Micah Chalmer
a4697342f7 Cover all cases for padding in paragraph fills as intended 2013-09-07 00:39:38 -04:00
Micah Chalmer
be4f19ae7c Fix regression of multi-line statement indents 2013-09-07 00:38:23 -04:00
Brandon Sanderson
5478ebb553 Add with_mem_writer to std::rt::io::mem.
This is in many ways a replacement for the current
std::io::with_str_writer.
2013-09-06 21:21:59 -07:00
novalis
c891fa326d Fix #6031. Allow symbolic log levels, not just numbers. 2013-09-06 23:30:17 -04:00
bors
25f3b29c61 auto merge of #9010 : aaronlaursen/rust/master, r=alexcrichton
Here's a fix for issue #7588, "Overflow handling of from_str methods is broken". 

The integer overflow issues are taken care of by checking to see if the multiply-by-radix-and-add-next-digit process is reversible. If it overflowed, then some information is lost and the process is irreversible, in which case, None is returned. 

Floats now consistently return Some(Inf) of Some(-Inf) on overflow thanks to a call to NumStrConv::inf() and NumStrConv::neg_inf() respectively when the overflow is detected (which yields a value of None in the case of ints and uints anyway). 

This is my first contribution to Rust, and my first time using the language in general, so any and all feedback is appreciated.
2013-09-06 20:10:57 -07:00
bors
12bca20d78 auto merge of #9030 : tikue/rust/glob, r=huonw 2013-09-06 19:01:01 -07:00
Tim Kuehn
39ce095ebd use enumerate in place of 'for ti in range(i, tokens.len()) ... match tokens[ti] ...' 2013-09-06 21:54:03 -04:00
bors
f883159cdf auto merge of #9019 : alexcrichton/rust/reconfigure-llvm, r=brson
@Chris-Morgan ran into this, turns out if we have a clean llvm in the old location we won't rebuild/reconfigure even though we should.
2013-09-06 16:51:00 -07:00
John Clements
956129cbb2 ident->name 2013-09-06 13:35:14 -07:00
John Clements
eabeba3ef3 added index to test cases, more debugging output 2013-09-06 13:35:14 -07:00
John Clements
1ecc1e51c0 quote_* macros no longer need to be capturing
This is actually almost a problem, because those were my poster-child
macros for "here's how to implement a capturing macro." Following this
change, there will be no macros that use capturing; this will probably
make life unpleasant for the first person that wants to implement a
capturing macro. I should probably create a dummy_capturing macro,
just to show how it works.
2013-09-06 13:35:14 -07:00
John Clements
4664d3320d comment fix 2013-09-06 13:35:14 -07:00
John Clements
114b1a7e97 add hygiene test, add copyright to another 2013-09-06 13:35:14 -07:00
John Clements
d8c77e082b make macro hygienic 2013-09-06 13:35:13 -07:00
John Clements
6c294ba538 add test case, cleanup 2013-09-06 13:35:13 -07:00
John Clements
fe1d21caec add display_sctable fn to ast_util 2013-09-06 13:35:13 -07:00
John Clements
8330411688 fixed a bug that caused double-expand-traversal of macros that expand into modules. 2013-09-06 13:35:13 -07:00
John Clements
fddc815ada WIP: adding mark-cancelling for macro_rules 2013-09-06 13:35:13 -07:00
John Clements
e681e7843e added string_to_tts 2013-09-06 13:35:13 -07:00
John Clements
985a92ec12 comments 2013-09-06 13:35:13 -07:00
John Clements
1a06584117 comment on hygienic context extension train fns 2013-09-06 13:35:13 -07:00
John Clements
dc7f3df27f awesome new bug! added test case 2013-09-06 13:35:12 -07:00
John Clements
7b548e7180 expose mtwt_marksof for testing 2013-09-06 13:35:12 -07:00
John Clements
7dca301cf4 ident->name 2013-09-06 13:35:12 -07:00
John Clements
bba10ec812 xfailed unhygienic test 2013-09-06 13:35:12 -07:00
John Clements
76c1e0497d ident->name 2013-09-06 13:35:12 -07:00
John Clements
dbf4e19ea5 remove unneeded imports, clean up unused var warnings 2013-09-06 13:35:12 -07:00
John Clements
60562ac9f8 whitespace, reindentation, and comments only 2013-09-06 13:35:12 -07:00
John Clements
ec0a64def5 memoization for resolve 2013-09-06 13:35:12 -07:00
John Clements
0954e66442 uncomment mtwt_resolve calls 2013-09-06 13:35:11 -07:00