Commit Graph

56043 Commits

Author SHA1 Message Date
Jonathan Turner
a361cdb72f 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
2016-08-20 07:09:36 -07:00
Jonathan Turner
0155eb16dd 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.
2016-08-20 07:09:36 -07:00
Jonathan Turner
15277eb0a9 Rollup merge of #35804 - pliniker:master, r=jonathandturner
Update error message for E0084

Fixes #35792 as part of #35233

r? @jonathandturner
2016-08-20 07:09:35 -07:00
Jonathan Turner
a36ff81753 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!
2016-08-20 07:09:35 -07:00
Jonathan Turner
ad17e0c277 Rollup merge of #35794 - cantino:fix-typo, r=apasel422
Fix minor typo

Minor typo in the book.
2016-08-20 07:09:35 -07:00
Jonathan Turner
f4b123f05f Rollup merge of #35781 - ErikUggeldahl:spellingfix, r=apasel422
Very minor spelling fix in the book

Changed datastructure to data structure.

r? @steveklabnik
2016-08-20 07:09:35 -07:00
Jonathan Turner
69612f0039 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
2016-08-20 07:09:35 -07:00
Jonathan Turner
7c843c4663 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
2016-08-20 07:09:34 -07:00
Jonathan Turner
54a41993f5 Rollup merge of #35775 - frewsxcv:os-str-doc-examples, r=GuillaumeGomez
Add a few doc examples for `std::ffi::OsStr`.
2016-08-20 07:09:34 -07:00
Jonathan Turner
ba8611ee38 Rollup merge of #35710 - matthew-piziak:explicit-drop, r=steveklabnik
note that calling drop() explicitly is a compiler error

Part of #29365
2016-08-20 07:09:34 -07:00
Jonathan Turner
ed9a18a7c7 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
2016-08-20 07:09:34 -07:00
Jonathan Turner
2d32a69700 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.
2016-08-20 07:09:33 -07:00
Jonathan Turner
d5595d1f3e 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).
2016-08-20 07:09:33 -07:00
bors
99867ee883 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
2016-08-20 00:08:38 -07:00
bors
38fa82a314 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
2016-08-19 18:14:53 -07:00
Alex Crichton
afeeadeae5 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
2016-08-19 11:59:56 -07:00
bors
f883b0bbab 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`.
2016-08-19 11:17:11 -07:00
bors
413ada3040 Auto merge of #35719 - Amanieu:atomic_access, r=alexcrichton
Implement RFC 1649

cc #35603 rust-lang/rfcs#1649

r? @alexcrichton
2016-08-18 18:44:54 -07:00
Jonathan Turner
ffbb8600fb Add workaround to detect correct compiler version 2016-08-18 15:22:23 -07:00
Matthew Piziak
6c66eaa035 replace AddAssign example with something more evocative of addition
This is analogous to PR #35709 for the `Add` trait.
2016-08-18 16:58:38 -04:00
Matthew Piziak
a516dbb7d9 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
2016-08-18 16:31:32 -04:00
pliniker
161cb36159 Update error message for E0084 2016-08-18 16:27:33 -04:00
Nick Cameron
301401e568 Redirect 2016-08-19 08:20:06 +12:00
Matthew Piziak
469b7fd1c0 split example into three sections with explanation 2016-08-18 16:12:40 -04:00
Matthew Piziak
9563f14eb5 demonstrate RHS != Self use cases for Mul and Div
Vector-scalar multipication is a good usecase for this. Thanks #rust!
2016-08-18 16:04:53 -04:00
Andrew Cantino
06302cb983 Fix minor typo 2016-08-18 15:06:05 -04:00
bors
499484f56d 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
2016-08-18 08:54:10 -07:00
Corey Farwell
c2b6f72114 Add a few doc examples for std::ffi::OsStr.
* `std::ffi::OsStr::new`.
* `std::ffi::OsStr::is_empty`.
* `std::ffi::OsStr::len`.
2016-08-18 10:34:54 -04:00
bors
43c090ed69 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
2016-08-18 05:39:11 -07:00
bors
9d6520f97b 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:
2016-08-18 00:15:11 -07:00
Erik Uggeldahl
6976991569 Fix tiny spelling mistake in book
Changed datastructure to data structure
2016-08-18 02:03:42 -04:00
clementmiao
dae1406b82 updated E0396 to new error format 2016-08-17 22:45:21 -07:00
clementmiao
0dc13ee7f2 updated E0395 to new error format 2016-08-17 22:03:52 -07:00
Nick Cameron
e6cc4c5d13 Fix links 2016-08-18 15:43:35 +12:00
Nick Cameron
da1f7731f6 rustdoc: remove the ! from macro URLs and titles 2016-08-18 15:40:56 +12:00
Eduard-Mihai Burtescu
d69cd7207b Rollup merge of #35770 - crypto-universe:E0221, r=jonathandturner
Updated test for E0221

As a part of issue #35233
?r @GuillaumeGomez
2016-08-18 06:12:23 +03:00
Eduard-Mihai Burtescu
d36b296cb6 Rollup merge of #35768 - GuillaumeGomez:err_codes, r=jonathandturner
Add new error code tests

r? @jonathandturner
2016-08-18 06:12:23 +03:00
Eduard-Mihai Burtescu
8ccc11b31b Rollup merge of #35765 - KiChjang:e0053-bonus, r=jonathandturner
Additional span info for E0053

Part of #35233.
Fixes #35212.

r? @jonathandturner
2016-08-18 06:12:23 +03:00
Eduard-Mihai Burtescu
c3601d40ec Rollup merge of #35756 - crypto-universe:E0407, r=GuillaumeGomez
New output for E0407

Issue #35697 as a part of #35233.
r? @GuillaumeGomez
2016-08-18 06:12:23 +03:00
Eduard-Mihai Burtescu
64c1aef5c8 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
2016-08-18 06:12:23 +03:00
Eduard-Mihai Burtescu
1e13de810f Rollup merge of #35750 - SimonSapin:help, r=alexcrichton
Add 'make help' for rustbuild

It is still advertised by the configure script.
2016-08-18 06:12:22 +03:00
Eduard-Mihai Burtescu
f1861b814a Rollup merge of #35749 - GuillaumeGomez:raw_field, r=jonathandturner
Fixes issue #11004

Fixes #11004.

r? @jonathandturner
2016-08-18 06:12:22 +03:00
Eduard-Mihai Burtescu
394c4497de Rollup merge of #35744 - DevShep:ds/update_E0009, r=jonathandturner
Update E0009 to new format

Part of #35233
Fixes #35193

r? @jonathandturner
2016-08-18 06:12:22 +03:00
Eduard-Mihai Burtescu
7a274441ae 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.
2016-08-18 06:12:22 +03:00
Eduard-Mihai Burtescu
99e5efdbe6 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
2016-08-18 06:12:21 +03:00
Eduard-Mihai Burtescu
71759ec52c 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.
2016-08-18 06:12:21 +03:00
Eduard-Mihai Burtescu
5e9a5b3bd7 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.
2016-08-18 06:12:21 +03:00
Eduard-Mihai Burtescu
612506bfff 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
2016-08-18 06:12:21 +03:00
bors
169b6128fc 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">
2016-08-17 19:57:22 -07:00
Matthew Piziak
dcee93a803 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".
2016-08-17 20:37:31 -04:00