]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #39913 - nikomatsakis:inference-error, r=pnkfelix
Corey Farwell [Mon, 20 Feb 2017 17:42:53 +0000 (12:42 -0500)]
Rollup merge of #39913 - nikomatsakis:inference-error, r=pnkfelix

Report full details of inference errors

When the old suggestion machinery was removed by @brson in https://github.com/rust-lang/rust/pull/37057, it was not completely removed. There was a bit of code that had the job of going through errors and finding those for which suggestions were applicable, and it remained, causing us not to emit the full details of such errors.  This PR removes that.

I've also added various lifetime tests to the UI test suite (so you can also see the before/after there). I have some concrete thoughts on how to improve these cases and am planning on writing those up in some mentoring issues (@CengizIO has expressed interest in working on those changes, so I plan to work with him on it, at least to start).

cc @jonathandturner

7 years agoAuto merge of #39748 - Rufflewind:master, r=steveklabnik
bors [Mon, 20 Feb 2017 15:06:07 +0000 (15:06 +0000)]
Auto merge of #39748 - Rufflewind:master, r=steveklabnik

Rust Book: Generics: Resolving ambiguities

- Add a small section to generics.md to explain how ambiguities in type inference can be resolved using the `::<>` syntax.
- Add links from syntax-index.md and iterators.md.
- Minor edits to iterators.md and structs.md.

7 years agoAuto merge of #39965 - ArtBears:master, r=steveklabnik
bors [Mon, 20 Feb 2017 10:58:36 +0000 (10:58 +0000)]
Auto merge of #39965 - ArtBears:master, r=steveklabnik

Fixed a typo in CONTRIBUTING.md

Small change to the CONTRIBUTING.md file.

r? @steveklabnik

7 years agoAuto merge of #39923 - mattyw:patch-1, r=steveklabnik
bors [Mon, 20 Feb 2017 08:16:31 +0000 (08:16 +0000)]
Auto merge of #39923 - mattyw:patch-1, r=steveklabnik

Variable Bindings possible nitpick

Complete drive by nitpick I'm afraid

7 years agoAuto merge of #39304 - jrmuizel:drop-flags, r=steveklabnik
bors [Mon, 20 Feb 2017 05:51:11 +0000 (05:51 +0000)]
Auto merge of #39304 - jrmuizel:drop-flags, r=steveklabnik

Remove obsolete documentation about drop-flags

7 years agoAuto merge of #39966 - steveklabnik:update-mdbook, r=GuillaumeGomez
bors [Mon, 20 Feb 2017 03:27:06 +0000 (03:27 +0000)]
Auto merge of #39966 - steveklabnik:update-mdbook, r=GuillaumeGomez

Update mdbook version

This version of mdbook includes
https://github.com/azerupi/mdBook/pull/207 , which is needed so that
we can start doing linkchecker on the various books.

7 years agoRust Book: Generics: Resolving ambiguities
Phil Ruffwind [Sat, 11 Feb 2017 22:00:56 +0000 (17:00 -0500)]
Rust Book: Generics: Resolving ambiguities

- Add a small section to generics.md to explain how ambiguities in type
  inference can be resolved using the ::<> syntax.
- Add links from syntax-index.md and iterators.md.
- Minor edits to iterators.md and structs.md.

7 years agoUpdate dependencies
Steve Klabnik [Mon, 20 Feb 2017 00:20:57 +0000 (19:20 -0500)]
Update dependencies

In order to update mdbook, we have to update other stuff too.

7 years agoUpdate mdbook version
Steve Klabnik [Sun, 19 Feb 2017 23:55:57 +0000 (18:55 -0500)]
Update mdbook version

This version of mdbook includes
https://github.com/azerupi/mdBook/pull/207 , which is needed so that
we can start doing linkchecker on the various books.

7 years agoAuto merge of #39955 - mp4096:master, r=GuillaumeGomez
bors [Mon, 20 Feb 2017 00:00:53 +0000 (00:00 +0000)]
Auto merge of #39955 - mp4096:master, r=GuillaumeGomez

Docs: Better explanation of return values for min, max functions for the Iterator trait

Added an explanation that `None` is returned if an iterator is empty.

Also added examples for `max` and `min`. I chose not to add examples for other functions like `max_by_key` etc. so that the examples stay concised and focused on the main functionality.

7 years agoMerge branch 'master' of https://github.com/rust-lang/rust
Glyne J. Gittens [Sun, 19 Feb 2017 22:32:21 +0000 (17:32 -0500)]
Merge branch 'master' of https://github.com/rust-lang/rust

7 years agoRemoved a typo from CONTRIBUTING.md
Glyne J. Gittens [Sun, 19 Feb 2017 22:30:50 +0000 (17:30 -0500)]
Removed a typo from CONTRIBUTING.md

7 years agofix run-pass test that required `Copy` impl
Niko Matsakis [Sun, 19 Feb 2017 20:26:32 +0000 (15:26 -0500)]
fix run-pass test that required `Copy` impl

7 years agoAuto merge of #39939 - petrochenkov:regres, r=eddyb
bors [Sun, 19 Feb 2017 17:52:54 +0000 (17:52 +0000)]
Auto merge of #39939 - petrochenkov:regres, r=eddyb

Fix two ICEs in path resolution

Fixes https://github.com/rust-lang/rust/issues/39535
Fixes https://github.com/rust-lang/rust/issues/39559
Fixes https://github.com/rust-lang/rust/issues/39924

r? @eddyb

7 years agoAuto merge of #39871 - binarycrusader:issue-39868, r=alexcrichton
bors [Sun, 19 Feb 2017 11:21:09 +0000 (11:21 +0000)]
Auto merge of #39871 - binarycrusader:issue-39868, r=alexcrichton

libstd needs update for pending libc change

This  updates libstd to accommodate the fixes made in https://github.com/rust-lang/libc/pull/523

Fixes #39868

7 years agoDocs: Better explanation of return values for min, max functions
Mikhail Pak [Sun, 19 Feb 2017 10:01:02 +0000 (11:01 +0100)]
Docs: Better explanation of return values for min, max functions

