Commit graph

73088 commits

Author SHA1 Message Date
bors
8e7a609e63 Auto merge of #46916 - michaelwoerister:generate-dead-code-plz, r=alexcrichton
Generate code for unused const- and inline-fns if -Clink-dead-code is specified.

Fixes https://github.com/rust-lang/rust/issues/46467.

r? @alexcrichton
2018-01-04 14:04:27 +00:00
bors
4cd918c4ca Auto merge of #47147 - projektir:to_ptr_cast, r=eddyb
Force appropriate extension when converting from int to ptr #43291

Fixes #43291.

Looking for feedback if I've missed something and/or need to add more tests.

@eddyb @retep998 @nagisa @oli-obk
2018-01-04 09:54:15 +00:00
Michael Woerister
238ed47d29 Generate code for const- and inline-fns if -Clink-dead-code is specified. 2018-01-04 10:12:20 +01:00
bors
78f24d86b8 Auto merge of #47124 - estebank:loan-paths, r=nikomatsakis
Reword reason for move note

On move errors, when encountering an enum variant, be more ambiguous and do not refer to the type on the cause note, to avoid referring to `(maybe as std::prelude::v1::Some).0`, and instead refer to `the value`.

Sidesteps part of the problem with #41962:

```
error[E0382]: use of partially moved value: `maybe`
 --> file.rs:5:30
  |
5 |         if let Some(thing) = maybe {
  |                     -----    ^^^^^ value used here after move
  |                     |
  |                     value moved here
  = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0`
 --> file.rs:5:21
  |
