]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #47156 - petrochenkov:extpath, r=nikomatsakis
bors [Sun, 7 Jan 2018 00:51:42 +0000 (00:51 +0000)]
Auto merge of #47156 - petrochenkov:extpath, r=nikomatsakis

Support `extern` in paths

Implement the primary alternative to https://github.com/rust-lang/rust/pull/46613 + https://github.com/rust-lang/rust/pull/45771, achieving the same effect without requiring changes to other imports.
Both need to be experimentally evaluated before making further progress.

The PR also adds docs for all these related features into the unstable book.

cc https://github.com/rust-lang/rust/issues/44660
r? @nikomatsakis

6 years agoAuto merge of #47235 - kennytm:rollup, r=kennytm
bors [Sat, 6 Jan 2018 20:41:33 +0000 (20:41 +0000)]
Auto merge of #47235 - kennytm:rollup, r=kennytm

Rollup of 7 pull requests

- Successful merges: #46947, #47170, #47190, #47205, #47217, #47220, #47230
- Failed merges: #47233

6 years agoRollup merge of #47230 - nerd2:debuginfo_shadow, r=alexcrichton
kennytm [Sat, 6 Jan 2018 18:36:07 +0000 (02:36 +0800)]
Rollup merge of #47230 - nerd2:debuginfo_shadow, r=alexcrichton

Debuginfo Shadowed Variable test: fix check numbering

Appears to be a simple fix to restore this test. Ref issue #47163, CC @arielb1

6 years agoRollup merge of #47220 - nagisa:nonamellvm, r=rkruppe
kennytm [Sat, 6 Jan 2018 18:36:06 +0000 (02:36 +0800)]
Rollup merge of #47220 - nagisa:nonamellvm, r=rkruppe

Use name-discarding LLVM context

This is only applicable when neither of --emit=llvm-ir or --emit=llvm-bc are not
requested.

In case either of these outputs are wanted, but the benefits of such context are
desired as well, -Zfewer_names option provides the same functionality regardless
of the outputs requested.

Should be a viable fix for https://github.com/rust-lang/rust/issues/46449

6 years agoRollup merge of #47217 - stjepang:set-examples, r=frewsxcv
kennytm [Sat, 6 Jan 2018 18:36:05 +0000 (02:36 +0800)]
Rollup merge of #47217 - stjepang:set-examples, r=frewsxcv

Write examples for {BTree,Hash}Set::{get,replace,take}

6 years agoRollup merge of #47205 - eddyb:alloc-id, r=oli-obk
kennytm [Sat, 6 Jan 2018 18:36:04 +0000 (02:36 +0800)]
Rollup merge of #47205 - eddyb:alloc-id, r=oli-obk

miri: use AllocId instead of u64.

This makes @alexreg's miri allocation -> LLVM global translation more straight-forward.

r? @oli-obk

6 years agoRollup merge of #47190 - EdSchouten:cloudabi-libpanic, r=alexcrichton
kennytm [Sat, 6 Jan 2018 18:36:03 +0000 (02:36 +0800)]
Rollup merge of #47190 - EdSchouten:cloudabi-libpanic, r=alexcrichton

Port libpanic_abort and libpanic_unwind to CloudABI

This change ports both the libpanic* libraries to CloudABI.

The most interesting part of this pull request, however, is that it imports the CloudABI system call API into the Rust tree through a Git submodule. These will also be used by my port of libstd to CloudABI extensively, as that library obviously needs to invoke system calls to implement its primitives.

I have taken the same approach as libc: `src/libcloudabi` + `src/rustc/cloudabi_shim`. If some other naming scheme is preferred, feel free to let me know! As `libcloudabi` is pretty small, maybe it makes sense to copy, instead of using a submodule?

6 years agoRollup merge of #47170 - eddyb:us-vs-usize, r=nikomatsakis
kennytm [Sat, 6 Jan 2018 18:36:02 +0000 (02:36 +0800)]
Rollup merge of #47170 - eddyb:us-vs-usize, r=nikomatsakis

rustc: use {U,I}size instead of {U,I}s shorthands.

`Us`/`Is` come from a time when `us` and `is` were the literal suffixes that are now `usize` / `isize`.

