Commit Graph

73168 Commits

Author SHA1 Message Date
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
Sebastian Dröge b69c124255 Fix potential overflow in TrustedRandomAccess impl for slice::{Chunks,ChunksMut} 2018-01-04 11:34:05 +02: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
Björn Steinbrink 7e522b2f0e Simplify LLVMRustModuleCost() 2018-01-04 08:57:14 +01:00
Björn Steinbrink 493c29d35a Remove unused function LLVMRustGetValueContext()
Refs #46437
2018-01-04 08:57:14 +01:00
Björn Steinbrink d7bbd3042c Remove outdated LLVMRustBuildLandingPad() wrapper
The function was added as a wrapper to handle compatibility with older
LLVM versions that we no longer support, so it can be removed.

Refs #46437
2018-01-04 08:57:14 +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
Eduard-Mihai Burtescu 210ac01792 rustc: use {U,I}size instead of {U,I}s shorthands. 2018-01-04 03:12:04 +02:00
Eduard-Mihai Burtescu 9599066dcb rustc: remove misleading `Ty::is_uint` method. 2018-01-04 02:32:39 +02: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
Stjepan Glavina 6076cf6f4e Remove `T: Ord` bound from `BTreeSet::{is_empty, len}` 2018-01-03 20:00:11 +01:00
Ed Schouten 05949b09a8 Explain why local-exec is used by CloudABI. 2018-01-03 18:32:41 +01:00
Steve Klabnik 50989cd98d
This is an unstable feature 2018-01-03 12:05:57 -05: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
Steve Klabnik 47e18e0db7
This isn't in Rust 1.23 2018-01-03 11:58:42 -05:00
Sam 28dd4d974e Restore working debuginfo tests by trimming comments from non-header directive lines 2018-01-03 15:03:00 +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
Sebastian Dröge 3f29e2b495 Fix compilation of TrustedRandomAccess impl for slice::Chunks
https://github.com/rust-lang/rust/pull/47113 renamed the private size
field to chunk_size for consistency.
2018-01-03 15:05:18 +02:00
Sebastian Dröge a56a3fc85f Add unit test for zipping slice::{Chunks, ChunksMut, Windows} iterators
For testing if the TrustedRandomAccess implementation works.
2018-01-03 15:05:18 +02:00
Sebastian Dröge 48f2f71185 Implement TrustedRandomAccess for slice::{Chunks, ChunksMut, Windows} 2018-01-03 15:05:18 +02: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
Sergio Benitez ab365be140 Add 'Span.parent()' and 'Span.source()' to proc_macro API. 2018-01-03 00:20:33 -08:00
David Tolnay 000e907c1f
Span::resolved_at and Span::located_at to combine behavior of two spans
Proc macro spans serve two mostly unrelated purposes: controlling name
resolution and controlling error messages. It can be useful to mix the
name resolution behavior of one span with the line/column error message
locations of a different span.

In particular, consider the case of a trait brought into scope within
the def_site of a custom derive. I want to invoke trait methods on the
fields of the user's struct. If the field type does not implement the
right trait, I want the error message to underline the corresponding
struct field.

Generating the method call with the def_site span is not ideal -- it
compiles and runs but error messages sadly always point to the derive
attribute like we saw with Macros 1.1.

```
  |
4 | #[derive(HeapSize)]
  |          ^^^^^^^^
```

Generating the method call with the same span as the struct field's
ident or type is not correct -- it shows the right underlines but fails
to resolve to the trait in scope at the def_site.

```
  |
7 |     bad: std:🧵:Thread,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
```

The correct span for the method call is one that combines the def_site's
name resolution with the struct field's line/column.

```
field.span.resolved_at(Span::def_site())

// equivalently
Span::def_site().located_at(field.span)
```

Adding both because which one is more natural will depend on context.
2018-01-02 23:43:52 -08:00
David Tolnay 2b9add2c16
Return None from Span::join if in different files 2018-01-02 23:37:36 -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