Commit Graph

33609 Commits

Author SHA1 Message Date
bors
7d0cc44f87 auto merge of #18070 : alexcrichton/rust/spring-cleaning, r=aturon
This is a large spring-cleaning commit now that the 0.12.0 release has passed removing an amount of deprecated functionality. This removes a number of deprecated crates (all still available as cargo packages in the rust-lang organization) as well as a slew of deprecated functions. All `#[crate_id]` support has also been removed.

I tried to avoid anything that was recently deprecated, but I may have missed something! The major pain points of this commit is the fact that rustc/syntax have `#[allow(deprecated)]`, but I've removed that annotation so moving forward they should be cleaned up as we go.
2014-10-20 16:07:43 +00:00
Alex Crichton
96445a533e Test fixes and rebase conflicts 2014-10-20 08:17:33 -07:00
Daniel Hofstetter
555ab2b3a4 Guide: Fix test count 2014-10-20 16:17:59 +02:00
bors
dcbd49ff88 auto merge of #18184 : cakebaker/rust/typo_in_path, r=steveklabnik 2014-10-20 14:17:10 +00:00
Daniel Hofstetter
cf3d3dc486 Guide: Fix typo in path 2014-10-20 15:26:09 +02:00
bors
ddfe24d641 auto merge of #18174 : huonw/rust/fix-sqrt, r=alexcrichton
Closes #9987.
2014-10-20 10:17:09 +00:00
Huon Wilson
a1d5cd204d Handle negative numbers in sqrt properly.
Closes #9987.
2014-10-20 21:10:13 +11:00
bors
045bc283ec auto merge of #18108 : mahkoh/rust/buffered_reader, r=alexcrichton
This optimizes `read` for the case in which the number of bytes
requested is larger than the internal buffer. Note that the first
comparison occurs again right afterwards and should thus be free. The
second comparison occurs only in the cold branch.
2014-10-20 03:27:12 +00:00
Julian Orth
3839696529 Optimize BufferedReader::read for large buffers.
This optimizes `read` for the case in which the number of bytes
requested is larger than the internal buffer. Note that the first
comparison occurs again right afterwards and should thus be free. The
second comparison occurs only in the cold branch.
2014-10-20 01:47:33 +02:00
bors
aff4f11cdd auto merge of #18160 : koshlo/rust/to-source-fix, r=alexcrichton
Fix for issue #18091 

The problem seems to be that `ast_util::int_ty_to_string` takes unsigned number, and no one adds `-` to result string. I've fixed it by putting `-` before result string using `format!`.

I've also added `test_signed_int_to_string()` to check if implementation is valid.
2014-10-19 23:32:07 +00:00
bors
5cba29d334 auto merge of #18142 : arielb1/rust/return-type-sized, r=eddyb
Fixes #18107 

r? @eddyb
2014-10-19 21:42:05 +00:00
Ariel Ben-Yehuda
0eb17e3f31 Ensure that the return type of a function is Sized
While no real rvalue of an unsized type can exist, a diverging function
can still "return" a value of such a type, which causes an ICE.

Fixes #18107.
2014-10-19 23:54:45 +03:00
Alex Crichton
9d5d97b55d Remove a large amount of deprecated functionality
Spring cleaning is here! In the Fall! This commit removes quite a large amount
of deprecated functionality from the standard libraries. I tried to ensure that
only old deprecated functionality was removed.

This is removing lots and lots of deprecated features, so this is a breaking
change. Please consult the deprecation messages of the deleted code to see how
to migrate code forward if it still needs migration.

[breaking-change]
2014-10-19 12:59:40 -07:00
Alex Crichton
fb169d5543 Remove a number of deprecated crates
All of these crates have been deprecated for some time and properly live in the
rust-lang organization as cargo-based crates.

To update your code, depend on the rust-lang/foo repository via cargo.

[breaking-change]
2014-10-19 12:59:40 -07:00
Aleksandr Koshlo
49ec356c60 fix printing signed literal in print_literal 2014-10-19 18:39:51 +03:00
bors
c121cbab35 auto merge of #18139 : JelteF/rust-1/patch-1, r=steveklabnik
The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
2014-10-19 13:52:06 +00:00
bors
18062c1e96 auto merge of #18138 : rclanan/rust/mark-lt-partialord-inline, r=sfackler
Fixes issue #18090
2014-10-19 10:57:09 +00:00
bors
e99dd205f8 auto merge of #18136 : mprobinson/rust/example-warning, r=alexcrichton
let mut value = mutex.lock();
warning: variable does not need to be mutable
2014-10-19 09:07:10 +00:00
bors
4bb21f37ef auto merge of #18135 : EduardoBautista/rust/fix-misaligned-carot, r=steveklabnik 2014-10-19 07:17:15 +00:00
bors
a572b74cc0 auto merge of #18124 : pnkfelix/rust/fsk-add-check-of-borrow-local-static, r=thestinger
Check for borrow of local variable introduced within static block.

