Commit Graph

26374 Commits

Author SHA1 Message Date
Brendan Zabarauskas
729060dbb9 Remove Times trait
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-30 14:52:25 +11:00
Johannes Muenzel
b46c0daa7b Add compile-fail tests for non-representable structs and enums 2014-01-29 20:33:51 -05:00
Johannes Muenzel
7a931574e3 Check enum and struct representability properly (issues #3008 and #3779) 2014-01-29 20:33:51 -05:00
xales
f17d972014 Remove seldom-used std::reference functions. 2014-01-29 20:31:03 -05:00
xales
d547f7ac21 Remove double-use of logging. 2014-01-29 20:31:03 -05:00
xales
d7f97e3018 Rename std::borrow to std::reference.
Fixes #11814
2014-01-29 20:31:03 -05:00
bors
704f93ff5e auto merge of #11893 : Armavica/rust/copyable-cloneable, r=huonw
I found awkward to have `MutableCloneableVector` and `CloneableIterator` on the one hand, and `CopyableVector` etc. on the other hand.

The concerned traits are:
* `CopyableVector` --> `CloneableVector`
* `OwnedCopyableVector` --> `OwnedCloneableVector`
* `ImmutableCopyableVector` --> `ImmutableCloneableVector`
* `CopyableTuple` --> `CloneableTuple`
2014-01-29 17:01:39 -08:00
Daniel Micay
e532e8d55d remove a layer of indirection from most intrinsics 2014-01-29 18:48:34 -05:00
OGINO Masanori
5281d874ef Append ; to #[allow(dead_code)].
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30 08:42:50 +09:00
OGINO Masanori
d3270c215f Prefix _ to unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30 08:42:50 +09:00
OGINO Masanori
96f0e9c74f Remove unused imports.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30 08:42:50 +09:00
bors
f84b7291e7 auto merge of #11776 : FlaPer87/rust/issue-11681-static-lifetime, r=nikomatsakis
Closes #11681
Closes #11854
2014-01-29 15:01:43 -08:00
Flavio Percoco
dbd8f2605a Add test for issue 6157 2014-01-29 23:39:09 +01:00
Flavio Percoco
cb5d7236f1 Fixes temporary lifetime computation for static items
closes: #11854
2014-01-29 22:39:33 +01:00
bors
1e23c5c051 auto merge of #11879 : thestinger/rust/frame-pointer, r=alexcrichton
This is still used for Rust code (`Options.NoFramePointerElim = true`).
2014-01-29 13:36:40 -08:00
Daniel Micay
cb263e875e enable fp-elim when debug info is disabled
This can almost be fully disabled, as it no longer breaks retrieving a
backtrace on OS X as verified by @alexcrichton. However, it still
breaks retrieving the values of parameters. This should be fixable in
the future via a proper location list...

Closes #7477
2014-01-29 16:35:05 -05:00
Daniel Micay
383e3fd13b use a more efficient vtable representation
[TyDesc, ... methods] -> [destructor, ... methods]
2014-01-29 16:31:46 -05:00
bors
dfb61166f5 auto merge of #11877 : Armavica/rust/doc-pm-vector, r=alexcrichton
This feature already was in the tutorial, but I believe that the tutorial should be a strict subset of the manual.

I also added an example.
2014-01-29 11:36:41 -08:00
Kevin Ballard
2258243ad8 Allow empty functional updating of structs
Fixes #8972
2014-01-29 10:44:27 -08:00
bors
c3ae182d5c auto merge of #11754 : alexcrichton/rust/unused-result, r=brson
The general consensus is that we want to move away from conditions for I/O, and I propose a two-step plan for doing so:

1. Warn about unused `Result` types. When all of I/O returns `Result`, it will require you inspect the return value for an error *only if* you have a result you want to look at. By default, for things like `write` returning `Result<(), Error>`, these will all go silently ignored. This lint will prevent blind ignorance of these return values, letting you know that there's something you should do about them.

2. Implement a `try!` macro:

```
macro_rules! try( ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) }) )
```

With these two tools combined, I feel that we get almost all the benefits of conditions. The first step (the lint) is a sanity check that you're not ignoring return values at callsites. The second step is to provide a convenience method of returning early out of a sequence of computations. After thinking about this for awhile, I don't think that we need the so-called "do-notation" in the compiler itself because I think it's just *too* specialized. Additionally, the `try!` macro is super lightweight, easy to understand, and works almost everywhere. As soon as you want to do something more fancy, my answer is "use match".

Basically, with these two tools in action, I would be comfortable removing conditions. What do others think about this strategy?

----

This PR specifically implements the `unused_result` lint. I actually added two lints, `unused_result` and `unused_must_use`, and the first commit has the rationale for why `unused_result` is turned off by default.
2014-01-29 09:46:34 -08:00
Alex Crichton
c13a62593c Flag Result as #[must_use] and deal with fallout. 2014-01-29 08:35:49 -08:00
bors
e1580f6d09 auto merge of #11868 : bytbox/rust/remove-do, r=alexcrichton
Fixes #10815.
2014-01-29 08:21:38 -08:00
Daniel Micay
50bee30459 stop making visit glue for closures and traits 2014-01-29 10:41:39 -05:00
Seo Sanghyeon
5f68142d0e Fix SIMD bit shifts 2014-01-30 00:28:29 +09:00
bors
87004db113 auto merge of #11867 : dmanescu/rust/8784-arena-glob, r=huonw
In line with the dissolution of libextra - #8784 - this moves arena and glob into
their own respective modules. Updates .gitignore with the entries
doc/{arena,glob} in accordance.
2014-01-29 06:26:38 -08:00
Scott Lawrence
a6867e259b Removing support for the do syntax from libsyntax and librustc.
Fixes #10815.
2014-01-29 09:15:42 -05:00
Scott Lawrence
221670b5bc Removing usage of the do keyword from documentation 2014-01-29 09:15:42 -05:00
Scott Lawrence
733d1dde93 Remove do keyword from compiletests 2014-01-29 09:15:42 -05:00
Scott Lawrence
3dbc1c34e6 Remove do keyword from test/ 2014-01-29 09:15:42 -05:00
Scott Lawrence
bb22ace3f0 Removing do keyword from libgreen 2014-01-29 09:15:41 -05:00
Scott Lawrence
badc580416 Removing do keyword from libextra 2014-01-29 09:15:41 -05:00
Scott Lawrence
d904179066 Removing do keyword from librustpkg 2014-01-29 09:15:41 -05:00
Scott Lawrence
518a5e08c0 Removing do keyword from libnative 2014-01-29 09:15:41 -05:00
Scott Lawrence
93e99b8be4 Remove do keyword from librustuv 2014-01-29 09:15:41 -05:00
Scott Lawrence
25e7e7f807 Removing do keyword from libstd and librustc 2014-01-29 09:15:41 -05:00
Scott Lawrence
af218d68e4 Removing do keyword from librustdoc 2014-01-29 09:15:41 -05:00
Flavio Percoco
279fe0fa76 Treat unary struct and enum variants as rvalues
Closes #11681
2014-01-29 14:15:24 +01:00
bors
7b1432f6c0 auto merge of #11889 : nikomatsakis/rust/issue-3243-stack-alloc-vec, r=nikomatsakis
(Lifetime of stack allocated vectors was not being enforced)

Closes #3243.
2014-01-29 05:06:44 -08:00
Virgile Andreani
d62097d88c Document vector destructuring with wildcard '..' 2014-01-29 10:28:50 +01:00
bors
1d80a9a0f6 auto merge of #11903 : alexcrichton/rust/android-test-deps, r=huonw
This changes android testing to upload *all* target crates rather than just a
select subset. This should unblock #11867 which is introducing a libglob
dependency in testing.
2014-01-29 01:06:41 -08:00
Alex Crichton
55280598a8 Fix android test deps
This changes android testing to upload *all* target crates rather than just a
select subset. This should unblock #11867 which is introducing a libglob
dependency in testing.
2014-01-29 00:16:32 -08:00
bors
2b9392566c auto merge of #11706 : alexcrichton/rust/issue-11253, r=huonw
Closes #11253
2014-01-28 23:41:36 -08:00
Alex Crichton
8a1b4dc9da Generate rlibs by default (instead of dylibs)
Closes #11253
2014-01-28 23:36:31 -08:00
David Manescu
93398d16ec extra: move glob to libglob
In line with the dissolution of libextra - moves glob to its own library libglob.
Changes based on PR #11787. Updates .gitignore to ignore doc/glob.
2014-01-29 17:23:28 +11:00
bors
2ba72fa4bc auto merge of #11887 : alexcrichton/rust/rpath-for-real, r=thestinger
Closes #5219
2014-01-28 21:46:36 -08:00
Jason Fager
9b1865a7fa Add a limited prim type lookup for safer const expr evaluation 2014-01-29 00:05:11 -05:00
bors
6fca5556a3 auto merge of #11883 : alexcrichton/rust/fix-mk-install, r=pnkfelix
Closes #11874
2014-01-28 20:26:40 -08:00
David Manescu
4d0d3da9e4 extra: move arena to libarena
In line with the dissolution of libextra - #8784 - moves arena to its own library libarena.
Changes based on PR #11787. Updates .gitignore to ignore doc/arena.
2014-01-29 13:54:38 +11:00
Alex Crichton
9896beb5b5 Implement an unused_result lint
I attempted to implement the lint in two steps. My first attempt was a
default-warn lint about *all* unused results. While this attempt did indeed find
many possible bugs, I felt that the false-positive rate was too high to be
turned on by default for all of Rust.

My second attempt was to make unused-result a default-allow lint, but allow
certain types to opt-in to the notion of "you must use this". For example, the
Result type is now flagged with #[must_use]. This lint about "must use" types is
warn by default (it's different from unused-result).

The unused_must_use lint had a 100% hit rate in the compiler, but there's not
that many places that return Result right now. I believe that this lint is a
crucial step towards moving away from conditions for I/O (because all I/O will
return Result by default). I'm worried that this lint is a little too specific
to Result itself, but I believe that the false positive rate for the
unused_result lint is too high to make it useful when turned on by default.
2014-01-28 15:54:47 -08:00
Virgile Andreani
2d60691eb7 Rename CopyableTuple to CloneableTuple 2014-01-28 23:51:52 +01:00