Commit Graph

25741 Commits

Author SHA1 Message Date
bors
0f637ebd06 auto merge of #11790 : lfairy/rust/rename-num-consts, r=alexcrichton
The following are renamed:

* `min_value` => `MIN`
* `max_value` => `MAX`
* `bits` => `BITS`
* `bytes` => `BYTES`

All tests pass, except for `run-pass/phase-syntax-link-does-resolve.rs`. I doubt that failure is related, though.

Fixes #10010.
2014-01-25 07:56:27 -08:00
bors
caabbb8388 auto merge of #11788 : salemtalha/rust/master, r=huonw
Fixes #11785.
2014-01-25 06:31:31 -08:00
bors
b0ef2d56a8 auto merge of #11775 : alexcrichton/rust/select-fix, r=pcwalton
The race here happened when a port had its deschedule in select() canceled, but
the other chan had already been dropped. This meant that the DISCONNECTED case
was hit in abort_selection, but the to_wake cell hadn't been emptied yet (this
was done after aborting), causing an assert in abort_selection to trip.

To fix this, the to_wake cell is just emptied before abort_selection is called
(we know that we're the owner of it already).
2014-01-25 05:11:28 -08:00
bors
6516b303b5 auto merge of #11570 : derekchiang/rust/fix-rt-docs, r=alexcrichton 2014-01-25 02:21:32 -08:00
Chris Wong
988e4f0a1c Uppercase numeric constants
The following are renamed:

* `min_value` => `MIN`
* `max_value` => `MAX`
* `bits` => `BITS`
* `bytes` => `BYTES`

Fixes #10010.
2014-01-25 21:38:25 +13:00
Salem Talha
1b4623d1dd Fixed iter's is_empty to use is_none() and added relevant test flag 2014-01-25 02:44:06 -05:00
Derek Chiang
e8baed0b2d Fix some docs about rt 2014-01-25 02:16:17 -05:00
bors
de57a22b9a auto merge of #11774 : sfackler/rust/move-macros, r=pcwalton
They all have to go into a single module at the moment unfortunately.
Ideally, the logging macros would live in std::logging, condition! would
live in std::condition, format! in std::fmt, etc. However, this
introduces cyclic dependencies between those modules and the macros they
use which the current expansion system can't deal with. We may be able
to get around this by changing the expansion phase to a two-pass system
but that's for a later PR.

Closes #2247
cc #11763
2014-01-24 20:31:37 -08:00
bors
7c028c9ba7 auto merge of #11772 : sanxiyn/rust/reexport, r=cmr
The field is always set to true.
2014-01-24 19:11:39 -08:00
bors
72e888960f auto merge of #11764 : Armavica/rust/doc_patmatch, r=pcwalton
I also removed the obsolete '*' wildcard from the manual.
2014-01-24 17:51:31 -08:00
bors
dc48adc69f auto merge of #11748 : brson/rust/timerfdandroid, r=alexcrichton
It doesn't seem to exist.
2014-01-24 16:11:31 -08:00
bors
8de3fab82a auto merge of #11732 : luqmana/rust/native-getaddrinfo, r=alexcrichton
The last bit I needed to be able to use libnative :P
2014-01-24 14:51:36 -08:00
Luqman Aden
adb5128020 libnative: Avoid gai_strerror on windows. 2014-01-24 16:44:16 -05:00
Luqman Aden
a04cc4db2c libstd: Use iotest! for for get_host_addresses. 2014-01-24 16:44:16 -05:00
bors
a1d9d9e6d2 auto merge of #11744 : alexcrichton/rust/issue-5219, r=thestinger
By default, the compiler and libraries are all still built with rpaths, but this
can be opted out of with --disable-rpath to ./configure or --no-rpath to rustc.

Closes #5219
2014-01-24 10:26:33 -08:00
Alex Crichton
35e26e94d8 Fix a spuriously tripped assert in select()
The race here happened when a port had its deschedule in select() canceled, but
the other chan had already been dropped. This meant that the DISCONNECTED case
was hit in abort_selection, but the to_wake cell hadn't been emptied yet (this
was done after aborting), causing an assert in abort_selection to trip.

