]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoAuto merge of #35871 - bluss:cstring-new, r=alexcrichton
bors [Mon, 22 Aug 2016 15:29:41 +0000 (08:29 -0700)]
Auto merge of #35871 - bluss:cstring-new, r=alexcrichton

cstring: avoid excessive growth just to 0-terminate

Based on following what happens in CString::new("string literal"):

1. Using `Into<Vec<u8>>`, a Vec is allocated with capacity exactly equal
   to the string's input length.
2. By `v.push(0)`, the Vec is grown to twice capacity, since it was full.
3. By `v.into_boxed_slice()`, the Vec capacity is shrunk to fit the length again.

If we use `.reserve_exact(1)` just before the push, then we avoid the
capacity doubling that we're going to have to shrink anyway.

Growing by just 1 byte means that the step (2) is less likely to have to
move the memory to a larger allocation chunk, and that the step (3) does
not have to reallocate.

Addresses part of #35838

7 years agoAuto merge of #35848 - Mark-Simulacrum:make-tidy-in-tree, r=alexcrichton
bors [Mon, 22 Aug 2016 12:39:53 +0000 (05:39 -0700)]
Auto merge of #35848 - Mark-Simulacrum:make-tidy-in-tree, r=alexcrichton

Check that executable file is in-tree before failing tidy check

I silenced stdout and stderr for ls-files, not sure if that's appropriate (is `make tidy` intended to give debugging information)? Otherwise it prints each file it find to stdout/stderr, which currently prints nothing (only executable files are checked).

I have not done major testing regarding the behavior of ls-files when the file is ignored, but judging by the man page everything should be fine.

I've duplicated the code which makes the path git-friendly from the `Cargo.lock` checking code; I can extract that into a common helper if wanted (it's only two lines).

Fixes #35689.

7 years agoAuto merge of #35821 - nbaksalyar:solaris-trans-fix, r=alexcrichton
bors [Mon, 22 Aug 2016 05:30:46 +0000 (22:30 -0700)]
Auto merge of #35821 - nbaksalyar:solaris-trans-fix, r=alexcrichton

Fix linker on Solaris/Illumos

This patch provides a fix for the `GnuLinker::export_symbols` function that currently relies on a `--retain-symbols-file` option which is not supported by the Solaris & Illumos linker.

