Commit Graph

33552 Commits

Author SHA1 Message Date
bors
a12d06b73f auto merge of #18381 : pelmers/rust/patch-1, r=alexcrichton
Happened to be reading through the doc.
2014-10-31 00:22:19 +00:00
bors
fd53657484 auto merge of #18339 : chastell/rust/guide_pattern_fixes, r=nikomatsakis
I think it helps to show that the variables introduced in match blocks are indeed independent from the matched variable `x` (especially when `x` is still reachable inside those blocks and might be useful), so this renames them accordingly. Maybe some linter (or language-level warning?) will eventually warn about shadowing `x` in such cases. ;)

I’m not super happy about the matching-on-range example, as it’s too contrived (`e` and `x` are exactly the same here), but I couldn’t come up with something both simple and non-redundant.
2014-10-30 20:17:15 +00:00
bors
52c3fe9533 auto merge of #18377 : steveklabnik/rust/fix_wording_about_errors, r=nikomatsakis
see https://github.com/rust-lang/rust/pull/18176#discussion_r19374679

/cc @eddyb @huonw @nikomatsakis
2014-10-30 17:57:09 +00:00
bors
301ed5e579 auto merge of #18376 : steveklabnik/rust/gh7963, r=alexcrichton
FIxes #7963.
2014-10-30 15:57:03 +00:00
bors
abb3b9c505 auto merge of #18374 : steveklabnik/rust/gh18197, r=sfackler
Fixes #18197
2014-10-30 13:57:07 +00:00
bors
ad4557ce76 auto merge of #18367 : pcwalton/rust/inline-atomic-constructors, r=thestinger
Servo really wants this.

r? @brson
2014-10-30 11:12:04 +00:00
bors
c40fc79a1a auto merge of #18279 : bgamari/rust/check-static-recursion, r=alexcrichton
I just found this patch which at some point solved a problem I encountered. Unfortunately I apparently dropped it before I managed to write a test case. I'll try to dig up the code that triggered the issue.
2014-10-30 09:12:05 +00:00
bors
2d27bfaeb6 auto merge of #17704 : nick29581/rust/object-safety, r=nikomatsakis
r? @nikomatsakis
2014-10-30 06:32:11 +00:00
bors
d1fc2dec79 auto merge of #18448 : brson/rust/clean-llvm, r=alexcrichton
When building for multiple targets, the initial 'make' invocation
always fails. The missing build stamp causes clean-llvm to be
invoked, but clean-llvm cleans *all* llvm builds. So what happens
is that 1) all llvm's are cleaned (a no-op), 2) llvm-${target1}
builds, 3) all llvm's are cleaned (deleting llvm-${target1}),
4) llvm-${target2} is built, 5) the remaining build for ${target1}
fails because llvm does not exist.

This makes the clean operation only clean the correct llvm build.
Should greatly reduce bot failures.
2014-10-30 04:32:08 +00:00
Ben Gamari
b9251cded8 check_static_recursion: Handle foreign items 2014-10-29 23:24:04 -04:00
Nick Cameron
88a250d194 Try and fix Windows terminal 2014-10-30 16:12:59 +13:00
Nick Cameron
3adb7554d6 Rebasing fixes 2014-10-30 16:12:59 +13:00
Brian Anderson
b8e7c4fcb9 mk: Clean just one llvm build at a time. Closes #17852
When building for multiple targets, the initial 'make' invocation
always fails. The missing build stamp causes clean-llvm to be
invoked, but clean-llvm cleans *all* llvm builds. So what happens
is that 1) all llvm's are cleaned (a no-op), 2) llvm-${target1}
builds, 3) all llvm's are cleaned (deleting llvm-${target1}),
4) llvm-${target2} is built, 5) the remaining build for ${target1}
fails because llvm does not exist.

This makes the clean operation only clean the correct llvm build.
Should greatly reduce bot failures.
2014-10-29 19:54:52 -07:00
Nick Cameron
5dd1bc3d14 Changes for Windows terminal 2014-10-30 15:51:56 +13:00
Nick Cameron
dd2a1e3469 Change extensions traits to blanket impls 2014-10-30 15:51:56 +13:00
Nick Cameron
c48a1ab158 changes to tests 2014-10-30 15:51:56 +13:00
Nick Cameron
1d500cfd74 changes to libs 2014-10-30 15:51:55 +13:00
Nick Cameron
8d8d8d4e52 Enforce object safety
closes #17670

