Commit Graph

28100 Commits

Author SHA1 Message Date
bors
ba25fecfef auto merge of #13615 : alexcrichton/rust/improve-demangling, r=brson
Previously, symbols with rust escape sequences (denoted with dollar signs)
weren't demangled if the escape sequence showed up in the middle. This alters
the printing loop to look through the entire string for dollar characters.
2014-04-19 05:41:26 -07:00
bors
2c22ae4378 auto merge of #13614 : cgaebel/rust/master, r=brson
We previously allocated 3x for every HashMap creation and resize. This patch reduces it to 1x.
2014-04-19 04:26:28 -07:00
bors
c7553ea173 auto merge of #13609 : richo/rust/str-type-vim, r=alexcrichton
It seems really weird to me when StrSlice and str highlight sanely, but StrBuf doesn't.

I think I added it to the right place.
2014-04-19 02:11:30 -07:00
bors
158e0c86fe auto merge of #13604 : alexcrichton/rust/connect-timeout, r=brson
This adds a `TcpStream::connect_timeout` function in order to assist opening
connections with a timeout (cc #13523). There isn't really much design space for
this specific operation (unlike timing out normal blocking reads/writes), so I
am fairly confident that this is the correct interface for this function.

The function is marked #[experimental] because it takes a u64 timeout argument,
and the u64 type is likely to change in the future.
2014-04-19 00:56:30 -07:00
Alex Crichton
3915e17cd7 std: Add an experimental connect_timeout function
This adds a `TcpStream::connect_timeout` function in order to assist opening
connections with a timeout (cc #13523). There isn't really much design space for
this specific operation (unlike timing out normal blocking reads/writes), so I
am fairly confident that this is the correct interface for this function.

The function is marked #[experimental] because it takes a u64 timeout argument,
and the u64 type is likely to change in the future.
2014-04-19 00:47:14 -07:00
bors
5a2ecb828b auto merge of #13608 : tbu-/rust/pr_smallesthello, r=alexcrichton
It now hands `puts` a zero-terminated string, like it expects.

Fix #13603.
2014-04-18 23:36:33 -07:00
bors
9d5082e88a auto merge of #13606 : alexcrichton/rust/better-thread-errors, r=brson
On windows, correctly check for errors when spawning threads, and on both
windows and unix handle the error more gracefully rather than printing an opaque
assertion failure.

Closes #13589
2014-04-18 22:16:35 -07:00
bors
af24045ff0 auto merge of #13607 : brson/rust/to_owned, r=brson
Continues https://github.com/mozilla/rust/pull/13548
2014-04-18 18:46:33 -07:00
Alex Crichton
55310acbca std: Fix demangling with middle special chars
Previously, symbols with rust escape sequences (denoted with dollar signs)
weren't demangled if the escape sequence showed up in the middle. This alters
the printing loop to look through the entire string for dollar characters.
2014-04-18 17:37:27 -07:00
Richo Healey
919889a1d6 Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
Clark Gaebel
9f45484db5 Reduce HashMap allocations. 2014-04-18 20:15:41 -04:00
bors
9b7cfd3c72 auto merge of #13513 : alexcrichton/rust/up-llvm, r=brson
This is a bit of an interesting upgrade to LLVM. Upstream LLVM has started using C++11 features, so they require a C++11 compiler to build. I've updated all the bots to have a C++11 compiler, and they appear to be building LLVM successfully:

* Linux bots - I added gcc/g++ 4.7 (good enough)
* Android bots - same as the linux ones
* Mac bots - I installed the most recent command line tools for Lion which gives us clang 3.2, but LLVM wouldn't build unless it was explicitly asked to link to `libc++` instead of `libstdc++`. This involved tweaking `mklldeps.py` and the `configure` script to get things to work out
* Windows bots - mingw-w64 has gcc 4.8.1 which is sufficient for building LLVM (hurray!)
* BSD bots - I updated FreeBSD to 10.0 which brought with it a relevant version of clang.

The largest fallout I've seen so far is that the test suite doesn't work at all on FreeBSD 10. We've already stopped gating on FreeBSD due to #13427 (we used to be on freebsd 9), so I don't think this puts us in too bad of a situation. I will continue to attempt to fix FreeBSD and the breakage on there.

The LLVM update brings with it all of the recently upstreamed LLVM patches. We only have one local patch now which is just an optimization, and isn't required to use upstream LLVM. I want to maintain compatibility with LLVM 3.3 and 3.4 while we can, and this upgrade is keeping us up to date with the 3.5 release. Once 3.5 is release we will in theory no longer require a bundled LLVM.
2014-04-18 17:11:32 -07:00
Richo Healey
3ec9f05534 vim: Add StrBuf as type to hilighting 2014-04-18 16:57:03 -07:00
Alex Crichton
426d701f8b debuginfo: Clamp the maximum dwarf version to 3
This is a consequence of #13611 and our bots running a "fairly old" gdb which
doesn't understand the newer versions of dwarf.
2014-04-18 16:54:38 -07:00
Tobias Bucher
031212bfd9 Fix smallest-hello-world.rs interaction with puts
It now hands `puts` a zero-terminated string, like it expects.

Fix #13603.
2014-04-19 00:34:55 +02:00
bors
b75683cadf auto merge of #13600 : brandonw/rust/master, r=brson
When calling a function, or anything with nested parens,
default to cindent's indent. The least error-prone way I
could think of identifying this is to look for a line
that ends with a ',', as well as a non-zero number of
any character except parens before the comma, and
then an open paren.

This will overlap with the previous rule accounting for
function definitions, but that should be fine because
it is also using cindent.
2014-04-18 15:01:22 -07:00
bors
c44c7abb42 auto merge of #13601 : mdinger/rust/readme, r=brson
Configure required git be installed so this should be added to the dependencies list.  If it's only required when using git, a note could also be added.
2014-04-18 13:01:25 -07:00
mdinger
065c4a6967 Add git to README.md dependency list because configure requires it 2014-04-18 14:50:31 -04:00
bors
d1d8497e53 auto merge of #13588 : alexcrichton/rust/no-more-growing, r=thestinger
This is all in preparation for DST. This removes all the growable/shrinkable methods from `~[T]`.
2014-04-18 11:41:23 -07:00
Brandon Waskiewicz
59f3414a4a Add another case where cindent is correct
When calling a function, or anything with nested parens,
default to cindent's indent. The least error-prone way I
could think of identifying this is to look for a line
that ends with a ',', as well as a non-zero number of
any character except parens before the comma, and
then an open paren.

This will overlap with the previous rule accounting for
function definitions, but that should be fine because
it is also using cindent.
2014-04-18 14:12:50 -04:00
Alex Crichton
675b82657e Update the rest of the compiler with ~[T] changes 2014-04-18 10:57:10 -07:00
Alex Crichton
c318d72b86 std: Fail more gracefully on thread spawn errors
On windows, correctly check for errors when spawning threads, and on both
windows and unix handle the error more gracefully rather than printing an opaque
assertion failure.

Closes #13589
2014-04-18 10:36:16 -07:00
Alex Crichton
7d3b0bf391 std: Make ~[T] no longer a growable vector
This removes all resizability support for ~[T] vectors in preparation of DST.
The only growable vector remaining is Vec<T>. In summary, the following methods
from ~[T] and various functions were removed. Each method/function has an
equivalent on the Vec type in std::vec unless otherwise stated.

* slice::OwnedCloneableVector
* slice::OwnedEqVector
* slice::append
* slice::append_one
* slice::build (no replacement)
* slice::bytes::push_bytes
* slice::from_elem
* slice::from_fn
* slice::with_capacity
* ~[T].capacity()
* ~[T].clear()
* ~[T].dedup()
* ~[T].extend()
* ~[T].grow()
* ~[T].grow_fn()
* ~[T].grow_set()
* ~[T].insert()
* ~[T].pop()
* ~[T].push()
* ~[T].push_all()
* ~[T].push_all_move()
* ~[T].remove()
* ~[T].reserve()
* ~[T].reserve_additional()
* ~[T].reserve_exect()
* ~[T].retain()
* ~[T].set_len()
* ~[T].shift()
* ~[T].shrink_to_fit()
* ~[T].swap_remove()
* ~[T].truncate()
* ~[T].unshift()
* ~str.clear()
* ~str.set_len()
* ~str.truncate()

Note that no other API changes were made. Existing apis that took or returned
~[T] continue to do so.

[breaking-change]
2014-04-18 10:06:24 -07:00
bors
ce2bab68d6 auto merge of #13585 : brandonw/rust/patch-1, r=cmr
The original text stated that one should only return a unique or managed pointer if you were given one in the first place. This makes it sound as if the function *should* return a unique pointer if it were given a unique pointer. The rest of the section goes on to describe why this is bad, and the example of bad code does exactly what the rule just said to do.

I reworded the original rule into a reference to the more concise rule mentioned at the bottom of the section, which helps add emphasis (a la 'it bears repeating').
2014-04-18 04:11:19 -07:00
bors
d35804ea5e auto merge of #13581 : DiamondLovesYou/rust/tests-mk-typo, r=alexcrichton
I spotted this while working on https://github.com/mozilla/rust/pull/13450.
2014-04-18 00:01:22 -07:00
bors
c834bf45c4 auto merge of #13580 : DiamondLovesYou/rust/std-result-hash, r=alexcrichton
Title says it all.
2014-04-17 22:41:22 -07:00
bors
29a39700a1 auto merge of #13525 : Ryman/rust/issue_5997, r=alexcrichton
Closes #5997.
2014-04-17 21:21:24 -07:00
bors
3f8e68686f auto merge of #13576 : lifthrasiir/rust/double-ref, r=alexcrichton
Uses the same strategy as `||` and `>>`. Closes #11227.
2014-04-17 20:01:25 -07:00
bors
0c23140aaf auto merge of #13575 : TeXitoi/rust/shootout-knucleotide-parallel, r=alexcrichton 2014-04-17 18:41:24 -07:00
bors
950312960a auto merge of #13572 : yuriks/rust/bitv-renames, r=alexcrichton
Renamed the methods in Bitv that test all bits to have names that, ehm, "roll off the tongue" a bit more easily. :)

Also added tests for them while at it, since they seemed to be missing.
2014-04-17 17:21:26 -07:00
bors
4c50cf38a0 auto merge of #13565 : alexcrichton/rust/issue-13560, r=brson
Syntax-only crates are no longer registered with the cstore, so there's no need
to allocate crate numbers to them. This ends up leaving gaps in the crate
numbering scheme which is not expected in the rest of the compiler.

Closes #13560
2014-04-17 15:51:27 -07:00
Brandon Waskiewicz
58ae1e7c62 Remove rule that is confusing
The original text stated that one should only return a unique or managed pointer if you were given one in the first place. This makes it sound as if the function *should* return a unique pointer if it were given a unique pointer. The rest of the section goes on to describe why this is bad, and the example of bad code does exactly what the rule just said to do.

I reworded the original rule into a reference to the more concise rule mentioned at the bottom of the section, which helps add emphasis (a la 'it bears repeating').
2014-04-17 16:59:58 -04:00
bors
99c258cd74 auto merge of #13261 : pnkfelix/rust/fsk-fix-12856, r=nikomatsakis
Fix #12856.

I wanted to put this up first because I wanted to get feedback about the second commit in the series, commit 8599236.  Its the more invasive part of the patch and is largely just belt-and-suspenders assertion checking; in the commit message I mentioned at least one other approach we could take here.  Or we could drop the belt-and-suspenders and just rely on the guard added in the first patch, commit 8d6a005 (which is really quite trivial on its own).

So any feedback on what would be better is appreciated.

r? @nikomatsakis
2014-04-17 12:46:26 -07:00
Felix S. Klock II
3099451020 Add result sanity check to is_to_be_inferred.
This version of `is_to_be_inferred` double-checks the result from
`inferred_map` by querying the `named_region_map` and `ast_map` and
then asserts that the `inferred_map` state is consistent with its own
findings.  (See issue 13261 for further discussion of the approaches).
2014-04-17 20:40:51 +02:00
Alex Crichton
ad3de7fdb5 rustc: Hint to the linker about static/shared libs
If a linker finds both a static and a dynamic version of the same library, then
the linker often chooses the dynamic version. This is surprising when a native
library is specified as being "static" in rust source. This modifies the linker
command line to obey the hints given in rust source files and instructing the
linker to prefer a particular version of a found library.

Unfortunately, this patch has no effect on osx because the linker supports
no such hint, and it also has no effect on windows because the linker apparently
just ignores it. For now this is predominately used to enable the previous patch
of linking to libstdc++ statically, but more support would need to be added for
this in the future if we wanted to officially support it.

cc #12557 (doesn't close because it doesn't support OSX and windows)
2014-04-17 11:39:51 -07:00
Alex Crichton
acdee8b904 llvm: Add an option to statically link libstdc++
The goal of the snapshot bots is to produce binaries which can run in as many
locations as possible. Currently we build on Centos 6 for this reason, but with
LLVM's update to C++11, this reduces the number of platforms that we could
possibly run on.

This adds a --enable-llvm-static-stdcpp option to the ./configure script for
Rust which will enable building a librustc with a static dependence on
libstdc++. This normally isn't necessary, but this option can be used on the
snapshot builders in order to continue to make binaries which should be able to
run in as many locations as possible.
2014-04-17 11:39:51 -07:00
bors
ff0b0d5cee auto merge of #13558 : alexcrichton/rust/snapshots, r=brson
This is the first snapshot build by mingw-w64 with the win32 threading model I believe (Closes #13501).

Curiously, this successfully built a snapshot on freebsd when the auto builder is continuously segfaulting. Who knew!
2014-04-17 11:16:31 -07:00
Alex Crichton
36d5635273 etc: The --system-libs flag is LLVM 3.5+
Older version of LLVM did not have this flag, so we need to fall back to our
previous library detection when using older versions of LLVM.
2014-04-17 11:11:39 -07:00
Alex Crichton
682c401045 configure: Enable clang for older OSX gcc versions
OSX often has a more recent version of clang than it does for GCC. When an older
version of gcc is detected on OSX, the --enable-clang flag is implicitly
enabled.
2014-04-17 11:11:39 -07:00
Alex Crichton
32a81d1e16 configure: Enable libc++ with LLVM with clang
When clang is enabled, also pass through --enable-libcpp to LLVM's configure
command line to help it pick up the most recent c++ runtime library. This also
changes the mklldeps.py script to pick up on whether LLVM was linked against
stdc++ or c++ based on the --cxxflags that llvm-config prints.

In an ongoing attempt to update LLVM, the bots need to update their C compilers
to something that supports c++11 (LLVM recently switched). The OSX bots are
running Lion (10.7), which only supports up to gcc 4.2 and clang 3.2. Apparently
the libstdc++ is too old (even on the most updated command line tools) for LLVM,
but using libc++ instead appears to work just fine.
2014-04-17 11:11:39 -07:00
Alex Crichton
30ff17f809 Upgrade LLVM
This comes with a number of fixes to be compatible with upstream LLVM:

* Previously all monomorphizations of "mem::size_of()" would receive the same
  symbol. In the past LLVM would silently rename duplicated symbols, but it
  appears to now be dropping the duplicate symbols and functions now. The symbol
  names of monomorphized functions are now no longer solely based on the type of
  the function, but rather the type and the unique hash for the
  monomorphization.

* Split stacks are no longer a global feature controlled by a flag in LLVM.
  Instead, they are opt-in on a per-function basis through a function attribute.
  The rust #[no_split_stack] attribute will disable this, otherwise all
  functions have #[split_stack] attached to them.

* The compare and swap instruction now takes two atomic orderings, one for the
  successful case and one for the failure case. LLVM internally has an
  implementation of calculating the appropriate failure ordering given a
  particular success ordering (previously only a success ordering was
  specified), and I copied that into the intrinsic translation so the failure
  ordering isn't supplied on a source level for now.

* Minor tweaks to LLVM's API in terms of debuginfo, naming, c++11 conventions,
  etc.
2014-04-17 11:11:39 -07:00
Richard Diamond
37096730fb mk/tests.mk: Fix a typo causing make to give compiletest the wrong rt build dir (target instead of host). 2014-04-17 13:04:41 -05:00
Kevin Butler
f829d208a3 Catch forward declarations in default type params at AST conversion. 2014-04-17 18:24:52 +01:00
Kevin Butler
52a53e8ae7 Change error for out of scope type params to be more helpful. 2014-04-17 18:24:52 +01:00
Kevin Butler
14e1fd4629 Add span to error for missing type params on enums. 2014-04-17 18:24:52 +01:00
Kevin Butler
3b9ade0f81 Tests for issue 5997 failure and success conditions.
Closes #5997.
2014-04-17 18:24:51 +01:00
Richard Diamond
506008f9a0 Add #[deriving(Hash)] to Result. 2014-04-17 12:22:02 -05:00
bors
903fbd2635 auto merge of #13569 : alexcrichton/rust/ignore-bytecode, r=brson
The name of the file changed awhile back and this spot wasn't updated to
continue ignoring the bytecode from rlibs when copying into staticlibs.
2014-04-17 06:16:24 -07:00
bors
1fd7de8246 auto merge of #13567 : iancormac84/rust/libc_windows_guid_fix, r=alexcrichton
structure's Data2 and Data3 members expect WORD types instead of DWORD. I
discovered this discrepancy while experimenting with some bindings to
Microsoft's OLE2 api. The discrepancy was corrupting the contents of the
string returned by UuidToString after I used known GUIDs to test the
accuracy of the function binding. I didn't add test cases because it would
mean adding a dependency to my rather incomplete binding library. However,
the fix produces expected string values when tested.
2014-04-17 04:46:50 -07:00
bors
d8fa106867 auto merge of #13563 : lifthrasiir/rust/refman-dl, r=alexcrichton
Closes #13561. All definition lists have been converted to unordered lists. This is a temporary measure; please revert this when Sundown (or any replacement) gets a support for definition lists in the future.
2014-04-17 03:16:25 -07:00