]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton
bors [Sat, 6 Jan 2018 14:50:14 +0000 (14:50 +0000)]
Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton

Bump to 1.25.0

* Bump the release version to 1.25
* Bump the bootstrap compiler to the recent beta
* Allow using unstable rustdoc features on beta - this fix has been applied to
  the beta branch but needed to go to the master branch as well.

6 years agoAuto merge of #47099 - SergioBenitez:master, r=jseyfried
bors [Sat, 6 Jan 2018 12:02:36 +0000 (12:02 +0000)]
Auto merge of #47099 - SergioBenitez:master, r=jseyfried

Add 'Span::parent()' and 'Span::source()' to proc_macro API.

As the title suggests: a couple of useful methods for `proc_macro`.

6 years agoAuto merge of #47083 - CAD97:issue-46976, r=nikomatsakis
bors [Sat, 6 Jan 2018 09:22:16 +0000 (09:22 +0000)]
Auto merge of #47083 - CAD97:issue-46976, r=nikomatsakis

Issue 46976

ICE is due to an empty path segments, so I set the path to be the same as the in band ty params symbol. (I think this is how regular generics end up being handled?)

Pinging @cramertj, this is your code I'm editing here.

6 years agoAuto merge of #47155 - nerd2:debuginfo_test_fix, r=alexcrichton
bors [Sat, 6 Jan 2018 05:20:22 +0000 (05:20 +0000)]
Auto merge of #47155 - nerd2:debuginfo_test_fix, r=alexcrichton

Restore working debuginfo tests by trimming comments from non-header directive lines

I noticed when adding a debuginfo test that nothing I did caused the test to fail. Tracing back this seems to have been caused by 3e6c83de1dc0a72df3663617d394a9e79641618d which broke parsing of the command/check lines, leaving all tests passing without any checking. This commit provides a basic (although still not very robust) restoration of tests and a should-fail test which checks the parser is running

6 years agoAuto merge of #47225 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sat, 6 Jan 2018 02:36:41 +0000 (02:36 +0000)]
Auto merge of #47225 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #46987, #47165, #47173, #47202, #47216
- Failed merges:

6 years agoRollup merge of #47216 - SergioBenitez:doc-fix, r=Mark-Simulacrum
Guillaume Gomez [Sat, 6 Jan 2018 01:13:36 +0000 (02:13 +0100)]
Rollup merge of #47216 - SergioBenitez:doc-fix, r=Mark-Simulacrum

Clarify appending behavior of 'io::Read::read_to_string()'.

A simple doc clarification.

6 years agoRollup merge of #47202 - GuillaumeGomez:fix-defocus, r=QuietMisdreavus
Guillaume Gomez [Sat, 6 Jan 2018 01:13:35 +0000 (02:13 +0100)]
Rollup merge of #47202 - GuillaumeGomez:fix-defocus, r=QuietMisdreavus

Fix search bar defocus

Fixes #47134.

r? @QuietMisdreavus

6 years agoRollup merge of #47173 - dotdash:cleanup, r=michaelwoerister
Guillaume Gomez [Sat, 6 Jan 2018 01:13:34 +0000 (02:13 +0100)]
Rollup merge of #47173 - dotdash:cleanup, r=michaelwoerister

Remove some outdated LLVM-related code

Ticks two boxes on #46437

6 years agoRollup merge of #47165 - mbrubeck:args, r=alexcrichton
Guillaume Gomez [Sat, 6 Jan 2018 01:13:33 +0000 (02:13 +0100)]
Rollup merge of #47165 - mbrubeck:args, r=alexcrichton

[unix] Don't clone command-line args on startup

Fixes part of #47164 and simplifies the `args` code on non-Apple Unix platforms.

Note: This could change behavior for programs that use both `std::env::args` *and* unsafe code that mutates `argv` directly.  However, these programs already behave differently on different platforms.  The new behavior on non-Apple platforms is closer to the existing behavior on Apple platforms.

6 years agoRollup merge of #46987 - frewsxcv:frewsxcv-current-exe, r=QuietMisdreavus
Guillaume Gomez [Sat, 6 Jan 2018 01:13:32 +0000 (02:13 +0100)]
Rollup merge of #46987 - frewsxcv:frewsxcv-current-exe, r=QuietMisdreavus

