Commit graph

17686 commits

Author SHA1 Message Date
Brendan Zabarauskas
cc51186be0 Add is_normal and classify methods to Float trait 2013-05-07 20:30:51 +10:00
Brendan Zabarauskas
a9ac2b95f4 Add abs_sub method to Signed trait 2013-05-07 19:16:03 +10:00
Brendan Zabarauskas
314b485c9c Fix order of methods 2013-05-07 19:16:03 +10:00
Brendan Zabarauskas
06c5e7f383 Implement exp_m1 and ln_1p as methods for Float
Both expm1 and ln1p have been renamed to exp_m1 and ln_1p in order to be consistent with the underscore usage elsewhere.

The exp_m1 method is used for increased accuracy when doing floating point calculations, so this has been moved from the more general 'Exponential' trait into 'Float'.
2013-05-07 19:16:02 +10:00
Brendan Zabarauskas
9b09dce3e1 Switch to using 'ln' for the natural logarithm and 'log' for arbitrary base logarithms 2013-05-07 19:16:02 +10:00
bors
7b2020f2c3 auto merge of #6245 : youknowone/rust/match-range-static, r=graydon
Fix unintended error problem of:
````
static s: int = 1;
static e: int = 42;

fn main() {
    match 7 {
        s..e => (),
         ^~                 error: expected `=>` but found `..`
        _ => (),
    }
}
````
2013-05-07 00:18:37 -07:00
bors
3225870191 auto merge of #6236 : alexcrichton/rust/more-map-methods, r=thestinger
Closes #5392 and #5393

I implemented the pop/swap methods for TrieMap/TreeMap/SmallIntMap, and I also updated all of them such that pop isn't just a remove/insert, but rather it's all done in one operation.

One thing I did notice is that with default methods it'd be really nice to define `insert` and `remove` in terms of `pop` and `swap` (or vice versa, just to have them available).
2013-05-06 23:06:36 -07:00
Alex Crichton
393a409b5d Add pop() and swap() to the Map trait 2013-05-07 01:16:04 -04:00
bors
bf748e5001 auto merge of #6241 : thestinger/rust/rc, r=pcwalton
To provide a reference counted pointer type with deterministic
destruction once managed boxes are switched over to a garbage
collector. Unlike managed boxes, these can be moved instead of just
copied/cloned which is helpful for avoiding reference counts.

Needs #5601 to be fixed in order for safety to be provided without the current ugly workaround of making the pointers contain `Option<@()>` and `Option<@mut ()>` (which are just set to `None`).

@brson: r?
2013-05-06 22:00:37 -07:00
bors
d2f0235a2c auto merge of #6228 : brson/rust/run-destroy, r=brson
These cause valgrind errors in subprocesses. I don't *think* these errors
lead to actual test failures but they are very confusing.
2013-05-06 20:12:37 -07:00
bors
4b6864f219 auto merge of #6226 : alexcrichton/rust/issue-6199, r=brson
I just removed `pub mod` from `core.rc` and then got everything to compile again. One thing I'm worried about is an import like this:

```rust
use a;
use a::b;

mod a {
  pub type b = int;
}
mod b {
  use a;    // bad
  use a::b; // good
}
```

I'm not sure if `use a::b` being valid is a bug or intended behavior (same question about `use a`). If it's intended behavior, then I got around these modules not being public by only importing the specific members that are necessary. Otherwise that probably needs an open issue.
2013-05-06 18:57:40 -07:00
bors
05460fcd5a auto merge of #6286 : nikomatsakis/rust/issue-5910-dyna-freeze, r=nikomatsakis
This rather sprawling branch refactors the borrow checker and much of the region code, addressing a number of outstanding issues. I will close them manually after validating that there are test cases for each one, but here is a (probably partial) list:

  - #4903: Flow sensitivity
  - #3387: Moves in overloaded operators
  - #3850: Region granularity
  - #4666: Odd loaning errors
  - #6021: borrow check errors with hashmaps
  - #5910: @mut broken

cc #5047

