Commit Graph

33704 Commits

Author SHA1 Message Date
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
P1start
2a7be1b209 Fix a minor issue with how lint groups are printed by rustc 2014-10-30 17:05:16 +13:00
P1start
a0ee7c9f55 Remove unused_extern_crate and unused_result from the unused lint group
These lints are allow by default because they are sometimes too sensitive.
2014-10-30 17:05:16 +13: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
Alex Crichton
8e9f8f924c 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
2014-10-29 18:48:30 -07:00
bors
15dd90b647 auto merge of #18359 : 1-more/rust/feature, r=alexcrichton 2014-10-30 00:27:02 +00:00
Manish Goregaokar
13d19bbf10 Rename rust_fail to rust_panic 2014-10-30 05:09:50 +05:30
Jakub Bukaj
3db13f4892 Always drop var IDs from type variables modulo -Z verbose, per PR discussion 2014-10-29 23:56:22 +01:00
Jakub Bukaj
1b79303f49 Address review comments 2014-10-29 23:56:22 +01:00
Jakub Bukaj
66fbe4c22c Update tests with the new diagnostic tweaks 2014-10-29 23:56:22 +01:00
Jakub Bukaj
0c0365d33f 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`.
2014-10-29 23:55:56 +01:00
Brendan Zabarauskas
98a4770a98 Formatting fixes 2014-10-30 09:35:53 +11:00