Commit Graph

33826 Commits

Author SHA1 Message Date
bors
7e662316d1 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.
2014-10-31 15:06:45 +00:00
Eduard Burtescu
96ba514294 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.
2014-10-31 16:47:25 +02:00
Jorge Aparicio
1384a43db3 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]
2014-10-31 07:25:34 -05:00
bors
82045ca360 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.
2014-10-31 11:16:44 +00:00
bors
065caf34f5 auto merge of #18431 : japaric/rust/show, r=alexcrichton
r? @aturon 
cc #16918
2014-10-31 06:01:41 +00:00
Jorge Aparicio
eef7e97017 DSTify Show and all the other formatting traits 2014-10-30 23:28:11 -05:00
bors
221fc1e3cd auto merge of #18459 : alexcrichton/rust/rollup, r=alexcrichton 2014-10-31 02:27:15 +00:00
Alex Crichton
8e6e846d8a rustc: Implement -l and include! tweaks
This is an implementation of the rustc bits of [RFC 403][rfc]. This adds a new
flag to the compiler, `-l`, as well as tweaking the `include!` macro (and
related source-centric macros).

The compiler's new `-l` flag is used to link libraries in from the command line.
This flag stacks with `#[link]` directives already found in the program. The
purpose of this flag, also stated in the RFC, is to ease linking against native
libraries which have wildly different requirements across platforms and even
within distributions of one platform. This flag accepts a string of the form
`NAME[:KIND]` where `KIND` is optional or one of dylib, static, or framework.
This is roughly equivalent to if the equivalent `#[link]` directive were just
written in the program.

The `include!` macro has been modified to recursively expand macros to allow
usage of `concat!` as an argument, for example. The use case spelled out in RFC
403 was for `env!` to be used as well to include compile-time generated files.
The macro also received a bit of tweaking to allow it to expand to either an
expression or a series of items, depending on what context it's used in.

[rfc]: https://github.com/rust-lang/rfcs/pull/403
2014-10-30 19:02:11 -07:00
Vadim Chugunov
e23f5c8e26 Really fix #17982 this time. 2014-10-30 18:01:02 -07:00
Alex Crichton
6fcba8826f Test fixes and rebase conflicts 2014-10-30 17:37:56 -07:00
Alex Crichton
c10c163377 rollup merge of #18445 : alexcrichton/index-mut
Conflicts:
	src/libcollections/vec.rs
2014-10-30 17:37:55 -07:00
Alex Crichton
5d6241ddaf rollup merge of #18430 : bjz/token
Conflicts:
	src/libsyntax/parse/parser.rs
2014-10-30 17:37:41 -07:00
Alex Crichton
00975e041d 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
2014-10-30 17:37:22 -07:00
Alex Crichton
f68dafa505 rollup merge of #18452 : bkoropoff/issue-18425 2014-10-30 17:36:49 -07:00
Alex Crichton
f3d72dc6a7 rollup merge of #18443 : alexcrichton/deref-vec-and-string 2014-10-30 17:36:49 -07:00
Alex Crichton
d7ee04c5c4 rollup merge of #18442 : Manishearth/rust_panic 2014-10-30 17:36:48 -07:00
Alex Crichton
8c03068b7a rollup merge of #18438 : jakub-/empty-file 2014-10-30 17:36:48 -07:00
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
Jakub Bukaj
696f72e84e Add a repeat function to the prelude
Implements a part of RFC 235.

[breaking-change]
2014-10-30 23:55:53 +01:00
Jakub Bukaj
a2624fc908 Use the _ representation for integral variables as well 2014-10-30 21:38:20 +01:00
Jakub Bukaj
cac995444b Add a test for errors unifying an integer variable with a float variable 2014-10-30 21:38:20 +01:00
Jakub Bukaj
3cbc3f4802 Add a test for failure to unify type parameters 2014-10-30 21:38:20 +01: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
gamazeps
bd9c18125f Doc: Clears up trim_char doc
Closes #18451
2014-10-30 19:00:47 +01: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
Alex Crichton
dfefe9a152 rollup merge of #18421 : tbu-/pr_checkeddiv1 2014-10-30 09:29:24 -07:00
Alex Crichton
09669772db rollup merge of #18417 : P1start/lint-fixes 2014-10-30 09:29:24 -07:00
Alex Crichton
fc3ed0c808 rollup merge of #18413 : bkoropoff/issue-18412 2014-10-30 09:29:24 -07:00
Alex Crichton
f3ba518675 rollup merge of #18411 : richo/tm-null-check 2014-10-30 09:29:24 -07:00
Alex Crichton
ce63fbc7bd rollup merge of #18409 : gamazeps/issue15273 2014-10-30 09:29:24 -07:00
Alex Crichton
1e919c93c7 rollup merge of #18408 : thestinger/unsafe 2014-10-30 09:29:23 -07:00
Alex Crichton
5ee8569889 rollup merge of #18407 : thestinger/arena 2014-10-30 09:29:23 -07:00
Alex Crichton
f2fe55b013 rollup merge of #18397 : aochagavia/ascii 2014-10-30 09:29:23 -07:00
Alex Crichton
b85780e7ea rollup merge of #18395 : cakebaker/fix_use_of_sqrt 2014-10-30 09:29:23 -07:00
Alex Crichton
735ad689d7 rollup merge of #18393 : aochagavia/prelude 2014-10-30 09:29:23 -07:00
Alex Crichton
cda554aaf9 rollup merge of #18392 : cakebaker/remove_double_negation 2014-10-30 09:29:23 -07:00
bors
301ed5e579 auto merge of #18376 : steveklabnik/rust/gh7963, r=alexcrichton
FIxes #7963.
2014-10-30 15:57:03 +00:00
Alex Crichton
7577b6b678 rollup merge of #18383 : bkoropoff/issue-17361 2014-10-30 08:55:40 -07:00
Alex Crichton
88946f72d5 rollup merge of #18381 : pelmers/patch-1 2014-10-30 08:55:39 -07:00
Alex Crichton
1d356624a1 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
2014-10-30 08:54:30 -07: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
P1start
737e39696b 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.
2014-10-30 19:51:17 +13:00
P1start
14398f2929 Add a message for when a . follows a macro invocation 2014-10-30 19:51:16 +13:00
bors
2d27bfaeb6 auto merge of #17704 : nick29581/rust/object-safety, r=nikomatsakis
r? @nikomatsakis
2014-10-30 06:32:11 +00:00
Brian Koropoff
88c8a54728 Add regression test for #18425 2014-10-29 21:48:15 -07:00
Brian Koropoff
8384dd9357 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
2014-10-29 21:45:35 -07: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
P1start
fb00015246 Improve the error message for parenthesised box expressions
Closes #15386.
2014-10-30 17:12:22 +13:00