Commit Graph

26981 Commits

Author SHA1 Message Date
Dmitry Promsky
53f3442ef7 Disallowed patterns in extern fn declarations.
Closes #10877
2014-03-06 00:01:16 +04:00
bors
8a55cd988f auto merge of #12711 : edwardw/rust/mtwt, r=pcwalton
- Moves mtwt hygiene code into its own file
- Fixes FIXME's which leads to ~2x speed gain in expansion pass
- It is now @-free
2014-03-05 11:11:42 -08:00
bors
db4f757367 auto merge of #12709 : aepsil0n/rust/update_man_version, r=alexcrichton
Just realized that these were quite outdated and quickly fixed it. I have to admit that I did not run the test suite on this one though…
2014-03-05 09:56:44 -08:00
Alex Crichton
e6acff8287 native: Fix usage of a deallocated mutex
When the timer_helper thread exited, it would attempt to re-acquire the global
task count mutex, but the mutex had previously been deallocated, leading to
undefined behavior of the mutex, and in some cases deadlock.

Another mutex is used to coordinate shutting down the timer helper thread.

Closes #12699
2014-03-05 09:11:11 -08:00
Alex Crichton
d8bd8de82e native: Move from usleep() to nanosleep()
Using nanosleep() allows us to gracefully recover from EINTR because on error it
fills in the second parameter with the remaining time to sleep.

Closes #12689
2014-03-05 09:11:10 -08:00
Alex Crichton
8334dd445f native: Stop using readdir()
This function is not threadsafe, and is deprecated in favor of the threadsafe
readdir_r variant.

Closes #12692
2014-03-05 09:11:10 -08:00
bors
a7da925b02 auto merge of #12700 : thestinger/rust/float, r=cmr 2014-03-05 08:38:10 -08:00
Daniel Micay
28d4f80836 consistently use LLVM floating point intrinsics 2014-03-05 11:21:00 -05:00
Daniel Micay
2760974ec0 add correct floating point min and max methods.
The `std::cmp` functions are not correct for floating point types.

`min(NaN, 2.0)` and `min(2.0, NaN)` return different values, because
these functions assume a total order. Floating point types need special
`min`, `max` and `clamp` functions.
2014-03-05 11:20:50 -05:00
Edward Wang
2302ce903d Refactor and fix FIXME's in mtwt hygiene code
- Moves mtwt hygiene code into its own file
- Fixes FIXME's which leads to ~2x speed gain in expansion pass
- It is now @-free
2014-03-05 22:45:51 +08:00
bors
ea71a08f6b auto merge of #12708 : SimonSapin/rust/patch-6, r=huonw
Feel free to reject this if I’m mistaken, but the `count` in the for loop does look like it’s going from 0 to `end`.
2014-03-05 02:51:45 -08:00
Eduard Bopp
a27501112a Update version and date info in man pages
Both for rustc and rustdoc the man pages contained out-of-date version info.
2014-03-05 11:22:58 +01:00
Simon Sapin
c92cdad3dd Str::slice_chars() is O(end), not O(end - begin) 2014-03-05 09:41:35 +00:00
bors
87a31f6f0f auto merge of #12491 : eddyb/rust/deref, r=nikomatsakis
Add the `Deref` and `DerefMut` traits and implement overloading explicit dereferences.
2014-03-04 23:21:42 -08:00
bors
712c630ab6 auto merge of #12300 : DaGenix/rust/uppercase-variable-lint, r=alexcrichton
I added a new lint for variables whose names contain uppercase characters, since, by convention, variable names should be all lowercase. What motivated me to work on this was when I ran into something like the following:

```rust
use std::io::File;
use std::io::IoError;

fn main() {
    let mut f = File::open(&Path::new("/something.txt"));
    let mut buff = [0u8, ..16];
    match f.read(buff) {
        Ok(cnt) => println!("read this many bytes: {}", cnt),
        Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_str()),
    }
}
```

I then got compile errors when I tried to add a wildcard match pattern at the end which I found very confusing since I believed that the 2nd match arm was only matching the EndOfFile condition. The problem is that I hadn't imported io::EndOfFile into the local scope. So, I thought that I was using EndOfFile as a sub-pattern, however, what I was actually doing was creating a new local variable named EndOfFile. This lint makes this error easier to spot by providing a warning that the variable name EndOfFile contains a uppercase characters which provides a nice hint as to why the code isn't doing what is intended.