[breaking-change]

Traits must be object-safe if they are to be used in trait objects. This might require splitting a trait into object-safe and non-object-safe parts.

Some standard library traits in std::io have been split - Reader has new traits BytesReader (for the bytes method) and AsRefReader (for by_ref), Writer has new trait AsRefWriter (for by_ref). All these new traits have blanket impls, so any type which implements Reader or Writer (respectively) will have an implmentation of the new traits. To fix your code, you just need to `use` the new trait.
2014-10-30 15:51:21 +13:00
bors
15dd90b647 auto merge of #18359 : 1-more/rust/feature, r=alexcrichton 2014-10-30 00:27:02 +00:00
bors
18a3db6aa1 auto merge of #18357 : TeXitoi/rust/simplify-reverse-complement, r=alexcrichton
Simpler, safer and shorter, in the same spirit of the current version, and the
same performances.

@mahkoh please review, I think I didn't change any performances related thing.
2014-10-29 22:17:00 +00:00
bors
77f44d4a7b auto merge of #17894 : steveklabnik/rust/fail_to_panic, r=aturon
This in-progress PR implements https://github.com/rust-lang/rust/issues/17489.

I made the code changes in this commit, next is to go through alllllllll the documentation and fix various things.

- Rename column headings as appropriate, `# Panics` for panic conditions and `# Errors` for `Result`s.
- clean up usage of words like 'fail' in error messages

Anything else to add to the list, @aturon ? I think I should leave the actual functions with names like `slice_or_fail` alone, since you'll get to those in your conventions work?

I'm submitting just the code bits now so that we can see it separately, and I also don't want to have to keep re-building rust over and over again if I don't have to 😉 

Listing all the bits so I can remember as I go:

- [x] compiler-rt
- [x] compiletest
- [x] doc
- [x] driver
- [x] etc
- [x] grammar
- [x] jemalloc
- [x] liballoc
- [x] libarena
- [x] libbacktrace
- [x] libcollections
- [x] libcore
- [x] libcoretest
- [x] libdebug
- [x] libflate
- [x] libfmt_macros
- [x] libfourcc
- [x] libgetopts
- [x] libglob
- [x] libgraphviz
- [x] libgreen
- [x] libhexfloat
- [x] liblibc
- [x] liblog
- [x] libnative
- [x] libnum
- [x] librand
- [x] librbml
- [x] libregex
- [x] libregex_macros
- [x] librlibc
- [x] librustc
- [x] librustc_back
- [x] librustc_llvm
- [x] librustdoc
- [x] librustrt
- [x] libsemver
- [x] libserialize
- [x] libstd
- [x] libsync
- [x] libsyntax
- [x] libterm
- [x] libtest
- [x] libtime
- [x] libunicode
- [x] liburl
- [x] libuuid
- [x] llvm
- [x] rt
- [x] test
2014-10-29 20:16:57 +00:00
Steve Klabnik
6ac7fc73f5 Update infrastructure for fail -> panic
This includes updating the language items and marking what needs to
change after a snapshot.

If you do not use the standard library, the language items you need to
implement have changed. For example:

```rust
 #[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
```

is now

```rust
 #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
```

Related, lesser-implemented language items `fail` and
`fail_bounds_check` have become `panic` and `panic_bounds_check`, as
well. These are implemented by `libcore`, so it is unlikely (though
possible!) that these two renamings will affect you.

[breaking-change]

Fix test suite
2014-10-29 16:06:13 -04:00
bors
4769bca148 auto merge of #18282 : pczarn/rust/regex-parse, r=burntsushi
Fixes #18034

3 bugs fixed.
2014-10-29 18:17:00 +00:00
Steve Klabnik
7828c3dd28 Rename fail! to panic!
https://github.com/rust-lang/rfcs/pull/221

The current terminology of "task failure" often causes problems when
writing or speaking about code. You often want to talk about the
possibility of an operation that returns a Result "failing", but cannot
because of the ambiguity with task failure. Instead, you have to speak
of "the failing case" or "when the operation does not succeed" or other
circumlocutions.

Likewise, we use a "Failure" header in rustdoc to describe when
operations may fail the task, but it would often be helpful to separate
out a section describing the "Err-producing" case.