(Rather than ICE on it.)

Fix #18118.
2014-10-19 05:12:14 +00:00
bors
dc2b9dba27 auto merge of #18123 : dotdash/rust/llvm_memcpy, r=alexcrichton 2014-10-19 02:52:36 +00:00
bors
c46812f659 auto merge of #18120 : jrincayc/rust/match_exp, r=thestinger
Use a match expression directly in the println statement, instead of creating a second variable.  It seems weird that the current guide.md complains about creating an extra variable, when the same feature could be demonstrated without creating the extra variable.
2014-10-19 00:47:18 +00:00
Neil Pankey
66939dfe64 [Docs] more intro typos 2014-10-18 17:40:57 -07:00
Neil Pankey
e1389530cf [Docs] intro typo 2014-10-18 17:37:54 -07:00
bors
d8cf023971 auto merge of #18109 : bkoropoff/rust/issue-16939, r=aturon
Closes #16939
2014-10-18 22:57:16 +00:00
bors
1c82e60ca7 auto merge of #18113 : bkoropoff/rust/issue-16739, r=alexcrichton
When translating the unboxing shim, account for the fact that the shim translation has already performed the necessary unboxing of input types and values when forwarding to the shimmed function.  This prevents ICEing or generating incorrect code.

Closes #16739
2014-10-18 21:02:17 +00:00
Jelte Fennema
2a668149c2 Fix fold explanation in the guide
The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
2014-10-18 19:29:53 +02:00
bors
ce342f522c auto merge of #18041 : arielb1/rust/no-size-overflow, r=pnkfelix
Should fix #17913.

Also clean-up u64/u32-ness. I really should split this commit and add tests (I have no idea how to add them).
2014-10-18 17:02:13 +00:00
Ariel Ben-Yehuda
ccdf8d5b52 trailing whitespace 2014-10-18 19:34:00 +03:00
Ray Clanan
1b7163358f Mark lt as inline in PartialOrd 2014-10-18 11:49:33 -04:00
bors
d670919aa4 auto merge of #18105 : nikomatsakis/rust/issue-18055, r=pcwalton
Check object lifetime bounds in coercions, not just trait bounds.  Fixes #18055.

r? @pcwalton 

This is a [breaking change]. Change code like this:

    fn foo(v: &[u8]) -> Box<Clone+'static> { ... }

to make the lifetimes agree:

    // either...
    fn foo(v: &'static[u8]) -> Box<Clone+'static> { box v }

    // or ...
    fn foo<'a>(v: &'a [u8]) -> Box<Clone+'a> { box v }
2014-10-18 15:12:11 +00:00
Phil Dawes
9c7865fa6f Parser: Fix spans of explicit self arg idents 2014-10-18 16:05:26 +01:00
bors
41a79104a4 auto merge of #18099 : jakub-/rust/fixed-issues, r=alexcrichton
Closes #9249.
Closes #13105.
Closes #13837.
Closes #13847.
Closes #15207.
Closes #15261.
Closes #16048. 
Closes #16098.
Closes #16256.
Closes #16562.
Closes #16596.
Closes #16709.
Closes #16747.
Closes #17025.
Closes #17121.
Closes #17450.
Closes #17636.
2014-10-18 13:22:11 +00:00
bors
c7c342d10c auto merge of #18103 : pcwalton/rust/bitflags-inline, r=thestinger
Servo really wants this.

r? @nick29581
2014-10-18 10:17:14 +00:00
Mike Robinson
6e9646dfb0 Fix warning in Struct sync::Mutex example
let mut value = mutex.lock();
warning: variable does not need to be mutable
2014-10-18 09:43:16 +01:00
bors
4b064a59cc auto merge of #18096 : Gankro/rust/ganksy-is-dum, r=steveklabnik
Fixes #18010

*phew* that was a lot of work. 😓
2014-10-18 08:27:13 +00:00
Eduardo Bautista
cef0b55c78 Fix misaligned carot in guide 2014-10-18 01:34:50 -05:00
bors
4480caf2a4 auto merge of #18024 : phungleson/rust/fix-var-name-in-doc, r=brson
Make the doc more consistent & runnable.

* Use `_index` instead of `_rhs` when appropriate.
* Use `_from` and `_to` to avoid warning.
* Remove unnecessary `::core::ops`
2014-10-18 06:22:15 +00:00
bors
2c0f87610d auto merge of #18022 : nikomatsakis/rust/issue-18019, r=pcwalton
Only consider impliciy unboxed closure impl if the obligation is actually for `Fn`, `FnMut`, or `FnOnce`.

Fixes #18019