5 |         if let Some(thing) = maybe {
  |                     ^^^^^ value moved here in previous iteration of loop
  = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

error: aborting due to 2 previous errors
```

Previous discussion: #44360

r? @arielb1
2018-01-04 05:52:39 +00:00
bors
608aae904b Auto merge of #47132 - cramertj:impl-trait-camel-case, r=nikomatsakis
Limit style lint to non-synthetic generic params

Fix https://github.com/rust-lang/rust/issues/46959

r? @nikomatsakis
2018-01-04 03:12:39 +00:00
Esteban Küber
a4d46b3d87 Tweak to mir borrow in a loop diagnostic 2018-01-03 14:13:32 -08:00
Esteban Küber
e027f5a99e Add mir test, review comments 2018-01-03 13:55:40 -08:00
bors
0a3761e63e Auto merge of #46984 - arielb1:pre-statement-effect, r=nikomatsakis
NLL fixes

First, introduce pre-statement effects to dataflow to fix #46875. Edge dataflow effects might make that redundant, but I'm not sure of the best way to integrate them with liveness etc., and if this is a hack, this is one of the cleanest hacks I've seen.

And I want a small fix to avoid the torrent of bug reports.

Second, fix linking of projections to fix #46974

r? @pnkfelix
2018-01-03 21:06:21 +00:00
bors
d96cc6e286 Auto merge of #47127 - EdSchouten:cloudabi-tests, r=kennytm
First cut at getting some part of the test suite working for CloudABI

I am currently working on creating a Docker container for automated CI for CloudABI. Here are some of the trivial changes that need to land to make tests pass.
2018-01-03 17:00:24 +00:00
Ed Schouten
3ca407e24b Restore a FIXME that was removed by one of my previous changes.
Requested by: kennytm
2018-01-03 15:40:37 +01:00
bors
8d1a30289e Auto merge of #46913 - Eh2406:master, r=eddyb
CStore switch FxHashMap to IndexVec

This is a first attempt to fix #46876.
2018-01-03 12:59:52 +00:00
bors
b107f720e5 Auto merge of #47151 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

- Successful merges: #47104, #47107, #47113, #47117, #47118, #47121, #47125, #47134, #47145
- Failed merges:
2018-01-03 10:07:39 +00:00
kennytm
b416119472 Rollup merge of #47145 - frewsxcv:frewsxcv-linewriter-error, r=QuietMisdreavus
Document when LineWriter flushes; document errors for into_inner.

Fixes https://github.com/rust-lang/rust/issues/42468.
2018-01-03 16:58:04 +08:00
kennytm
08501bd983 Rollup merge of #47134 - Sogomn:master, r=QuietMisdreavus
Defocus search bar in rustdoc pages

rust-lang/rfcs#2265
2018-01-03 16:58:03 +08:00
kennytm
bf3fd1744c Rollup merge of #47125 - daboross:patch-3, r=estebank
Mention SliceConcatExt's stability in its docs

Just saw someone in IRC mention there being no stable way to join string slices! It isn't entirely clear from the rust documentation that `SliceConcatExt` is usable. While this is mentioned in https://doc.rust-lang.org/std/prelude/, the trait has nothing to indicate that it's currently usable if found via a documentation search.

The wording on this could probably be improved, but I'm hoping its better than nothing.
2018-01-03 16:58:02 +08:00
kennytm
8bfb420d63 Rollup merge of #47121 - frewsxcv:frewsxcv-vec, r=kennytm
Fix panic condition docs for Vec::insert.

Fixes https://github.com/rust-lang/rust/issues/47065.
2018-01-03 16:58:01 +08:00
kennytm
2182f1431c Rollup merge of #47118 - hdhoang:patch-2, r=BurntSushi
memchr: fix variable name in docstrings

upstream BurntSushi/rust-memchr#24

r=BurntSushi
2018-01-03 16:58:00 +08:00
kennytm
d6cf5a56ac Rollup merge of #47117 - tinaun:no_more_dups, r=frewsxcv
[unstable book] remove duplicate entries

if a unstable feature is a language feature, it shouldn't also have a library feature stub generated
2018-01-03 16:57:58 +08:00
kennytm
219e72c908 Rollup merge of #47113 - sdroege:chunks-size-field, r=dtolnay
Minor cleanup for slice::Chunks and ChunksMut

This only renames the `size` field to `chunk_size` in one of them for consistency, and changes an assertion to check for != 0 instead of > 0.
2018-01-03 16:57:57 +08:00
kennytm
dd0b70e3fe Rollup merge of #47107 - mark-i-m:patch-1, r=steveklabnik
Fix typo

I am assuming that there was once something else you could do and somebody forgot to remove "either". Is that correct?
2018-01-03 16:57:56 +08:00
kennytm
f7932ef1d5 Rollup merge of #47104 - matthewjasper:dont-panic-on-generic-drop, r=estebank
Delay panic from incoherent drop implementation

Closes #41974
2018-01-03 16:57:55 +08:00
bors
b8934399a8 Auto merge of #47088 - clarcharr:cleanup_unicode_py, r=alexcrichton
Move static code outside of unciode.py.

This script in libstd_unicode is a mess and also contains code that shouldn't be output by a script, and instead just put in modules. So, this change does that.
2018-01-03 06:24:23 +00:00
projektir
6536d363d5 Force appropriate extension when converting from int to ptr #43291 2018-01-02 20:23:13 -08:00
Clar Charr
b4b3ddd59e Move static code outside of unciode.py. 2018-01-02 22:51:22 -05:00
Esteban Küber
48b684a40a Be ambiguous when type cannot be properly mentioned 2018-01-02 19:49:38 -08:00
bors
0f4ebf9f0a Auto merge of #47146 - ereslibre:issue-42106, r=estebank
Only bump error count when we are sure that the diagnostic is not a repetition

This ensures that if we emit the same diagnostic twice, the error count will
match the real number of errors shown to the user.

Fixes #42106

This is a followup of https://github.com/rust-lang/rust/pull/45603 as stated in https://github.com/rust-lang/rust/issues/42106#issuecomment-345218473.

This program, for example:

```rust
fn do_something<T>(collection: &mut Vec<T>) {
    let _a = &collection;
    collection.swap(1, 2);
}

fn main() {}
```

without this patch, produces:

```
error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
  --> $DIR/issue-42106.rs:13:5
   |
12 |     let _a = &collection;
   |               ---------- immutable borrow occurs here
13 |     collection.swap(1, 2); //~ ERROR also borrowed as immutable
   |     ^^^^^^^^^^ mutable borrow occurs here
14 | }
   | - immutable borrow ends here