(take 5)
2013-05-06 17:52:52 -07:00
Niko Matsakis
39a119074a appease the tidy gods with respect to a FIXME 2013-05-06 20:27:59 -04:00
Niko Matsakis
cd164cf8b5 Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze 2013-05-06 20:15:27 -04:00
Niko Matsakis
ce45f390dd Remove debug_mem since @graydon said it conflicted with GC changes 2013-05-06 20:14:54 -04:00
Niko Matsakis
8b32bde408 add rust_take_task_borrow_list and rust_set_task_borrow_list to rustrt.def.in 2013-05-06 20:10:19 -04:00
Daniel Micay
3d526d1af3 add task-local reference counted smart pointers
To provide a reference counted pointer type with deterministic
destruction once managed boxes are switched over to a garbage
collector. Unlike managed boxes, these can be moved instead of just
copied/cloned which is helpful for avoiding reference counts.
2013-05-06 17:03:20 -04:00
bors
bd5fd6e42a auto merge of #6150 : yichoi/rust/arm-test-pull, r=brson
Support #5297

install.mk : install-runtime-target added for conveneice
                 automatically push runtime library to android device

test.mk : expanded to support android test automation with adb

compiletest : expanded to support android test automation with adb
2013-05-06 13:15:38 -07:00
Niko Matsakis
2e4790ca06 Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze 2013-05-06 16:10:31 -04:00
Brian Anderson
de8071234f Move core::run tests of process killing into standalone run-pass tests
These cause valgrind errors in subprocesses. I don't *think* these errors
lead to actual test failures but they are very confusing.
2013-05-06 12:50:08 -07:00
bors
a5891bebc1 auto merge of #6265 : sanxiyn/rust/xc-packed, r=nikomatsakis 2013-05-06 11:30:48 -07:00
Niko Matsakis
0ef4e860da Replace NOTE with FIXME 2013-05-06 14:02:28 -04:00
bors
b6dea9d41d auto merge of #6263 : bjz/rust/approx-eq, r=erickt
Moving the trait into `core` allows it to be added to the `num::Float` trait.

I have also added and `assert_approx_eq!` macro. This is useful fo making approximate assertions on types that implement the `ApproxEq` trait.

Examples:

~~~rust
// using the default epsilon value
assert_approx_eq!(1.0000001f, 1.0f);

// using a custom epsilon value
assert_approx_eq!(1.000001f, 1.0f, 1.0e-5);

// fails with: "left: 1.00001 does not approximately equal right: 1"
assert_approx_eq!(1.00001f, 1.0f);
~~~
2013-05-06 09:12:37 -07:00
Niko Matsakis
c50a9d5b66 Use rust_try_get_task for compat with new rt, and strenghten assumptions about borrow list 2013-05-06 11:18:59 -04:00
Seo Sanghyeon
502817a9c1 Fix cross-crate packed structs 2013-05-06 23:35:27 +09:00
Niko Matsakis
84f7ecce5c Adust arena test: can no longer allocate recursively 2013-05-06 09:56:17 -04:00
Niko Matsakis
6c0c3a44bd Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze 2013-05-06 09:00:50 -04:00
Niko Matsakis
2ea52a38e5 refinement to technique used to not run regionck 2013-05-06 09:00:37 -04:00
Brendan Zabarauskas
0e2242f6d6 Add assert_approx_eq! macro 2013-05-06 21:51:48 +10:00
Brendan Zabarauskas
0211833008 Move FuzzyEq trait into core::cmp and rename it to 'ApproxEq' 2013-05-06 21:51:07 +10:00
Niko Matsakis
e235f6ca53 remove some unused mut decls and vars 2013-05-06 05:18:23 -04:00
Niko Matsakis
4dc62dfcf3 do not run regionck if there have been type errors 2013-05-06 05:17:36 -04:00
Niko Matsakis
7b36e34c89 Fix two more write guard failures 2013-05-05 21:05:37 -04:00
Niko Matsakis
4300d4d2fa Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze
Conflicts:
	src/libcore/core.rc
	src/libcore/hashmap.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/num/float.rs
	src/libcore/num/int-template.rs
	src/libcore/num/num.rs
	src/libcore/num/strconv.rs
	src/libcore/num/uint-template.rs
	src/libcore/ops.rs
	src/libcore/os.rs
	src/libcore/prelude.rs
	src/libcore/rt/mod.rs
	src/libcore/unstable/lang.rs
	src/librustc/driver/session.rs
	src/librustc/middle/astencode.rs
	src/librustc/middle/borrowck/check_loans.rs
	src/librustc/middle/borrowck/gather_loans.rs
	src/librustc/middle/borrowck/loan.rs
	src/librustc/middle/borrowck/preserve.rs
	src/librustc/middle/liveness.rs
	src/librustc/middle/mem_categorization.rs
	src/librustc/middle/region.rs
	src/librustc/middle/trans/base.rs
	src/librustc/middle/trans/inline.rs
	src/librustc/middle/trans/reachable.rs
	src/librustc/middle/typeck/check/_match.rs
	src/librustc/middle/typeck/check/regionck.rs
	src/librustc/util/ppaux.rs
	src/libstd/arena.rs
	src/libstd/ebml.rs
	src/libstd/json.rs
	src/libstd/serialize.rs
	src/libstd/std.rc
	src/libsyntax/ast_map.rs
	src/libsyntax/parse/parser.rs
	src/test/compile-fail/borrowck-uniq-via-box.rs
	src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
	src/test/run-pass/borrowck-nested-calls.rs