Explain that a None is returned if the iterator is empty.

7 years agoAuto merge of #39912 - nikomatsakis:incr-comp-trait-select-no-vec, r=eddyb
bors [Sun, 19 Feb 2017 06:30:38 +0000 (06:30 +0000)]
Auto merge of #39912 - nikomatsakis:incr-comp-trait-select-no-vec, r=eddyb

rework `TraitSelect` to avoid a vec and just use two def-ids

r? @eddyb

7 years agoAvoid ICE in Self::Assoc in impl headers
Vadim Petrochenkov [Sat, 18 Feb 2017 21:15:30 +0000 (00:15 +0300)]
Avoid ICE in Self::Assoc in impl headers

7 years agoPrivatize fields of PathResolution
Vadim Petrochenkov [Sat, 18 Feb 2017 19:11:42 +0000 (22:11 +0300)]
Privatize fields of PathResolution

Ensure Def::Err has depth == 0

7 years agoAuto merge of #39933 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sat, 18 Feb 2017 17:10:34 +0000 (17:10 +0000)]
Auto merge of #39933 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #39847, #39862, #39898, #39904, #39928
- Failed merges:

7 years agoRollup merge of #39928 - GuillaumeGomez:env_func_urls, r=frewsxcv
Guillaume Gomez [Sat, 18 Feb 2017 17:10:15 +0000 (18:10 +0100)]
Rollup merge of #39928 - GuillaumeGomez:env_func_urls, r=frewsxcv

Add missing urls for env functions

r? @frewsxcv

7 years agoRollup merge of #39904 - Stebalien:cleanup-string-split-off, r=frewsxcv
Guillaume Gomez [Sat, 18 Feb 2017 17:10:14 +0000 (18:10 +0100)]
Rollup merge of #39904 - Stebalien:cleanup-string-split-off, r=frewsxcv

Fixup String::split_off documentation

1. Clarify that `String::split_off` returns one string and modifies self in-place. The documentation implied that it returns two new strings.

2. Make the documentation mirror `Vec::split_off`.

7 years agoRollup merge of #39898 - king6cong:logic_clean, r=alexcrichton
Guillaume Gomez [Sat, 18 Feb 2017 17:10:13 +0000 (18:10 +0100)]
Rollup merge of #39898 - king6cong:logic_clean, r=alexcrichton

code order tweak

7 years agoRollup merge of #39862 - stjepang:fix-wording-localkey, r=GuillaumeGomez
Guillaume Gomez [Sat, 18 Feb 2017 17:10:12 +0000 (18:10 +0100)]
Rollup merge of #39862 - stjepang:fix-wording-localkey, r=GuillaumeGomez

Fix wording in LocalKey documentation

Fixes #39841

r? @GuillaumeGomez

7 years agoRollup merge of #39847 - CBenoit:patch-1, r=frewsxcv
Guillaume Gomez [Sat, 18 Feb 2017 17:10:11 +0000 (18:10 +0100)]
Rollup merge of #39847 - CBenoit:patch-1, r=frewsxcv

Correct a typo in procedural macros chapter of the Book.

A simple and short correction for procedural macros chapter of the Rust Programming Language Book.

7 years agoAdd missing urls for env functions
Guillaume Gomez [Sat, 18 Feb 2017 13:44:56 +0000 (14:44 +0100)]
Add missing urls for env functions

7 years agoAuto merge of #39887 - nikomatsakis:issue-39292, r=arielb1
bors [Sat, 18 Feb 2017 12:17:06 +0000 (12:17 +0000)]
Auto merge of #39887 - nikomatsakis:issue-39292, r=arielb1

erase late bound regions in `get_vtable_methods()`

Higher-ranked object types can otherwise cause late-bound regions to
sneak into the substs, leading to the false conclusion that some method
is unreachable.

r? @arielb1, who wrote the heart of this patch anyhow

Fixes #39292

7 years agoVariable Bindings possible nitpick
Matt Williams [Sat, 18 Feb 2017 09:57:33 +0000 (09:57 +0000)]
Variable Bindings possible nitpick

Complete drive by nitpick I'm afraid

7 years agoAuto merge of #39877 - estebank:remove-params, r=petrochenkov
bors [Sat, 18 Feb 2017 09:50:10 +0000 (09:50 +0000)]
Auto merge of #39877 - estebank:remove-params, r=petrochenkov

Remove noop method `Substs::params()`

Re: 48b3dd11f59f48819031206ee2b3ab98ceae1550 & 7a8d4822d8eb922f0cd50e92f420b5f1938db64d

7 years agoAuto merge of #39854 - nagisa:mir-asm-stmt, r=nikomatsakis
bors [Sat, 18 Feb 2017 04:49:56 +0000 (04:49 +0000)]
Auto merge of #39854 - nagisa:mir-asm-stmt, r=nikomatsakis

[MIR] Make InlineAsm a Statement

Previously InlineAsm was an Rvalue, but its semantics doesn't really match the semantics of an
Rvalue - rather it behaves more like a Statement.

r? @nikomatsakis you wanted this to happen

7 years agoAuto merge of #39837 - alexcrichton:llvm-crt-static, r=brson
bors [Fri, 17 Feb 2017 22:12:00 +0000 (22:12 +0000)]
Auto merge of #39837 - alexcrichton:llvm-crt-static, r=brson

rustc: Link statically to the MSVCRT

This commit changes all MSVC rustc binaries to be compiled with
`-C target-feature=+crt-static` to link statically against the MSVCRT instead of
dynamically (as it does today). This also necessitates compiling LLVM in a
different fashion, ensuring it's compiled with `/MT` instead of `/MD`.

cc #37406

7 years agoremove vestiges of the old suggestion machinery
Niko Matsakis [Fri, 17 Feb 2017 15:33:06 +0000 (10:33 -0500)]
remove vestiges of the old suggestion machinery