r? @pcwalton
2014-10-18 04:32:16 +00:00
bors
1270f8e77a auto merge of #17955 : rjz/rust/tweak-tasks-guide, r=brson 2014-10-18 02:37:16 +00:00
bors
222ae8b9bb auto merge of #17815 : typelist/rust/recursive-structs, r=brson
The representability-checking routine ```is_type_representable``` failed to detect structural recursion in some cases, leading to stack overflow later on.

The first problem was in the loop in the ```find_nonrepresentable``` function. We were improperly terminating the iteration if we saw a ```ContainsRecursive``` condition. We should have kept going in case a later member of the struct (or enum, etc) being examined was ```SelfRecursive```. The example from #17431 triggered this issue:

```rust
use std::sync::Mutex;
struct Foo { foo: Mutex<Option<Foo>> }
impl Foo { fn bar(self) {} }
fn main() {}
```

I'm not 100% sure, but I think the ```ty_enum``` case of ```fn type_structurally_recursive``` had a similar problem, since it could ```break``` on ```ContainsRecursive``` before looking at all variants. I've replaced this with a ```flat_map``` call.

The second problem was that we were failing to identify code like ```struct Foo { foo: Option<Option<Foo>> }``` as SelfRecursive, even though we correctly identified ```struct Foo { foo: Option<Foo> }```. This was caused by using DefId's for the ```ContainsRecursive``` check, which meant the nested ```Option```s were identified as illegally recursive (because ```ContainsRecursive``` is not an error, we would then keep compiling and eventually hit a stack overflow).

In order to make sure that we can recurse through the different ```Option``` invocations, I've changed the type of ```seen``` from ```Vec<DefId>``` to ```Vec<t>``` and added a separate ```same_type``` function to check whether two types are the same when generics are taken into account. Now we only return ```ContainsRecursive``` when this stricter check is satisfied. (There's probably a better way to do this, and I'm not sure my code is entirely correct--but my knowledge of rustc internals is pretty limited, so any help here would be appreciated!)

Note that the ```SelfRecursive``` check is still comparing ```DefId```s--this is necessary to prevent code like this from being allowed:

```rust
struct Foo { x: Bar<Foo> }
struct Bar<T> { x: Bar<Foo> }
```

All four of the new ```issue-17431``` tests cause infinite recursion on master, and errors with this pull request. I wrote the extra ```issue-3008-4.rs``` test to make sure I wasn't introducing a regression.

Fixes #17431.
2014-10-18 00:47:22 +00:00
bors
9b80efd74e auto merge of #17009 : kballard/rust/install_no_sudo, r=pnkfelix
When running `sudo make install`, we only want to run the actual install
as root, the building of the documentation and the distribution folder
should happen as the non-root user.

Related to #13728.
2014-10-17 22:57:30 +00:00
bors
4694b99102 auto merge of #16855 : P1start/rust/help-messages, r=brson
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message.

They look like this:

```
match.rs:10:13: 10:14 error: unreachable pattern [E0001]
match.rs:10             1 => {},
                        ^
match.rs:3:1: 3:38 note: in expansion of foo!
match.rs:7:5: 20:2 note: expansion site
match.rs:10:13: 10:14 help: pass `--explain E0001` to see a detailed explanation
```

(`help` is coloured cyan.) Adding these errors on a separate line stops the lines from being too long, as discussed in #16619.
2014-10-17 20:32:22 +00:00
Felix S. Klock II
88de96178f Check for borrow of local variable introduced within static block.
(Rather than ICE on it.)

Fix #18118.
2014-10-17 18:15:57 +02:00
Björn Steinbrink
ee985a5a51 Update LLVM to get slightly better memcpy elision 2014-10-17 17:16:18 +02:00
bors
97bf93e405 auto merge of #18093 : steveklabnik/rust/remove_gc_reference, r=alexcrichton 2014-10-17 14:17:34 +00:00
jrincayc
ce83a24b5f Use match expression directly in guide.md
Use a match expression directly in the println statement, instead of creating a second variable.
2014-10-17 07:00:29 -06:00
Niko Matsakis
f4a7d32c8b Correct a test. The error message changed because, with this fix, we
detected (correctly) that there was only one impl and hence ignored the
`Self` bound completely. I (semi-arbitrarily) elected to delect the
impl, forcing the trait matcher to be more conservative and lean on the
where clauses in scope, yielding the original error message.
2014-10-17 08:04:34 -04:00
Ariel Ben-Yehuda
3ce5a9539f Make the tests green as they should on 32-bit architectures
On 32-bit architectures, the size calculations on two of the tests wrap-around
in typeck, which gives the relevant arrays a size of 0, which is (correctly)
successfully allocated.
2014-10-17 12:37:27 +03:00
bors
93e589c872 auto merge of #18089 : gamazeps/rust/small-bitv-cleanup, r=alexcrichton
I was going to write some doc in order to remove the #[allow(missing_doc)] but there was actually none missing.
I also removed a warning i didn't see in my last commit  #18018
Linked to #18009
2014-10-17 09:22:14 +00:00