Commit Graph

22365 Commits

Author SHA1 Message Date
Benjamin Herr
aa406c151e pp: typo in comment 2013-09-17 22:27:12 +02:00
bors
023aab453c auto merge of #9236 : steveklabnik/rust/rustpkg_init, r=catamorphism
Closes #9045

Built on top of #9235, which isn't strictly needed for now, but I imagine I will use part of. Unsure.

I mostly wanted to start this off to get some feedback from @catamorphism and others. These are the directories that actually need made, but I was thinking about adding a few other things:

1. an `examples` directory, since it seems like that's a common pattern
2. a `.gitignore` file that ignores `build`. And anything else that makes sense
3. a sample module that'd actually compile


Feedback?
2013-09-17 11:00:46 -07:00
Steve Klabnik
77bbf23b4a Implementing 'rustpkg init'.
This will initialize a new workspace.
2013-09-17 10:53:32 -07:00
bors
72e7c62ec4 auto merge of #9245 : kballard/rust/bytes-span, r=catamorphism
This constrains the span to the appropriate argument, so you know which
one caused the problem. Instead of

    foo.rs:2:4: 2:21 error: Too large integer literal in bytes!
    foo.rs:2    bytes!(1, 256, 2)
                ^~~~~~~~~~~~~~~~~

it will say

    foo.rs:2:14 2:17 error: Too large integer literal in bytes!
    foo.rs:2    bytes!(1, 256, 2)
                          ^~~
2013-09-17 08:45:44 -07:00
bors
29cdf58861 auto merge of #9244 : thestinger/rust/drop, r=catamorphism
This doesn't close any bugs as the goal is to convert the parameter to by-value, but this is a step towards being able to make guarantees about `&T` pointers (where T is Freeze) to LLVM.
2013-09-17 07:15:42 -07:00
bors
f45c6406bc auto merge of #9241 : alexcrichton/rust/build-rustdoc-ng, r=catamorphism
Now rustdoc_ng will be built as both a binary and a library (using the same
rules as all the other binaries that rust has). Furthermore, this will also
start building rustdoc_ng unit tests (and running them).

Note that some `rustdoc_ng` tests were removed, but @cmr says they weren't supposed to be there in the first place. The rustdoc_ng code should also be included in `make install` and `make dist` now.
2013-09-17 06:00:45 -07:00
bors
7ea85333ff auto merge of #9239 : steveklabnik/rust/rustpkg_tutorial, r=catamorphism
First shot at a new tutorial for rustpkg. /cc @catamorphism

Right now, I'm linking to my sample package on GitHub, I'm not sure that everyone would be comfortable with me having that there. Maybe under the mozilla org? I think having one to install and hold up as a default makes sense.
2013-09-17 04:45:45 -07:00
bors
2a706aab1c auto merge of #9234 : steveklabnik/rust/rustpkg_manpage, r=cmr
Closes #9221.

"rustpkg test" isn't implemented yet, so it shouldn't be in the manpage. Referring interested parties to the manual is probably
the right thing for now; eventually, these documents should merge.

/cc @catamorphism
2013-09-17 03:30:48 -07:00
bors
07e821aa6b auto merge of #9225 : huonw/rust/closing-time, r=alexcrichton
Closes #2074.
Closes #5008.
Closes #7519.
Closes #7673.
Closes #7770.
Closes #8171.
2013-09-17 02:15:49 -07:00
Huon Wilson
4f92f452bd Tests for fixed issues.
Closes #2074.
Closes #5008.
Closes #7519.
Closes #7673.
Closes #7770.
Closes #8171.
2013-09-17 18:02:44 +10:00
bors
6055611af6 auto merge of #9214 : adridu59/rust/issue-7723, r=thestinger
This avoids default CRLF on msysgit for Windows which can cause trouble.
Cf. https://help.github.com/articles/dealing-with-line-endings#text-eollf

Closes #7723.
2013-09-17 01:00:47 -07:00
bors
d1c05504ba auto merge of #9130 : alexcrichton/rust/inline-globals, r=thestinger
In #8185 cross-crate condition handlers were fixed by ensuring that globals
didn't start appearing in different crates with different addressed. An
unfortunate side effect of that pull request is that constants weren't inlined
across crates (uint::bits is unknown to everything but libstd).

This commit fixes this inlining by using the `available_eternally` linkage
provided by LLVM. It partially reverts #8185, and then adds support for this
linkage type. The main caveat is that not all statics could be inlined into
other crates. Before this patch, all statics were considered "inlineable items",
but an unfortunate side effect of how we deal with `&static` and `&[static]`
means that these two cases cannot be inlined across crates. The translation of
constants was modified to propogate this condition of whether a constant
should be considered inlineable into other crates.

Closes #9036
2013-09-16 23:45:49 -07:00
bors
66ecff2b13 auto merge of #9237 : brson/rust/valgrind, r=thestinger
This fixes valgrind on the linux snapshot bot. The command added here
makes us require a fairly recent valgrind.
2013-09-16 22:30:51 -07:00
bors
b75e07501b auto merge of #9233 : catamorphism/rust/issue-4208, r=catamorphism
Closes #4208
2013-09-16 21:15:51 -07:00
bors
d5e9033a0d auto merge of #9108 : blake2-ppc/rust/hazards-on-overflow, r=alexcrichton
Fix uint overflow bugs in std::{at_vec, vec, str}