7 years agoadd some sample UI error test cases
Niko Matsakis [Fri, 17 Feb 2017 15:32:25 +0000 (10:32 -0500)]
add some sample UI error test cases

These are some samples that I have been focusing on improving over
time. In this PR, I mainly want to stem the bleeding where we in some
cases we show an error that gives you no possible way to divine the
problem.

7 years agorework `TraitSelect` to avoid a vec and just use two def-ids
Nicholas Nethercote [Fri, 4 Nov 2016 06:31:52 +0000 (17:31 +1100)]
rework `TraitSelect` to avoid a vec and just use two def-ids

7 years agoAuto merge of #39578 - canndrew:nixos-bootstrap-fix, r=alexcrichton
bors [Fri, 17 Feb 2017 15:20:11 +0000 (15:20 +0000)]
Auto merge of #39578 - canndrew:nixos-bootstrap-fix, r=alexcrichton

Fix for bootstrapping on NixOS

NixOS puts Linux's dynamic loader in wierd place. Detect when we're on NixOS and patch the downloaded bootstrap executables appropriately.

7 years agoAuto merge of #39485 - canndrew:inference-fix-39297, r=nikomatsakis
bors [Fri, 17 Feb 2017 10:46:59 +0000 (10:46 +0000)]
Auto merge of #39485 - canndrew:inference-fix-39297, r=nikomatsakis

Ignore expected type in diverging blocks

As per comment: https://github.com/rust-lang/rust/issues/39297#issuecomment-276810343

7 years agoAuto merge of #39852 - alexcrichton:appveyor-separate-dist, r=brson
bors [Fri, 17 Feb 2017 07:32:18 +0000 (07:32 +0000)]
Auto merge of #39852 - alexcrichton:appveyor-separate-dist, r=brson

appveyor: Move MSVC dist builds to their own builder

In the long run we want to separate out the dist builders from the test
builders. This provides us leeway to expand the dist builders with more tools
(e.g. Cargo and the RLS) without impacting cycle times.

Currently the Travis dist builders double-up the platforms they provide builds
for, so I figured we could try that out for MSVC as well. This commit adds a new
AppVeyor builder which runs a dist for all the MSVC targets:

* x86_64-pc-windows-msvc
* i686-pc-windows-msvc
* i586-pc-windows-msvc

If this takes too long and/or times out we'll need to split this up. In any case
we're going to need more capacity from AppVeyor no matter what becaue the two
pc-windows-gnu targets can't cross compile so we need at least 2 more builders
no matter what.

7 years agoFixup String::split_off documentation
Steven Allen [Fri, 17 Feb 2017 06:49:46 +0000 (22:49 -0800)]
Fixup String::split_off documentation

1. Clarify that `String::split_off` returns one string and modifies self
   in-place. The documentation implied that it returns two new strings.

2. Make the documentation mirror `Vec::split_off`.

7 years agoStyle fixups
Andrew Cann [Fri, 17 Feb 2017 06:00:58 +0000 (14:00 +0800)]
Style fixups

7 years agoAuto merge of #39752 - keeperofdakeys:macro-error, r=keeperofdakeys
bors [Fri, 17 Feb 2017 04:02:18 +0000 (04:02 +0000)]
Auto merge of #39752 - keeperofdakeys:macro-error, r=keeperofdakeys

Refactor macro resolution errors + add derive macro suggestions

Move legacy macro resolution error reporting to `finalize_current_module_macro_resolutions`, and provide suggestions for derive macros.

Fixes #39323

cc https://github.com/rust-lang/rust/issues/30197

r? @jseyfried

7 years agocode order tweak
king6cong [Fri, 17 Feb 2017 01:47:37 +0000 (09:47 +0800)]
code order tweak

7 years agoUpdate src/liblibc
Shawn Walker-Salas [Thu, 16 Feb 2017 21:04:14 +0000 (13:04 -0800)]
Update src/liblibc

7 years agoAuto merge of #38368 - arthurprs:hm-adapt, r=alexcrichton
bors [Thu, 16 Feb 2017 20:32:45 +0000 (20:32 +0000)]
Auto merge of #38368 - arthurprs:hm-adapt, r=alexcrichton

Adaptive hashmap implementation

All credits to @pczarn who wrote https://github.com/rust-lang/rfcs/pull/1796 and https://github.com/contain-rs/hashmap2/pull/5

 **Background**

Rust std lib hashmap puts a strong emphasis on security, we did some improvements in https://github.com/rust-lang/rust/pull/37470 but in some very specific cases and for non-default hashers it's still vulnerable (see #36481).

This is a simplified version of https://github.com/rust-lang/rfcs/pull/1796 proposal sans switching hashers on the fly and other things that require an RFC process and further decisions. I think this part has great potential by itself.

