Commit Graph

19587 Commits

Author SHA1 Message Date
bors
91922f04f8 auto merge of #8966 : FlaPer87/rust/issue/7473, r=bblum
Current access methods are nestable and unsafe. This patch renames
current methods implementation - prepends unsafe_ - and implements 2 new
methods that are both safe and un-nestable.

Fixes #7473
2013-09-04 08:50:57 -07:00
bors
67555d9bd4 auto merge of #8956 : thestinger/rust/test, r=huonw 2013-09-04 06:20:57 -07:00
Florian Hahn
e38739bb44 Convert rust_log.cpp to Rust, closes #8703 2013-09-04 14:18:56 +02:00
Daniel Micay
62a3434529 stop treating char as an integer type
Closes #7609
2013-09-04 08:07:56 -04:00
Daniel Micay
28f36253b2 add test for tydesc name 2013-09-04 07:56:11 -04:00
Felix S. Klock II
7f834c5c07 Update clients of path.rs to use new API.
In most cases this involved removing a ~str allocations or clones
(yay), or coercing a ~str to a slice.  In a few places, I had to bind
an intermediate Path (e.g. path.pop() return values), so that it would
live long enough to support the borrowed &str.

And in a few places, where the code was actively using the property
that the old API returned ~str's, I had to put in to_owned() or
clone(); but in those cases, we're trading an allocation within the
path.rs code for one in the client code, so they neutralize each
other.
2013-09-04 13:10:32 +02:00
Felix S. Klock II
0f3c87e26e Revise path.rs API to not allocate ~str so much.
Note that I left dirname as returning ~str, because both of its
implementations work by calling dir_path, which produces a new path,
and thus we cannot borrow the result from &'a self passed to dirname
(because the new path returned by dir_path will not live long enough
to satisfy the lifetime 'a).
2013-09-04 13:07:29 +02:00
bors
787f4c986c auto merge of #8976 : alexcrichton/rust/issue-5425, r=pnkfelix
Closes #5425
2013-09-04 03:20:56 -07:00
bors
142dab4e4f auto merge of #8960 : Kimundi/rust/master, r=alexcrichton
Changed ToStr impl for Ascii
Added ToStr impl for char
2013-09-04 01:35:58 -07:00
Alex Crichton
2c573e933b Don't die with an ICE on a blank library name
Closes #5425
2013-09-04 01:09:56 -07:00
Felix S. Klock II
6fbb64acbe Make non-pub condition! expand to non-pub mod. Fix #6009. 2013-09-04 10:05:10 +02:00
Felix S. Klock II
83e19d2ead Added explicit pub to several conditions. Enables completion of #6009. 2013-09-04 10:03:47 +02:00
bors
b659fe3e50 auto merge of #8951 : chris-morgan/rust/vim-update-highlighting, r=alexcrichton
Several changes with appropriate commit messages to explain them.

The final two commits, highlighting everything in the prelude, may be a little controversial. I think it's the sensible way forward with it.
2013-09-04 00:25:56 -07:00
Flaper Fesp
d0ad251376 Use MuextArc and RWArc in docstrings 2013-09-04 09:14:56 +02:00
bors
64ff315584 auto merge of #8950 : sanxiyn/rust/cross-xfail, r=brson 2013-09-03 23:15:56 -07:00
Alex Crichton
ba1f663bbd Raise errors on format strings with unmatched }
Otherwise extra stuff after a lone '}' character is simply ignored, which is
very bad.

Closes #8938
2013-09-03 23:02:59 -07:00
bors
1611e7b72a auto merge of #8943 : alexcrichton/rust/issue-8904, r=brson
We already do this for libstd tests automatically, and compiletest runs into the
same problems where when forking lots of processes lots of file descriptors are
created. On OSX we can use specific syscalls to raise the limits, in this
situation, though.