The lint warns on local bindings as well:

```rust
let Hi = 0;
```

And also struct fields:

```rust
struct Something {
    X: uint
}
```
2014-03-04 22:06:38 -08:00
Palmer Cox
258dbd09ba Emit the uppercase variable lint for struct fields that have names with uppercase characters 2014-03-05 00:22:19 -05:00
Palmer Cox
e3723dc4f1 Allow uppercase_variables in libstd/libc.rs 2014-03-05 00:22:09 -05:00
bors
3cc761f3f9 auto merge of #12671 : nick29581/rust/expand, r=sfackler
Fixes a regression from #4913 which causes items to be exanded with spans lacking expn_info from the context's current backtrace.
2014-03-04 19:41:38 -08:00
bors
f1955e028c auto merge of #12688 : alexcrichton/rust/fix-some-link-args, r=brson
Linker argument order with respect to libraries is important enough that we
shouldn't be attempting to filter out libraries getting passed through to the
linker. When linking with a native library that has multiple dependant native
libraries, it's useful to have control over the link argument order.
2014-03-04 18:26:40 -08:00
Palmer Cox
a9798c25df Rename struct fields with uppercase characters in their names to use lowercase 2014-03-04 21:23:37 -05:00
Palmer Cox
935c912335 Add lint for variable names that contain uppercase characters 2014-03-04 21:23:37 -05:00
Palmer Cox
6d9bdf975a Rename all variables that have uppercase characters in their names to use only lowercase characters 2014-03-04 21:23:36 -05:00
Nick Cameron
4a891fe80d Expand nested items within a backtrace.
Fixes a regression from #4913 which causes items to be exanded with spans lacking expn_info from the context's current backtrace.
2014-03-04 18:04:16 -08:00
bors
dcb24f5450 auto merge of #12697 : thestinger/rust/vec, r=huonw
This exists for the sake of compatibility during the ~[T] -> Vec<T>
transition. It will be removed in the future.
2014-03-04 17:11:39 -08:00
Daniel Micay
15adaf6f3e mark the map method on Vec<T> as deprecated
This exists for the sake of compatibility during the ~[T] -> Vec<T>
transition. It will be removed in the future.
2014-03-04 19:37:07 -05:00
bors
fe50c75d02 auto merge of #12694 : thestinger/rust/mut_iter, r=huonw
This become `Pod` when it was switched to using marker types.
2014-03-04 15:56:37 -08:00
Daniel Micay
4d8295df6c make MutItems iterator sound again
This become `Pod` when it was switched to using marker types.
2014-03-04 18:53:57 -05:00
Eduard Burtescu
bcc5486c17 Allow overloading explicit dereferences. 2014-03-05 00:26:51 +02:00
bors
0a5138c752 auto merge of #12667 : Kimundi/rust/any_improv, r=cmr
- Added `TraitObject` representation to `std::raw`.
- Added doc to `std::raw`.
- Removed `Any::as_void_ptr()` and `Any::as_mut_void_ptr()`
  methods as they are uneccessary now after the removal of
  headers on owned boxes. This reduces the number of virtual calls needed from 2 to 1.
- Made the `..Ext` implementations work directly with the repr of
  a trait object.
- Removed `Any`-related traits from the prelude.
- Added bench.

Bench before/after:
~~~
7 ns/iter (+/- 0)
4 ns/iter (+/- 0)
~~~
2014-03-04 13:16:41 -08:00
Marvin Löbel
3158047a45 Cleaned up std::any
- Added `TraitObject` representation to `std::raw`.
- Added doc to `std::raw`.
- Removed `Any::as_void_ptr()` and `Any::as_mut_void_ptr()`
  methods as they are uneccessary now after the removal of
  headers on owned boxes. This reduces the number of virtual calls needed.
- Made the `..Ext` implementations work directly with the repr of
  a trait object.
- Removed `Any`-related traits from the prelude.

