Commit Graph

25842 Commits

Author SHA1 Message Date
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
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
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
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
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
bors
edfb546e4b auto merge of #11490 : wting/rust/wting_11362_update_extract_tests, r=alexcrichton
Refactored the file quite a bit, I can add unit tests if desired. There's a few changes from the previous version's behavior:

- destination directory will be created if it doesn't exist
- strings and file is written as unicode

I have a few questions, but will ask them in #11362.
2014-01-28 14:11:33 -08:00
Niko Matsakis
afd8df6af2 Add test case for #3243, which was fixed as part of fix for #3511.
(Lifetime of stack allocated vectors was not being enforced)

Closes #3243.
2014-01-28 16:53:50 -05:00
William Ting
9f60e7c306 Update extract-tests.py to use same test directives as rustdoc.
Closes #11362.
2014-01-28 14:52:36 -06:00
bors
c6bd05303c auto merge of #11845 : xales/rust/libnative, r=alexcrichton
Fixes std::net test error when re-running too quickly.

Suggested by @cmr
2014-01-28 12:01:44 -08:00
Alex Crichton
dea86ca86b Fix a typo in disable rpaths
Closes #5219
2014-01-28 11:49:25 -08:00
Alex Crichton
20d6a8e0af Add a missing backslash to a makefile
Closes #11874
2014-01-28 09:17:06 -08:00
bors
b3d10f4383 auto merge of #11864 : comex/rust/11352, r=alexcrichton
Set "Dwarf Version" to 2 on OS X to avoid toolchain incompatibility, and
set "Debug Info Version" to prevent debug info from being stripped from
bitcode.

Fixes #11352.
2014-01-28 05:11:28 -08:00
bors
a39be7ca2e auto merge of #11858 : huonw/rust/11841-followup, r=brson
Follow-up to #11841 which added this function.
2014-01-28 03:31:25 -08:00
bors
e90a8c4a35 auto merge of #11851 : pnkfelix/rust/fsk-fix-issue-10031, r=alexcrichton
Fix #10031.
2014-01-28 02:01:27 -08:00
bors
3781728d8f auto merge of #11837 : xales/rust/doc-fixes, r=cmr,huonw,alexcrichton 2014-01-28 00:41:30 -08:00
bors
1fdd23166d auto merge of #11833 : kballard/rust/gitignore-doc-flate-rustdoc, r=brson 2014-01-27 23:21:27 -08:00
bors
1ac9bf65b6 auto merge of #11738 : dmanescu/rust/11721, r=alexcrichton
Fixes #11721
2014-01-27 21:46:33 -08:00
comex
ea7b20d8f2 Add appropriate LLVM module flags for debug info.
Set "Dwarf Version" to 2 on OS X to avoid toolchain incompatibility, and
set "Debug Info Version" to prevent debug info from being stripped from
bitcode.

Fixes #11352.
2014-01-28 00:05:33 -05:00
bors
d21b18306c auto merge of #11826 : huonw/rust/7621-deriving-errors, r=alexcrichton
cc #7621.

See the commit message. I'm not sure if we should merge this now, or wait until we can write `Clone::clone(x)` which will directly solve the above issue with perfect error messages.
2014-01-27 20:26:35 -08:00
xales
e901c4caf3 Set SO_REUSEADDR by default in libnative.
Fixes std::net test error when re-running too quickly.
2014-01-27 20:59:15 -05:00
bors
8c6c229831 auto merge of #11626 : nickdesaulniers/rust/issue10617, r=alexcrichton
#10617
2014-01-27 17:26:55 -08:00
Huon Wilson
2e24adf521 std: comment about OOM & allocs in begin_unwind_fmt.
Follow-up to #11841 which added this function.
2014-01-28 12:19:17 +11:00
Nick Desaulniers
ea9db66c50 can borrow mut in proc Fixes #10617 2014-01-27 17:06:11 -08:00
Huon Wilson
cb02a37042 syntax: make deriving have slightly less cryptic error messages.
This unfortunately changes an error like

    error: mismatched types: expected `&&NotClone` but found `&NotClone`

into

    error: type `NotClone` does not implement any method in scope named `clone`
2014-01-28 11:07:45 +11:00
bors
daf60f0c4f auto merge of #11847 : alexcrichton/rust/fix-test-deps, r=pcwalton
The stdtest binary uses both libnative and libgreen to test the two
implementations

Closes #11843
2014-01-27 16:06:36 -08:00
bors
4176343073 auto merge of #11846 : michaelwoerister/rust/cu_name, r=pcwalton
Fixes #11600
2014-01-27 14:46:56 -08:00
bors
760ddb3081 auto merge of #11723 : eddyb/rust/more-trans-cleanup, r=pcwalton 2014-01-27 13:26:46 -08:00
Eduard Burtescu
e81ab4198c Removed take_glue from tydesc, inlining the equivalent refcount increment code instead. 2014-01-27 22:32:30 +02:00