Closes #8742

Fix issue #8742, which summarized is: unsafe code in vec and str did assume
that a reservation for `X + Y` elements always succeeded, and didn't overflow.

Introduce the method `Vec::reserve_additional(n)` to make it easy to check for
overflow in `Vec::push` and `Vec::push_all`.

In std::str, simplify and remove a lot of the unsafe code and use `push_str`
instead. With improvements to `.push_str` and the new function
`vec::bytes::push_bytes`, it looks like this change has either no or positive
impact on performance.

I believe there are many places still where `v.reserve(A + B)` still can overflow.
This by itself is not an issue unless followed by (unsafe) code that steps aside
boundary checks.
2013-09-16 19:35:50 -07:00
Daniel Micay
4e161a4d40 switch Drop to &mut self 2013-09-16 22:19:23 -04:00
Kevin Ballard
b0647feab0 Limit spans in bytes!() error messages to the argument in question
This constrains the span to the appropriate argument, so you know which
one caused the problem. Instead of

  foo.rs:2:4: 2:21 error: Too large integer literal in bytes!
  foo.rs:2    bytes!(1, 256, 2)
              ^~~~~~~~~~~~~~~~~

it will say

  foo.rs:2:14 2:17 error: Too large integer literal in bytes!
  foo.rs:2    bytes!(1, 256, 2)
                        ^~~
2013-09-16 18:55:56 -07:00
Steve Klabnik
cf2253ba3f Updating rustpkg tutorial from feedback. 2013-09-16 18:49:47 -07:00
Alex Crichton
876cb76f1b Add the rustdoc_ng binary to the makefile rules
Now rustdoc_ng will be built as both a binary and a library (using the same
rules as all the other binaries that rust has). Furthermore, this will also
start building rustdoc_ng unit tests (and running them).
2013-09-16 18:10:46 -07:00
bors
2f96c22a21 auto merge of #9231 : cmr/rust/enum_encoding, r=catamorphism 2013-09-16 17:55:46 -07:00
blake2-ppc
e211888407 std::at_vec: Fix segfault on overflow when resizing ~[@T]
Easy to reproduce:

    let mut v = ~[@1];
    v.resize(-1);  // success a.k.a silent failure
    v.push(@2); // segfault
2013-09-17 02:48:00 +02:00
blake2-ppc
6e538edea2 rt::io: Use vec::reserve_additional 2013-09-17 02:48:00 +02:00
blake2-ppc
90dc9512ba std::str: Fix overflow problems in unsafe code
See issue #8742
2013-09-17 02:47:59 +02:00
Steve Klabnik
a0b9cc6a8b New rustpkg tutorial. 2013-09-16 16:30:49 -07:00
Corey Richardson
d0e0c336d0 Update syntax test 2013-09-16 19:12:54 -04:00
bors
38d4f48f0a auto merge of #9109 : thestinger/rust/function, r=alexcrichton 2013-09-16 15:50:47 -07:00
Daniel Micay
1afaf0b308 set attributes on invoke instructions too
also removes the unused `FastInvoke` wrapper, as it's never actually
going to be used (we can't *partially* switch to `fastcc`, and this is
only used for Rust functions)
2013-09-16 18:30:59 -04:00
Brian Anderson
4c49a3d8cd mk: Fix valgrinding with jemalloc
This fixes valgrind on the linux snapshot bot. The command added here
makes us require a fairly recent valgrind.
2013-09-16 15:29:46 -07:00
Corey Richardson
bb4d4d7eb9 Fix hardcoded string in libsyntax 2013-09-16 17:12:53 -04:00
Steve Klabnik
e1507f3120 Update rustpkg man page.
Closes #9221.

"rustpkg test" isn't implemented yet, so it shouldn't be in the manpage. Referring interested parties to the manual is probably
the right thing for now; eventually, these documents should merge.
2013-09-16 13:51:02 -07:00
bors
bc89ade401 auto merge of #9223 : sfackler/rust/tasks-fix, r=catamorphism
This module was removed a while ago, but the tasks tutorial wasn't
updated, and the old docs page for pipes was never deleted so the link
confusingly still worked!
2013-09-16 13:30:42 -07:00
Tim Chevalier
edf20ccc1b testsuite: Add test for #4208
Closes #4208
2013-09-16 12:02:27 -07:00
bors
0ec4d34b3f auto merge of #9211 : klutzy/rust/win32-fix, r=alexcrichton 2013-09-16 11:30:42 -07:00
Daniel Micay
22b6f7481f document why attributes are set on CallInst 2013-09-16 13:44:04 -04:00
Daniel Micay
b2eb1c01a4 add sret + noalias to the out pointer parameter
This brings Rust in line with how `clang` handles return pointers.

Example:

    pub fn bar() -> [uint, .. 8] {
        let a = [0, .. 8];
        a
    }