Minor rewrite of env::current_exe docs; clarify symlinks.

- Update example in ‘security’ section to use hard links, like the
  linked securityvulns.com example.
- Weaken language on symbolic links – indicate behavior is
  platform-specific

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

6 years agorustc: Don't ICE if we invalidate an invalid incr dir
Alex Crichton [Fri, 5 Jan 2018 18:07:36 +0000 (10:07 -0800)]
rustc: Don't ICE if we invalidate an invalid incr dir

This showed up on the Windows bot for testing this PR, and this pr allows
`mark_incr_comp_session_as_invalid` ok if it's already invalid, hopefully
avoiding scary ICEs and instead leaving the nicely printed errors

6 years agoAuto merge of #47142 - sdroege:trusted-random-access-chunks, r=kennytm
bors [Fri, 5 Jan 2018 14:17:04 +0000 (14:17 +0000)]
Auto merge of #47142 - sdroege:trusted-random-access-chunks, r=kennytm

Implement TrustedRandomAccess for slice::{Chunks, ChunksMut, Windows}

As suggested by @bluss in https://github.com/rust-lang/rust/issues/47115#issuecomment-354888334

6 years agoClarify appending behavior of 'io::Read::read_to_string()'.
Sergio Benitez [Fri, 5 Jan 2018 12:24:12 +0000 (04:24 -0800)]
Clarify appending behavior of 'io::Read::read_to_string()'.

6 years agoDisable failing tests temporarily
Sam [Wed, 3 Jan 2018 18:24:25 +0000 (18:24 +0000)]
Disable failing tests temporarily

6 years agoAuto merge of #47214 - kennytm:rollup, r=kennytm
bors [Fri, 5 Jan 2018 10:07:47 +0000 (10:07 +0000)]
Auto merge of #47214 - kennytm:rollup, r=kennytm

Rollup of 10 pull requests

- Successful merges: #47030, #47033, #47110, #47149, #47150, #47160, #47162, #47182, #47198, #47199
- Failed merges:

6 years agoRollup merge of #47199 - alexcrichton:stable-no-dev, r=kennytm
kennytm [Fri, 5 Jan 2018 09:22:13 +0000 (17:22 +0800)]
Rollup merge of #47199 - alexcrichton:stable-no-dev, r=kennytm

rustbuild: Don't allow stable bootstrap from dev

I forgot to update the bootstrap compiler for the 1.23.0 release so let's make
sure it doesn't happen again!

6 years agoRollup merge of #47198 - dzamlo:patch-2, r=frewsxcv
kennytm [Fri, 5 Jan 2018 09:22:12 +0000 (17:22 +0800)]
Rollup merge of #47198 - dzamlo:patch-2, r=frewsxcv

Fix an error in std::process documentation

6 years agoRollup merge of #47182 - aheart:master, r=steveklabnik
kennytm [Fri, 5 Jan 2018 09:22:11 +0000 (17:22 +0800)]
Rollup merge of #47182 - aheart:master, r=steveklabnik

Equivalent example for ? operator

The example with the ? operator in the documentation for try! macro was missing file.write_all.
Now all three examples are consistent.

6 years agoRollup merge of #47162 - stjepang:cleanup-btreeset, r=alexcrichton
kennytm [Fri, 5 Jan 2018 09:22:10 +0000 (17:22 +0800)]
Rollup merge of #47162 - stjepang:cleanup-btreeset, r=alexcrichton

Remove `T: Ord` bound from `BTreeSet::{is_empty, len}`

This change makes the API for `BTreeSet` more consistent with `BTreeMap`, where `BTreeMap::{is_empty, len}` don't require `T: Ord` either.

Also, it reduces the number of `impl`s for `BTreeSet`, making the generated documentation look much cleaner. Closes #47138.

cc @rust-lang/libs

6 years agoRollup merge of #47160 - rust-lang:steveklabnik-patch-1, r=alexcrichton
kennytm [Fri, 5 Jan 2018 09:22:09 +0000 (17:22 +0800)]
Rollup merge of #47160 - rust-lang:steveklabnik-patch-1, r=alexcrichton

This isn't in Rust 1.23