We have been steadily moving away from task failure and toward Result as
an error-handling mechanism, so we should optimize our terminology
accordingly: Result-producing functions should be easy to describe.

To update your code, rename any call to `fail!` to `panic!` instead.
Assuming you have not created your own macro named `panic!`, this
will work on UNIX based systems:

    grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'

You can of course also do this by hand.

[breaking-change]
2014-10-29 11:43:07 -04:00
bors
dd7113609c auto merge of #18375 : steveklabnik/rust/gh17969, r=alexcrichton
Fixes #17969
2014-10-29 15:17:01 +00:00
bors
3bc545373d auto merge of #18365 : bjz/rust/token, r=alexcrichton
[breaking-change]

(for syntax-extensions)

- Token variant identifiers have been converted to PascalCase for consistency with Rust coding standards
- Some free-functions in `syntax::token` have been converted to methods on `syntax::token::Token`:
    - `can_begin_expr`         -> `Token::can_begin_expr`
    - `close_delimiter_for`    -> `Token::get_close_delimiter`
    - `is_lit`                 -> `Token::is_lit`
    - `is_ident`               -> `Token::is_ident`
    - `is_path`                -> `Token::is_path`
    - `is_plain_ident`         -> `Token::is_plain_ident`
    - `is_lifetime`            -> `Token::is_lifetime`
    - `is_mutability`          -> `Token::is_mutability`
    - `to_binop`               -> `Token::to_binop`
    - `is_keyword`             -> `Token::is_keyword`
    - `is_any_keyword`         -> `Token:is_any_keyword`
    - `is_strict_keyword`      -> `Token::is_strict_keyword`
    - `is_reserved_keyword`    -> `Token::is_reserved_keyword`
    - `mtwt_token_eq`          -> `Token::mtwt_eq`
- `token::Ident` now takes an enum instead of a boolean for clarity
- `token::{to_string, binop_to_string}` were moved to `pprust::{token_to_string, binop_to_string}`
2014-10-29 10:22:01 +00:00
bors
124508dea1 auto merge of #18340 : chastell/rust/guide_closures_fixes, r=steveklabnik
Some minor wording fixes to the Closures chapter; my brain tripped a few times when reading it, so I tried to come up with something a bit smoother. I’m not a native speaker, so please do review this critically.
2014-10-29 06:36:57 +00:00
bors
1effc9e141 auto merge of #18410 : thestinger/rust/revert-parallel, r=alexcrichton
This reverts commit c245c5bbad.

Parallel code generation generates invalid code for librand, which is
caught by recent versions of binutils.
2014-10-29 02:26:59 +00:00
Daniel Micay
79723a3e30 Revert "enable parallel codegen by default"
This reverts commit c245c5bbad.

Parallel code generation generates invalid code for librand, which is
caught by recent versions of binutils.
2014-10-28 20:14:00 -04:00
bors
1652a1f2c6 auto merge of #17603 : jakub-/rust/ty_bot, r=nikomatsakis
We now instead use a fresh variable for expressions that diverge.

Closes #14973.
Closes #13847.

[Work in progress]

cc @nikomatsakis
2014-10-28 22:11:56 +00:00
Guillaume Pinot
7017fb095b rephrase some comments according to remarks in the PR 2014-10-28 22:14:05 +01:00
bors
98bbccf2c7 auto merge of #18291 : japaric/rust/dstify, r=aturon
This PR changes the signature of several methods from `foo(self, ...)` to `foo(&self, ...)`/`foo(&mut self, ...)`, but there is no breakage of the usage of these methods due to the autoref nature of `method.call()`s. This PR also removes the lifetime parameter from some traits (`Trait<'a>` -> `Trait`). These changes break any use of the extension traits for generic programming, but those traits are not meant to be used for generic programming in the first place. In the whole rust distribution there was only one misuse of a extension trait as a bound, which got corrected (the bound was unnecessary and got removed) as part of this PR.

I've kept the commits as small and self-contained as possible for reviewing sake, but I can squash them when the review is over.

See this [table] to get an idea of what's left to be done. I've already DSTified [`Show`][show] and I'm working on `Hash`, but bootstrapping those changes seem to require a more recent snapshot (#18259 does the trick)

r? @aturon 
cc #16918 