Instead, a [version script](https://www.gnu.org/software/gnulib/manual/html_node/LD-Version-Scripts.html) is used on this platform to achieve the same goal. Here's an example of a similar approach in LLVM's CMake script: https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/AddLLVM.cmake#L88-L94.

Perhaps other platforms like OpenBSD could benefit from this as well. /cc @semarie

7 years agoAuto merge of #35777 - nrc:carrier3, r=@nikomatsakis
bors [Sun, 21 Aug 2016 22:12:43 +0000 (15:12 -0700)]
Auto merge of #35777 - nrc:carrier3, r=@nikomatsakis

Carrier trait (third attempt)

This adds a `Carrier` trait to operate with `?`. The only public implementation is for `Result`, so effectively the trait does not exist, however, it ensures future compatibility for the `?` operator. This is not intended to be used, nor is it intended to be a long-term solution.

Although this exact PR has not been through Crater, I do not expect it to be a breaking change based on putting numerous similar PRs though Crater in the past.

cc:
* [? tracking issue](https://github.com/rust-lang/rust/issues/31436)
* [previous PR](https://github.com/rust-lang/rust/pull/35056)
* [RFC issue](https://github.com/rust-lang/rfcs/issues/1718) for discussion of long-term Carrier trait solutions.

r? @nikomatsakis

7 years agoFix type error with `?` in existing code.
Nick Cameron [Sun, 21 Aug 2016 21:31:26 +0000 (09:31 +1200)]
Fix type error with `?` in existing code.

7 years agoAuto merge of #35776 - jseyfried:more_groundwork, r=nrc
bors [Sun, 21 Aug 2016 18:03:48 +0000 (11:03 -0700)]
Auto merge of #35776 - jseyfried:more_groundwork, r=nrc

resolve: More groundwork for `item_like_imports` (RFC 1560)

r? @nrc

7 years agocstring: avoid excessive growth just to 0-terminate
Ulrik Sverdrup [Sun, 21 Aug 2016 11:33:28 +0000 (13:33 +0200)]
cstring: avoid excessive growth just to 0-terminate

Based on following what happens in CString::new("string literal"):

1. Using `Into<Vec<u8>>`, a Vec is allocated with capacity exactly equal
   to the string's input length.
2. By `v.push(0)`, the Vec is grown to twice capacity, since it was full.
3. By `v.into_boxed_slice()`, the Vec capacity is shrunk to fit the length again.

If we use `.reserve_exact(1)` just before the push, then we avoid the
capacity doubling that we're going to have to shrink anyway.

Growing by just 1 byte means that the step (2) is less likely to have to
move the memory to a larger allocation chunk, and that the step (3) does
not have to reallocate.

7 years agoAuto merge of #35857 - jonathandturner:rollup, r=jonathandturner
bors [Sat, 20 Aug 2016 14:09:53 +0000 (07:09 -0700)]
Auto merge of #35857 - jonathandturner:rollup, r=jonathandturner

Rollup of 19 pull requests

- Successful merges: #35234, #35701, #35709, #35710, #35775, #35778, #35780, #35781, #35794, #35800, #35804, #35806, #35811, #35812, #35818, #35827, #35830, #35831, #35839
- Failed merges: #35759

7 years agoRollup merge of #35839 - jonathandturner:error_touchup, r=Aatch
Jonathan Turner [Sat, 20 Aug 2016 14:09:37 +0000 (07:09 -0700)]
Rollup merge of #35839 - jonathandturner:error_touchup, r=Aatch

Wording fixes in error messages

This PR is largely wording fixes to existing PRs that I found going back through the ones that have already been updated.  Sometimes seeing the message in context made me think "oh there's a better wording!"

There's one additional fix.  This will also prevent the secondary underlining of derive call (since they look like macros to the system in the way I was using):

```
error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
  --> src/test/compile-fail/E0184.rs:11:10
   |
11 | #[derive(Copy)] //~ ERROR E0184
   |          ^^^^
   |          |
   |          in this macro invocation
```

Is now just:

```
error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
  --> src/test/compile-fail/E0184.rs:11:10
   |
11 | #[derive(Copy)] //~ ERROR E0184
   |          ^^^^
```

7 years agoRollup merge of #35831 - trixnz:error-428, r=jonathandturner
Jonathan Turner [Sat, 20 Aug 2016 14:09:37 +0000 (07:09 -0700)]
Rollup merge of #35831 - trixnz:error-428, r=jonathandturner

Update E0428 to new format

Fixes #35798 as part of #35233.

r? @jonathandturner

7 years agoRollup merge of #35830 - matthew-piziak:not-example, r=steveklabnik
Jonathan Turner [Sat, 20 Aug 2016 14:09:37 +0000 (07:09 -0700)]
Rollup merge of #35830 - matthew-piziak:not-example, r=steveklabnik

replace `Neg` example with something more evocative of negation

7 years agoRollup merge of #35827 - matthew-piziak:neg-example, r=steveklabnik
Jonathan Turner [Sat, 20 Aug 2016 14:09:37 +0000 (07:09 -0700)]
Rollup merge of #35827 - matthew-piziak:neg-example, r=steveklabnik

replace `Not` example with something more evocative

7 years agoRollup merge of #35818 - wdv4758h:E0133-label, r=Aatch
Jonathan Turner [Sat, 20 Aug 2016 14:09:36 +0000 (07:09 -0700)]
Rollup merge of #35818 - wdv4758h:E0133-label, r=Aatch

Fix label messages for E0133

Issue #35789

7 years agoRollup merge of #35812 - mlayne:E0232, r=jonathandturner
Jonathan Turner [Sat, 20 Aug 2016 14:09:36 +0000 (07:09 -0700)]
Rollup merge of #35812 - mlayne:E0232, r=jonathandturner

Update error format for E0232

Fixes #35795, as part of #35233.

Excited to make my first contribution to rustc!

r? @jonathandturner

7 years agoRollup merge of #35811 - jonathandturner:fix_rustbuild_version_test, r=alexcrichton
Jonathan Turner [Sat, 20 Aug 2016 14:09:36 +0000 (07:09 -0700)]
Rollup merge of #35811 - jonathandturner:fix_rustbuild_version_test, r=alexcrichton

Add workaround to detect correct compiler version

This adds a workaround which fixes a rustbuild issue where the wrong compiler is checked for the version number.  The bug would arise if you build the system correctly then changed to any other version (eg doing a `git pull`).  After changing to the new version, building would fail and complain that crates were built with the wrong compiler.

There are actually two compilers at play, the bootstrapping compiler (called the "snapshot" compiler) and the actual compiler being built (the "real" compiler).  In the case of this issue, the wrong compiler was being checked for version mismatch.

r? @alexcrichton

7 years agoRollup merge of #35806 - matthew-piziak:addassign-example, r=steveklabnik
Jonathan Turner [Sat, 20 Aug 2016 14:09:36 +0000 (07:09 -0700)]
Rollup merge of #35806 - matthew-piziak:addassign-example, r=steveklabnik

replace `AddAssign` example with something more evocative of addition

This is analogous to PR #35709 for the `Add` trait.

7 years agoRollup merge of #35804 - pliniker:master, r=jonathandturner
Jonathan Turner [Sat, 20 Aug 2016 14:09:35 +0000 (07:09 -0700)]
Rollup merge of #35804 - pliniker:master, r=jonathandturner

Update error message for E0084

Fixes #35792 as part of #35233

r? @jonathandturner

7 years agoRollup merge of #35800 - matthew-piziak:mul-div-examples, r=steveklabnik
Jonathan Turner [Sat, 20 Aug 2016 14:09:35 +0000 (07:09 -0700)]
Rollup merge of #35800 - matthew-piziak:mul-div-examples, r=steveklabnik

demonstrate `RHS != Self` use cases for `Mul` and `Div`

Vector-scalar multipication is a good usecase for this. Thanks #rust!

7 years agoRollup merge of #35794 - cantino:fix-typo, r=apasel422
Jonathan Turner [Sat, 20 Aug 2016 14:09:35 +0000 (07:09 -0700)]
Rollup merge of #35794 - cantino:fix-typo, r=apasel422

Fix minor typo

Minor typo in the book.

7 years agoRollup merge of #35781 - ErikUggeldahl:spellingfix, r=apasel422
Jonathan Turner [Sat, 20 Aug 2016 14:09:35 +0000 (07:09 -0700)]
Rollup merge of #35781 - ErikUggeldahl:spellingfix, r=apasel422

Very minor spelling fix in the book

Changed datastructure to data structure.

r? @steveklabnik

7 years agoRollup merge of #35780 - clementmiao:E0396_new_err_format, r=jonathandturner
Jonathan Turner [Sat, 20 Aug 2016 14:09:35 +0000 (07:09 -0700)]
Rollup merge of #35780 - clementmiao:E0396_new_err_format, r=jonathandturner

updated E0396 to new error format

Updated E0396 to new error format.
Part of #35233
Fixes #35779

Thanks again for letting me help!

r? @jonathandturner

7 years agoRollup merge of #35778 - clementmiao:E0395_new_error_format, r=jonathandturner
Jonathan Turner [Sat, 20 Aug 2016 14:09:34 +0000 (07:09 -0700)]
Rollup merge of #35778 - clementmiao:E0395_new_error_format, r=jonathandturner

updated E0395 to new error format

Updated E0395 to new error format.
Part of #35233
Fixes #35693

Thanks again for letting me help!

r? @jonathandturner

7 years agoRollup merge of #35775 - frewsxcv:os-str-doc-examples, r=GuillaumeGomez
Jonathan Turner [Sat, 20 Aug 2016 14:09:34 +0000 (07:09 -0700)]
Rollup merge of #35775 - frewsxcv:os-str-doc-examples, r=GuillaumeGomez

Add a few doc examples for `std::ffi::OsStr`.

7 years agoRollup merge of #35710 - matthew-piziak:explicit-drop, r=steveklabnik
Jonathan Turner [Sat, 20 Aug 2016 14:09:34 +0000 (07:09 -0700)]
Rollup merge of #35710 - matthew-piziak:explicit-drop, r=steveklabnik

note that calling drop() explicitly is a compiler error

Part of #29365

7 years agoRollup merge of #35709 - matthew-piziak:add-trait-example, r=GuillaumeGomez
Jonathan Turner [Sat, 20 Aug 2016 14:09:34 +0000 (07:09 -0700)]
Rollup merge of #35709 - matthew-piziak:add-trait-example, r=GuillaumeGomez

replace `Add` example with something more evocative of addition

Currently most of the operator traits use trivial implementation
examples that only perform side effects. Honestly, that might not be too
bad for the sake of documentation; but anyway, here's a proposal to move
a slightly modified version of the module-level point-addition example
into the `Add` documentation, since it's more evocative of addition
semantics.

Part of #29365

7 years agoRollup merge of #35701 - matthew-piziak:rangefull-example-error, r=steveklabnik
Jonathan Turner [Sat, 20 Aug 2016 14:09:33 +0000 (07:09 -0700)]
Rollup merge of #35701 - matthew-piziak:rangefull-example-error, r=steveklabnik

explicitly show how iterating over `..` fails

I've also removed the `main()` wrapper, which I believe is extraneous.
LMK if that's incorrect.

7 years agoRollup merge of #35234 - nrc:rustdoc-macros, r=steveklabnik
Jonathan Turner [Sat, 20 Aug 2016 14:09:33 +0000 (07:09 -0700)]
Rollup merge of #35234 - nrc:rustdoc-macros, r=steveklabnik

rustdoc: remove the `!` from macro URLs and titles

Because the `!` is part of a macro use, not the macro's name. E.g., you write `macro_rules! foo` not `macro_rules! foo!`, also `#[macro_import(foo)]`.

(Pulled out of #35020).

7 years agoFix broken tests for E0428
trixnz [Sat, 20 Aug 2016 10:10:41 +0000 (12:10 +0200)]
Fix broken tests for E0428

7 years agoFix linker on Solaris/Illumos
Nikita Baksalyar [Sat, 13 Aug 2016 09:09:43 +0000 (14:09 +0500)]
Fix linker on Solaris/Illumos

Solaris linker doesn't support the `--retain-symbols-file` option,
so this patch provides version scripts as an alternative on that
platform.

7 years agoAuto merge of #35607 - alexcrichton:stabilize-1.12, r=brson
bors [Sat, 20 Aug 2016 07:08:38 +0000 (00:08 -0700)]
Auto merge of #35607 - alexcrichton:stabilize-1.12, r=brson

std: Stabilize APIs for the 1.12 release

Stabilized

* `Cell::as_ptr`
* `RefCell::as_ptr`
* `IpAddr::is_{unspecified,loopback,multicast}`
* `Ipv6Addr::octets`
* `LinkedList::contains`
* `VecDeque::contains`
* `ExitStatusExt::from_raw` - both on Unix and Windows
* `Receiver::recv_timeout`
* `RecvTimeoutError`
* `BinaryHeap::peek_mut`
* `PeekMut`
* `iter::Product`
* `iter::Sum`
* `OccupiedEntry::remove_entry`
* `VacantEntry::into_key`

Deprecated

* `Cell::as_unsafe_cell`
* `RefCell::as_unsafe_cell`
* `OccupiedEntry::remove_pair`

Closes #27708
cc #27709
Closes #32313
Closes #32630
Closes #32713
Closes #34029
Closes #34392
Closes #34285
Closes #34529

7 years agoCheck that executable file is in-tree before failing tidy check.
Mark-Simulacrum [Sat, 20 Aug 2016 03:44:46 +0000 (21:44 -0600)]
Check that executable file is in-tree before failing tidy check.

7 years agoAuto merge of #33922 - estebank:doc-comment, r=alexcrichton
bors [Sat, 20 Aug 2016 01:14:53 +0000 (18:14 -0700)]
Auto merge of #33922 - estebank:doc-comment, r=alexcrichton

Specific error message for missplaced doc comments

Identify when documetation comments have been missplaced in the following places:

 * After a struct element:

    ```rust
    // file.rs:
    struct X {
        a: u8 /** document a */,
    }
    ```

    ```bash
    $ rustc file.rs
    file.rs:2:11: 2:28 error: found documentation comment that doesn't
    document anything
    file.rs:2     a: u8 /** document a */,
                        ^~~~~~~~~~~~~~~~~
    file.rs:2:11: 2:28 help: doc comments must come before what they document,
    maybe a comment was intended with `//`?
    ```

 * As the last line of a struct:

    ```rust
    // file.rs:
    struct X {
        a: u8,
        /// incorrect documentation
    }
    ```

    ```bash
    $ rustc file.rs
    file.rs:3:5: 3:27 error: found a documentation comment that doesn't
    document anything
    file.rs:3     /// incorrect documentation
                  ^~~~~~~~~~~~~~~~~~~~~~
    file.rs:3:5: 3:27 help: doc comments must come before what they document,
    maybe a comment was intended with `//`?
    ```

 * As the last line of a `fn`:

    ```rust
    // file.rs:
    fn main() {
        let x = 1;
        /// incorrect documentation
    }
    ```

    ```bash
    $ rustc file.rs
    file.rs:3:5: 3:27 error: found a documentation comment that doesn't
    document anything
    file.rs:3     /// incorrect documentation
                  ^~~~~~~~~~~~~~~~~~~~~~
    file.rs:3:5: 3:27 help: doc comments must come before what they document,
    maybe a comment was intended with `//`?
    ```

Fix #27429, #30322

7 years agowording fixes in error messages
Jonathan Turner [Fri, 19 Aug 2016 23:05:37 +0000 (16:05 -0700)]
wording fixes in error messages

7 years agostd: Stabilize APIs for the 1.12 release
Alex Crichton [Thu, 11 Aug 2016 21:08:24 +0000 (14:08 -0700)]
std: Stabilize APIs for the 1.12 release

Stabilized

* `Cell::as_ptr`
* `RefCell::as_ptr`
* `IpAddr::is_{unspecified,loopback,multicast}`
* `Ipv6Addr::octets`
* `LinkedList::contains`
* `VecDeque::contains`
* `ExitStatusExt::from_raw` - both on Unix and Windows
* `Receiver::recv_timeout`
* `RecvTimeoutError`
* `BinaryHeap::peek_mut`
* `PeekMut`
* `iter::Product`
* `iter::Sum`
* `OccupiedEntry::remove_entry`
* `VacantEntry::into_key`

Deprecated

* `Cell::as_unsafe_cell`
* `RefCell::as_unsafe_cell`
* `OccupiedEntry::remove_pair`

Closes #27708
cc #27709
Closes #32313
Closes #32630
Closes #32713
Closes #34029
Closes #34392
Closes #34285
Closes #34529

7 years agoAuto merge of #35655 - ollie27:rustdoc_search_static_prim, r=steveklabnik
bors [Fri, 19 Aug 2016 18:17:11 +0000 (11:17 -0700)]
Auto merge of #35655 - ollie27:rustdoc_search_static_prim, r=steveklabnik

rustdoc: Fix a couple of issues with the search results

* Fix links to static items in the search results.
* Don't include the path for primitive methods in the search results. Displaying `std::u32::max_value` is misleading so just display `u32::max_value`.

7 years agoUpdate E0428 to new format
trixnz [Fri, 19 Aug 2016 17:19:34 +0000 (19:19 +0200)]
Update E0428 to new format

7 years agoreplace `Neg` example with something more evocative of negation
Matthew Piziak [Fri, 19 Aug 2016 16:46:11 +0000 (12:46 -0400)]
replace `Neg` example with something more evocative of negation

7 years agoreplace `Not` example with something more evocative
Matthew Piziak [Fri, 19 Aug 2016 16:35:54 +0000 (12:35 -0400)]
replace `Not` example with something more evocative

7 years agoFix label messages for E0133
Chiu-Hsiang Hsu [Fri, 19 Aug 2016 03:58:26 +0000 (11:58 +0800)]
Fix label messages for E0133

Issue #35789

7 years agoAuto merge of #35719 - Amanieu:atomic_access, r=alexcrichton
bors [Fri, 19 Aug 2016 01:44:54 +0000 (18:44 -0700)]
Auto merge of #35719 - Amanieu:atomic_access, r=alexcrichton

Implement RFC 1649

cc #35603 rust-lang/rfcs#1649

r? @alexcrichton

7 years agoRemove the Option and bool impls for carrier and add a dummy impl
Nick Cameron [Tue, 9 Aug 2016 05:54:24 +0000 (17:54 +1200)]
Remove the Option and bool impls for carrier and add a dummy impl

The dummy impl should ensure the same type checking behaviour as having other (real) Carrier impls.

7 years agoUpdate error format for E0232
Michael Layne [Thu, 18 Aug 2016 21:40:59 +0000 (14:40 -0700)]
Update error format for E0232

7 years agoAdd workaround to detect correct compiler version
Jonathan Turner [Thu, 18 Aug 2016 22:22:23 +0000 (15:22 -0700)]
Add workaround to detect correct compiler version

7 years agoreplace `AddAssign` example with something more evocative of addition
Matthew Piziak [Thu, 18 Aug 2016 20:54:33 +0000 (16:54 -0400)]
replace `AddAssign` example with something more evocative of addition

This is analogous to PR #35709 for the `Add` trait.

7 years agonote that calling drop() explicitly is a compiler error
Matthew Piziak [Tue, 16 Aug 2016 08:33:59 +0000 (04:33 -0400)]
note that calling drop() explicitly is a compiler error

Part of #29365

explain that std::mem::drop in prelude will invoke Drop

change "prelude" -> "the prelude"; change links to reference-style

move link references to links' section

7 years agoUpdate error message for E0084
pliniker [Thu, 18 Aug 2016 20:27:33 +0000 (16:27 -0400)]
Update error message for E0084

7 years agoRedirect
Nick Cameron [Tue, 16 Aug 2016 02:25:12 +0000 (14:25 +1200)]
Redirect

7 years agosplit example into three sections with explanation
Matthew Piziak [Thu, 18 Aug 2016 20:12:40 +0000 (16:12 -0400)]
split example into three sections with explanation

7 years agodemonstrate `RHS != Self` use cases for `Mul` and `Div`
Matthew Piziak [Thu, 18 Aug 2016 20:04:53 +0000 (16:04 -0400)]
demonstrate `RHS != Self` use cases for `Mul` and `Div`

Vector-scalar multipication is a good usecase for this. Thanks #rust!

7 years agoFix minor typo
Andrew Cantino [Thu, 18 Aug 2016 19:06:05 +0000 (15:06 -0400)]
Fix minor typo

7 years agoAuto merge of #35684 - nikomatsakis:incr-comp-metadata-audit-35111, r=mw
bors [Thu, 18 Aug 2016 15:54:10 +0000 (08:54 -0700)]
Auto merge of #35684 - nikomatsakis:incr-comp-metadata-audit-35111, r=mw

Restructure metadata encoder to track deps precisely

This issue restructures meta-data encoding to track dependencies very precisely. It uses a cute technique I hope to spread elsewhere, where we can guard the data flowing into a new dep-graph task and ensure that it is not "leaking" information from the outside, which would result in missing edges. There are no tests because we don't know of any bugs in the old system, but it's clear that there was leaked data.

The commit series is standalone, but the refactorings are kind of "windy". It's a good idea to read the comment in `src/librustc_metadata/index_builder.rs` to get a feeling for the overall strategy I was aiming at.

In several cases, I wound up adding some extra hashtable lookups, I think primarily for looking up `AdtDef` instances. We could remove these by implementing `DepGraphRead` for an `AdtDef` and then having it register a read to the adt-defs table, I guess, but I doubt it is really noticeable.

Eventually I think I'd like to extend this pattern to the dep-graph more generally, since it effectively guarantees that data cannot leak.

Fixes #35111.

r? @michaelwoerister

7 years agoAdd a few doc examples for `std::ffi::OsStr`.
Corey Farwell [Thu, 18 Aug 2016 02:56:43 +0000 (22:56 -0400)]
Add a few doc examples for `std::ffi::OsStr`.

* `std::ffi::OsStr::new`.
* `std::ffi::OsStr::is_empty`.
* `std::ffi::OsStr::len`.

7 years agoAuto merge of #35732 - jonathandturner:region_error_labels, r=nikomatsakis
bors [Thu, 18 Aug 2016 12:39:11 +0000 (05:39 -0700)]
Auto merge of #35732 - jonathandturner:region_error_labels, r=nikomatsakis

Move 'doesn't live long enough' errors to labels

This patch moves the "doesn't live long enough" region-style errors to instead use labels.

An example follows.

Before:

```
error: `x` does not live long enough
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18
   |
26 |         let y = &x;
   |                  ^
   |
note: reference must be valid for the block at 23:10...
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:23:11
   |
23 | fn main() {
   |           ^
note: ...but borrowed value is only valid for the block suffix following statement 0 at 25:18
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:25:19
   |
25 |         let x = 1;
   |                   ^
```

After:

```
error: `x` does not live long enough
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18
   |
26 |         let y = &x;
   |                  ^ does not live long enough
...
32 |     };
   |     - borrowed value only valid until here
...
35 | }
   | - borrowed value must be valid until here
```

r? @nikomatsakis

7 years agoAdd type `Determinacy`.
Jeffrey Seyfried [Thu, 18 Aug 2016 05:39:32 +0000 (05:39 +0000)]
Add type `Determinacy`.

7 years agoFix fallout in tests.
Jeffrey Seyfried [Thu, 18 Aug 2016 02:00:47 +0000 (02:00 +0000)]
Fix fallout in tests.

7 years agoRefactor away `ImportResolvingError`.
Jeffrey Seyfried [Thu, 18 Aug 2016 03:39:48 +0000 (03:39 +0000)]
Refactor away `ImportResolvingError`.

7 years agoRename `source` -> `name` in `finalize_import`.
Jeffrey Seyfried [Thu, 18 Aug 2016 01:46:18 +0000 (01:46 +0000)]
Rename `source` -> `name` in `finalize_import`.

7 years agoRename `target_module` to `module` or `imported_module`.
Jeffrey Seyfried [Thu, 18 Aug 2016 01:43:26 +0000 (01:43 +0000)]
Rename `target_module` to `module` or `imported_module`.

7 years agoImprove import failure detection.
Jeffrey Seyfried [Thu, 18 Aug 2016 00:11:56 +0000 (00:11 +0000)]
Improve import failure detection.

7 years agoAuto merge of #35769 - eddyb:rollup, r=eddyb
bors [Thu, 18 Aug 2016 07:15:11 +0000 (00:15 -0700)]
Auto merge of #35769 - eddyb:rollup, r=eddyb

Rollup of 12 pull requests

- Successful merges: #35346, #35734, #35739, #35740, #35742, #35744, #35749, #35750, #35751, #35756, #35766, #35768
- Failed merges:

7 years agoFix tiny spelling mistake in book
Erik Uggeldahl [Thu, 18 Aug 2016 06:03:42 +0000 (02:03 -0400)]
Fix tiny spelling mistake in book

Changed datastructure to data structure

7 years agoupdated E0396 to new error format
clementmiao [Thu, 18 Aug 2016 05:45:21 +0000 (22:45 -0700)]
updated E0396 to new error format

7 years agoupdated E0395 to new error format
clementmiao [Thu, 18 Aug 2016 05:03:52 +0000 (22:03 -0700)]
updated E0395 to new error format

7 years agoUse a Carrier trait with the `?` operator
Nick Cameron [Tue, 3 May 2016 01:01:54 +0000 (13:01 +1200)]
Use a Carrier trait with the `?` operator

Allows use with `Option` and custom `Result`-like types.

7 years agoFix links
Nick Cameron [Mon, 15 Aug 2016 22:36:39 +0000 (10:36 +1200)]
Fix links

7 years agorustdoc: remove the `!` from macro URLs and titles
Nick Cameron [Wed, 3 Aug 2016 00:55:01 +0000 (12:55 +1200)]
rustdoc: remove the `!` from macro URLs and titles

7 years agoRefactor out `finalize_import()` from `resolve_import()`.
Jeffrey Seyfried [Mon, 15 Aug 2016 08:19:09 +0000 (08:19 +0000)]
Refactor out `finalize_import()` from `resolve_import()`.

7 years agoCheck privacy in `resolve_name_in_module`.
Jeffrey Seyfried [Mon, 15 Aug 2016 22:43:25 +0000 (22:43 +0000)]
Check privacy in `resolve_name_in_module`.

7 years agoRefactor `value_determined` -> `value_result`, `type_determined` -> `type_result`.
Jeffrey Seyfried [Wed, 17 Aug 2016 20:48:53 +0000 (20:48 +0000)]
Refactor `value_determined` -> `value_result`, `type_determined` -> `type_result`.

7 years agoRefactor `resolve_module_path` to take an `Option<Span>` instead of a `Span`.
Jeffrey Seyfried [Mon, 15 Aug 2016 20:51:19 +0000 (20:51 +0000)]
Refactor `resolve_module_path` to take an `Option<Span>` instead of a `Span`.

7 years agoRefactor `record_used: bool` -> `record_used: Option<Span>`.
Jeffrey Seyfried [Fri, 5 Aug 2016 01:58:59 +0000 (01:58 +0000)]
Refactor `record_used: bool` -> `record_used: Option<Span>`.

7 years agoRefactor away the field `arenas` of `ModuleS`.
Jeffrey Seyfried [Wed, 17 Aug 2016 01:33:19 +0000 (01:33 +0000)]
Refactor away the field `arenas` of `ModuleS`.

7 years agoRefactor away `module.resolve_name()`.
Jeffrey Seyfried [Mon, 1 Aug 2016 20:43:48 +0000 (20:43 +0000)]
Refactor away `module.resolve_name()`.

7 years agoAdd field `current_vis` to `Resolver`.
Jeffrey Seyfried [Sun, 14 Aug 2016 23:42:05 +0000 (23:42 +0000)]
Add field `current_vis` to `Resolver`.

7 years agoClean up `build_reduced_graph.rs`.
Jeffrey Seyfried [Mon, 15 Aug 2016 01:08:31 +0000 (01:08 +0000)]
Clean up `build_reduced_graph.rs`.

7 years agoRefactor `unresolved_imports` -> `indeterminate_imports`.
Jeffrey Seyfried [Wed, 17 Aug 2016 00:52:18 +0000 (00:52 +0000)]
Refactor `unresolved_imports` -> `indeterminate_imports`.

7 years agoAdd field `parent` to `ImportDirective`.
Jeffrey Seyfried [Wed, 17 Aug 2016 00:42:14 +0000 (00:42 +0000)]
Add field `parent` to `ImportDirective`.

7 years agoRefactor `module.add_import_directive()` -> `resolver.add_import_directive()`.
Jeffrey Seyfried [Wed, 17 Aug 2016 00:22:03 +0000 (00:22 +0000)]
Refactor `module.add_import_directive()` -> `resolver.add_import_directive()`.

7 years agoRollup merge of #35770 - crypto-universe:E0221, r=jonathandturner
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:23 +0000 (06:12 +0300)]
Rollup merge of #35770 - crypto-universe:E0221, r=jonathandturner

Updated test for E0221

As a part of issue #35233
?r @GuillaumeGomez

7 years agoRollup merge of #35768 - GuillaumeGomez:err_codes, r=jonathandturner
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:23 +0000 (06:12 +0300)]
Rollup merge of #35768 - GuillaumeGomez:err_codes, r=jonathandturner

Add new error code tests

r? @jonathandturner

7 years agoRollup merge of #35765 - KiChjang:e0053-bonus, r=jonathandturner
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:23 +0000 (06:12 +0300)]
Rollup merge of #35765 - KiChjang:e0053-bonus, r=jonathandturner

Additional span info for E0053

Part of #35233.
Fixes #35212.

r? @jonathandturner

7 years agoRollup merge of #35756 - crypto-universe:E0407, r=GuillaumeGomez
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:23 +0000 (06:12 +0300)]
Rollup merge of #35756 - crypto-universe:E0407, r=GuillaumeGomez

New output for E0407

Issue #35697 as a part of #35233.
r? @GuillaumeGomez

7 years agoRollup merge of #35751 - nagisa:mir-scope-fix-again, r=eddyb
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:23 +0000 (06:12 +0300)]
Rollup merge of #35751 - nagisa:mir-scope-fix-again, r=eddyb

Fix the invalidation of the MIR early exit cache

~~The #34307 introduced a cache for early exits in order to help with O(n*m) explosion of cleanup blocks but the cache is invalidated incorrectly and I can’t seem to figure out why (caching is hard!)~~

~~Remove the cache for now to fix the immediate correctness issue and worry about the performance later.~~

Cache invalidation got fixed.

Fixes #35737

r? @nikomatsakis

7 years agoRollup merge of #35750 - SimonSapin:help, r=alexcrichton
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:22 +0000 (06:12 +0300)]
Rollup merge of #35750 - SimonSapin:help, r=alexcrichton

Add 'make help' for rustbuild

It is still advertised by the configure script.

7 years agoRollup merge of #35749 - GuillaumeGomez:raw_field, r=jonathandturner
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:22 +0000 (06:12 +0300)]
Rollup merge of #35749 - GuillaumeGomez:raw_field, r=jonathandturner

Fixes issue #11004

Fixes #11004.

r? @jonathandturner

7 years agoRollup merge of #35744 - DevShep:ds/update_E0009, r=jonathandturner
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:22 +0000 (06:12 +0300)]
Rollup merge of #35744 - DevShep:ds/update_E0009, r=jonathandturner

Update E0009 to new format

Part of #35233
Fixes #35193

r? @jonathandturner

7 years agoRollup merge of #35742 - spladug:readme-cmake-version, r=nikomatsakis
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:22 +0000 (06:12 +0300)]
Rollup merge of #35742 - spladug:readme-cmake-version, r=nikomatsakis

Update minimum CMake version in README

The minimum got bumped in the LLVM upgrade of #34743.

7 years agoRollup merge of #35740 - eddyb:llvm-prl-fix, r=alexcrichton
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:21 +0000 (06:12 +0300)]
Rollup merge of #35740 - eddyb:llvm-prl-fix, r=alexcrichton

Update LLVM to include 4 backported commits by @majnemer.

Partial fix for rust-lang/rust#35662, should help at least loops on small arrays.

Nominated for backporting into the new beta (not the one that's being released as stable this week).

r? @alexcrichton

7 years agoRollup merge of #35739 - circuitfox:E0403-update-error-format, r=jonathandturner
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:21 +0000 (06:12 +0300)]
Rollup merge of #35739 - circuitfox:E0403-update-error-format, r=jonathandturner

E0403 update error format

Fixes #35696

Part of #35233

r? @jonathandturner

Also did the bonus for this one.

7 years agoRollup merge of #35734 - japaric:mips-uclibc, r=alexcrichton
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:21 +0000 (06:12 +0300)]
Rollup merge of #35734 - japaric:mips-uclibc, r=alexcrichton

add mips-uclibc targets

These targets cover OpenWRT 15.05 devices, which use the soft float ABI
and the uclibc library. None of the other built-in mips targets covered
those devices (mips-gnu is hard float and glibc-based, mips-musl is
musl-based).

With this commit one can now build std for these devices using these
commands:

```
$ configure --enable-rustbuild --target=mips-unknown-linux-uclibc
$ make
```

cc #35673

---

r? @alexcrichton
cc @felixalias This is the target the rust-tessel project should be using.
Note that the libc crate doesn't support the uclibc library and will have to be updated. We are lucky that uclibc and glibc are somewhat similar and one can build std and even run the libc-test test suite with the current, unmodified libc. About that last part, I tried to run the libc-test and got a bunch of compile errors. I don't intend to fix them but I'll post some instruction about how to run libc-test in the rust-lang/libc issue tracker.

7 years agoRollup merge of #35346 - DarkEld3r:e0093-formatting, r=jonathandturner
Eduard-Mihai Burtescu [Thu, 18 Aug 2016 03:12:21 +0000 (06:12 +0300)]
Rollup merge of #35346 - DarkEld3r:e0093-formatting, r=jonathandturner

Update compiler error 0093 to use new error format

Addresses #35230, Part of the #35233 meta bug

r? @jonathandturner

7 years agoAuto merge of #35702 - jonathandturner:add_backtrace_labels, r=nikomatsakis
bors [Thu, 18 Aug 2016 02:57:22 +0000 (19:57 -0700)]
Auto merge of #35702 - jonathandturner:add_backtrace_labels, r=nikomatsakis

Replace macro backtraces with labeled local uses

This PR (which builds on https://github.com/rust-lang/rust/pull/35688) follows from the conversations on how best to [handle the macro backtraces](https://internals.rust-lang.org/t/improving-macro-errors/3809).  The feeling there was that there were two different "groups" of users.

The first group, the macro users, rarely (and likely never) want to see the macro backtrace.  This is often more confusing to users as it will be talking about code they didn't write.

The second group, the macro writers, are trying to debug a macro.  They'll want to see something of the backtrace so that they can see where it's going wrong and what the steps were to get there.

For the first group, it seems clear that we don't want to show *any* macro backtrace.  For the second group, we want to show enough to help the macro writer.

This PR uses a heuristic.  It will only show any backtrace steps if they are in the same crate that is being compiled.  This keeps errors in foreign crates from showing to users that didn't need them.

Additionally, in asking around I repeated heard that the middle steps of the backtrace are rarely, if ever, used in practice.  This PR takes and applies this knowledge.  Now, instead of a full backtrace, the user is given the error underline inside of a local macro as well as the use site as a secondary label.  This effectively means seeing the root of the error and the top of the backtrace, eliding the middle steps.

Rather than being the "perfect solution", this PR opts to take an incremental step towards a better experience.  Likely it would help to have additional macro debugging tools, as they could be much more verbose than we'd likely want to use in the error messages themselves.

Some examples follow.

**Example 1**

Before:

<img width="1275" alt="screen shot 2016-08-15 at 4 13 18 pm" src="https://cloud.githubusercontent.com/assets/547158/17682828/3948cea2-6303-11e6-93b4-b567e9d62848.png">

After:

<img width="596" alt="screen shot 2016-08-15 at 4 13 03 pm" src="https://cloud.githubusercontent.com/assets/547158/17682832/3d670d8c-6303-11e6-9bdc-f30a30bf11ac.png">

**Example 2**

Before:

<img width="918" alt="screen shot 2016-08-15 at 4 14 35 pm" src="https://cloud.githubusercontent.com/assets/547158/17682870/722225de-6303-11e6-9175-336a3f7ce308.png">

After:

<img width="483" alt="screen shot 2016-08-15 at 4 15 01 pm" src="https://cloud.githubusercontent.com/assets/547158/17682872/7582cf6c-6303-11e6-9235-f67960f6bd4c.png">

7 years agoreplace Add example with something more evocative of addition
Matthew Piziak [Tue, 16 Aug 2016 08:11:48 +0000 (04:11 -0400)]
replace Add example with something more evocative of addition

Currently most of the operator traits use trivial implementation
examples that only perform side effects. Honestly, that might not be too
bad for the sake of documentation; but anyway, here's a proposal to move
a slightly modified version of the module-level point-addition example
into the `Add` documentation, since it's more evocative of addition
semantics.

Part of #29365

wrap identifiers in backticks

minor rephrasing

fix module-level documentation to be more truthful

This branch changes the example for `Add` to no longer be a "minimum implementation that prints something to the screen".

7 years agoAuto merge of #35736 - brson:relnotes, r=steveklabnik
bors [Wed, 17 Aug 2016 23:38:44 +0000 (16:38 -0700)]
Auto merge of #35736 - brson:relnotes, r=steveklabnik

1.11 changelog

[Rendered](https://github.com/brson/rust/blob/9863afe029092d421c9a3daafd6b7a718d53f1cf/RELEASES.md)

r? @steveklabnik

It's too late to get this into the actual release, but still needs to be backported to 1.12 beta.

7 years agoFix tidy and nits
Jonathan Turner [Wed, 17 Aug 2016 22:53:10 +0000 (15:53 -0700)]
Fix tidy and nits

7 years agoFix tidy check.
crypto-universe [Wed, 17 Aug 2016 22:43:18 +0000 (00:43 +0200)]
Fix tidy check.

7 years agoAdd UI test for E0053
Keith Yeung [Wed, 17 Aug 2016 11:05:04 +0000 (04:05 -0700)]
Add UI test for E0053

7 years agoMove 'doesn't live long enough' errors to labels
Jonathan Turner [Tue, 16 Aug 2016 22:02:20 +0000 (15:02 -0700)]
Move 'doesn't live long enough' errors to labels

7 years ago1.11 changelog
Brian Anderson [Tue, 16 Aug 2016 23:11:03 +0000 (16:11 -0700)]
1.11 changelog

7 years agoDisplay secondary span for E0053 for Mutability TypeErrors
Keith Yeung [Wed, 17 Aug 2016 11:04:14 +0000 (04:04 -0700)]
Display secondary span for E0053 for Mutability TypeErrors