r? @nikomatsakis

6 years agoRollup merge of #46947 - tspiteri:checked-div-rem-none, r=frewsxcv
kennytm [Sat, 6 Jan 2018 18:36:01 +0000 (02:36 +0800)]
Rollup merge of #46947 - tspiteri:checked-div-rem-none, r=frewsxcv

doc: improve None condition doc for `checked_div` and `checked_rem`

This commit improves the condition mentioned in the docs for which `checked_div` and `checked_rem` return `None`.

For signed division, the commit changes "the operation results in overflow" to "the division results in overflow", otherwise there is room for misinterpretation for `checked_rem`: Without considering overflow, `MIN % -1` would be simply zero, allowing the misinterpretation that "the operation" does not result in overflow in this case. This ambiguity is removed using "when the division results in overflow".

For unsigned division, the condition for `None` should be simply when `rhs == 0`, as no other overflow is possible.

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 agoDebuginfo Shadowed Variable test: fix check numbering
Sam [Sat, 6 Jan 2018 11:05:31 +0000 (11:05 +0000)]
Debuginfo Shadowed Variable test: fix check numbering

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 agoLet libpanic_abort call into libc's abort() on CloudABI.
Ed Schouten [Fri, 5 Jan 2018 21:16:54 +0000 (22:16 +0100)]
Let libpanic_abort call into libc's abort() on CloudABI.

Ideally, we should make use of CloudABI's internal proc_raise(SIGABRT)
system call. POSIX abort() requires things like flushing of stdios,
which may not be what we want under panic conditions. Invoking the raw
CloudABI system call would have prevented that.

Unfortunately, we have to make use of the "cloudabi" crate to invoke raw
CloudABI system calls. This is undesired, as discussed in the pull
request (#47190).

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 agoUse name-discarding LLVM context
Simonas Kazlauskas [Thu, 4 Jan 2018 20:19:23 +0000 (22:19 +0200)]
Use name-discarding LLVM context

This is only applicable when neither of --emit=llvm-ir or --emit=llvm-bc are not
requested.

In case either of these outputs are wanted, but the benefits of such context are
desired as well, -Zfewer_names option provides the same functionality regardless
of the outputs requested.

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 agoWrite examples for {BTree,Hash}Set::{get,replace,take}
Stjepan Glavina [Fri, 5 Jan 2018 14:02:10 +0000 (15:02 +0100)]
Write examples for {BTree,Hash}Set::{get,replace,take}

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 agomiri: use AllocId instead of u64.
Eduard-Mihai Burtescu [Fri, 5 Jan 2018 03:12:38 +0000 (05:12 +0200)]
miri: use AllocId instead of u64.

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 agoMake libpanic_unwind build on CloudABI.
Ed Schouten [Thu, 4 Jan 2018 16:55:44 +0000 (17:55 +0100)]
Make libpanic_unwind build on CloudABI.

CloudABI uses LLVM's libunwind for stack unwinding. There was a small
bug that went by unnoticed, namely that it was not built with -fno-rtti.
This caused it to (indirectly) depend on the entire C++ runtime.

Now that that issue has been resolved, it is also perfectly fine to make
use of this library for programming languages other than C++.

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 agorustc: use {U,I}size instead of {U,I}s shorthands.
Eduard-Mihai Burtescu [Thu, 4 Jan 2018 01:12:04 +0000 (03:12 +0200)]
rustc: use {U,I}size instead of {U,I}s shorthands.

6 years agorustc: remove misleading `Ty::is_uint` method.
Eduard-Mihai Burtescu [Thu, 4 Jan 2018 00:14:53 +0000 (02:14 +0200)]
rustc: remove misleading `Ty::is_uint` method.

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 agoAdd docs for `crate_in_paths`, `extern_in_paths` and `extern_absolute_paths` into...
Vadim Petrochenkov [Wed, 3 Jan 2018 16:14:46 +0000 (19:14 +0300)]
Add docs for `crate_in_paths`, `extern_in_paths` and `extern_absolute_paths` into the unstable book

6 years agoSupport `extern` in paths
Vadim Petrochenkov [Mon, 1 Jan 2018 14:42:32 +0000 (17:42 +0300)]
Support `extern` in paths

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.