r? @alexcrichton

6 years agoRollup merge of #47150 - dtolnay:join, r=jseyfried
kennytm [Fri, 5 Jan 2018 09:22:08 +0000 (17:22 +0800)]
Rollup merge of #47150 - dtolnay:join, r=jseyfried

Return None from Span::join if in different files

Fixes #47148. r? @abonander

6 years agoRollup merge of #47149 - dtolnay:spans, r=jseyfried
kennytm [Fri, 5 Jan 2018 09:22:07 +0000 (17:22 +0800)]
Rollup merge of #47149 - dtolnay:spans, r=jseyfried

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::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.

```rust
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.

Addresses https://github.com/rust-lang/rust/issues/38356#issuecomment-354947143. r? @jseyfried

6 years agoRollup merge of #47110 - EdSchouten:cloudabi-tls, r=kennytm
kennytm [Fri, 5 Jan 2018 09:22:06 +0000 (17:22 +0800)]
Rollup merge of #47110 - EdSchouten:cloudabi-tls, r=kennytm

Use the right TLS model for CloudABI.

CloudABI doesn't do dynamic linking. For this reason, there is no need
to handle any other TLS model than local-exec. CloudABI's C library
doesn't provide a __tls_get_addr() function to do Dynamic TLS.

By forcing local-exec to be used here, we ensure that we don't generate
function calls to __tls_get_addr().

6 years agoRollup merge of #47033 - EdSchouten:cloudabi-oom, r=kennytm
kennytm [Fri, 5 Jan 2018 09:22:05 +0000 (17:22 +0800)]
Rollup merge of #47033 - EdSchouten:cloudabi-oom, r=kennytm

Disable printing of error message on file descriptor 2 on CloudABI.

As CloudABI is a capability-based runtime environment, file descriptors
are the mechanism that grants rights to a process. These file
descriptors may be passed into processes on startup using a utility
called cloudabi-run. Unlike the POSIX shell, cloudabi-run does not
follow the UNIX model where file descriptors 0, 1 and 2 represent stdin,
stdout and stderr. There can be arbitrary many (or few) file descriptors
that can be provided. For this reason, CloudABI's C library also doesn't
define STD*_FILENO. liblibc should also not declare these.

Disable the code in liballoc_system that tries to print error messages
over file descriptor 2. For now, let's keep this function quiet. We'll
see if we can think of some other way to log this in the future.

6 years agoRollup merge of #47030 - ollie27:stab, r=alexcrichton
kennytm [Fri, 5 Jan 2018 09:22:04 +0000 (17:22 +0800)]
Rollup merge of #47030 - ollie27:stab, r=alexcrichton

Correct a few stability attributes

* The extra impls for `ManuallyDrop` were added in #44310 which was only stabilised in 1.22.0.
* The impls for `SliceIndex` were stabilised in #43373 but as `RangeInclusive` and `RangeToInclusive` are still unstable the impls should remain unstable.
* The `From` impls for atomic integers were added in #45610 but most atomic integers are still unstable.
* The `shared_from_slice2` impls were added in #45990 but they won't be stable until 1.24.0.
* The `Mutex` and `RwLock` impls were added in #46082 but won't be stable until 1.24.0.

6 years agoAuto merge of #46907 - varkor:contrib-8, r=nagisa
bors [Fri, 5 Jan 2018 05:20:23 +0000 (05:20 +0000)]
Auto merge of #46907 - varkor:contrib-8, r=nagisa

Allow non-alphabetic underscores in camel case

Certain identifiers, such as `X86_64`, cannot currently be unambiguously represented in camel case (`X8664`, `X86_64`, `X8_664`, etc. are all transformed to the same identifier). This change relaxes the rules so that underscores are permitted between two non-alphabetic characters under `#[forbid(non_camel_case_types)]`. Fixes #34633 and fixes #41621.

6 years agoAuto merge of #46739 - arielb1:simple-loops, r=nikomatsakis
bors [Fri, 5 Jan 2018 02:31:19 +0000 (02:31 +0000)]
Auto merge of #46739 - arielb1:simple-loops, r=nikomatsakis

[needs perf run] Try to improve LLVM pass ordering

Fixes #45466