- Added bench for `Any`
2014-03-04 21:10:23 +01:00
bors
a15448c85a auto merge of #12649 : adrientetar/rust/highlight, r=alexcrichton
[Here is](http://adrientetar.legtux.org/cached/rust-doc/to_str.rs.html) an example.

Closes #12648.

@alexcrichton, @huonw
2014-03-04 12:01:45 -08:00
Adrien Tétar
0106a04d70 doc: use the newer favicon 2014-03-04 18:37:51 +01:00
Adrien Tétar
fd09e91e00 rustdoc: tweak highlighting 2014-03-04 18:37:09 +01:00
Eduard Burtescu
52532d13a6 Implement DerefImm for Rc and DerefImm/DerefMut for RefCell's Ref/RefMut. 2014-03-04 16:41:48 +02:00
Eduard Burtescu
3b125ff3bb Add the DerefImm and DerefMut traits. 2014-03-04 16:41:48 +02:00
bors
19fadf6567 auto merge of #12678 : lifthrasiir/rust/pluralize, r=alexcrichton
While we are not yet ready for compiler i18n, this also keeps the error handling code clean. The set of altered error messages was obtained by grepping for `"s"` and `(s)`, so there might be some missing messages.
2014-03-04 00:31:40 -08:00
Kang Seonghoon
21454452b2 rustc: Streamline error messages for i18n, using plural whenever possible. 2014-03-04 16:41:57 +09:00
bors
dc18659160 auto merge of #12669 : huonw/rust/de-block-arms, r=alexcrichton
syntax: make match arms store the expr directly.

Previously `ast::Arm` was always storing a single `ast::Expr` wrapped in an
`ast::Block` (for historical reasons, AIUI), so we might as just store
that expr directly.

Closes #3085.
2014-03-03 23:16:40 -08:00
bors
062e950ae8 auto merge of #12672 : korenchkin/rust/checked-bigint, r=alexcrichton 2014-03-03 22:01:40 -08:00
bors
3c0d0987be auto merge of #12674 : alexcrichton/rust/snapshots, r=Aatch
This should fix the travis builds.
2014-03-03 18:06:42 -08:00
Alex Crichton
b0e0cb5e32 Register new snapshots
This should fix the travis builds.
2014-03-03 18:00:52 -08:00
bors
c951696c61 auto merge of #12673 : huonw/rust/extendable-vec, r=Aatch
std: add reserve_additional and an Extendable impl to Vec.
2014-03-03 14:51:42 -08:00
Huon Wilson
6cb34cf08f std: add reserve_additional and an Extendable impl to Vec. 2014-03-04 08:05:18 +11:00
TorstenWeber
47cff94ab9 Implemented checked arithmetic for Big(U)Ints 2014-03-03 19:20:21 +01:00
bors
6e7f170fed auto merge of #12665 : alexcrichton/rust/fix-snap-again, r=huonw
This should get us a passing snapshot again.
2014-03-03 05:51:38 -08:00
Huon Wilson
c3b9047040 syntax: make match arms store the expr directly.
Previously `ast::Arm` was always storing a single `ast::Expr` wrapped in an
`ast::Block` (for historical reasons, AIUI), so we might as just store
that expr directly.

Closes #3085.
2014-03-03 22:48:42 +11:00
Alex Crichton
58802d6ad4 test: Ignore some more syntax extension tests
This should get us a passing snapshot again.
2014-03-03 00:08:13 -08:00
bors
3f3425a555 auto merge of #12663 : MicahChalmer/rust/emacs-remove-ws-bug-warning, r=brson
The incompatibility of rust-mode with global-whitespace-mode warned
about in the README was actually fixed by commit 581b3db3b3.  Remove the
warning from the README and close #3994.
2014-03-02 20:56:30 -08:00
Micah Chalmer
d92fdb27cb Emacs: Remove README warning of old whitespace bug
The incompatibility of rust-mode with global-whitespace-mode warned
about in the README was actually fixed by commit 581b3db3b3.  Remove the
warning from the README and close #3994.
2014-03-02 22:02:18 -05:00
bors
fbe26af3c5 auto merge of #12662 : sfackler/rust/unexported-type, r=cmr 2014-03-02 17:36:28 -08:00