error: aborting due to 2 previous errors
```

The number of errors do not match the diagnostics reported. This PR fixes this problem. The output is now in this case:

```
error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
  --> $DIR/issue-42106.rs:13:5
   |
12 |     let _a = &collection;
   |               ---------- immutable borrow occurs here
13 |     collection.swap(1, 2); //~ ERROR also borrowed as immutable
   |     ^^^^^^^^^^ mutable borrow occurs here
14 | }
   | - immutable borrow ends here

error: aborting due to previous error
```

Also, some other tests outputs have been adapted because their count didn't really match the number of diagnostics reported.

As an aside, an outdated comment has been removed (`Handler::cancel` will only call to the `Diagnostic::cancel` method and will not decrease the count of errors).

All tests are passing with this PR (`x.py test` is successful).
2018-01-03 03:37:47 +00:00
Rafael Fernández López
063607eecb
Only bump error count when we are sure that the diagnostic is not a repetition.
This ensures that if we emit the same diagnostic twice, the error count will
match the real number of errors shown to the user.

Fixes #42106
2018-01-03 00:42:12 +01:00
Corey Farwell
f3ef077b91 Document when LineWriter flushes; document errors for into_inner.
Fixes https://github.com/rust-lang/rust/issues/42468.
2018-01-02 13:30:44 -08:00
Johannes Boczek
3153d23bb7 Indentation fix
Fixed intentaion (tabs -> spaces)
Added trailing newline
2018-01-02 19:58:06 +01:00
Johannes Boczek
0772b6faed Defocus search bar in rustdoc pages
Escape now removes focus from the search bar
2018-01-02 19:47:44 +01:00
Taylor Cramer
b86a65d39b Limit style lint to non-synthetic generic params 2018-01-02 09:42:11 -08:00
Ed Schouten
c51f8783f2 Correct for changes in line numbers in expected stderr output.
Due to the disable-cloudabi tags being added to the source files, the
expected output of the compiler is altered slightly.
2018-01-02 18:12:10 +01:00
bors
687d3d15ba Auto merge of #47105 - matthewjasper:dont-panic-for-mut-in-static, r=estebank
Delay panic for aliasing violation for static items.

Closes #46604
2018-01-02 15:40:20 +00:00
Ed Schouten
abced5a6b5 Provide a copy of stdout_isatty() on CloudABI.
CloudABI doesn't make any distinction between TTYs and ordinary pipes.
While there, remove the redundant implementation used by Redox. It can
use the same stub function.
2018-01-02 14:22:37 +01:00
Ed Schouten
04ce26a6f6 Force the creation of libs instead of dylibs on CloudABI.
CloudABI doesn't support the creation of dynamic libraries. Any test
making use of auxiliary libraries will fail without this change applied.
2018-01-02 14:18:40 +01:00
Ed Schouten
3f880912e9 Add 'ignore-cloudabi' to tests that don't and won't build on CloudABI.
It looks like many of these tests are already disabled on emscripten,
which also doesn't seem to support environment variables and subprocess
spawning. Just add a similar tag for CloudABI. While there, sort some of
the lists of operating systems alphabetically.
2018-01-02 14:11:41 +01:00
bors
a37126b90c Auto merge of #47042 - redox-os:redox, r=estebank
Redox - Implement rename using new system call

This does the following:

- Update syscall module to match upstream
- Implement rename using new system call
- Make readlink and symlink utilize O_CLOEXEC
- Make readlink and symlink not leave dangling file handles on failure
2018-01-02 11:22:40 +00:00
David Ross
d5acd23565 Mention SliceConcatExt's stability in its docs
SliceConcatExt's status as an unstable trait with stable methods is
documented in the compiler error for using it, and in
https://doc.rust-lang.org/std/prelude/, but it is not mentioned in the
trait itself.

Mentioning the methods can be used in stable rust today should help
users who are looking for a `join` method while working on stable rust.
2018-01-02 00:38:03 -08:00
bors
5873a74d8f Auto merge of #47111 - rkruppe:repr-transparent, r=estebank
Check all repr hints together when checking for mis-applied attributes

Fixes #47094

Besides fixing that bug, this change has a user-visible effect on the spans in the "incompatible repr hints" warning and another error: they now point at `foo` and/or `bar` in `repr(foo, bar)` instead of the whole attribute. This is sometimes more precise (e.g., `#[repr(C, packed)]` on an enum points at the `packed`) but sometimes not. I moved a compile-fail test to a ui test to illustrate how it now looks in the common case of only one attribute.
2018-01-02 08:34:27 +00:00
Sebastian Dröge
c096b3a451 Use assert!(chunk_size != 0) instead of > 0 for usize value 2018-01-02 10:00:58 +02:00
Sebastian Dröge
9957cf6023 Consistently use chunk_size as the field name for Chunks and ChunksMut
Previously Chunks used size and ChunksMut used chunk_size
2018-01-02 10:00:58 +02:00
Esteban Küber
6c506d4c71 Address review comments: make label shorter 2018-01-01 22:10:13 -08:00
Esteban Küber
be6734a7e7 Move reason for move to label 2018-01-01 21:55:46 -08:00
Corey Farwell
301e457989 Fix panic condition docs for Vec::insert.
Fixes https://github.com/rust-lang/rust/issues/47065.
2018-01-01 19:06:59 -08:00
tinaun
5c25b0c594 prevent generating duplicate stubs 2018-01-01 19:56:40 -05:00
bors
b9cf26c38a Auto merge of #47106 - EdSchouten:compiletest-cloudabi, r=alexcrichton
Tiny fixes to make compiletest work for CloudABI cross builds