[show]: https://github.com/japaric/rust/commits/show
[table]: https://docs.google.com/spreadsheets/d/1MZ_iSNuzsoqeS-mtLXnj9m0hBYaH5jI8k9G_Ud8FT5g/edit?usp=sharing
2014-10-28 19:56:56 +00:00
Steve Klabnik
72fb8f3688 Fix example for BufferedReader
Fixes #18197
2014-10-28 15:55:56 -04:00
Steve Klabnik
b7e177d242 update keyword list
Fixes #17969
2014-10-28 15:55:04 -04:00
bors
3fa2b56537 auto merge of #17851 : brson/rust/rustup, r=alexcrichton
Just to have it somewhere to point to. Updating it will not
automatically update the one on static.rust-lang.org.
2014-10-28 17:47:01 +00:00
Jakub Bukaj
6d2080c448 Address review comments 2014-10-28 18:33:38 +01:00
Brian Anderson
9106546aa7 Long lines 2014-10-28 10:24:03 -07:00
Jakub Bukaj
7f523e7252 Update tests with the new error messages 2014-10-28 17:54:16 +01:00
Jakub Bukaj
cca84e9e21 Remove ty_bot from the type system
We now instead use a fresh variable for expressions that diverge.
2014-10-28 17:54:16 +01:00
Steve Klabnik
4d43d163df Describe doc attribute in the reference
FIxes #7963.
2014-10-28 12:11:26 -04:00
Vladimir Smola
9bf82fa7ff Fix the output of negative duration
Technically speaking, negative duration is not valid ISO 8601, but we need to
print it anyway. If `d` is a positive duration with the output `xxxxxxx`, then
the expected output of negative `-d` value is `-xxxxxxx`. I.e. the idea is to
print negative durations as positive with a leading minus sign.

Closes #18181.
2014-10-28 21:48:21 +07:00
bors
d1bfd6515c auto merge of #18273 : gamazeps/rust/issue18218, r=steveklabnik
Closes #18218
2014-10-28 14:36:54 +00:00
bors
58dc0a05ab auto merge of #18386 : nikomatsakis/rust/issue-18208, r=pnkfelix
Avoid O(n^2) performance by reconsidering the full set of obligations only when we are about to report an error (#18208). I found it is still important to consider the full set in order to make tests like `let x: Vec<_> = obligations.iter().collect()` work.

I think we lack the infrastructure to write a regression test for this, but when I did manual testing I found a massive reduction in type-checking time for extreme examples like those found in #18208 vs stage0.

f? @dotdash
2014-10-28 12:26:50 +00:00
Niko Matsakis
1da73ff126 Avoid O(n^2) performance by reconsidering the full set of obligations only when we are about to report an error (#18208). I found it is still important to consider the full set in order to make tests like let x: Vec<_> = obligations.iter().collect() work. 2014-10-28 08:18:21 -04:00
bors
9a778bc550 auto merge of #18254 : areski/rust/pr-fix-vec-doc-example, r=alexcrichton
- shrink_to_fit example is now more clear by asserting the capacity value
- annotation [0, mid) changed for [0, mid]
2014-10-28 10:11:51 +00:00
bors
faed6489da auto merge of #18127 : alexcrichton/rust/deriving-arc, r=aturon
This adds impls of Eq/Ord/PartialEq/PartialOrd/Show/Default to Arc<T>, and it
also removes the `Send + Sync` bound on the `Clone` impl of Arc to make it more
deriving-friendly. The `Send + Sync` requirement is still enforce on
construction, of course!
2014-10-28 08:01:52 +00:00
bors
3f37e2efac auto merge of #18192 : jmesmon/rust/platform-generic, r=alexcrichton
The goal here is to make it easier to add new platform definitions,
especially when the additions are programmatic (ie: in build scripts).
2014-10-28 05:46:53 +00:00
Alex Crichton
35ad00d2ec alloc: Make deriving more friendly with Arc
This adds impls of Eq/Ord/PartialEq/PartialOrd/Show/Default to Arc<T>, and it
also removes the `Send + Sync` bound on the `Clone` impl of Arc to make it more
deriving-friendly. The `Send + Sync` requirement is still enforce on
construction, of course!
2014-10-27 22:45:44 -07:00
Brendan Zabarauskas
665ad9c175 Move token-to-string functions into print::pprust 2014-10-28 15:55:38 +11:00
Brendan Zabarauskas
cd049591a2 Use an enum rather than a bool in token::Ident 2014-10-28 15:55:37 +11:00