6 years agoFix search bar defocus
Guillaume Gomez [Fri, 5 Jan 2018 00:14:10 +0000 (01:14 +0100)]
Fix search bar defocus

6 years ago[unix] Don't clone command-line args on startup
Matt Brubeck [Wed, 3 Jan 2018 20:09:22 +0000 (12:09 -0800)]
[unix] Don't clone command-line args on startup

6 years agorustbuild: Don't allow stable bootstrap from dev
Alex Crichton [Thu, 4 Jan 2018 21:14:15 +0000 (13:14 -0800)]
rustbuild: Don't allow stable bootstrap from dev

I forgot to update the bootstrap compiler for the 1.23.0 release so let's make
sure it doesn't happen again!

6 years agoFix an error in std::process documentation
Loïc Damien [Thu, 4 Jan 2018 21:01:57 +0000 (22:01 +0100)]
Fix an error in std::process documentation

6 years agorustc: Don't use relative paths for extended errors
Alex Crichton [Wed, 3 Jan 2018 00:21:35 +0000 (16:21 -0800)]
rustc: Don't use relative paths for extended errors

These no longer work now that Cargo changes the cwd of rustc while it's running.
Instead use an absolute path that's set by rustbuild.

6 years agoBump to 1.25.0
Alex Crichton [Tue, 2 Jan 2018 01:53:47 +0000 (17:53 -0800)]
Bump to 1.25.0

* Bump the release version to 1.25
* Bump the bootstrap compiler to the recent beta
* Allow using unstable rustdoc features on beta - this fix has been applied to
  the beta branch but needed to go to the master branch as well.

6 years agoAuto merge of #46916 - michaelwoerister:generate-dead-code-plz, r=alexcrichton
bors [Thu, 4 Jan 2018 14:04:27 +0000 (14:04 +0000)]
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

6 years agoMake examples equivalent
aheart [Thu, 4 Jan 2018 13:55:01 +0000 (15:55 +0200)]
Make examples equivalent

The example with the ? operator was missing file.write_all

6 years agoAuto merge of #47147 - projektir:to_ptr_cast, r=eddyb
bors [Thu, 4 Jan 2018 09:54:15 +0000 (09:54 +0000)]
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

6 years agoFix potential overflow in TrustedRandomAccess impl for slice::{Chunks,ChunksMut}
Sebastian Dröge [Thu, 4 Jan 2018 09:34:05 +0000 (11:34 +0200)]
Fix potential overflow in TrustedRandomAccess impl for slice::{Chunks,ChunksMut}

6 years agoGenerate code for const- and inline-fns if -Clink-dead-code is specified.
Michael Woerister [Thu, 21 Dec 2017 16:49:24 +0000 (17:49 +0100)]
Generate code for const- and inline-fns if -Clink-dead-code is specified.

6 years agoSimplify LLVMRustModuleCost()
Björn Steinbrink [Fri, 8 Dec 2017 10:23:23 +0000 (11:23 +0100)]
Simplify LLVMRustModuleCost()

6 years agoRemove unused function LLVMRustGetValueContext()
Björn Steinbrink [Fri, 8 Dec 2017 10:07:08 +0000 (11:07 +0100)]
Remove unused function LLVMRustGetValueContext()

Refs #46437

6 years agoRemove outdated LLVMRustBuildLandingPad() wrapper
Björn Steinbrink [Fri, 8 Dec 2017 09:53:46 +0000 (10:53 +0100)]
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

6 years agoAuto merge of #47124 - estebank:loan-paths, r=nikomatsakis
bors [Thu, 4 Jan 2018 05:52:39 +0000 (05:52 +0000)]
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

6 years agoAuto merge of #47132 - cramertj:impl-trait-camel-case, r=nikomatsakis
bors [Thu, 4 Jan 2018 03:12:39 +0000 (03:12 +0000)]
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

6 years agoTweak to mir borrow in a loop diagnostic
Esteban Küber [Wed, 3 Jan 2018 22:13:32 +0000 (14:13 -0800)]
Tweak to mir borrow in a loop diagnostic

6 years agoAdd mir test, review comments
Esteban Küber [Wed, 3 Jan 2018 21:55:40 +0000 (13:55 -0800)]
Add mir test, review comments