Before:

    ; Function Attrs: nounwind uwtable
    define void @_ZN3bar17ha4635c6f704bfa334v0.0E([8 x i64]* nocapture, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #1 {
    "function top level":
      %a = alloca [8 x i64], align 8
      %2 = bitcast [8 x i64]* %a to i8*
      call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 64, i32 8, i1 false)
      %3 = bitcast [8 x i64]* %0 to i8*
      call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 64, i32 8, i1 false)
      ret void
    }

After:

    ; Function Attrs: nounwind uwtable
    define void @_ZN3bar17ha4635c6f704bfa334v0.0E([8 x i64]* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #1 {
    "function top level":
      %2 = bitcast [8 x i64]* %0 to i8*
      call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 64, i32 8, i1 false)
      ret void
    }

Closes #9072
Closes #7298
Closes #9154
2013-09-16 13:44:04 -04:00
Daniel Micay
3c31cf25b1 fix handling of function attributes
The `noalias` attributes were being set only on function definitions,
not on all declarations. This is harmless for `noalias`, but prevented
some optimization opportunities and is *not* harmless for other
attributes like `sret` with ABI implications.

Closes #9104
2013-09-16 13:44:01 -04:00
bors
250c3d47df auto merge of #9204 : lkuper/rust/workcache, r=alexcrichton
This just removes the stray "foo.c" that `workcache::test` leaves behind when, for example, `make check` runs.
2013-09-16 10:15:43 -07:00
blake2-ppc
e34e2032e8 std::str: Add bench tests for StrVector::connect() and for str::push_str 2013-09-16 19:13:41 +02:00
blake2-ppc
8fce135326 std::vec: Add function vec::bytes::push_bytes
`push_bytes` is implemented with `ptr::copy_memory` here since this
function is intended to be used to implement `.push_str()` for str, so
we want to avoid the overhead.
2013-09-16 19:13:41 +02:00
blake2-ppc
8d488f38ed std::vec: Fix hazards with uint overflows in unsafe code
Issue #8742

Add the method `.reserve_additional(n: uint)`: Check for overflow in
self.len() + n, and reserve that many elements (rounded up to next power
of two). Does nothing if self.len() + n < self.capacity() already.
2013-09-16 19:13:30 +02:00
Corey Richardson
9ea295b7df extra::json: use a different encoding for enums.
It now uses `{"type": VariantName, "fields": [...]}`, which, according to
@Seldaek, since all enums will have the same "shape" rather than being a weird
ad-hoc array, will optimize better in javascript JITs. It also looks prettier,
and makes more sense.
2013-09-16 12:40:32 -04:00
bors
6bc48b63f3 auto merge of #9192 : Kimundi/rust/master, r=huonw
A SendStr is a string that can hold either a ~str or a &'static str.
This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries.

SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings.

This basically reimplements #7599 and has a use case for replacing an similar type in `std::rt::logging` ( Added in #9180).
2013-09-16 09:00:44 -07:00
Marvin Löbel
0635cb75b5 Corrected a few small style issues
Split up test function a bit
2013-09-16 17:45:24 +02:00
adridu59
62991e6047 gitattributes: force LF line endings for all files
This avoids default CRLF on msysgit for Windows which can cause trouble.
Cf. https://help.github.com/articles/dealing-with-line-endings#text-eollf

Commit dad2ccc9b3 followup.
Closes #7723.
2013-09-16 17:16:33 +02:00
Marvin Löbel
76c3e8a38c Add an SendStr type
A SendStr is a string that can hold either a ~str or a &'static str.
This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries.

SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings.

Replaced std::rt:logging::SendableString with SendStr
Added tests for using an SendStr as key in Hash- and Treemaps
2013-09-16 16:57:50 +02:00
bors
507a7f093d auto merge of #9121 : sanxiyn/rust/arm, r=alexcrichton
Ignore failing tests on Android to prepare for #9120.
2013-09-16 07:45:45 -07:00
Alex Crichton
0107028991 Resume inlining globals across crates
In #8185 cross-crate condition handlers were fixed by ensuring that globals
didn't start appearing in different crates with different addressed. An
unfortunate side effect of that pull request is that constants weren't inlined
across crates (uint::bits is unknown to everything but libstd).

This commit fixes this inlining by using the `available_eternally` linkage
provided by LLVM. It partially reverts #8185, and then adds support for this
linkage type. The main caveat is that not all statics could be inlined into
other crates. Before this patch, all statics were considered "inlineable items",
but an unfortunate side effect of how we deal with `&static` and `&[static]`
means that these two cases cannot be inlined across crates. The translation of
constants was modified to propogate this condition of whether a constant
should be considered inlineable into other crates.

Closes #9036
2013-09-16 07:29:49 -07:00
Seo Sanghyeon
942bc3161e Ignore failing tests on Android 2013-09-16 23:10:01 +09:00
Seo Sanghyeon
51998d22b0 Pass OS to gyp_uv 2013-09-16 23:09:50 +09:00
bors
2562f480f5 auto merge of #9220 : kballard/rust/c_str-as_str, r=thestinger
Also rustify .as_bytes(), so it no longer calls libc::strlen() and is
inlineable.
2013-09-16 06:30:51 -07:00