To fix this, the to_wake cell is just emptied before abort_selection is called
(we know that we're the owner of it already).
2014-01-24 10:05:58 -08:00
Alex Crichton
e715cdba31 Allow opting-out of rpath usage
By default, the compiler and libraries are all still built with rpaths, but this
can be opted out of with --disable-rpath to ./configure or --no-rpath to rustc.

cc #5219
2014-01-24 09:24:45 -08:00
bors
8c805fa70b auto merge of #11760 : dmac/rust/addressable-search, r=alexcrichton
This change adds two improvements to docs searching functionality.

First, search results will immediately be displayed when a ?search=searchterm
query string parameter is provided to any docs url.

Second, search results are now inserted into the browser history, allowing for
easier navigation between search results and docs pages.
2014-01-24 08:46:33 -08:00
Steven Fackler
3ba916ddff Delete ignore! macro
This was a holdover from when we didn't allow nested comment blocks
(think #if 0). It isn't used anywhere.
2014-01-24 08:46:31 -08:00
Steven Fackler
86a8b031f5 Move macro_rules! macros to libstd
They all have to go into a single module at the moment unfortunately.
Ideally, the logging macros would live in std::logging, condition! would
live in std::condition, format! in std::fmt, etc. However, this
introduces cyclic dependencies between those modules and the macros they
use which the current expansion system can't deal with. We may be able
to get around this by changing the expansion phase to a two-pass system
but that's for a later PR.

Closes #2247
cc #11763
2014-01-24 08:35:39 -08:00
bors
1ea0947c5d auto merge of #11753 : misfo/rust/patch-1, r=pcwalton 2014-01-24 07:26:31 -08:00
bors
a5ab960d2e auto merge of #11750 : bnoordhuis/rust/follow-rustc-symlink, r=thestinger
Before this commit, rustc looked in `dirname $0`/../lib for libraries
but that doesn't work when rustc is invoked through a symlink.

This commit makes rustc look in `dirname $(readlink $0)`/../lib, i.e.
it first canonicalizes the symlink before walking up the directory tree.

Fixes #3632.
2014-01-24 06:06:33 -08:00
Seo Sanghyeon
0f36438a8e Remove reexport field 2014-01-24 20:46:19 +09:00
bors
5675f2813f auto merge of #11742 : eminence/rust/dylib-test-fix, r=alexcrichton
On my Gentoo Linux machine, the c-dynamic-dylib test is failing, because libcfoo can't be found.  bar has a correct rpath for finding libfoo.so, but libfoo.so's rpath doesn't contain the right entries for finding libcfoo.


Below is the test failure on my machine.  This test pass with this commit:

```
maketest: c-dynamic-dylib
----- /storage/home/achin/devel/rust/src/test/run-make/c-dynamic-dylib/ --------------------
------ stdout ---------------------------------------------
make[1]: Entering directory `/storage/home/achin/devel/rust/src/test/run-make/c-dynamic-dylib'
gcc -Wall -Werror -g -fPIC -m64 -L /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib -c -o /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib/libcfoo.o cfoo.c
gcc -Wall -Werror -g -fPIC -m64 -L /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib -o /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib/libcfoo.so /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib/libcfoo.o -shared
/storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/stage2/bin/rustc --out-dir /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib -L /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib foo.rs
/storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/stage2/bin/rustc --out-dir /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib -L /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib bar.rs
/storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib/bar
rm /storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib/libcfoo.o
make[1]: Leaving directory `/storage/home/achin/devel/rust/src/test/run-make/c-dynamic-dylib'

------ stderr ---------------------------------------------
/storage/home/achin/devel/rust/x86_64-unknown-linux-gnu/test/run-make/c-dynamic-dylib/bar: error while loading shared libraries: libcfoo.so: cannot open shared object file: No such file or directory
make[1]: *** [all] Error 127

------        ---------------------------------------------

```
2014-01-24 03:16:31 -08:00
bors
4ce84fa1de auto merge of #11720 : sfackler/rust/macro-export-source, r=alexcrichton
The old method of serializing the AST gives totally bogus spans if the
expansion of an imported macro causes compilation errors. The best
solution seems to be to serialize the actual textual macro definition
and load it the same way the std-macros are. I'm not totally confident
that getting the source from the CodeMap will always do the right thing,
but it seems to work in simple cases.
2014-01-24 00:06:31 -08:00
bors
cd8ee786f9 auto merge of #11718 : ktt3ja/rust/borrowck-error-msg, r=brson
A mutable and immutable borrow place some restrictions on what you can
with the variable until the borrow ends. This commit attempts to convey
to the user what those restrictions are. Also, if the original borrow is
a mutable borrow, the error message has been changed (more specifically,
i. "cannot borrow `x` as immutable because it is also borrowed as
mutable" and ii. "cannot borrow `x` as mutable more than once" have
been changed to "cannot borrow `x` because it is already borrowed as
mutable").

In addition, this adds a (custom) span note to communicate where the
original borrow ends.

```rust
fn main() {
    match true {
        true => {
            let mut x = 1;
            let y = &x;
            let z = &mut x;
        }
        false => ()
    }
}

test.rs:6:21: 6:27 error: cannot borrow `x` as mutable because it is already borrowed as immutable
test.rs:6             let z = &mut x;
                              ^~~~~~
test.rs:5:21: 5:23 note: previous borrow of `x` occurs here; the immutable borrow prevents subsequent moves or mutable borrows of `x` until the borrow ends
test.rs:5             let y = &x;
                              ^~
test.rs:7:10: 7:10 note: previous borrow ends here
test.rs:3         true => {
test.rs:4             let mut x = 1;
test.rs:5             let y = &x;
test.rs:6             let z = &mut x;
test.rs:7         }
                  ^
```

```rust
fn foo3(t0: &mut &mut int) {
    let t1 = &mut *t0;
    let p: &int = &**t0;
}

fn main() {}

test.rs:3:19: 3:24 error: cannot borrow `**t0` because it is already borrowed as mutable
test.rs:3     let p: &int = &**t0;
                            ^~~~~
test.rs:2:14: 2:22 note: previous borrow of `**t0` as mutable occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `**t0` until the borrow ends
test.rs:2     let t1 = &mut *t0;
                       ^~~~~~~~
test.rs:4:2: 4:2 note: previous borrow ends here
test.rs:1 fn foo3(t0: &mut &mut int) {
test.rs:2     let t1 = &mut *t0;
test.rs:3     let p: &int = &**t0;
test.rs:4 }
          ^
```

For the "previous borrow ends here" note, if the span is too long (has too many lines), then only the first and last lines are printed, and the middle is replaced with dot dot dot:
```rust
fn foo3(t0: &mut &mut int) {
    let t1 = &mut *t0;
    let p: &int = &**t0;



}

fn main() {}

test.rs:3:19: 3:24 error: cannot borrow `**t0` because it is already borrowed as mutable
test.rs:3     let p: &int = &**t0;
                            ^~~~~
test.rs:2:14: 2:22 note: previous borrow of `**t0` as mutable occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `**t0` until the borrow ends
test.rs:2     let t1 = &mut *t0;
                       ^~~~~~~~
test.rs:7:2: 7:2 note: previous borrow ends here
test.rs:1 fn foo3(t0: &mut &mut int) {
...
test.rs:7 }
          ^
```

(Sidenote: the `span_end_note` currently also has issue #11715)
2014-01-23 22:46:32 -08:00
bors
bf9c25562d auto merge of #11686 : mankyKitty/rust/rename-invert-to-flip-issue-10632, r=alexcrichton
Renamed the ```invert()``` function in ```iter.rs``` to ```flip()```, from #10632 

Also renamed the ```Invert<T>``` type to ```Flip<T>```.

Some related code comments changed. Documentation that I could find has
been updated, and all the instances I could locate where the
function/type were called have been updated as well.

This is my first contribution to Rust! Apologies in advance if I've snarfed the 
PR process, I'm not used to rebase.

I initially had issues with the ```codegen``` section of the tests failing, however
the ```make check``` process is not reporting any failures at this time. I think
that was a local env issue more than me facerolling my changes. :)
2014-01-23 19:56:35 -08:00
Virgile Andreani
7b1d124f6e Add '@' subpattern binding and examples to manual and tutorial 2014-01-24 03:58:02 +01:00
Virgile Andreani
2c5b04cef1 Replace '*' by '..' in the doc of pattern matching 2014-01-24 03:58:02 +01:00
bors
2b62371c20 auto merge of #11478 : klutzy/rust/rustpkg-crate-id, r=cmr
This patchset consists of three parts:

- rustpkg doesn't guess crate version if it is not given by user.
- `rustpkg::version::Version` is replaced by `Option<~str>`.
  It removes some semantic versioning portions which is not currently used.
  (cc #8405 and #11396)
  `rustpkg::crate_id::CrateId` is also replaced by `syntax::crateid::CrateId`.
- rustpkg now computes hash to find crate, instead of manual filename parse.

cc @metajack
2014-01-23 17:31:44 -08:00
bors
9f4e5b6f31 auto merge of #11761 : alexcrichton/rust/epoll-eintr, r=alexcrichton 2014-01-23 15:36:56 -08:00
aydin.kim
be6fb8f2cd update llvm 2014-01-23 15:15:43 -08:00
Alex Crichton
219478fb41 Build llvm-extract (needed by codegen tests) 2014-01-23 15:13:00 -08:00
Daniel MacDougall
b869f36e78 Make docs search results URL-addressable
This change adds two improvements to docs searching functionality.

First, search results will immediately be displayed when a ?search=searchterm
query string parameter is provided to any docs url.

Second, search results are now inserted into the browser history, allowing for
easier navigation between search results and docs pages.
2014-01-23 14:04:50 -08:00
Sean Chalmers
292ed3e55c Update flip() to be rev().
Consensus leaned in favour of using rev instead of flip.
2014-01-23 22:18:18 +01:00
Sean Chalmers
55d6e0e1b7 Rename Invert to Flip - Issue 10632
Renamed the invert() function in iter.rs to flip().

Also renamed the Invert<T> type to Flip<T>.

Some related code comments changed. Documentation that I could find has
been updated, and all the instances I could locate where the
function/type were called have been updated as well.
2014-01-23 21:50:18 +01:00
Alex Crichton
aa78da3f45 Handle EINTR in epoll for native timers 2014-01-23 12:34:01 -08:00
Kiet Tran
b3290d322e Make some borrow checker errors more user friendly
A mutable and immutable borrow place some restrictions on what you can
with the variable until the borrow ends. This commit attempts to convey
to the user what those restrictions are. Also, if the original borrow is
a mutable borrow, the error message has been changed (more specifically,
i. "cannot borrow `x` as immutable because it is also borrowed as
mutable" and ii. "cannot borrow `x` as mutable more than once" have
been changed to "cannot borrow `x` because it is already borrowed as
mutable").

In addition, this adds a (custom) span note to communicate where the
original borrow ends.
2014-01-23 14:44:28 -05:00
Steven Fackler
d908e97da3 Redo exported macro serialization
The old method of serializing the AST gives totally bogus spans if the
expansion of an imported macro causes compilation errors. The best
solution seems to be to serialize the actual textual macro definition
and load it the same way the std-macros are. I'm not totally confident
that getting the source from the CodeMap will always do the right thing,
but it seems to work in simple cases.
2014-01-23 09:01:36 -08:00
Trent Ogren
e1e7ddc494 Fix typo in tutorial 2014-01-23 10:43:48 -06:00
bors
657e353022 auto merge of #11739 : thestinger/rust/rm-old-ext, r=alexcrichton 2014-01-23 05:56:30 -08:00
Ben Noordhuis
51103c89d0 Make check-summary.py support file globbing
Fixes the following error when executing `make check-lite`:

    Traceback (most recent call last):
      File "/home/bnoordhuis/src/rust/src/etc/check-summary.py", line 27, in <module>
        map(summarise, logfiles)
      File "/home/bnoordhuis/src/rust/src/etc/check-summary.py", line 10, in summarise
        with open(fname) as fd:
    IOError: [Errno 2] No such file or directory: 'tmp/*.log'
2014-01-23 13:06:21 +01:00
bors
7cabd40320 auto merge of #11737 : alexcrichton/rust/issue-11729, r=thestinger
Closes #11729
2014-01-23 03:51:29 -08:00
Ben Noordhuis
8cce35e490 Follow symlinks in sysroot
Before this commit, rustc looked in `dirname $0`/../lib for libraries
but that doesn't work when rustc is invoked through a symlink.

This commit makes rustc look in `dirname $(readlink $0)`/../lib, i.e.
it first canonicalizes the symlink before walking up the directory tree.

Fixes #3632.
2014-01-23 11:45:23 +01:00
bors
aa9cf4cf8d auto merge of #11701 : FeGs/rust/stray-debug-in-metadata, r=alexcrichton
When there is `println!` macro in the code, compiling is never end.

```rust
// print.rs
fn main() {
  println!("Hello!");
}
```

```bash
$ RUST_LOG=rustc rustc print.rs
```

And this is a part of output from stderr.

```bash
# ...
Looking up syntax::ast::DefId{crate: 1u32, node: 176234u32}
looking up syntax::ast::DefId{crate: 1u32, node: 176235u32} : extra::ebml::Doc<>{data: &[168u8, 16u8, 0u8, 0u8, 16u8, 51u8, 101u8, 53u8, 97u8, 101u8, 98u8, 56u8, 51u8, 55u8, 97u8, 101u8, 49u8, 54u8, 50u8
# ...
# vector which has infinite length.
```

* note : rust 0.9, 0.10-pre
2014-01-23 01:31:39 -08:00
Brian Anderson
e70ca23b8d native: Don't use timerfd on Android
It doesn't seem to exist.
2014-01-23 01:08:34 -08:00
bors
19e0cbe420 auto merge of #11682 : thestinger/rust/vector, r=brson
This is just an initial implementation and does not yet fully replace `~[T]`. A generic initialization syntax for containers is missing, and the slice functionality needs to be reworked to make auto-slicing unnecessary.

Traits for supporting indexing properly are also required. This also needs to be fixed to make ring buffers as easy to use as vectors.

The tests and documentation for `~[T]` can be ported over to this type when it is removed. I don't really expect DST to happen for vectors as having both `~[T]` and `Vec<T>` is overcomplicated and changing the slice representation to 3 words is not at all appealing. Unlike with traits, it's possible (and easy) to implement `RcSlice<T>` and `GcSlice<T>` without compiler help.
2014-01-22 23:26:33 -08:00
bors
52ba3b6414 auto merge of #11611 : SiegeLord/rust/exp_printing, r=alexcrichton
Fixes #6593

Currently, Rust provides no way to print very large or very small floating point values which come up routinely in scientific and modeling work. The classical solution to this is to use the scientific/exponential notation, which not-coincidentally, corresponds to how floating point values are encoded in memory. Given this, there are two solutions to the problem. One is what, as far as I understand it, Python does. I.e. for floating point numbers in a certain range it does what we do today with the `'f'` formatting flag, otherwise it switches to exponential notation. The other way is to provide a set of formatting flags to explicitly choose the exponential notation, like it is done in C. I've chosen the second way as I think its important to provide that kind of control to the user.

This pull request changes the `std::num::strconv::float_to_str_common` function to optionally format floating point numbers using the exponential (scientific) notation. The base of the significant can be varied between 2 and 25, while the base of the exponent can be 2 or 10.

Additionally this adds two new formatting specifiers to `format!` and friends: `'e'` and `'E'` which switch between outputs like `1.0e5` and `1.0E5`. Mostly parroting C stdlib in this sense, although I wasn't going for an exact output match.
2014-01-22 22:01:40 -08:00
Andrew Chin
24c560a69f Set LD_LIBRARY_PATH on linux for c-dynamic-dylib test
Else, libfoo can't find libcfoo.so.

bar has an rpath, which lets it find libfoo.  But libfoo doesn't have an
rapth that tells it where to find libcfoo
2014-01-22 23:49:36 -05:00
bors
7ea063ea0f auto merge of #11294 : alexcrichton/rust/native-timer, r=brson
Commit messages have the fun details

Closes #10925
2014-01-22 20:41:29 -08:00