6 years agoAuto merge of #46984 - arielb1:pre-statement-effect, r=nikomatsakis
bors [Wed, 3 Jan 2018 21:06:21 +0000 (21:06 +0000)]
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

6 years agoRemove `T: Ord` bound from `BTreeSet::{is_empty, len}`
Stjepan Glavina [Wed, 3 Jan 2018 19:00:11 +0000 (20:00 +0100)]
Remove `T: Ord` bound from `BTreeSet::{is_empty, len}`

6 years agoExplain why local-exec is used by CloudABI.
Ed Schouten [Wed, 3 Jan 2018 17:32:41 +0000 (18:32 +0100)]
Explain why local-exec is used by CloudABI.

6 years agoThis is an unstable feature
Steve Klabnik [Wed, 3 Jan 2018 17:05:57 +0000 (12:05 -0500)]
This is an unstable feature

6 years agoAuto merge of #47127 - EdSchouten:cloudabi-tests, r=kennytm
bors [Wed, 3 Jan 2018 17:00:24 +0000 (17:00 +0000)]
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.

6 years agoThis isn't in Rust 1.23
Steve Klabnik [Wed, 3 Jan 2018 16:58:42 +0000 (11:58 -0500)]
This isn't in Rust 1.23

6 years agoRestore working debuginfo tests by trimming comments from non-header directive lines
Sam [Wed, 3 Jan 2018 15:03:00 +0000 (15:03 +0000)]
Restore working debuginfo tests by trimming comments from non-header directive lines

6 years agoRestore a FIXME that was removed by one of my previous changes.
Ed Schouten [Wed, 3 Jan 2018 14:40:37 +0000 (15:40 +0100)]
Restore a FIXME that was removed by one of my previous changes.

Requested by: kennytm

6 years agoFix compilation of TrustedRandomAccess impl for slice::Chunks
Sebastian Dröge [Wed, 3 Jan 2018 10:26:55 +0000 (12:26 +0200)]
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.

6 years agoAdd unit test for zipping slice::{Chunks, ChunksMut, Windows} iterators
Sebastian Dröge [Wed, 3 Jan 2018 10:25:18 +0000 (12:25 +0200)]
Add unit test for zipping slice::{Chunks, ChunksMut, Windows} iterators

For testing if the TrustedRandomAccess implementation works.

6 years agoImplement TrustedRandomAccess for slice::{Chunks, ChunksMut, Windows}
Sebastian Dröge [Tue, 2 Jan 2018 22:58:56 +0000 (00:58 +0200)]
Implement TrustedRandomAccess for slice::{Chunks, ChunksMut, Windows}

6 years agoAuto merge of #46913 - Eh2406:master, r=eddyb
bors [Wed, 3 Jan 2018 12:59:52 +0000 (12:59 +0000)]
Auto merge of #46913 - Eh2406:master, r=eddyb

CStore switch FxHashMap to IndexVec

This is a first attempt to fix #46876.

6 years agoAuto merge of #47151 - kennytm:rollup, r=kennytm
bors [Wed, 3 Jan 2018 10:07:39 +0000 (10:07 +0000)]
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:

6 years agoRollup merge of #47145 - frewsxcv:frewsxcv-linewriter-error, r=QuietMisdreavus
kennytm [Wed, 3 Jan 2018 08:58:04 +0000 (16:58 +0800)]
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.

6 years agoRollup merge of #47134 - Sogomn:master, r=QuietMisdreavus
kennytm [Wed, 3 Jan 2018 08:58:03 +0000 (16:58 +0800)]
Rollup merge of #47134 - Sogomn:master, r=QuietMisdreavus

Defocus search bar in rustdoc pages

rust-lang/rfcs#2265

6 years agoRollup merge of #47125 - daboross:patch-3, r=estebank
kennytm [Wed, 3 Jan 2018 08:58:02 +0000 (16:58 +0800)]
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.

6 years agoRollup merge of #47121 - frewsxcv:frewsxcv-vec, r=kennytm
kennytm [Wed, 3 Jan 2018 08:58:01 +0000 (16:58 +0800)]
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.

