Commit Graph

26923 Commits

Author SHA1 Message Date
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
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
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
bors
4eea6f7f24 auto merge of #12659 : alexcrichton/rust/fix-snap, r=sfackler
These tests are failing on the snap builders, and are now tagged with a FIXME.

cc #12102
2014-03-02 16:21:33 -08:00
Steven Fackler
4c2353adee Make visible types public in rustc 2014-03-02 15:26:39 -08:00
bors
813544fd07 auto merge of #12658 : sfackler/rust/asm-expand, r=alexcrichton
A couple of syntax extensions manually expanded expressions, but it
wasn't done universally, most noticably inside of asm!().

There's also a bit of random cleanup.
2014-03-02 15:06:34 -08:00
Alex Crichton
6a6d933af3 test: Ignore some phase(syntax) tests
These tests are failing on the snap builders, and are now tagged with a FIXME.

cc #12102
2014-03-02 14:39:34 -08:00
Steven Fackler
a0e54c7761 Expand string literals and exprs inside of macros
A couple of syntax extensions manually expanded expressions, but it
wasn't done universally, most noticably inside of asm!().

There's also a bit of random cleanup.
2014-03-02 14:12:02 -08:00
bors
51233c5219 auto merge of #12656 : Armavica/rust/terminfo, r=sfackler
According to `/etc/terminfo/README`,
```
This directory is for system-local terminfo descriptions. By default,
ncurses will search ${HOME}/.terminfo first, then /etc/terminfo (this
directory), then /lib/terminfo, and last not least /usr/share/terminfo.
```
2014-03-02 13:41:28 -08:00
Virgile Andreani
979046044f Add /etc/terminfo to the terminfo search paths 2014-03-02 22:31:11 +01:00
bors
25431774a9 auto merge of #12651 : lucab/rust/llvmdep-ldflags, r=alexcrichton
This commit let librustc automatically pickup LDFLAGS dependencies
inherited from LLVM, which may otherwise result in undefined
references to external symbols under certain linking environment.

A symptom of this issue is eg. a failure when trying to link against
librustc (due to unresolved ffi_* symbols), while using a system-wide
LLVM.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-03-02 11:21:34 -08:00