Closes #8904
2013-09-03 22:05:59 -07:00
bors
523701aad0 auto merge of #8942 : novalis/rust/fmt, r=alexcrichton 2013-09-03 20:56:19 -07:00
novalis
5977376b46 Test and document escaping on format!() 2013-09-03 23:39:58 -04:00
Chris Morgan
9f6180413d Silence fo+=j error for users of Vim < 7.3.541. 2013-09-04 13:33:40 +10:00
bors
383073883f auto merge of #8963 : jmgrosen/rust/issue-8881, r=alexcrichton 2013-09-03 19:46:42 -07:00
Marvin Löbel
8d610e1d2d Added ToStr impl for char
Changed ToStr impl for Ascii
2013-09-04 03:19:52 +02:00
Flaper Fesp
c0aa62c872 Fixed docs and styles 2013-09-04 02:28:16 +02:00
Flaper Fesp
408367ba6d Add a safe implementation of MutexArc::access* methods
Current access methods are nestable and unsafe. This patch renames
current methods implementation - prepends unsafe_ - and implements 2 new
methods that are both safe and un-nestable.

Fixes #7473
2013-09-04 01:13:56 +02:00
Flaper Fesp
b22861d16d Rename MutexArc access methods to unsafe_access 2013-09-04 01:12:23 +02:00
jmgrosen
4a18d46130 Fixes #8881. condition! imports parent's pub identifiers 2013-09-03 16:11:00 -07:00
bors
3c4e943881 auto merge of #8954 : anasazi/rust/tcp-acceptor, r=catamorphism
The Listener trait takes two type parameters, the type of connection and the type of Acceptor,
and specifies only one method, listen, which consumes the listener and produces an Acceptor.

The Acceptor trait takes one type parameter, the type of connection, and defines two methods.
The accept() method waits for an incoming connection attempt and returns the result.
The incoming() method creates an iterator over incoming connections and is a default method.

Example:

```rust
let listener = TcpListener.bind(addr); // Bind to a socket
let acceptor = listener.listen(); // Start the listener
for stream in acceptor.incoming() {
    // Process incoming connections forever (a failure will kill the task).
}
```

Closes #8689
2013-09-03 14:56:22 -07:00
bors
b4ff0bca4c auto merge of #8921 : huonw/rust/stability, r=brson
Significant progress on #6875, enough that I'll open new bugs and turn that into a metabug when this lands.

Description & example in the commit message.
2013-09-03 12:22:16 -07:00
blake2-ppc
913d1b48ad rt::io: Rename Bytes to ByteIterator and add note about iteration 2013-09-03 20:06:45 +02:00
bors
7ee90a002a auto merge of #8934 : sfackler/rust/bufreader, r=brson 2013-09-03 11:01:17 -07:00
bors
dee9d7f97f auto merge of #8945 : alexcrichton/rust/ifmt-dont-move, r=thestinger 2013-09-03 09:50:58 -07:00
Chris Morgan
2bc408f3e3 Update highlighting for prelude changes. 2013-09-04 02:38:41 +10:00
Chris Morgan
c4b180aa9c Highlight everything in the prelude in Vim.
This is a rather more extensive change than the last, but *ever* so much
easier to maintain reasonably, as there's then something to track
directly.
2013-09-04 02:34:23 +10:00
Chris Morgan
afbf908ff4 Update a handful of keywords highlighted in Vim.
I added a few and removed a few and corrected a couple, all with
reference to the prelude. It ends up a slightly arbitrary decision
precisely what ends up in and what doesn't, unfortunately.
2013-09-04 02:34:23 +10:00
Chris Morgan
15f05dc581 Modernise some Vim syntax highlighting.
- Remove highlighting of ``L"..."`` (obsolete syntax)
- Remove backslash at end of line being a line continuation always
  (obsolete syntax; this only affects comments, actually)
- Add highlighting for backslash at end of line and leading whitespace
  on the following line inside a string (a genuine line continuation)
2013-09-04 02:34:22 +10:00
bors
c14daba3b2 auto merge of #8947 : thestinger/rust/name, r=huonw
Storing the type name in the `tydesc` aims to avoid the need to pass a type name in almost every single visitor method.