6 years agoRollup merge of #47118 - hdhoang:patch-2, r=BurntSushi
kennytm [Wed, 3 Jan 2018 08:58:00 +0000 (16:58 +0800)]
Rollup merge of #47118 - hdhoang:patch-2, r=BurntSushi

memchr: fix variable name in docstrings

upstream BurntSushi/rust-memchr#24

r=BurntSushi

6 years agoRollup merge of #47117 - tinaun:no_more_dups, r=frewsxcv
kennytm [Wed, 3 Jan 2018 08:57:58 +0000 (16:57 +0800)]
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

6 years agoRollup merge of #47113 - sdroege:chunks-size-field, r=dtolnay
kennytm [Wed, 3 Jan 2018 08:57:57 +0000 (16:57 +0800)]
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.

6 years agoRollup merge of #47107 - mark-i-m:patch-1, r=steveklabnik
kennytm [Wed, 3 Jan 2018 08:57:56 +0000 (16:57 +0800)]
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?

6 years agoRollup merge of #47104 - matthewjasper:dont-panic-on-generic-drop, r=estebank
kennytm [Wed, 3 Jan 2018 08:57:55 +0000 (16:57 +0800)]
Rollup merge of #47104 - matthewjasper:dont-panic-on-generic-drop, r=estebank

Delay panic from incoherent drop implementation

Closes #41974

6 years agoAdd 'Span.parent()' and 'Span.source()' to proc_macro API.
Sergio Benitez [Mon, 1 Jan 2018 02:30:13 +0000 (18:30 -0800)]
Add 'Span.parent()' and 'Span.source()' to proc_macro API.

6 years agoSpan::resolved_at and Span::located_at to combine behavior of two spans
David Tolnay [Wed, 3 Jan 2018 07:29:11 +0000 (23:29 -0800)]
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::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.

6 years agoReturn None from Span::join if in different files
David Tolnay [Wed, 3 Jan 2018 07:37:36 +0000 (23:37 -0800)]
Return None from Span::join if in different files

6 years agoAuto merge of #47088 - clarcharr:cleanup_unicode_py, r=alexcrichton
bors [Wed, 3 Jan 2018 06:24:23 +0000 (06:24 +0000)]
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.

6 years agoForce appropriate extension when converting from int to ptr #43291
projektir [Tue, 2 Jan 2018 20:44:54 +0000 (12:44 -0800)]
Force appropriate extension when converting from int to ptr #43291

6 years agoMove static code outside of unciode.py.
Clar Charr [Sun, 31 Dec 2017 07:08:15 +0000 (02:08 -0500)]
Move static code outside of unciode.py.

6 years agoBe ambiguous when type cannot be properly mentioned
Esteban Küber [Tue, 2 Jan 2018 06:23:13 +0000 (22:23 -0800)]
Be ambiguous when type cannot be properly mentioned

6 years agoAuto merge of #47146 - ereslibre:issue-42106, r=estebank
bors [Wed, 3 Jan 2018 03:37:47 +0000 (03:37 +0000)]
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).

6 years agoOnly bump error count when we are sure that the diagnostic is not a repetition.
Rafael Fernández López [Tue, 2 Jan 2018 19:00:12 +0000 (20:00 +0100)]
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

6 years agoDocument when LineWriter flushes; document errors for into_inner.
Corey Farwell [Tue, 2 Jan 2018 21:30:44 +0000 (13:30 -0800)]
Document when LineWriter flushes; document errors for into_inner.

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

6 years agoIndentation fix
Johannes Boczek [Tue, 2 Jan 2018 18:58:06 +0000 (19:58 +0100)]
Indentation fix

Fixed intentaion (tabs -> spaces)
Added trailing newline

6 years agoDefocus search bar in rustdoc pages
Johannes Boczek [Tue, 2 Jan 2018 18:47:44 +0000 (19:47 +0100)]
Defocus search bar in rustdoc pages

Escape now removes focus from the search bar

6 years agoLimit style lint to non-synthetic generic params
Taylor Cramer [Tue, 2 Jan 2018 17:08:49 +0000 (09:08 -0800)]
Limit style lint to non-synthetic generic params

6 years agoCorrect for changes in line numbers in expected stderr output.
Ed Schouten [Tue, 2 Jan 2018 16:19:20 +0000 (17:19 +0100)]
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.