I'm currently working toward getting a `src/ci/docker` container working to do isolated/automated builds and testing of `x86_64-unknown-cloudabi`. This is working pretty well, but still requires some fixes to `libtest` and `compiletest`. Here is the first set of fixes that I had to apply.
2018-01-02 00:31:07 +00:00
Robin Kruppe
03936115ef Check all repr hints together when checking for mis-applied attributes
Fixes #47094

Besides fixing that bug, this change has a user-visible effect on the spans in the "incompatible repr hints" warning and another error: they now point at `foo` and/or `bar` in `repr(foo, bar)` instead of the whole attribute. This is sometimes more precise (e.g., `#[repr(C, packed)]` on an enum points at the `packed`) but sometimes not. I moved a compile-fail test to a ui test to illustrate how it now looks in the common case of only one attribute.
2018-01-01 22:05:29 +01:00
Who? Me?!
05cbe6d7db
Fix typo 2018-01-01 13:17:25 -06:00
bors
b65f0bedd2 Auto merge of #46735 - Manishearth:memchr-find, r=burntsushi
Use memchr for str::find(char)

This is a 10x improvement for searching for characters.

This also contains the patches from https://github.com/rust-lang/rust/pull/46713 . Feel free to land both separately or together.

cc @mystor @alexcrichton

r? @bluss

fixes #46693
2018-01-01 19:04:33 +00:00
Ed Schouten
7b5543d7b6 Move the TestPaths structure from libtest to compiletest.
This structure doesn't seem to be used by libtest itself. It is used by
compiletest, but never passed on to anything externally. This makes it
easier to get the testing framework to work for CloudABI crossbuilds, as
CloudABI currently lacks PathBuf, which is used by TestPaths.
2018-01-01 19:30:19 +01:00