]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoAdd regression test
Brian Koropoff [Sun, 2 Nov 2014 03:21:55 +0000 (20:21 -0700)]
Add regression test

9 years agoAlways consider static methods object-safe
Brian Koropoff [Sun, 2 Nov 2014 03:15:48 +0000 (20:15 -0700)]
Always consider static methods object-safe

This also fixes #18490 as a side-effect by avoiding a later
out-of-bounds slice.

9 years agoauto merge of #17595 : danburkert/rust/tuple-index-deserialization, r=alexcrichton
bors [Sat, 1 Nov 2014 22:41:48 +0000 (22:41 +0000)]
auto merge of #17595 : danburkert/rust/tuple-index-deserialization, r=alexcrichton

Currently `Decoder` implementations are not provided the tuple arity as
a parameter to `read_tuple`. This forces all encoder/decoder combos to
serialize the arity along with the elements. Tuple-arity is always known
statically at the decode site, because it is part of the type of the
tuple, so it could instead be provided as an argument to `read_tuple`,
as it is to `read_struct`.

The upside to this is that serialized tuples could become smaller in
encoder/decoder implementations which choose not to serialize type
(arity) information. For example, @TyOverby's
[binary-encode](https://github.com/TyOverby/binary-encode) format is
currently forced to serialize the tuple-arity along with every tuple,
despite the information being statically known at the decode site.

A downside to this change is that the tuple-arity of serialized tuples
can no longer be automatically checked during deserialization. However,
for formats which do serialize the tuple-arity, either explicitly (rbml)
or implicitly (json), this check can be added to the `read_tuple` method.

The signature of `Deserialize::read_tuple` and
`Deserialize::read_tuple_struct` are changed, and thus binary
backwards-compatibility is broken. This change does *not* force
serialization formats to change, and thus does not break decoding values
serialized prior to this change.

[breaking-change]

9 years agoauto merge of #18474 : alexcrichton/rust/no-more-traits, r=aturon
bors [Sat, 1 Nov 2014 20:21:47 +0000 (20:21 +0000)]
auto merge of #18474 : alexcrichton/rust/no-more-traits, r=aturon

As part of the collections reform RFC, this commit removes all collections
traits in favor of inherent methods on collections themselves. All methods
should continue to be available on all collections.

This is a breaking change with all of the collections traits being removed and
no longer being in the prelude. In order to update old code you should move the
trait implementations to inherent implementations directly on the type itself.

Note that some traits had default methods which will also need to be implemented
to maintain backwards compatibility.

[breaking-change]
cc #18424

9 years agocollections: Remove all collections traits
Alex Crichton [Thu, 30 Oct 2014 20:43:24 +0000 (13:43 -0700)]
collections: Remove all collections traits

As part of the collections reform RFC, this commit removes all collections
traits in favor of inherent methods on collections themselves. All methods
should continue to be available on all collections.

This is a breaking change with all of the collections traits being removed and
no longer being in the prelude. In order to update old code you should move the
trait implementations to inherent implementations directly on the type itself.

Note that some traits had default methods which will also need to be implemented
to maintain backwards compatibility.

[breaking-change]
cc #18424

9 years agoTuple deserialization should not fail
Dan Burkert [Sat, 25 Oct 2014 16:29:41 +0000 (09:29 -0700)]
Tuple deserialization should not fail

9 years agolibserialize: tuple-arity should be provided to `Decoder::read_tuple`
Dan Burkert [Sat, 27 Sep 2014 21:19:19 +0000 (14:19 -0700)]
libserialize: tuple-arity should be provided to `Decoder::read_tuple`

Currently `Decoder` implementations are not provided the tuple arity as
a parameter to `read_tuple`. This forces all encoder/decoder combos to
serialize the arity along with the elements. Tuple-arity is always known
statically at the decode site, because it is part of the type of the
tuple, so it could instead be provided as an argument to `read_tuple`,
as it is to `read_struct`.

The upside to this is that serialized tuples could become smaller in
encoder/decoder implementations which choose not to serialize type
(arity) information. For example, @TyOverby's
[binary-encode](https://github.com/TyOverby/binary-encode) format is
currently forced to serialize the tuple-arity along with every tuple,
despite the information being statically known at the decode site.

A downside to this change is that the tuple-arity of serialized tuples
can no longer be automatically checked during deserialization. However,
for formats which do serialize the tuple-arity, either explicitly (rbml)
or implicitly (json), this check can be added to the `read_tuple` method.

The signature of `Deserialize::read_tuple` and
`Deserialize::read_tuple_struct` are changed, and thus binary
backwards-compatibility is broken. This change does *not* force
serialization formats to change, and thus does not break decoding values
serialized prior to this change.

[breaking-change]

9 years agoauto merge of #18457 : japaric/rust/tocstr, r=alexcrichton
bors [Sat, 1 Nov 2014 11:21:47 +0000 (11:21 +0000)]
auto merge of #18457 : japaric/rust/tocstr, r=alexcrichton

Methods that used to take `ToCStr` implementors by value, now take them by reference. In particular, this breaks some uses of `Command`:

``` rust
Command::new("foo");  // Still works
Command::new(path) -> Command::new(&path)
cmd.arg(string) -> cmd.arg(&string) or cmd.arg(string.as_slice())
```

[breaking-change]

---

It may be sensible to remove `impl ToCstr for String` since:
- We're getting `impl Deref<str> for String`, so `string.to_cstr()` would still work
- `Command` methods would still be able to use `cmd.arg(string[..])` instead of `cmd.arg(&string)`.

But, I'm leaving that up to the library stabilization process.

r? @aturon
cc #16918

9 years agoauto merge of #18422 : michaelwoerister/rust/windows-freeze-fix, r=alexcrichton
bors [Sat, 1 Nov 2014 03:56:44 +0000 (03:56 +0000)]
auto merge of #18422 : michaelwoerister/rust/windows-freeze-fix, r=alexcrichton

On some Windows versions of GDB this is more stable than setting breakpoints via function names. This is also something I wanted to do for some time now because it makes the tests more consistent.

@brson:
These changes are in response to issue #17540. It works on my machine with the toolchain mentioned in the issue. In order to find out if the problem is really worked around, we also need to make the build bots use the newer GDB version again.

9 years agoauto merge of #18371 : nikomatsakis/rust/issue-18262, r=pcwalton
bors [Sat, 1 Nov 2014 01:41:45 +0000 (01:41 +0000)]
auto merge of #18371 : nikomatsakis/rust/issue-18262, r=pcwalton

Teach variance checker about the lifetime bounds that appear in trait object types.

[breaking-change] This patch fixes a hole in the type system which resulted in lifetime parameters that were only used in trait objects not being checked. It's hard to characterize precisely the changes that might be needed to fix target code.

cc #18262 (this fixes the test case by @jakub- but I am not sure if this is the same issue that @alexcrichton was reporting)

r? @pnkfelix

Fixes #18205

9 years agoauto merge of #18177 : nick29581/rust/ufcs2, r=nikomatsakis
bors [Fri, 31 Oct 2014 23:36:48 +0000 (23:36 +0000)]
auto merge of #18177 : nick29581/rust/ufcs2, r=nikomatsakis

r?

closes #18061

9 years agoFix RustDoc bug
Nick Cameron [Fri, 31 Oct 2014 02:00:35 +0000 (15:00 +1300)]
Fix RustDoc bug

9 years agoRebasing and review changes
Nick Cameron [Thu, 30 Oct 2014 03:33:37 +0000 (16:33 +1300)]
Rebasing and review changes

9 years agotest
Nick Cameron [Sun, 19 Oct 2014 22:27:56 +0000 (11:27 +1300)]
test

9 years agoCross crait inherant impls
Nick Cameron [Mon, 20 Oct 2014 01:30:31 +0000 (14:30 +1300)]
Cross crait inherant impls

9 years agoRemove FnStyle from DefFn and DefStaticMethod
Nick Cameron [Thu, 16 Oct 2014 04:44:24 +0000 (17:44 +1300)]
Remove FnStyle from DefFn and DefStaticMethod

9 years agoResolve methods called as functions and...
Nick Cameron [Thu, 16 Oct 2014 04:40:01 +0000 (17:40 +1300)]
Resolve methods called as functions and...

...defined in another crate.

Fixes #18061

9 years agoTeach variance checker about the lifetime bounds that appear in trait object types.
Niko Matsakis [Mon, 27 Oct 2014 18:03:25 +0000 (14:03 -0400)]
Teach variance checker about the lifetime bounds that appear in trait object types.

9 years agodebuginfo: Enable some GDB tests on Windows.
Michael Woerister [Thu, 30 Oct 2014 06:08:27 +0000 (11:08 +0500)]
debuginfo: Enable some GDB tests on Windows.

9 years agodebuginfo: Make GDB tests use line breakpoints like done in LLDB tests.
Michael Woerister [Wed, 29 Oct 2014 06:13:29 +0000 (10:13 +0400)]
debuginfo: Make GDB tests use line breakpoints like done in LLDB tests.

On some Windows versions of GDB this is more stable than setting breakpoints via function names.

9 years agoauto merge of #18440 : japaric/rust/hash, r=alexcrichton
bors [Fri, 31 Oct 2014 17:11:43 +0000 (17:11 +0000)]
auto merge of #18440 : japaric/rust/hash, r=alexcrichton

- The signature of the `*_equiv` methods of `HashMap` and similar structures have changed, and now require one less level of indirection. Change your code from:

``` rust
hashmap.find_equiv(&"Hello");
hashmap.find_equiv(&&[0u8, 1, 2]);
```

to:

``` rust
hashmap.find_equiv("Hello");
hashmap.find_equiv(&[0u8, 1, 2]);
```

- The generic parameter `T` of the `Hasher::hash<T>` method have become `Sized?`. Downstream code must add `Sized?` to that method in their implementations. For example:

``` rust
impl Hasher<FnvState> for FnvHasher {
    fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
}
```

must be changed to:

``` rust
impl Hasher<FnvState> for FnvHasher {
    fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
    //      ^^^^^^
}
```

[breaking-change]

---

After review I'll squash the commits and update the commit message with the above paragraph.

r? @aturon
cc #16918

9 years agoDSTify ToCStr
Jorge Aparicio [Sat, 25 Oct 2014 00:23:22 +0000 (19:23 -0500)]
DSTify ToCStr

9 years agoauto merge of #18458 : eddyb/rust/free-region-args, r=nikomatsakis
bors [Fri, 31 Oct 2014 15:06:45 +0000 (15:06 +0000)]
auto merge of #18458 : eddyb/rust/free-region-args, r=nikomatsakis

This fixes ICEs caused by late-bound lifetimes ending up in argument
datum types and being used in cleanup - user Drop impl's would then
fail to monomorphize if the type was used to look up the impl of a
method call - which happens in trans now, I presume for multidispatch.

9 years agotrans: use types from argument patterns instead of the function signature.
Eduard Burtescu [Fri, 31 Oct 2014 14:20:25 +0000 (16:20 +0200)]
trans: use types from argument patterns instead of the function signature.

This fixes ICEs caused by late-bound lifetimes ending up in argument
datum types and being used in cleanup - user Drop impl's would then
fail to monomorphize if the type was used to look up the impl of a
method call - which happens in trans now, I presume for multidispatch.

9 years agoDSTify Hash
Jorge Aparicio [Fri, 24 Oct 2014 17:25:50 +0000 (12:25 -0500)]
DSTify Hash

- The signature of the `*_equiv` methods of `HashMap` and similar structures
have changed, and now require one less level of indirection. Change your code
from:

```
hashmap.find_equiv(&"Hello");
hashmap.find_equiv(&&[0u8, 1, 2]);
```

to:

```
hashmap.find_equiv("Hello");
hashmap.find_equiv(&[0u8, 1, 2]);
```

- The generic parameter `T` of the `Hasher::hash<T>` method have become
`Sized?`. Downstream code must add `Sized?` to that method in their
implementations. For example:

```
impl Hasher<FnvState> for FnvHasher {
    fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
}
```

must be changed to:

```
impl Hasher<FnvState> for FnvHasher {
    fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ }
    //      ^^^^^^
}
```

[breaking-change]

9 years agoauto merge of #18264 : jakub-/rust/var-ids-in-error-messages, r=nikomatsakis
bors [Fri, 31 Oct 2014 11:16:44 +0000 (11:16 +0000)]
auto merge of #18264 : jakub-/rust/var-ids-in-error-messages, r=nikomatsakis

This PR aims to improve the readability of diagnostic messages that involve unresolved type variables. Currently, messages like the following:

```rust
mismatched types: expected `core::result::Result<uint,()>`, found `core::option::Option<<generic #1>>`
<anon>:6     let a: Result<uint, ()> = None;
                                       ^~~~
mismatched types: expected `&mut <generic #2>`, found `uint`
<anon>:7     f(42u);
               ^~~
```

tend to appear unapproachable to new users. [0] While specific type var IDs are valuable in
diagnostics that deal with more than one such variable, in practice many messages
only mention one. In those cases, leaving out the specific number makes the messages
slightly less terrifying.

```rust
mismatched types: expected `core::result::Result<uint, ()>`, found `core::option::Option<_>`
<anon>:6     let a: Result<uint, ()> = None;
                                       ^~~~
mismatched types: expected `&mut _`, found `uint`
<anon>:7     f(42u);
               ^~~
```

As you can see, I also tweaked the aesthetics slightly by changing type variables to use the type hole syntax _. For integer variables, the syntax used is:

```rust
mismatched types: expected `core::result::Result<uint, ()>`, found `core::option::Option<_#1i>`
<anon>:6     let a: Result<uint, ()> = Some(1);
```

and float variables:

```rust
mismatched types: expected `core::result::Result<uint, ()>`, found `core::option::Option<_#1f>`
<anon>:6     let a: Result<uint, ()> = Some(0.5);
```

[0] https://twitter.com/coda/status/517713085465772032

Closes https://github.com/rust-lang/rust/issues/2632.
Closes https://github.com/rust-lang/rust/issues/3404.
Closes https://github.com/rust-lang/rust/issues/18426.

9 years agoauto merge of #18431 : japaric/rust/show, r=alexcrichton
bors [Fri, 31 Oct 2014 06:01:41 +0000 (06:01 +0000)]
auto merge of #18431 : japaric/rust/show, r=alexcrichton

r? @aturon
cc #16918

9 years agoDSTify Show and all the other formatting traits
Jorge Aparicio [Fri, 24 Oct 2014 19:33:41 +0000 (14:33 -0500)]
DSTify Show and all the other formatting traits

9 years agoauto merge of #18459 : alexcrichton/rust/rollup, r=alexcrichton
bors [Fri, 31 Oct 2014 02:27:15 +0000 (02:27 +0000)]
auto merge of #18459 : alexcrichton/rust/rollup, r=alexcrichton

9 years agoTest fixes and rebase conflicts
Alex Crichton [Thu, 30 Oct 2014 16:13:02 +0000 (09:13 -0700)]
Test fixes and rebase conflicts

9 years agorollup merge of #18445 : alexcrichton/index-mut
Alex Crichton [Thu, 30 Oct 2014 16:03:21 +0000 (09:03 -0700)]
rollup merge of #18445 : alexcrichton/index-mut

Conflicts:
src/libcollections/vec.rs

9 years agorollup merge of #18430 : bjz/token
Alex Crichton [Thu, 30 Oct 2014 16:02:52 +0000 (09:02 -0700)]
rollup merge of #18430 : bjz/token

Conflicts:
src/libsyntax/parse/parser.rs

9 years agorollup merge of #18398 : aturon/lint-conventions-2
Alex Crichton [Thu, 30 Oct 2014 16:02:07 +0000 (09:02 -0700)]
rollup merge of #18398 : aturon/lint-conventions-2

Conflicts:
src/libcollections/slice.rs
src/libcore/failure.rs
src/libsyntax/parse/token.rs
src/test/debuginfo/basic-types-mut-globals.rs
src/test/debuginfo/simple-struct.rs
src/test/debuginfo/trait-pointers.rs

9 years agorollup merge of #18452 : bkoropoff/issue-18425
Alex Crichton [Thu, 30 Oct 2014 15:58:16 +0000 (08:58 -0700)]
rollup merge of #18452 : bkoropoff/issue-18425

9 years agorollup merge of #18443 : alexcrichton/deref-vec-and-string
Alex Crichton [Thu, 30 Oct 2014 15:58:06 +0000 (08:58 -0700)]
rollup merge of #18443 : alexcrichton/deref-vec-and-string

9 years agorollup merge of #18442 : Manishearth/rust_panic
Alex Crichton [Thu, 30 Oct 2014 15:58:04 +0000 (08:58 -0700)]
rollup merge of #18442 : Manishearth/rust_panic

9 years agorollup merge of #18438 : jakub-/empty-file
Alex Crichton [Thu, 30 Oct 2014 15:57:59 +0000 (08:57 -0700)]
rollup merge of #18438 : jakub-/empty-file

9 years agoauto merge of #18381 : pelmers/rust/patch-1, r=alexcrichton
bors [Fri, 31 Oct 2014 00:22:19 +0000 (00:22 +0000)]
auto merge of #18381 : pelmers/rust/patch-1, r=alexcrichton

Happened to be reading through the doc.

9 years agoUse the `_` representation for integral variables as well
Jakub Bukaj [Thu, 30 Oct 2014 20:17:06 +0000 (21:17 +0100)]
Use the `_` representation for integral variables as well

9 years agoAdd a test for errors unifying an integer variable with a float variable
Jakub Bukaj [Thu, 30 Oct 2014 20:29:13 +0000 (21:29 +0100)]
Add a test for errors unifying an integer variable with a float variable

9 years agoAdd a test for failure to unify type parameters
Jakub Bukaj [Thu, 30 Oct 2014 20:16:52 +0000 (21:16 +0100)]
Add a test for failure to unify type parameters

9 years agoauto merge of #18339 : chastell/rust/guide_pattern_fixes, r=nikomatsakis
bors [Thu, 30 Oct 2014 20:17:15 +0000 (20:17 +0000)]
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.

9 years agoauto merge of #18377 : steveklabnik/rust/fix_wording_about_errors, r=nikomatsakis
bors [Thu, 30 Oct 2014 17:57:09 +0000 (17:57 +0000)]
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

9 years agorollup merge of #18421 : tbu-/pr_checkeddiv1
Alex Crichton [Thu, 30 Oct 2014 15:57:45 +0000 (08:57 -0700)]
rollup merge of #18421 : tbu-/pr_checkeddiv1

9 years agorollup merge of #18417 : P1start/lint-fixes
Alex Crichton [Thu, 30 Oct 2014 15:57:43 +0000 (08:57 -0700)]
rollup merge of #18417 : P1start/lint-fixes

9 years agorollup merge of #18413 : bkoropoff/issue-18412
Alex Crichton [Thu, 30 Oct 2014 15:57:40 +0000 (08:57 -0700)]
rollup merge of #18413 : bkoropoff/issue-18412

9 years agorollup merge of #18411 : richo/tm-null-check
Alex Crichton [Thu, 30 Oct 2014 15:57:39 +0000 (08:57 -0700)]
rollup merge of #18411 : richo/tm-null-check

9 years agorollup merge of #18409 : gamazeps/issue15273
Alex Crichton [Thu, 30 Oct 2014 15:57:36 +0000 (08:57 -0700)]
rollup merge of #18409 : gamazeps/issue15273

9 years agorollup merge of #18408 : thestinger/unsafe
Alex Crichton [Thu, 30 Oct 2014 15:57:34 +0000 (08:57 -0700)]
rollup merge of #18408 : thestinger/unsafe

9 years agorollup merge of #18407 : thestinger/arena
Alex Crichton [Thu, 30 Oct 2014 15:57:30 +0000 (08:57 -0700)]
rollup merge of #18407 : thestinger/arena

9 years agorollup merge of #18397 : aochagavia/ascii
Alex Crichton [Thu, 30 Oct 2014 15:57:17 +0000 (08:57 -0700)]
rollup merge of #18397 : aochagavia/ascii

9 years agorollup merge of #18395 : cakebaker/fix_use_of_sqrt
Alex Crichton [Thu, 30 Oct 2014 15:55:48 +0000 (08:55 -0700)]
rollup merge of #18395 : cakebaker/fix_use_of_sqrt

9 years agorollup merge of #18393 : aochagavia/prelude
Alex Crichton [Thu, 30 Oct 2014 15:55:46 +0000 (08:55 -0700)]
rollup merge of #18393 : aochagavia/prelude

9 years agorollup merge of #18392 : cakebaker/remove_double_negation
Alex Crichton [Thu, 30 Oct 2014 15:55:45 +0000 (08:55 -0700)]
rollup merge of #18392 : cakebaker/remove_double_negation

9 years agoauto merge of #18376 : steveklabnik/rust/gh7963, r=alexcrichton
bors [Thu, 30 Oct 2014 15:57:03 +0000 (15:57 +0000)]
auto merge of #18376 : steveklabnik/rust/gh7963, r=alexcrichton

FIxes #7963.

9 years agorollup merge of #18383 : bkoropoff/issue-17361
Alex Crichton [Thu, 30 Oct 2014 15:55:40 +0000 (08:55 -0700)]
rollup merge of #18383 : bkoropoff/issue-17361

9 years agorollup merge of #18381 : pelmers/patch-1
Alex Crichton [Thu, 30 Oct 2014 15:55:39 +0000 (08:55 -0700)]
rollup merge of #18381 : pelmers/patch-1

9 years agocollections: Enable IndexMut for some collections
Alex Crichton [Thu, 23 Oct 2014 15:42:21 +0000 (08:42 -0700)]
collections: Enable IndexMut for some collections

This commit enables implementations of IndexMut for a number of collections,
including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same
time this deprecates the `get_mut` methods on vectors in favor of using the
indexing notation.

cc #18424

9 years agoauto merge of #18374 : steveklabnik/rust/gh18197, r=sfackler
bors [Thu, 30 Oct 2014 13:57:07 +0000 (13:57 +0000)]
auto merge of #18374 : steveklabnik/rust/gh18197, r=sfackler

Fixes #18197

9 years agoauto merge of #18367 : pcwalton/rust/inline-atomic-constructors, r=thestinger
bors [Thu, 30 Oct 2014 11:12:04 +0000 (11:12 +0000)]
auto merge of #18367 : pcwalton/rust/inline-atomic-constructors, r=thestinger

Servo really wants this.

r? @brson

9 years agoauto merge of #18279 : bgamari/rust/check-static-recursion, r=alexcrichton
bors [Thu, 30 Oct 2014 09:12:05 +0000 (09:12 +0000)]
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.

9 years agoSpecial-case some error messages about `Sized`
P1start [Tue, 28 Oct 2014 08:04:08 +0000 (21:04 +1300)]
Special-case some error messages about `Sized`

The error messages still aren’t as good as they were before DST, but they better
describe the actual problem, not mentioning `Sized` at all (because that bound
is normally implied, not explicitly stated).

Closes #17567.
Closes #18040.
Closes #18159.

9 years agoAdd a message for when a `.` follows a macro invocation
P1start [Mon, 27 Oct 2014 04:43:38 +0000 (17:43 +1300)]
Add a message for when a `.` follows a macro invocation

9 years agoauto merge of #17704 : nick29581/rust/object-safety, r=nikomatsakis
bors [Thu, 30 Oct 2014 06:32:11 +0000 (06:32 +0000)]
auto merge of #17704 : nick29581/rust/object-safety, r=nikomatsakis

r? @nikomatsakis

9 years agoAdd regression test for #18425
Brian Koropoff [Thu, 30 Oct 2014 04:48:15 +0000 (21:48 -0700)]
Add regression test for #18425

9 years agoFix ICE translating array repeat expr of non-Copy type
Brian Koropoff [Thu, 30 Oct 2014 04:45:35 +0000 (21:45 -0700)]
Fix ICE translating array repeat expr of non-Copy type

The type checker permits an array repeat expression of non-Copy
type if the count is 1, but trans asserts on it prior to this
change.

Closes #18425

9 years agoauto merge of #18448 : brson/rust/clean-llvm, r=alexcrichton
bors [Thu, 30 Oct 2014 04:32:08 +0000 (04:32 +0000)]
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.

9 years agoImprove the error message for parenthesised box expressions
P1start [Sat, 25 Oct 2014 23:07:54 +0000 (12:07 +1300)]
Improve the error message for parenthesised box expressions

Closes #15386.

9 years agoFix a minor issue with how lint groups are printed by rustc
P1start [Sat, 11 Oct 2014 01:34:45 +0000 (14:34 +1300)]
Fix a minor issue with how lint groups are printed by rustc

9 years agoRemove `unused_extern_crate` and `unused_result` from the `unused` lint group
P1start [Sat, 11 Oct 2014 01:27:37 +0000 (14:27 +1300)]
Remove `unused_extern_crate` and `unused_result` from the `unused` lint group

These lints are allow by default because they are sometimes too sensitive.

9 years agocheck_static_recursion: Handle foreign items
Ben Gamari [Fri, 24 Oct 2014 14:32:43 +0000 (10:32 -0400)]
check_static_recursion: Handle foreign items

9 years agoTry and fix Windows terminal
Nick Cameron [Wed, 22 Oct 2014 04:42:13 +0000 (17:42 +1300)]
Try and fix Windows terminal

9 years agoRebasing fixes
Nick Cameron [Wed, 22 Oct 2014 03:53:03 +0000 (16:53 +1300)]
Rebasing fixes

9 years agomk: Clean just one llvm build at a time. Closes #17852
Brian Anderson [Thu, 30 Oct 2014 02:54:52 +0000 (19:54 -0700)]
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.

9 years agoChanges for Windows terminal
Nick Cameron [Mon, 20 Oct 2014 21:59:00 +0000 (10:59 +1300)]
Changes for Windows terminal

9 years agoChange extensions traits to blanket impls
Nick Cameron [Thu, 16 Oct 2014 00:49:00 +0000 (13:49 +1300)]
Change extensions traits to blanket impls

9 years agochanges to tests
Nick Cameron [Wed, 1 Oct 2014 06:31:21 +0000 (19:31 +1300)]
changes to tests

9 years agochanges to libs
Nick Cameron [Wed, 1 Oct 2014 06:01:08 +0000 (19:01 +1300)]
changes to libs

9 years agoEnforce object safety
Nick Cameron [Wed, 1 Oct 2014 03:43:39 +0000 (16:43 +1300)]
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.

9 years agocollections: impl Deref for Vec/String
Alex Crichton [Wed, 29 Oct 2014 22:26:29 +0000 (15:26 -0700)]
collections: impl Deref for Vec/String

This commit adds the following impls:

    impl<T> Deref<[T]> for Vec<T>
    impl<T> DerefMut<[T]> for Vec<T>
    impl Deref<str> for String

This commit also removes all duplicated inherent methods from vectors and
strings as implementations will now silently call through to the slice
implementation. Some breakage occurred at std and beneath due to inherent
methods removed in favor of those in the slice traits and std doesn't use its
own prelude,

cc #18424

9 years agoauto merge of #18359 : 1-more/rust/feature, r=alexcrichton
bors [Thu, 30 Oct 2014 00:27:02 +0000 (00:27 +0000)]
auto merge of #18359 : 1-more/rust/feature, r=alexcrichton

9 years agoRename rust_fail to rust_panic
Manish Goregaokar [Wed, 29 Oct 2014 23:28:34 +0000 (04:58 +0530)]
Rename rust_fail to rust_panic

9 years agoAlways drop var IDs from type variables modulo -Z verbose, per PR discussion
Jakub Bukaj [Wed, 29 Oct 2014 20:20:06 +0000 (21:20 +0100)]
Always drop var IDs from type variables modulo -Z verbose, per PR discussion

9 years agoAddress review comments
Jakub Bukaj [Wed, 29 Oct 2014 17:59:04 +0000 (18:59 +0100)]
Address review comments

9 years agoUpdate tests with the new diagnostic tweaks
Jakub Bukaj [Thu, 23 Oct 2014 20:48:32 +0000 (22:48 +0200)]
Update tests with the new diagnostic tweaks

9 years agoImprove the readability of diagnostics that involve unresolved type variables
Jakub Bukaj [Thu, 23 Oct 2014 20:35:19 +0000 (22:35 +0200)]
Improve the readability of diagnostics that involve unresolved type variables

Diagnostics such as the following

```
mismatched types: expected `core::result::Result<uint,()>`, found `core::option::Option<<generic #1>>`
<anon>:6     let a: Result<uint, ()> = None;
                                       ^~~~
mismatched types: expected `&mut <generic #2>`, found `uint`
<anon>:7     f(42u);
               ^~~
```

tend to be fairly unappealing to new users. While specific type var IDs are valuable in
diagnostics that deal with more than one such variable, in practice many messages
only mention one. In those cases, leaving out the specific number makes the messages
slightly less terrifying.

In addition, type variables have been changed to use the type hole syntax `_` in diagnostics.
With a variable ID, they're printed as `_#id` (e.g. `_#1`). In cases where the ID is left out,
it's simply `_`. Integer and float variables have an additional suffix after the number, e.g.
`_#1i` or `_#3f`.

9 years agoFormatting fixes
Brendan Zabarauskas [Wed, 29 Oct 2014 21:44:41 +0000 (08:44 +1100)]
Formatting fixes

9 years agoRemove Token::get_close_delimiter
Brendan Zabarauskas [Wed, 29 Oct 2014 14:47:53 +0000 (01:47 +1100)]
Remove Token::get_close_delimiter

We can simplify these usages due to the new delimiter representation. `Parser::expect_open_delim` has been added for convenience.

9 years agoUse common variants for open and close delimiters
Brendan Zabarauskas [Wed, 29 Oct 2014 10:37:54 +0000 (21:37 +1100)]
Use common variants for open and close delimiters

This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.

9 years agoauto merge of #18357 : TeXitoi/rust/simplify-reverse-complement, r=alexcrichton
bors [Wed, 29 Oct 2014 22:17:00 +0000 (22:17 +0000)]
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.

9 years agoRemove an empty file from librustc
Jakub Bukaj [Wed, 29 Oct 2014 21:48:35 +0000 (22:48 +0100)]
Remove an empty file from librustc

9 years agorustc: fail if LLVM is passed an invalid triple
Richo Healey [Wed, 29 Oct 2014 01:58:46 +0000 (18:58 -0700)]
rustc: fail if LLVM is passed an invalid triple

This changes create_target_machine to correctly return a Result (Since
the underlying LLVM function can fail and return NULL)

9 years agoauto merge of #17894 : steveklabnik/rust/fail_to_panic, r=aturon
bors [Wed, 29 Oct 2014 20:16:57 +0000 (20:16 +0000)]
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 :wink:

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

9 years agoUpdate infrastructure for fail -> panic
Steve Klabnik [Tue, 28 Oct 2014 18:07:33 +0000 (14:07 -0400)]
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

9 years agoauto merge of #18282 : pczarn/rust/regex-parse, r=burntsushi
bors [Wed, 29 Oct 2014 18:17:00 +0000 (18:17 +0000)]
auto merge of #18282 : pczarn/rust/regex-parse, r=burntsushi

Fixes #18034

3 bugs fixed.

9 years agoRename fail! to panic!
Steve Klabnik [Thu, 9 Oct 2014 19:17:22 +0000 (15:17 -0400)]
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]

9 years agoauto merge of #18375 : steveklabnik/rust/gh17969, r=alexcrichton
bors [Wed, 29 Oct 2014 15:17:01 +0000 (15:17 +0000)]
auto merge of #18375 : steveklabnik/rust/gh17969, r=alexcrichton

Fixes #17969

9 years agoauto merge of #18365 : bjz/rust/token, r=alexcrichton
bors [Wed, 29 Oct 2014 10:22:01 +0000 (10:22 +0000)]
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}`

9 years agoFix `core::num::CheckedDiv::checked_div` documentation
Tobias Bucher [Wed, 29 Oct 2014 09:08:36 +0000 (10:08 +0100)]
Fix `core::num::CheckedDiv::checked_div` documentation

The "/" was probably generated by a `gq` in vim.

9 years agoauto merge of #18340 : chastell/rust/guide_closures_fixes, r=steveklabnik
bors [Wed, 29 Oct 2014 06:36:57 +0000 (06:36 +0000)]
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.