2013-05-05 15:11:04 -04:00
bors
6e6a4be19d auto merge of #6208 : sanxiyn/rust/accurate-span, r=sanxiyn 2013-05-05 11:12:37 -07:00
Seo Sanghyeon
aca2a00fb4 Fix span tests 2013-05-06 03:09:19 +09:00
Niko Matsakis
6cb273ed4e Address all FIXMEs from #5562 2013-05-05 13:50:10 -04:00
Niko Matsakis
0b0b8018a6 add warning for #6248 and remove instances of it 2013-05-05 12:17:59 -04:00
bors
063851ffa1 auto merge of #6235 : pnkfelix/rust/issue-3326-play-with-directory-orderonly-prereqs, r=z0w0
r? (for #3326)
2013-05-05 05:09:36 -07:00
Niko Matsakis
6806900a7c disable lang debug for perf 2013-05-05 07:43:43 -04:00
bors
3b299e8140 auto merge of #6244 : thestinger/rust/ffi, r=z0w0
The previous example was erroneously attempting to destroy
uninitialized memory, which was often zeroed (masking the bug).
2013-05-05 04:09:36 -07:00
bors
29a2a1ecd1 auto merge of #6234 : yichoi/rust/glob-dummy-pull, r=thestinger
transitional patch to resolve compile/link failure on android

after #6161 landed, I've encountered below errors since android does not support glob in libc.

/opt/ndk_standalone/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/yichoi/rust_work/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/arm-linux-androideabi/lib/libcore-c3ca5d77d81b46c1-0.7-pre.so: error: undefined reference to 'glob'

/opt/ndk_standalone/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/yichoi/rust_work/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/arm-linux-androideabi/lib/libcore-c3ca5d77d81b46c1-0.7-pre.so: error: undefined reference to 'globfre

Since android does not have `glob.h`, `glob_t` definition comes from
https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/vSH6MWPD0Vk

#6100 should be resolved.
2013-05-04 22:09:36 -07:00
Young-il Choi
987ad9c878 rt: rust_android_dummy.cpp fix for make tidy 2013-05-05 14:00:53 +09:00
Jeong YunWon
cb918e1a83 Allow non-literal static range pattern for match arms
Fix unintended error problem of:

static s: int = 1;
static e: int = 42;

fn main() {
    match 7 {
        s..e => (),
         ^~                 error: expected `=>` but found `..`
        _ => (),
    }
}
2013-05-05 11:05:06 +09:00
Daniel Micay
8f2d71ac00 small fix to the tutorial-ffi destructor example
The previous example was erroneously attempting to destroy
uninitialized memory, which was often zeroed (masking the bug).
2013-05-04 21:57:10 -04:00
bors
d74ac9ea03 auto merge of #6240 : brson/rust/snapshots, r=brson 2013-05-04 15:48:36 -07:00
Brian Anderson
8081e8debf Register snapshots 2013-05-04 15:43:51 -07:00
bors
b872900a5b auto merge of #6237 : dotdash/rust/reduce_bloat, r=brson
In commit d7f5e43 "core::rt: Add the local heap to newsched tasks",
local_malloc and local_free have become rather big and their forced
inlining causes quite a bit of code bloat. Compile times for crates
affected by the bloat (e.g. rustc) improve, while others (e.g. libstd)
seem to be unaffected, so I guess the inlining doesn't gain us much.

Sizes:
```
               | librustc   | libsytax
---------------|–-----------|------------
with inlining  | 18,547,824 |  7,110,848
w/o inlining   | 15,092,040 |  5,518,608
2013-05-04 13:33:37 -07:00
Niko Matsakis
989d008124 separate out write_guard code into its own module 2013-05-04 14:29:32 -04:00
Niko Matsakis
ccf2f7b979 make asm_comments something that you opt in to 2013-05-04 14:29:08 -04:00