0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-11-29 10:05:55 +01:00
Commit Graph

17401 Commits

Author SHA1 Message Date
bors
7a857673ff auto merge of #6103 : catamorphism/rust/nonfatal-errors, r=catamorphism
r? @nikomatsakis typeck::check::_match wasn't suppressing derived errors properly.
Fixed it. (This will fix #5100)
2013-04-30 17:39:36 -07:00
Tim Chevalier
4493cf49cd Fix error messages harder 2013-04-30 16:17:19 -07:00
bors
9329bd669d auto merge of #6136 : jld/rust/simplifycfg-unrevert, r=thestinger
Also add the clearly marked test case that should have been there all along, and un-xfail the not-so-obvious doc test that was affected.
2013-04-30 15:24:36 -07:00
bors
9d966aef06 auto merge of #6134 : jld/rust/issue-6117, r=catamorphism
Cases like `Either<@int,()>` have a null case with at most one value but
a nonzero number of fields; if we misreport this, then bad things can
happen inside of, for example, pattern matching.

Closes #6117.
2013-04-30 13:30:39 -07:00
bors
9b54fbd40f auto merge of #6118 : brson/rust/too-much-recursion, r=thestinger
I don't understand how this is still passing on the bots. This condition
should trigger an abort now.
2013-04-30 12:12:37 -07:00
Jed Davis
4701716b56 Revert "doc: XFAIL mysterious failure on bots"
This reverts commit 2c6dae081b.
2013-04-30 12:07:10 -07:00
Jed Davis
41d06dbd28 Reverse accidental src/llvm reversion in 876483dcf, and add test.
The test is reduced from a doc test, but making it separate ensures that
(1) unrelated changes to the docs won't leave this case uncovered, and
(2) the nature of any future failures will be more obvious to whoever
sees the tree on fire as a result.
2013-04-30 12:05:06 -07:00
Jed Davis
8408012ca4 The null case of a nullable-poiner enum might not be nullary.
Cases like `Either<@int,()>` have a null case with at most one value but
a nonzero number of fields; if we misreport this, then bad things can
happen inside of, for example, pattern matching.

Closes #6117.
2013-04-30 11:36:22 -07:00
bors
c081ffbd1e auto merge of #6121 : luqmana/rust/newtype-cc, r=graydon
#6086
2013-04-30 02:21:37 -07:00
bors
84e22f2b8e auto merge of #6108 : gifnksm/rust/bigint-shift-bug, r=brson
`std::bigint` contains the following code.
```rust
borrow = *elem << (uint::bits - n_bits);
```
The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand,
because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture.

If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`,
but if --opt-level is given, `borrow` is always zero.

I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug,
but the unittest passes normally.)

This pull request also removes the implicit vector copies in `bigint.rs`.
2013-04-29 22:30:36 -07:00
bors
48f50ac800 auto merge of #6107 : catamorphism/rust/mkdir_recursive, r=brson
r? @brson This hopefully addresses your concerns about the termination condition, and adds more tests. With a bonus documentation commit.
2013-04-29 20:48:37 -07:00
Tim Chevalier
849f8142a2 rustc / test: Fix error message 2013-04-29 20:46:54 -07:00
bors
868b7c153c auto merge of #6073 : huonw/rust/core-rust-isaac, r=pcwalton
This replaces the wrapper around the runtime RNG with a pure Rust implementation of the same algorithm. This is much faster (up to 5x), and is hopefully safer.

There is still (a little) room for optimisation: testing by summing 100,000,000 random `u32`s indicates this is about ~~40-50%~~ 10% slower than the pure C implementation (running as standalone executable, not in the runtime).

(Only 6d50d55 is part of this PR, the first two are from #6058, but are required for the rt rng to be correct to compare against in the tests.)
2013-04-29 18:24:37 -07:00
Luqman Aden
10f290ef68 Add test for cross crate newtype struct in match pattern. 2013-04-29 17:35:36 -07:00
Luqman Aden
b50aa827a0 librustc: Fix pattern matching on cross crate newtype structs. 2013-04-29 17:35:36 -07:00
Brian Anderson
9ddcf1cdd3 test: Remove run-pass/too-much-recursion.rs
I don't understand how this is still passing on the bots. This condition
should trigger an abort now.
2013-04-29 17:11:22 -07:00
Huon Wilson
d4b934bdce core: add some inlining hints to methods/fns in rand. 2013-04-30 08:41:06 +10:00
Huon Wilson
30266a788f core: a pure Rust implementation of the ISAAC RNG.
This replaces the wrapper around the runtime RNG with a pure Rust
implementation of the same algorithm. This is faster (up to 5x), and
is hopefully safer.

There is still much room for optimisation: testing by summing 100,000,000
random `u32`s indicates this is about 40-50% slower than the pure C
implementation (running as standalone executable, not in the runtime).
2013-04-30 08:40:05 +10:00
Tim Chevalier
d8024e2c3b rustc: Change At to Managed and Uniq to Owned 2013-04-29 14:38:39 -07:00
bors
f1ddb8d5cc auto merge of #6080 : pcwalton/rust/demode-everything, r=pcwalton
r? @brson
2013-04-29 14:33:37 -07:00
Patrick Walton
78f33437b6 libstd: Fix merge fallout. 2013-04-29 14:30:57 -07:00
Patrick Walton
2c6dae081b doc: XFAIL mysterious failure on bots 2013-04-29 14:30:57 -07:00
Patrick Walton
a9da34bf6e librustc: Fix merge fallout. 2013-04-29 14:30:57 -07:00
Patrick Walton
39693e7b61 test: Fix more tests. 2013-04-29 14:30:57 -07:00
Patrick Walton
37abf4bad0 librustc: Forbid type implementations on typedefs. 2013-04-29 14:30:57 -07:00
Patrick Walton
670ab8ac36 librustc: Change labels to use the lifetime notation '. 2013-04-29 14:30:57 -07:00
Patrick Walton
876483dcf4 test: Fix tests. 2013-04-29 14:30:56 -07:00
Patrick Walton
f30f54e9d0 librustc: Remove the concept of modes from the compiler.
This commit does not remove `ty::arg`, although that should be
possible to do now.
2013-04-29 14:30:55 -07:00
Patrick Walton
a12a3db5b4 librustc: Make &fn by-copy by default and remove the mode from frame_address. 2013-04-29 14:30:55 -07:00
Patrick Walton
17723d18de test: Remove #[legacy_modes] from the test suite. 2013-04-29 14:30:55 -07:00
Patrick Walton
a214fee0ba libfuzzer: De-mode the fuzzer. 2013-04-29 14:30:54 -07:00
Patrick Walton
0780b2830f librustc: Remove the legacy mode in the type visitor intrinsic. 2013-04-29 14:30:53 -07:00
Patrick Walton
c6a9e28842 librustc: Rename reinterpret_cast to transmute_copy and remove the intrinsic 2013-04-29 14:30:53 -07:00
Patrick Walton
b6277f8140 librustc: Implement reinterpret_cast in terms of transmute. 2013-04-29 14:30:53 -07:00
Patrick Walton
b0522a497c librustc: Remove ptr::addr_of. 2013-04-29 14:30:53 -07:00
Tim Chevalier
58791c2fd8 Revert "libcore: remove unnecessary deref"
This reverts commit 9860fe10a1.
2013-04-29 14:30:52 -07:00
bors
dbcc3fe63a auto merge of #6110 : bjz/rust/numeric-traits, r=pcwalton
As discussed on issue #4819, I have created four new traits: `Algebraic`, `Trigonometric`, `Exponential` and `Hyperbolic`, and moved the appropriate methods into them from `Real`.

~~~rust
pub trait Algebraic {
    fn pow(&self, n: Self) -> Self;
    fn sqrt(&self) -> Self;
    fn rsqrt(&self) -> Self;
    fn cbrt(&self) -> Self;
    fn hypot(&self, other: Self) -> Self;
}

pub trait Trigonometric {
    fn sin(&self) -> Self;
    fn cos(&self) -> Self;
    fn tan(&self) -> Self;
    fn asin(&self) -> Self;
    fn acos(&self) -> Self;
    fn atan(&self) -> Self;
    fn atan2(&self, other: Self) -> Self;
}

pub trait Exponential {
    fn exp(&self) -> Self;
    fn exp2(&self) -> Self;
    fn expm1(&self) -> Self;
    fn log(&self) -> Self;
    fn log2(&self) -> Self;
    fn log10(&self) -> Self;
}

pub trait Hyperbolic: Exponential {
    fn sinh(&self) -> Self;
    fn cosh(&self) -> Self;
    fn tanh(&self) -> Self;
}
~~~

There was some discussion over whether we should shorten the names, for example `Trig` and `Exp`. No abbreviations have been agreed on yet, but this could be considered in the future.

Additionally, `Integer::divisible_by` has been renamed to `Integer::is_multiple_of`.
2013-04-29 13:39:37 -07:00
bors
76ec35ae74 auto merge of #6099 : danluu/rust/xfail_clone, r=catamorphism
One of the tests seems to have no current equivalent that's similar. Please let me know if that's incorrect, and I'll try fixing it instead of deleting it. I suppose a struct could be used instead of `any` and `match type`, but it seems like the original intent of the test was to exercise `match type`
2013-04-29 11:57:40 -07:00
Brendan Zabarauskas
500078e147 Revert "Merge Exponential and Hyperbolic traits"
After discussions on IRC and #4819, we have decided to revert this change. This is due to the traits expressing different ideas and because hyperbolic functions are not trivially implementable from exponential functions for floating-point types.
2013-04-29 23:50:34 +10:00
Brendan Zabarauskas
d3f494f5c3 Merge Exponential and Hyperbolic traits
The Hyperbolic Functions are trivially implemented in terms of `exp`, so it's  simpler to group them the Exponential trait. In the future these would have default implementations.
2013-04-29 22:15:58 +10:00
ILYONG CHO
32901104cb tutorial: Fix 'self' to 'Self' 2013-04-29 18:03:11 +09:00
ILYONG CHO
9d33008da1 tutorial: Fix 'self' to 'Self' 2013-04-29 17:59:25 +09:00
bors
ea74f6845e auto merge of #6083 : jbclements/rust/parser-cleanup, r=jbclements
r? @pcwalton

A month's worth of parser cleanup here. Much of this is new comments and renaming. A number of these commits also remove unneeded code.  Probably the biggest refactor here is splitting "parse_item_or_view_item" into two functions; it turns out that the only overlap between items in foreign modules and items in regular modules was macros, so this refactor should make things substantially easier for future maintenance.
2013-04-29 00:12:37 -07:00
Brendan Zabarauskas
20ad931bf3 Rename 'divisible_by' method to 'is_multiple_of', add tests for 'is_odd' and 'is_even' 2013-04-29 16:03:48 +10:00
John Clements
cce13c18fe add test case for enum disambiguation 2013-04-28 23:01:41 -07:00
John Clements
cdf4d4bcdd fix typo in librstpkg tests, allowed by old parser 2013-04-28 23:01:41 -07:00
Brendan Zabarauskas
8f63f9789b Implement Fractional for Ratio 2013-04-29 16:00:27 +10:00
Brendan Zabarauskas
c9620dc052 Move appropriate functions out of Real and into separate Algebraic, Trigonometric, Exponential and Hyperbolic traits 2013-04-29 15:33:55 +10:00
gifnksm
ffa31d235b libstd: modify wrong shift width.
borrow = *elem << (uint::bits - n_bits);

The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand,
because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture.

If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`,
but if --opt-level is given, `borrow` is always zero.

I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug,
but the unittest passes normally.)
2013-04-29 13:49:27 +09:00
gifnksm
e4ca2da420 libstd: remove implicit copying of BigInt/BigUint 2013-04-29 13:49:27 +09:00