6 years agoAuto merge of #47105 - matthewjasper:dont-panic-for-mut-in-static, r=estebank
bors [Tue, 2 Jan 2018 15:40:20 +0000 (15:40 +0000)]
Auto merge of #47105 - matthewjasper:dont-panic-for-mut-in-static, r=estebank

Delay panic for aliasing violation for static items.

Closes #46604

6 years agoProvide a copy of stdout_isatty() on CloudABI.
Ed Schouten [Tue, 2 Jan 2018 13:22:37 +0000 (14:22 +0100)]
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.

6 years agoForce the creation of libs instead of dylibs on CloudABI.
Ed Schouten [Tue, 2 Jan 2018 13:18:40 +0000 (14:18 +0100)]
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.

6 years agoAdd 'ignore-cloudabi' to tests that don't and won't build on CloudABI.
Ed Schouten [Tue, 2 Jan 2018 13:11:41 +0000 (14:11 +0100)]
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.

6 years agoAuto merge of #47042 - redox-os:redox, r=estebank
bors [Tue, 2 Jan 2018 11:22:40 +0000 (11:22 +0000)]
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

6 years agoMention SliceConcatExt's stability in its docs
David Ross [Tue, 2 Jan 2018 03:14:32 +0000 (19:14 -0800)]
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.

6 years agoAuto merge of #47111 - rkruppe:repr-transparent, r=estebank
bors [Tue, 2 Jan 2018 08:34:27 +0000 (08:34 +0000)]
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.

6 years agoUse assert!(chunk_size != 0) instead of > 0 for usize value
Sebastian Dröge [Mon, 1 Jan 2018 23:57:46 +0000 (01:57 +0200)]
Use assert!(chunk_size != 0) instead of > 0 for usize value

6 years agoConsistently use chunk_size as the field name for Chunks and ChunksMut
Sebastian Dröge [Mon, 1 Jan 2018 23:46:50 +0000 (01:46 +0200)]
Consistently use chunk_size as the field name for Chunks and ChunksMut

Previously Chunks used size and ChunksMut used chunk_size

6 years agoAddress review comments: make label shorter
Esteban Küber [Tue, 2 Jan 2018 06:10:04 +0000 (22:10 -0800)]
Address review comments: make label shorter

6 years agoMove reason for move to label
Esteban Küber [Wed, 6 Sep 2017 06:36:34 +0000 (23:36 -0700)]
Move reason for move to label

6 years agoFix panic condition docs for Vec::insert.
Corey Farwell [Tue, 2 Jan 2018 03:06:59 +0000 (19:06 -0800)]
Fix panic condition docs for Vec::insert.

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

6 years agoRemove dependency on regex
varkor [Tue, 2 Jan 2018 01:06:17 +0000 (01:06 +0000)]
Remove dependency on regex

6 years agoprevent generating duplicate stubs
tinaun [Tue, 2 Jan 2018 00:32:44 +0000 (19:32 -0500)]
prevent generating duplicate stubs

6 years agoAuto merge of #47106 - EdSchouten:compiletest-cloudabi, r=alexcrichton
bors [Tue, 2 Jan 2018 00:31:07 +0000 (00:31 +0000)]
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.

6 years agoCheck all repr hints together when checking for mis-applied attributes
Robin Kruppe [Mon, 1 Jan 2018 20:42:12 +0000 (21:42 +0100)]
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.

6 years agoUse the right TLS model for CloudABI.
Ed Schouten [Mon, 1 Jan 2018 20:46:22 +0000 (21:46 +0100)]
Use the right TLS model for CloudABI.

CloudABI doesn't do dynamic linking. For this reason, there is no need
to handle any other TLS model than local-exec. CloudABI's C library
doesn't provide a __tls_get_addr() function to do Dynamic TLS.

By forcing local-exec to be used here, we ensure that we don't generate
function calls to __tls_get_addr().

6 years agoFix typo
Who? Me?! [Mon, 1 Jan 2018 19:17:25 +0000 (13:17 -0600)]
Fix typo

6 years agoAuto merge of #46735 - Manishearth:memchr-find, r=burntsushi
bors [Mon, 1 Jan 2018 19:04:33 +0000 (19:04 +0000)]
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