It would likely be much saner for `repr` to simply be passed the `TyDesc` corresponding to the function or just the type name, but this is good enough for now.
2013-09-03 08:06:04 -07:00
Huon Wilson
506f69aed7 Implement support for indicating the stability of items.
There are 6 new compiler recognised attributes: deprecated, experimental,
unstable, stable, frozen, locked (these levels are taken directly from
Node's "stability index"[1]). These indicate the stability of the
item to which they are attached; e.g. `#[deprecated] fn foo() { .. }`
says that `foo` is deprecated.

This comes with 3 lints for the first 3 levels (with matching names) that
will detect the use of items marked with them (the `unstable` lint
includes items with no stability attribute). The attributes can be given
a short text note that will be displayed by the lint. An example:

    #[warn(unstable)]; // `allow` by default

    #[deprecated="use `bar`"]
    fn foo() { }

    #[stable]
    fn bar() { }

    fn baz() { }

    fn main() {
        foo(); // "warning: use of deprecated item: use `bar`"

        bar(); // all fine

        baz(); // "warning: use of unmarked item"
    }

The lints currently only check the "edges" of the AST: i.e. functions,
methods[2], structs and enum variants. Any stability attributes on modules,
enums, traits and impls are not checked.

[1]: http://nodejs.org/api/documentation.html
[2]: the method check is currently incorrect and doesn't work.
2013-09-04 00:12:27 +10:00
bors
1ac8e8885b auto merge of #8884 : blake2-ppc/rust/exact-size-hint, r=huonw
The message of the first commit explains (edited for changed trait name):

The trait `ExactSize` is introduced to solve a few small niggles:

* We can't reverse (`.invert()`) an enumeration iterator
* for a vector, we have `v.iter().position(f)` but `v.rposition(f)`.
* We can't reverse `Zip` even if both iterators are from vectors

`ExactSize` is an empty trait that is intended to indicate that an
iterator, for example `VecIterator`, knows its exact finite size and
reports it correctly using `.size_hint()`. Only adaptors that preserve
this at all times, can expose this trait further. (Where here we say
finite for fitting in uint).

---

It may seem complicated just to solve these small "niggles",
(It's really the reversible enumerate case that's the most interesting)
but only a few core iterators need to implement this trait.

While we gain more capabilities generically for some iterators,
it becomes a tad more complicated to figure out if a type has
the right trait impls for it.
2013-09-03 06:56:05 -07:00
bors
7048e05d5f auto merge of #8932 : huonw/rust/closed-issues, r=thestinger 2013-09-03 05:46:00 -07:00
bors
d252d810fc auto merge of #8939 : Kimundi/rust/master, r=huonw 2013-09-03 04:36:03 -07:00
Marvin Löbel
7419085337 Modernized a few more types in syntax::ast 2013-09-03 14:45:06 +02:00
Huon Wilson
490c0c7f24 Re-xfail extern-pass-TwoU{8,16}.rs (still doesn't work on 32-bit platforms). 2013-09-03 21:35:51 +10:00
Seo Sanghyeon
877e7f3463 Correctly determine OS to xfail in cross build 2013-09-03 19:34:23 +09:00
Huon Wilson
12099ce94c Tests for fixed issues.
Closes #3794.
Closes #4025.
Closes #5688.
Closes #5708.
Closes #7012.
Closes #7327.
2013-09-03 20:00:42 +10:00
Huon Wilson
364beaa776 Un-xfail/move/delete some tests. 2013-09-03 20:00:41 +10:00
bors
8183c74ec1 auto merge of #8940 : pnkfelix/rust/fsk-8468-allow-underscore-paramname-in-trait-default-method, r=alexcrichton
Fix #8468.  (Though the right answer in the end, as noted on the dialogue on the ticket, might be to just require trait methods to name their parameters, regardless of whether they have a default method implementation or not.)
2013-09-03 02:56:03 -07:00
Felix S. Klock II
1b3cd960de Incorporate review feedback. Fix #8468. 2013-09-03 11:15:41 +02:00
Daniel Micay
a6a993ee71 repr: add very basic support for functions
Closes #8917
2013-09-03 04:45:00 -04:00
Daniel Micay
09ad0cd362 add type name to the tydesc
Closes #8926
2013-09-03 04:44:47 -04:00
Alex Crichton
7e7024718a Don't have format! move out of local variables 2013-09-02 23:53:13 -07:00
Alex Crichton
36a4af49e0 Remove __extensions__ in names for a "pretty name"
As with the previous commit, this is targeted at removing the possibility of
collisions between statics. The main use case here is when there's a
type-parametric function with an inner static that's compiled as a library.
Before this commit, any impl would generate a path item of "__extensions__".
This changes this identifier to be a "pretty name", which is either the last
element of the path of the trait implemented or the last element of the type's
path that's being implemented.  That doesn't quite cut it though, so the (trait,
type) pair is hashed and again used to append information to the symbol.

Essentially, __extensions__ was removed for something nicer for debugging, and
then some more information was added to symbol name by including a hash of the
trait being implemented and type it's being implemented for. This should prevent
colliding names for inner statics in regular functions with similar names.
2013-09-02 23:12:41 -07:00
Alex Crichton
4600212a38 Fix inner statics having the same symbol name
Before, the path name for all items defined in methods of traits and impls never
took into account the name of the method. This meant that if you had two statics
of the same name in two different methods the statics would end up having the
same symbol named (even after mangling) because the path components leading to
the symbol were exactly the same (just __extensions__ and the static name).

It turns out that if you add the symbol "A" twice to LLVM, it automatically
makes the second one "A1" instead of "A". What this meant is that in local crate
compilations we never found this bug. Even across crates, this was never a
problem. The problem arises when you have generic methods that don't get
generated at compile-time of a library. If the statics were re-added to LLVM by
a client crate of a library in a different order, you would reference different
constants (the integer suffixes wouldn't be guaranteed to be the same).

This fixes the problem by adding the method name to symbol path when building
the ast_map. In doing so, two symbols in two different methods are disambiguated
against.
2013-09-02 23:12:20 -07:00
bors
58decdd7a1 auto merge of #8941 : alexcrichton/rust/fix-comment, r=thestinger 2013-09-02 22:10:57 -07:00
Alex Crichton
aeb2f88a48 Raise the file descriptor limits when running compiletest
We already do this for libstd tests automatically, and compiletest runs into the
same problems where when forking lots of processes lots of file descriptors are
created. On OSX we can use specific syscalls to raise the limits, in this
situation, though.

Closes #8904
2013-09-02 21:50:50 -07:00
Alex Crichton
70f3cabe46 Fix the std::fmt doc-block to show up in pandoc 2013-09-02 21:19:11 -07:00
bors
4f151b388b auto merge of #8936 : pnkfelix/rust/fsk-issue-2355-testcase, r=alexcrichton
Fix #2355.
2013-09-02 20:15:52 -07:00
Felix S. Klock II
ba1f44d24f Regression test for #8468. 2013-09-03 01:58:36 +02:00
Felix S. Klock II
4fa28a2e85 Allow _ param name in trait default method for #8468. 2013-09-03 01:58:12 +02:00
Felix S. Klock II
af3cde2c97 Long awaited test case for #2355. 2013-09-02 23:19:04 +02:00
Steven Fackler
319b8833d8 Implement BufReader 2013-09-02 14:24:21 -04:00
Luqman Aden
462604ace1 librustc: Check for empty crate link meta name and vers. 2013-09-02 13:48:20 -04:00
Luqman Aden
0691c01562 libsyntax: Remove obsolete fixme. 2013-09-02 13:48:20 -04:00
bors
7ff102a685 auto merge of #8927 : thestinger/rust/repr, r=huonw 2013-09-02 02:05:45 -07:00
Daniel Micay
67a8ea521a switch __field__ hack to <unnamed_field>
avoids conflict with fields actually named `__field__`
2013-09-02 05:00:42 -04:00
Daniel Micay
331d2d6d31 repr: handle tuple structs sanely
Closes #8919
2013-09-02 04:10:56 -04:00
bors
6a3dd30afe auto merge of #8931 : ILyoan/rust/turnoff_android_ndk_asm, r=thestinger
Now we don't need android ndk to generate unwind info for arm target thanks to LLVM upgrade.
This fix removes the ndk asm pass.
2013-09-02 00:20:44 -07:00
Daniel Micay
cc1f0027c7 repr: add support for trait objects
Closes #8916
2013-09-02 02:50:14 -04:00
Daniel Micay
7a52154d78 repr: print functions as fn() 2013-09-02 00:19:34 -04:00
Ilyong Cho
cbd143f966 turn off android ndk asm pass 2013-09-02 11:55:54 +09:00
novalis
c4bb88364e Fix #8898 2013-09-01 22:35:19 -04:00
blake2-ppc
61026ae621 rt::io: Add Bytes iterator for Reader
An iterator that simply calls `.read_bytes()` each iteration.

I think choosing to own the Reader value and implementing Decorator to
allow extracting it is the most generically useful. The Reader type
variable can of course be some kind of reference type that implements
Reader.
2013-09-02 03:12:32 +02:00
Marvin Löbel
857f867320 Renamed syntax::ast::ident -> Ident 2013-09-02 02:51:21 +02:00
Daniel Micay
1f4aba8cbf touch llvm clean trigger 2013-09-01 15:03:28 -04:00
blake2-ppc
7c369ee733 std/extra: Add ExactSize for Bitv, DList, RingBuf, Option iterators 2013-09-01 18:20:24 +02:00
blake2-ppc
35040dfccc std::iterator: Use ExactSize, inheriting DoubleEndedIterator
Address discussion with acrichto; inherit DoubleEndedIterator so that
`.rposition()` can be a default method, and that the nische of the trait
is clear. Use assertions when using `.size_hint()` in reverse enumerate
and `.rposition()`
2013-09-01 18:17:26 +02:00
blake2-ppc
04845f0aeb std::iterator: Add back .rposition() test 2013-09-01 18:17:19 +02:00
bors
c70486fffe auto merge of #8913 : poiru/rust/issue-8702, r=cmr
Closes #8702.
2013-09-01 08:50:44 -07:00
bors
7c5398b612 auto merge of #8276 : kballard/rust/iterator-protocol, r=cmr
r? @thestinger
2013-09-01 07:00:44 -07:00
Marvin Löbel
539f37925c Modernized a few type names in rustc and syntax 2013-09-01 14:43:26 +02:00
Birunthan Mohanathas
30fc2c8df2 Fix incorrect strftime error handling in rust_localtime
Closes #8702.
2013-09-01 14:57:29 +03:00
bors
a60c6a8b18 auto merge of #8903 : luqmana/rust/en, r=thestinger
Fixes #8735.
2013-08-31 16:25:40 -07:00
bors
04fac7f90d auto merge of #8899 : thestinger/rust/repr, r=huonw 2013-08-31 15:15:40 -07:00
Daniel Micay
17f9382672 document why some tests are xfail-fast 2013-08-31 16:16:43 -04:00
bors
c8db9e2638 auto merge of #8905 : sstewartgallus/rust/cleanup_tests, r=bblum
In this commit I:
- removed unneeded heap allocations
- added extra whitespace to crowded expressions
- and removed unneeded syntax

Also, CC @bblum although this change is fairly unobjectionable.
2013-08-31 12:40:40 -07:00
Steven Stewart-Gallus
e2f2a601e8 Cleanup concurrency tests
In this commit I:
- removed unneeded heap allocations
- added extra whitespace to crowded expressions
- and removed unneeded syntax
2013-08-31 11:26:01 -07:00
Luqman Aden
ba5f101fa9 librustc: Add export_name attribute to specify symbol name. 2013-08-31 13:23:31 -04:00
Daniel Micay
6655b3c462 repr: remove trailing {} from unit-like structs 2013-08-31 03:54:15 -04:00
Daniel Micay
874611b348 repr: print the name of structs 2013-08-31 03:54:13 -04:00
bors
bb35e23f1c auto merge of #8896 : lightcatcher/rust/default_eq_fix, r=thestinger
Summary:
-removed "ne" methods in libstd and librustpkg
-made default "ne" be inlined
-made one of the "eq" methods in librustpkg follow more standard parameter naming convention
2013-08-30 21:40:32 -07:00
bors
5fe553d30f auto merge of #8862 : dcrewi/rust/drop-redundant-ord-impls, r=thestinger
If this were to break something, I would expect existing tests to catch it, and a `make check` run passes locally.
2013-08-30 20:30:35 -07:00
bors
206ad61fd8 auto merge of #8894 : alexcrichton/rust/faster, r=thestinger
The only changes to the default passes is that O1 now doesn't run the inline
pass, just always-inline with lifetime intrinsics. O2 also now has a threshold
of 225 instead of 275. Otherwise the default passes being run is the same.

I've also added a few more options for configuring the pass pipeline. Namely you
can now specify arguments to LLVM directly via the `--llvm-args` command line
option which operates similarly to `--passes`. I also added the ability to turn
off pre-population of the pass manager in case you want to run *only* your own
passes.

I would consider this as closing #8890. I don't think that we should change the default inlining threshold because LLVM/clang will probably have chosen those numbers more carefully than we would. Regardless, here's the performance numbers from this commit:

```
$ ./x86_64-apple-darwin/stage0/bin/rustc ./gistfile1.rs --test --opt-level=3 -o before
warning: no debug symbols in executable (-arch x86_64)
$ ./before --bench

running 1 test
test bench::aes_bench_x8 ... bench: 1602 ns/iter (+/- 66) = 7990 MB/s

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

$ ./x86_64-apple-darwin/stage1/bin/rustc ./gistfile1.rs --test --opt-level=3 -o after
warning: no debug symbols in executable (-arch x86_64)
$ ./after --bench

running 1 test
test bench::aes_bench_x8 ... bench: 2103 ns/iter (+/- 175) = 6086 MB/s

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

$ ./x86_64-apple-darwin/stage1/bin/rustc ./gistfile1.rs --test --opt-level=3 -o after --llvm-args '-inline-threshold=225'
warning: no debug symbols in executable (-arch x86_64)
$ ./after --bench

running 1 test
test bench::aes_bench_x8 ... bench: 1600 ns/iter (+/- 71) = 8000 MB/s

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

```
2013-08-30 19:20:36 -07:00
Eric Martin
1ab0ddae5c made Eq for package_id use more standard parameter names 2013-08-30 22:10:36 -04:00
Eric Martin
ed2217d7b6 Now inline default 'ne' methods 2013-08-30 22:02:24 -04:00
Eric Martin
babe20f018 remove several 'ne' methods 2013-08-30 21:53:25 -04:00
Alex Crichton
8d12673c82 Tweak pass management and add some more options
The only changes to the default passes is that O1 now doesn't run the inline
pass, just always-inline with lifetime intrinsics. O2 also now has a threshold
of 225 instead of 275. Otherwise the default passes being run is the same.

I've also added a few more options for configuring the pass pipeline. Namely you
can now specify arguments to LLVM directly via the `--llvm-args` command line
option which operates similarly to `--passes`. I also added the ability to turn
off pre-population of the pass manager in case you want to run *only* your own
passes.
2013-08-30 17:56:04 -07:00
bors
29449e355a auto merge of #8889 : erickt/rust/cleanup, r=catamorphism
This fixes a couple minor things I've been sitting on. It cleans up some warnings, CapCases some types in librustc's rscope module, and adds a fixme.
2013-08-30 17:20:36 -07:00
bors
8002a09bf9 auto merge of #8831 : catamorphism/rust/extend_rust_path, r=catamorphism
r? @brson

@metajack requested the ability to violate the "only workspaces can be in the RUST_PATH" rule for the purpose of bootstrapping Servo without having to restructure all the directories. This patch gives rustpkg the ability to find sources if a directory in the RUST_PATH directly contains one of rustpkg's "special" files (lib.rs, main.rs, bench.rs, or test.rs), even if it's not a workspace. In this case, it puts the build artifacts in the first workspace in the RUST_PATH.

I'm not sure whether or not it's a good idea to keep this feature in rustpkg permanently. Thus, I added a flag, ```--use-rust-path-hack```, and only enabled it when the flag is set.
2013-08-30 16:10:52 -07:00
Tim Chevalier
98e470ad73 rustpkg: Allow package directories to appear in the RUST_PATH
This commit adds a rustpkg flag, --rust-path-hack, that allows
rustpkg to *search* inside package directories if they appear in
the RUST_PATH, while *building* libraries and executables into a
different target directory.

This behavior is hidden behind a flag because I believe we only
want to support it temporarily, to make it easier to port servo to
rustpkg.

This commit also includes a fix for how rustpkg fetches sources
from git repositories -- it uses a temporary directory as the target
when invoking `git clone`, then moves that directory into the workspace
if the clone was successful. (The old behavior was that when the
`git clone` failed, the empty target directory would be left lying
around anyway.)
2013-08-30 15:48:41 -07:00
Tim Chevalier
7cbdee1663 rustpkg: Add a not_a_workspace condition 2013-08-30 15:48:41 -07:00
Tim Chevalier
34ed4e26a2 std: Add a file-renaming function to std::os 2013-08-30 15:48:37 -07:00