**Proposal**
This PR adds code checking for extra long probe and shifts lengths (see code comments and https://github.com/rust-lang/rfcs/pull/1796 for details), when those are encountered the hashmap will grow (even if the capacity limit is not reached yet) _greatly_ attenuating the degenerate performance case.

We need a lower bound on the minimum occupancy that may trigger the early resize, otherwise in extreme cases it's possible to turn the CPU attack into a memory attack. The PR code puts that lower bound at half of the max occupancy (defined by ResizePolicy). This reduces the protection (it could potentially be exploited between 0-50% occupancy) but makes it completely safe.

**Drawbacks**

* May interact badly with poor hashers.  Maps using those may not use the desired capacity.
* It adds 2-3 branches to the common insert path, luckily those are highly predictable and there's room to shave some in future patches.
* May complicate exposure of ResizePolicy in the future as the constants are a function of the fill factor.

**Example**

Example code that exploit the exposure of iteration order and weak hasher.

```
const MERGE: usize = 10_000usize;
#[bench]
fn merge_dos(b: &mut Bencher) {
    let first_map: $hashmap<usize, usize, FnvBuilder> = (0..MERGE).map(|i| (i, i)).collect();
    let second_map: $hashmap<usize, usize, FnvBuilder> = (MERGE..MERGE * 2).map(|i| (i, i)).collect();
    b.iter(|| {
        let mut merged = first_map.clone();
        for (&k, &v) in &second_map {
            merged.insert(k, v);
        }
        ::test::black_box(merged);
    });
}
```

_91 is stdlib and _ad is patched (the end capacity in both cases is the same)

```
running 2 tests
test _91::merge_dos              ... bench:  47,311,843 ns/iter (+/- 2,040,302)
test _ad::merge_dos              ... bench:     599,099 ns/iter (+/- 83,270)
```

7 years agoResize hashmap when long probes are detected
arthurprs [Tue, 13 Dec 2016 22:52:22 +0000 (23:52 +0100)]
Resize hashmap when long probes are detected

7 years agoappveyor: Move MSVC dist builds to their own builder
Alex Crichton [Wed, 15 Feb 2017 17:36:52 +0000 (09:36 -0800)]
appveyor: Move MSVC dist builds to their own builder

In the long run we want to separate out the dist builders from the test
builders. This provides us leeway to expand the dist builders with more tools
(e.g. Cargo and the RLS) without impacting cycle times.

Currently the Travis dist builders double-up the platforms they provide builds
for, so I figured we could try that out for MSVC as well. This commit adds a new
AppVeyor builder which runs a dist for all the MSVC targets:

* x86_64-pc-windows-msvc
* i686-pc-windows-msvc
* i586-pc-windows-msvc

If this takes too long and/or times out we'll need to split this up. In any case
we're going to need more capacity from AppVeyor no matter what becaue the two
pc-windows-gnu targets can't cross compile so we need at least 2 more builders
no matter what.

7 years agoerase late bound regions in `get_vtable_methods()`
Niko Matsakis [Thu, 16 Feb 2017 18:55:08 +0000 (13:55 -0500)]
erase late bound regions in `get_vtable_methods()`

Higher-ranked object types can otherwise cause late-bound regions to
sneak into the substs, leading to the false conclusion that some method
is unreachable.  The heart of this patch is from @arielb1.

7 years agoRefactor macro resolution errors + add derive macro suggestions
Josh Driver [Mon, 6 Feb 2017 11:44:38 +0000 (22:14 +1030)]
Refactor macro resolution errors + add derive macro suggestions

7 years agoAuto merge of #39824 - alexcrichton:disable-dist-src, r=brson
bors [Thu, 16 Feb 2017 08:20:29 +0000 (08:20 +0000)]
Auto merge of #39824 - alexcrichton:disable-dist-src, r=brson

travis: Disable source tarballs on most builders

Currently we create a source tarball on almost all of the `DEPLOY=1` builders
but this has the adverse side effect of all source tarballs overriding
themselves in the S3 bucket. Normally this is ok but unfortunately a source
tarball created on Windows is not buildable on Unix.

On Windows the vendored sources contain paths with `\` characters in them which
when interpreted on Unix end up in "file not found" errors.

Instead of this overwriting behavior, whitelist just one linux builder for
producing tarballs and avoid producing tarballs on all other hosts.

7 years agoCorrect a typo in procedural macros chapter of the Book. (fixup [c8292fcd6ad2a06d2529f5])
Benoît CORTIER [Thu, 16 Feb 2017 08:18:19 +0000 (09:18 +0100)]
Correct a typo in procedural macros chapter of the Book. (fixup [c8292fcd6ad2a06d2529f5])

7 years agosimplify home_dir by removing unnecessary getpwuid_r wrapper
Shawn Walker-Salas [Thu, 16 Feb 2017 06:52:47 +0000 (22:52 -0800)]
simplify home_dir by removing unnecessary getpwuid_r wrapper

7 years agoRemove noop method `Substs::params()`
Esteban Küber [Thu, 16 Feb 2017 05:46:23 +0000 (21:46 -0800)]
Remove noop method `Substs::params()`

Re: 48b3dd11f59f48819031206ee2b3ab98ceae1550

7 years agoAuto merge of #39876 - frewsxcv:rollup, r=frewsxcv
bors [Thu, 16 Feb 2017 05:52:46 +0000 (05:52 +0000)]
Auto merge of #39876 - frewsxcv:rollup, r=frewsxcv

Rollup of 12 pull requests

- Successful merges: #39775, #39793, #39804, #39834, #39836, #39839, #39840, #39843, #39844, #39846, #39857, #39861
- Failed merges:

7 years agoRollup merge of #39861 - retep998:small-fix, r=alexcrichton
Corey Farwell [Thu, 16 Feb 2017 04:48:23 +0000 (23:48 -0500)]
Rollup merge of #39861 - retep998:small-fix, r=alexcrichton

Fix parameter to GetUserProfileDirectoryW

7 years agoRollup merge of #39857 - binarycrusader:master, r=alexcrichton
Corey Farwell [Thu, 16 Feb 2017 04:48:22 +0000 (23:48 -0500)]
Rollup merge of #39857 - binarycrusader:master, r=alexcrichton

use bash when invoking dist shell scripts on solaris

Partially fixes #25845

A separate, trivial fix is needed to the rust-installer scripts to completely resolve this issue.

7 years agoRollup merge of #39846 - WRONGWAY4YOU:typo-fix, r=frewsxcv
Corey Farwell [Thu, 16 Feb 2017 04:48:21 +0000 (23:48 -0500)]
Rollup merge of #39846 - WRONGWAY4YOU:typo-fix, r=frewsxcv

Fix typo

7 years agoRollup merge of #39844 - king6cong:sys, r=alexcrichton
Corey Farwell [Thu, 16 Feb 2017 04:48:20 +0000 (23:48 -0500)]
Rollup merge of #39844 - king6cong:sys, r=alexcrichton

sys/mod doc update and mod import order adjust

* Some doc updates.
* Racer currently use the first mod it finds regardless of cfg attrs. Moving #[cfg(unix)] up should be a temporary tweak that works as expected for more people.

7 years agoRollup merge of #39843 - AndrewGaspar:natvis, r=brson
Corey Farwell [Thu, 16 Feb 2017 04:48:19 +0000 (23:48 -0500)]
Rollup merge of #39843 - AndrewGaspar:natvis, r=brson

Vec, LinkedList, VecDeque, String, and Option NatVis visualizations

I've added some basic [NatVis](https://msdn.microsoft.com/en-us/library/jj620914.aspx) visualizations for core Rust collections and types. This helps address a need filed in issue #36503. NatVis visualizations are similar to gdb/lldb pretty printers, but for windbg and the Visual Studio debugger on Windows.

For example, Vec without the supplied NatVis looks like this in windbg using the "dx" command:
```
0:000> dx some_64_bit_vec
some_64_bit_vec                 [Type: collections::vec::Vec<u64>]
    [+0x000] buf              [Type: alloc::raw_vec::RawVec<u64>]
    [+0x010] len              : 0x4 [Type: unsigned __int64]
```

With the NatVis, the elements of the Vec are displayed:
```
0:000> dx some_64_bit_vec
some_64_bit_vec                 : { size=0x4 } [Type: collections::vec::Vec<u64>]
    [<Raw View>]     [Type: collections::vec::Vec<u64>]
    [size]           : 0x4 [Type: unsigned __int64]
    [capacity]       : 0x4 [Type: unsigned __int64]
    [0]              : 0x4 [Type: unsigned __int64]
    [1]              : 0x4f [Type: unsigned __int64]
    [2]              : 0x1a [Type: unsigned __int64]
    [3]              : 0x184 [Type: unsigned __int64]
```

In fact, the vector can be treated as an array by the NatVis expression evaluator:
```
0:000> dx some_64_bit_vec[2]
some_64_bit_vec[2] : 0x1a [Type: unsigned __int64]
```

In general, it works with any NatVis command that understands collections, such as NatVis LINQ expressions:
```
0:000> dx some_64_bit_vec.Select(x => x * 2)
some_64_bit_vec.Select(x => x * 2)
    [0]              : 0x8
    [1]              : 0x9e
    [2]              : 0x34
    [3]              : 0x308
```

std::string::String is implemented, as well:
```
0:000> dv
    hello_world = "Hello, world!"
          empty = ""
            new = ""
0:000> dx hello_world
hello_world                 : "Hello, world!" [Type: collections::string::String]
    [<Raw View>]     [Type: collections::string::String]
    [size]           : 0xd [Type: unsigned __int64]
    [capacity]       : 0xd [Type: unsigned __int64]
    [0]              : 72 'H' [Type: char]
    [1]              : 101 'e' [Type: char]
...
    [12]             : 33 '!' [Type: char]
0:000> dx empty
empty                 : "" [Type: collections::string::String]
    [<Raw View>]     [Type: collections::string::String]
    [size]           : 0x0 [Type: unsigned __int64]
    [capacity]       : 0x0 [Type: unsigned __int64]

```

VecDeque and LinkedList are also implemented.

My biggest concern is the implementation for Option due to the different layouts it can receive based on whether the sentinel value can be embedded with-in the Some value or must be stored separately.

It seems to work, but my testing isn't exhaustive:
```
0:000> dv
          three = { Some 3 }
           none = { None }
         no_str = { None }
       some_str = { Some "Hello!" }
0:000> dx three
three                 : { Some 3 } [Type: core::option::Option<i32>]
    [<Raw View>]     [Type: core::option::Option<i32>]
    [size]           : 0x1 [Type: ULONG]
    [value]          : 3 [Type: int]
    [0]              : 3 [Type: int]
0:000> dx none
none                 : { None } [Type: core::option::Option<i32>]
    [<Raw View>]     [Type: core::option::Option<i32>]
    [size]           : 0x0 [Type: ULONG]
    [value]          : 4 [Type: int]
0:000> dx no_str
no_str                 : { None } [Type: core::option::Option<collections::string::String>]
    [<Raw View>]     [Type: core::option::Option<collections::string::String>]
    [size]           : 0x0 [Type: ULONG]
0:000> dx some_str
some_str                 : { Some "Hello!" } [Type: core::option::Option<collections::string::String>]
    [<Raw View>]     [Type: core::option::Option<collections::string::String>]
    [size]           : 0x1 [Type: ULONG]
    [value]          : 0x4673df710 : "Hello!" [Type: collections::string::String *]
    [0]              : "Hello!" [Type: collections::string::String]
```

For now all of these visualizations work in windbg, but I've only gotten the visualizations in libcore.natvis working in the VS debugger. My priority is windbg, but somebody else may be interested in investigating the issues related to VS.

You can load these visualizations into a windbg sessions using the .nvload command:
```
0:000> .nvload ..\rust\src\etc\natvis\libcollections.natvis; .nvload ..\rust\src\etc\natvis\libcore.natvis
Successfully loaded visualizers in "..\rust\src\etc\natvis\libcollections.natvis"
Successfully loaded visualizers in "..\rust\src\etc\natvis\libcore.natvis"
```

There are some issues with the symbols that Rust and LLVM conspire to emit into the PDB that inhibit debugging in windbg generally, and by extension make writing visualizations more difficult. Additionally, there are some bugs in windbg itself that complicate or disable some use of the NatVis visualizations for Rust. Significantly, due to NatVis limitations in windbg around allowable type names, you cannot write a visualization for [T] or str. I'll report separate issues as I isolate them.

In the near term, I hope to fill out these NatVis files with more of Rust's core collections and types. In the long run, I hope that we can ship NatVis files with crates and streamline their deployment when debugging Rust programs on windows.

7 years agoRollup merge of #39840 - DaseinPhaos:patch-2, r=frewsxcv
Corey Farwell [Thu, 16 Feb 2017 04:48:18 +0000 (23:48 -0500)]
Rollup merge of #39840 - DaseinPhaos:patch-2, r=frewsxcv

Update procedural-macros.md

Fix typo

7 years agoRollup merge of #39839 - king6cong:refine-doc, r=frewsxcv
Corey Farwell [Thu, 16 Feb 2017 04:48:17 +0000 (23:48 -0500)]
Rollup merge of #39839 - king6cong:refine-doc, r=frewsxcv

make doc consistent with var name

7 years agoRollup merge of #39836 - durka:patch-37, r=alexcrichton
Corey Farwell [Thu, 16 Feb 2017 04:48:15 +0000 (23:48 -0500)]
Rollup merge of #39836 - durka:patch-37, r=alexcrichton

fix types in to_owned doctest

Fixes #39831.

7 years agoRollup merge of #39834 - cseale:feature-gate-static-recursion, r=est31
Corey Farwell [Thu, 16 Feb 2017 04:48:15 +0000 (23:48 -0500)]
Rollup merge of #39834 - cseale:feature-gate-static-recursion, r=est31

static recursion test added to compile-fail test suite

Issue #39059
r? @est31

7 years agoRollup merge of #39804 - seppo0010:recommend-five-traits, r=jonathandturner
Corey Farwell [Thu, 16 Feb 2017 04:48:14 +0000 (23:48 -0500)]
Rollup merge of #39804 - seppo0010:recommend-five-traits, r=jonathandturner

Show five traits implementation in help when there are exactly five

Fixes #39802

7 years agoRollup merge of #39793 - RalfJung:cell, r=alexcrichton
Corey Farwell [Thu, 16 Feb 2017 04:48:13 +0000 (23:48 -0500)]
Rollup merge of #39793 - RalfJung:cell, r=alexcrichton

Allow more Cell methods for non-Copy types

Clearly, `get_mut` is safe for any `T`. The other two only provide unsafe pointers anyway.

The only remaining inherent method with `Copy` bound is `get`, which sounds about right to me.

I found the order if `impl` blocks in the file a little weird (first inherent impl, then some trait impls, then another inherent impl), but didn't change it to keep the diff small.

Contributes to #39264

7 years agoRollup merge of #39775 - mina86:master, r=steveklabnik
Corey Farwell [Thu, 16 Feb 2017 04:48:12 +0000 (23:48 -0500)]
Rollup merge of #39775 - mina86:master, r=steveklabnik

book: don’t use GNU extensions in the example unnecessarily

The use of a GNU C extension for bloc expressions is immaterial to the
actual problem with C macros that the section tries to show so don’t
use it and instead use a plain C way of writing the macro which has
added benefit of being better C code (since the macro now behaves like
a function, syntax-wise).

7 years agorustc: Link statically to the MSVCRT
Alex Crichton [Tue, 14 Feb 2017 22:30:39 +0000 (14:30 -0800)]
rustc: Link statically to the MSVCRT

This commit changes all MSVC rustc binaries to be compiled with
`-C target-feature=+crt-static` to link statically against the MSVCRT instead of
dynamically (as it does today). This also necessitates compiling LLVM in a
different fashion, ensuring it's compiled with `/MT` instead of `/MD`.

cc #37406

7 years agoAuto merge of #39761 - est31:master, r=aturon
bors [Thu, 16 Feb 2017 03:18:37 +0000 (03:18 +0000)]
Auto merge of #39761 - est31:master, r=aturon

Stabilize field init shorthand

Closes #37340.

~Still blocked by the documentation issue #38830.~ EDIT: seems that all parts required for stabilisation are fixed, so its not blocked.

7 years agotravis: Disable source tarballs on most builders
Alex Crichton [Tue, 14 Feb 2017 17:54:58 +0000 (09:54 -0800)]
travis: Disable source tarballs on most builders

Currently we create a source tarball on almost all of the `DEPLOY=1` builders
but this has the adverse side effect of all source tarballs overriding
themselves in the S3 bucket. Normally this is ok but unfortunately a source
tarball created on Windows is not buildable on Unix.

On Windows the vendored sources contain paths with `\` characters in them which
when interpreted on Unix end up in "file not found" errors.

Instead of this overwriting behavior, whitelist just one linux builder for
producing tarballs and avoid producing tarballs on all other hosts.

7 years agolibstd needs update for pending libc change
Shawn Walker-Salas [Thu, 16 Feb 2017 01:48:20 +0000 (17:48 -0800)]
libstd needs update for pending libc change

Fixes #39868

7 years agoFix wording in LocalKey documentation
Stjepan Glavina [Wed, 15 Feb 2017 22:26:29 +0000 (23:26 +0100)]
Fix wording in LocalKey documentation

7 years agoFix parameter to GetUserProfileDirectoryW
Peter Atashian [Wed, 15 Feb 2017 22:31:51 +0000 (17:31 -0500)]
Fix parameter to GetUserProfileDirectoryW

7 years agoAuto merge of #39457 - bvinc:master, r=alexcrichton
bors [Wed, 15 Feb 2017 22:02:36 +0000 (22:02 +0000)]
Auto merge of #39457 - bvinc:master, r=alexcrichton

Dont segfault if btree range is not in order

This is a first attempt to fix issue #33197.  The issue is that the BTree iterator uses next_unchecked for fast iteration, but it can be tricked into running off the end of the tree and segfaulting if range is called with a maximum that is less than the minimum.

Since a user defined Ord should not determine the safety of BTreeMap, and we still want fast iteration, I've implemented the idea of @gereeter and walk the tree simultaneously searching for both keys to make sure that if our keys diverge, the min key is to the left of our max key.  I currently panic if that is not the case.

Open questions:

1.  Do we want to panic in this error case or do we want to return an empty iterator?  The drain API panics if the range is bad, but drain is given a range of index values, while this is a generic key type.  Panicking is brittle and returning an empty iterator is probably the most flexible and matches what people would want it to do... but artificially returning a BTreeMap::Range with start==end seems like a pretty weird and unnatural thing to do, although it's doable since those fields are not accessible.

The same question for other weird cases:
2.  (Included(101), Excluded(100)) on a map that contains [1,2,3].  Both BTree edges end up on the same part of the map, but comparing the keys shows the range is backwards.
3.  (Excluded(5), Excluded(5)).  The keys are equal but BTree edges end up backwards if the map contains 5.
4.  (Included(5), Excluded(5)).  Should naturally produce an empty iterator, right?

7 years agouse bash when invoking dist shell scripts on solaris
Shawn Walker-Salas [Wed, 15 Feb 2017 20:51:26 +0000 (12:51 -0800)]
use bash when invoking dist shell scripts on solaris

Partially fixes #25845

7 years agostatic recursion test added to compile-fail test suite
Colm Seale [Wed, 15 Feb 2017 01:18:11 +0000 (01:18 +0000)]
static recursion test added to compile-fail test suite

    Issue #39059
    r? @est31

7 years ago[MIR] Make InlineAsm a Statement
Simonas Kazlauskas [Wed, 15 Feb 2017 19:21:36 +0000 (21:21 +0200)]
[MIR] Make InlineAsm a Statement

Previously InlineAsm was an Rvalue, but its semantics doesn’t really match the semantics of an
Rvalue – rather it behaves more like a Statement.

7 years agoRemove obsolete documentation about drop-flags
Jeff Muizelaar [Wed, 25 Jan 2017 21:41:44 +0000 (16:41 -0500)]
Remove obsolete documentation about drop-flags

7 years agobook: don’t use GNU extensions in the example unnecessarily
Michal Nazarewicz [Mon, 13 Feb 2017 01:09:24 +0000 (02:09 +0100)]
book: don’t use GNU extensions in the example unnecessarily

The use of a GNU C extension for bloc expressions is immaterial to the
actual problem with C macros that the section tries to show so don’t
use it and instead use a plain C way of writing the macro.

7 years agoAuto merge of #39781 - nrc:save-impls, r=nikomatsakis
bors [Wed, 15 Feb 2017 13:48:09 +0000 (13:48 +0000)]
Auto merge of #39781 - nrc:save-impls, r=nikomatsakis

save-analysis: emit info about impls and super-traits in JSON

7 years agoCorrect a typo in procedural macros chapter of the Book.
Benoît CORTIER [Wed, 15 Feb 2017 12:44:52 +0000 (13:44 +0100)]
Correct a typo in procedural macros chapter of the Book.

7 years agoFix typo
Dmitry Guzeev [Wed, 15 Feb 2017 12:13:31 +0000 (15:13 +0300)]
Fix typo

7 years agosys/mod doc update and mod import order adjust
king6cong [Wed, 15 Feb 2017 10:38:34 +0000 (18:38 +0800)]
sys/mod doc update and mod import order adjust

7 years agoAuto merge of #39594 - clarcharr:cstr_box, r=aturon
bors [Wed, 15 Feb 2017 10:22:34 +0000 (10:22 +0000)]
Auto merge of #39594 - clarcharr:cstr_box, r=aturon

Conversions between CStr, OsStr, Path and boxes

This closes a bit of the inconsistencies between `CStr`, `OsStr`, `Path`, and `str`, allowing people to create boxed versions of DSTs other than `str` and `[T]`.

Full list of additions:
* `Default` for `Box<str>`, `Box<CStr>`, `Box<OsStr>`, and `Box<Path>` (note: `Default` for `PathBuf` is already implemented)
* `CString::into_boxed_c_str` (feature gated)
* `OsString::into_boxed_os_str` (feature gated)
* `Path::into_boxed_path` (feature gated)
* `From<&CStr> for Box<CStr>`
* `From<&OsStr> for Box<OsStr>`
* `From<&Path> for Box<Path>`

This also includes adding the internal methods:
* `sys::*::os_str::Buf::into_box`
* `sys::*::os_str::Slice::{into_box, empty_box}`
* `sys_common::wtf8::Wtf8Buf::into_box`
* `sys_common::wtf8::Wtf8::{into_box, empty_box}`

7 years agoUpdate procedural-macros.md
Luxko [Wed, 15 Feb 2017 09:53:27 +0000 (03:53 -0600)]
Update procedural-macros.md

Fix typo

7 years agoVec, LinkedList, VecDeque, String, and Option NatVis visualizations
Andrew Gaspar [Wed, 15 Feb 2017 09:51:19 +0000 (01:51 -0800)]
Vec, LinkedList, VecDeque, String, and Option NatVis visualizations

7 years agoAuto merge of #39560 - F001:retainHashMap, r=alexcrichton
bors [Wed, 15 Feb 2017 07:30:10 +0000 (07:30 +0000)]
Auto merge of #39560 - F001:retainHashMap, r=alexcrichton

std: Add retain method for HashMap and HashSet

Fix #36648

r? @bluss

7 years agomake doc consistent with var name
king6cong [Wed, 15 Feb 2017 06:52:13 +0000 (14:52 +0800)]
make doc consistent with var name

7 years agoStabilize field init shorthand
est31 [Sun, 12 Feb 2017 05:49:15 +0000 (06:49 +0100)]
Stabilize field init shorthand

Closes #37340.

7 years agofix types in to_owned doctest
Alex Burka [Wed, 15 Feb 2017 04:07:51 +0000 (23:07 -0500)]
fix types in to_owned doctest

7 years agoAuto merge of #39633 - steveklabnik:vendor-mdbook, r=alexcrichton
bors [Wed, 15 Feb 2017 01:22:16 +0000 (01:22 +0000)]
Auto merge of #39633 - steveklabnik:vendor-mdbook, r=alexcrichton

Port books to mdbook

Part of https://github.com/rust-lang/rust/issues/39588

blocked on https://github.com/rust-lang/rust/pull/39431

As a first step towards the bookshelf, we ~vendor mdbook in-tree and~ port our books to it. Eventually, both of these books will be moved out-of-tree, but the nightly book will rely on doing the same thing. As such, this intermediate step is useful.

r? @alexcrichton @brson

/cc @azerupi

7 years agoAuto merge of #39818 - frewsxcv:rollup, r=frewsxcv
bors [Tue, 14 Feb 2017 22:46:10 +0000 (22:46 +0000)]
Auto merge of #39818 - frewsxcv:rollup, r=frewsxcv

Rollup of 8 pull requests

- Successful merges: #39659, #39730, #39754, #39772, #39785, #39788, #39790, #39813
- Failed merges:

7 years agoConversions between CStr/OsStr/Path and boxes.
Clar Charr [Wed, 1 Feb 2017 03:46:16 +0000 (22:46 -0500)]
Conversions between CStr/OsStr/Path and boxes.

7 years agoShow five traits implementation in help when there are exactly five
Sebastian Waisbrot [Tue, 14 Feb 2017 04:32:05 +0000 (01:32 -0300)]
Show five traits implementation in help when there are exactly five

7 years agoRollup merge of #39813 - sanxiyn:non-camel-case-variant, r=petrochenkov
Corey Farwell [Tue, 14 Feb 2017 15:07:37 +0000 (10:07 -0500)]
Rollup merge of #39813 - sanxiyn:non-camel-case-variant, r=petrochenkov

Use check_variant for non_camel_case_types lint

This way we automatically consider lint attributes.

Fix #38452.

7 years agoRollup merge of #39790 - zackw:tidy-linelen-exempt-urls, r=alexcrichton
Corey Farwell [Tue, 14 Feb 2017 15:07:36 +0000 (10:07 -0500)]
Rollup merge of #39790 - zackw:tidy-linelen-exempt-urls, r=alexcrichton

tidy: exempt URLs from the line length restriction

The length of a URL is usually not under our control, and Markdown
provides no way to split a URL in the middle.  Therefore, comment
lines consisting _solely_ of a URL (possibly with a Markdown link
label in front) should be exempt from the line-length restriction.

Inline hyperlink destinations ( `[foo](http://...)` notation ) are
_not_ exempt, because it is my arrogant opinion that long lines of
that type make the source text illegible.

The patch adds dependencies on the `regex` and `lazy_static` crates
to the tidy utility.  This _appears_ to Just Work, but if you would
rather not have that dependency I am willing to provide a hand-written
parser instead.

7 years agoRollup merge of #39788 - GuillaumeGomez:rustdoc-test-md-file, r=alexcrichton
Corey Farwell [Tue, 14 Feb 2017 15:07:35 +0000 (10:07 -0500)]
Rollup merge of #39788 - GuillaumeGomez:rustdoc-test-md-file, r=alexcrichton

Add filename when running rustdoc --test on a markdown file

r? @alexcrichton

7 years agoRollup merge of #39785 - alexcrichton:no-thread-sanitizer, r=japaric
Corey Farwell [Tue, 14 Feb 2017 15:07:34 +0000 (10:07 -0500)]
Rollup merge of #39785 - alexcrichton:no-thread-sanitizer, r=japaric

test: Remove sanitizer-thread test

Unfortunately it appears to spuriously fail so we can't gate on it

7 years agoRollup merge of #39772 - cseale:staged_api_whitelist_removal, r=est31
Corey Farwell [Tue, 14 Feb 2017 15:07:33 +0000 (10:07 -0500)]
Rollup merge of #39772 - cseale:staged_api_whitelist_removal, r=est31

Adding compile fail test for staged_api feature

Issue #39059
r? @est31

@est31 running the tests for this feature fails. Is that expected since this is the `compile-fail`suite?

I copied this test from the run-pass suite: `rust/src/test/run-pass/reachable-unnameable-type-alias.rs`. What are the differences between these suites in operation and why they are used?

7 years agoRollup merge of #39754 - alexcrichton:less-assertions, r=brson
Corey Farwell [Tue, 14 Feb 2017 15:07:31 +0000 (10:07 -0500)]
Rollup merge of #39754 - alexcrichton:less-assertions, r=brson

travis: Add builders without assertions

This commit adds three new builders, one OSX, one Linux, and one MSVC, which
will produce "nightlies" with LLVM assertions disabled. Currently all nightly
releases have LLVM assertions enabled to catch bugs before they reach the
beta/stable channels. The beta/stable channels, however, do not have LLVM
assertions enabled.

Unfortunately though projects like Servo are stuck on nightlies for the near
future at least and are also suffering very long compile times. The purpose of
this commit is to provide artifacts to these projects which are not distributed
through normal channels (e.g. rustup) but are provided for developers to use
locally if need be.

Logistically these builds will all be uploaded to `rustc-builds-alt` instead of
the `rustc-builds` folder of the `rust-lang-ci` bucket. These builds will stay
there forever (until cleaned out if necessary) and there are no plans to
integrate this with rustup and/or the official release process.

7 years agoRollup merge of #39730 - jseyfried:fix_empty_seq_rep_ice, r=nrc
Corey Farwell [Tue, 14 Feb 2017 15:07:30 +0000 (10:07 -0500)]
Rollup merge of #39730 - jseyfried:fix_empty_seq_rep_ice, r=nrc

macros: fix ICE on certain sequence repetitions

Fixes #39709.
r? @nrc

7 years agoRollup merge of #39659 - zackw:asciiext-ctype, r=alexcrichton
Corey Farwell [Tue, 14 Feb 2017 15:07:29 +0000 (10:07 -0500)]
Rollup merge of #39659 - zackw:asciiext-ctype, r=alexcrichton

Add equivalents of C's <ctype.h> functions to AsciiExt.

 * `is_ascii_alphabetic`
 * `is_ascii_uppercase`
 * `is_ascii_lowercase`
 * `is_ascii_alphanumeric`
 * `is_ascii_digit`
 * `is_ascii_hexdigit`
 * `is_ascii_punctuation`
 * `is_ascii_graphic`
 * `is_ascii_whitespace`
 * `is_ascii_control`

This addresses issue #39658.

Lightly tested on x86-64-linux.  tidy complains about the URLs in the documentation making lines too long, I don't know what to do about that.

7 years agoUse check_variant for non_camel_case_types lint
Seo Sanghyeon [Tue, 14 Feb 2017 10:46:48 +0000 (19:46 +0900)]
Use check_variant for non_camel_case_types lint