]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #57653 - mark-i-m:contrib-doc, r=nikomatsakis
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:31 +0000 (09:03 +0100)]
Rollup merge of #57653 - mark-i-m:contrib-doc, r=nikomatsakis

Make the contribution doc reference the guide more

and also remove a lot of redundant info already in the guide

5 years agoRollup merge of #57634 - oli-obk:remove_unused_argument, r=davidtwco
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:29 +0000 (09:03 +0100)]
Rollup merge of #57634 - oli-obk:remove_unused_argument, r=davidtwco

Remove an unused function argument

The only use was a debug printing, which might help someone with debugging dataflow problems, but seems otherwise useless

5 years agoRollup merge of #57610 - mark-i-m:nested-matchers, r=petrochenkov
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:28 +0000 (09:03 +0100)]
Rollup merge of #57610 - mark-i-m:nested-matchers, r=petrochenkov

Fix nested `?` matchers

fix #57597

I'm not 100% if this works yet...

cc @alercah

When  this is ready (but perhaps not yet):

5 years agoRollup merge of #57573 - Xanewok:querify-entry-fn, r=Zoxc
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:27 +0000 (09:03 +0100)]
Rollup merge of #57573 - Xanewok:querify-entry-fn, r=Zoxc

Querify `entry_fn`

Analogous to https://github.com/rust-lang/rust/pull/57570 but this will also require few fixups in Miri so I decided to separate that (and it seems [CI doesn't let us break tools anymore](https://github.com/rust-lang/rust/pull/57392#issuecomment-453801540)? Or was that because it was a rollup PR?)

r? @nikomatsakis

5 years agoRollup merge of #57501 - petrochenkov:highvar, r=alexreg
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:26 +0000 (09:03 +0100)]
Rollup merge of #57501 - petrochenkov:highvar, r=alexreg

High priority resolutions for associated variants

In https://github.com/rust-lang/rust/pull/56225 variants were assigned lowest priority during name resolution to avoid crater run and potential breakage.

This PR changes the rules to give variants highest priority instead.
Some motivation:
- If variants (and their constructors) are treated as associated items, then they are obviously *inherent* associated items since they don't come from traits.
- Inherent associated items have higher priority during resolution than associated items from traits.
- The reason is that there is a way to disambiguate in favor of trait items (`<Type as Trait>::Ambiguous`), but there's no way to disambiguate in favor of inherent items, so they became unusable in case of ambiguities if they have low priority.
- It's technically problematic to fallback from associated types to anything until lazy normalization (?) is implemented.

Crater found some regressions from this change, but they are all in type positions, e.g.
```rust
fn f() -> Self::Ambiguos { ... } // Variant `Ambiguous` or associated type `Ambiguous`?
```
, so variants are not usable there right now, but they may become usable in the future if https://github.com/rust-lang/rfcs/pull/2593 is accepted.
This PR keeps code like this successfully resolving, but introduces a future-compatibility lint `ambiguous_associated_items` that recommends rewriting it as `<Self as Trait>::Ambiguous`.

5 years agoRollup merge of #57476 - Xanewok:bye-crate-analysis, r=Zoxc
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:24 +0000 (09:03 +0100)]
Rollup merge of #57476 - Xanewok:bye-crate-analysis, r=Zoxc

Move glob map use to query and get rid of CrateAnalysis

~Also includes commits from ~https://github.com/rust-lang/rust/pull/57392~ and ~https://github.com/rust-lang/rust/pull/57436~.~

With glob map calculated unconditionally in https://github.com/rust-lang/rust/pull/57392, this PR moves the calculated glob map to `GlobalCtxt` and exposes a relevant query (as we do with other queries which copy precomputed data over from the `Resolver`).

This allows us to get rid of the `CrateAnalysis` struct in an attempt to simplify the compiler interface.
cc @Zoxc

r? @nikomatsakis @Zoxc @petrochenkov

5 years agoRollup merge of #57268 - peterhj:peterhj-optmergefunc, r=nagisa
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:23 +0000 (09:03 +0100)]
Rollup merge of #57268 - peterhj:peterhj-optmergefunc, r=nagisa

Add a target option "merge-functions", and a corresponding -Z flag (works around #57356)

This commit adds a target option "merge-functions", which takes values in ("disabled", "trampolines", or "aliases" (default is "aliases")), to allow targets to opt out of the MergeFunctions LLVM pass. Additionally, the latest commit also adds an optional -Z flag, "merge-functions", which takes the same values and has precedence over the target option when both are specified.

This works around https://github.com/rust-lang/rust/issues/57356.

cc @eddyb @japaric @oli-obk @nox @nagisa

Also thanks to @denzp and @gnzlbg for discussing this on rust-cuda!

### Motivation

Basically, the problem is that the MergeFunctions pass, which rustc currently enables by default at -O2 and -O3 [1], and `extern "ptx-kernel"` functions (specific to the NVPTX target) are currently not compatible with each other. If the MergeFunctions pass is allowed to run, rustc can generate invalid PTX assembly (i.e. a PTX file that is not accepted by the native PTX assembler `ptxas`). Therefore we would like a way to opt out of the MergeFunctions pass, which is what our target option does.

### Related work

The current behavior of rustc is to enable MergeFunctions at -O2 and -O3 [1], and also to enable the use of function aliases within MergeFunctions [2] [3]. MergeFunctions seems to have some benefits, such as reducing code size and fixing a crash [4], which is why it is enabled. However, MergeFunctions both with and without function aliases is incompatible with the NVPTX target; a more detailed example for both cases is given below.

clang's "solution" is to have a "-fmerge-functions" flag that opts in to the MergeFunctions pass, but it is not enabled by default.

### Examples/more details

Consider an example Rust lib using `extern "ptx-kernel"` functions: https://github.com/peterhj/nvptx-mergefunc-bug/blob/master/nocore.rs. If we try to compile this with nightly rustc, we get the following compiler error:

    LLVM ERROR: Module has aliases, which NVPTX does not support.

This error happens because: (1) functions `foo` and `bar` have the same body, so are candidates to be merged by MergeFunctions; and (2) rustc configures MergeFunctions to generate function aliases using the "mergefunc-use-aliases" LLVM option [2] [3], but the NVPTX backend does not support those aliases.

Okay, so we can try omitting "mergefunc-use-aliases", and then rustc will happily emit PTX assembly: https://github.com/peterhj/nvptx-mergefunc-bug/blob/master/nocore-mergefunc-nousealiases-bad.ptx. However, this PTX is invalid! When we try to assemble it with `ptxas` (I'm on the CUDA 9.2 toolchain), we get an assembler error:

    ptxas nocore-mergefunc-nousealiases-bad.ptx, line 38; error   : Illegal call target, device function expected
    ptxas fatal   : Ptx assembly aborted due to errors

What's happening is that MergeFunctions rewrites the `bar` function to call `foo`. However, directly calling an `extern "ptx-kernel"` function from another `extern "ptx-kernel"` is wrong.

If we disable the MergeFunctions pass from running at all, rustc generates correct PTX assembly: https://github.com/peterhj/nvptx-mergefunc-bug/blob/master/nocore-nomergefunc-ok.ptx

[1] https://github.com/rust-lang/rust/blob/a36b960df626cbb8bea74f01243318b73f0bd201/src/librustc_codegen_ssa/back/write.rs#L155
[2] https://github.com/rust-lang/rust/blob/a36b960df626cbb8bea74f01243318b73f0bd201/src/librustc_codegen_llvm/llvm_util.rs#L64
[3] https://github.com/rust-lang/rust/pull/56358
[4] https://github.com/rust-lang/rust/pull/49479

5 years agoAuto merge of #56722 - Aaron1011:fix/blanket-eval-overflow, r=nikomatsakis
bors [Sat, 19 Jan 2019 05:05:48 +0000 (05:05 +0000)]
Auto merge of #56722 - Aaron1011:fix/blanket-eval-overflow, r=nikomatsakis

Fix stack overflow when finding blanket impls

Currently, SelectionContext tries to prevent stack overflow by keeping
track of the current recursion depth. However, this depth tracking is
only used when performing normal section (which includes confirmation).
No such tracking is performed for evaluate_obligation_recursively, which
can allow a stack overflow to occur.

To fix this, this commit tracks the current predicate evaluation depth.
This is done separately from the existing obligation depth tracking:
an obligation overflow can occur across multiple calls to 'select' (e.g.
when fulfilling a trait), while a predicate evaluation overflow can only
happen as a result of a deep recursive call stack.

Fixes #56701

I've re-used `tcx.sess.recursion_limit` when checking for predication evaluation overflows. This is such a weird corner case that I don't believe it's necessary to have a separate setting controlling the maximum depth.

5 years agoAuto merge of #56479 - mark-i-m:unsat, r=nikomatsakis
bors [Sat, 19 Jan 2019 02:25:38 +0000 (02:25 +0000)]
Auto merge of #56479 - mark-i-m:unsat, r=nikomatsakis

Better lifetime error message

I propose the following error message as more user-friendly

r? @nikomatsakis

5 years agoAuto merge of #57747 - Centril:rollup, r=Centril
bors [Fri, 18 Jan 2019 23:40:14 +0000 (23:40 +0000)]
Auto merge of #57747 - Centril:rollup, r=Centril

Rollup of 11 pull requests

Successful merges:

 - #57107 (Add a regression test for mutating a non-mut #[thread_local])
 - #57132 (Document that `-C opt-level=0` implies `-C debug-assertions`.)
 - #57212 (docs(rustc): Link to the book's source in rustc)
 - #57302 (Fix unused_assignments false positive)
 - #57350 (Better error note on unimplemented Index trait for string)
 - #57635 (use structured macro and path resolve suggestions)
 - #57650 (librustc_metadata: Pass a default value when unwrapping a span)
 - #57657 (Add regression test to close #53787)
 - #57658 (Two HIR tweaks)
 - #57720 (Fix suggestions given mulitple bad lifetimes)
 - #57725 (Use structured suggestion to surround struct literal with parenthesis)

Failed merges:

r? @ghost

5 years agoRollup merge of #57725 - estebank:parens, r=michaelwoerister
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:48 +0000 (22:56 +0100)]
Rollup merge of #57725 - estebank:parens, r=michaelwoerister

Use structured suggestion to surround struct literal with parenthesis

5 years agoRollup merge of #57720 - dlrobertson:fix_57521, r=estebank
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:47 +0000 (22:56 +0100)]
Rollup merge of #57720 - dlrobertson:fix_57521, r=estebank

Fix suggestions given mulitple bad lifetimes

When given multiple lifetimes prior to type parameters in generic
parameters, do not ICE and print the correct suggestion.

r? @estebank

CC @pnkfelix

Fixes: #57521
5 years agoRollup merge of #57658 - nnethercote:rm-hir-P-Lit, r=michaelwoerister
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:45 +0000 (22:56 +0100)]
Rollup merge of #57658 - nnethercote:rm-hir-P-Lit, r=michaelwoerister

Two HIR tweaks

Two HIR tweaks that make things slightly simpler and faster.

5 years agoRollup merge of #57657 - AB1908:regression-test-case, r=nikomatsakis
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:44 +0000 (22:56 +0100)]
Rollup merge of #57657 - AB1908:regression-test-case, r=nikomatsakis

Add regression test to close #53787

Fixes #53787

5 years agoRollup merge of #57650 - AB1908:master, r=petrochenkov
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:43 +0000 (22:56 +0100)]
Rollup merge of #57650 - AB1908:master, r=petrochenkov

librustc_metadata: Pass a default value when unwrapping a span

Fixes #57323.

When compiling with `static-nobundle` a-la

`rustc -l static-nobundle=nonexistent main.rs`

we now get a neat output in the form of:

```
error[E0658]: kind="static-nobundle" is feature gated (see issue #37403)
  |
  = help: add #![feature(static_nobundle)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
```
The build and tests completed successfully on my machine. Should I be adding a new test?

5 years agoRollup merge of #57635 - euclio:path-separators, r=michaelwoerister
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:42 +0000 (22:56 +0100)]
Rollup merge of #57635 - euclio:path-separators, r=michaelwoerister

use structured macro and path resolve suggestions

5 years agoRollup merge of #57350 - folex:master, r=estebank
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:40 +0000 (22:56 +0100)]
Rollup merge of #57350 - folex:master, r=estebank

Better error note on unimplemented Index trait for string

fixes #56740

I've tried to compile suggestion from comments in the issue #56740, but unsure of it. So I'm open to advice :)

Current output will be like this:
```rust
error[E0277]: the type `str` cannot be indexed by `{integer}`
  --> $DIR/str-idx.rs:3:17
   |
LL |     let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`
   |                 ^^^^ `str` cannot be indexed by `{integer}`
   |
   = help: the trait `std::ops::Index<{integer}>` is not implemented for `str`
   = note: you can use `.chars().nth()` or `.bytes().nth()`
           see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
```

`x.py test src/test/ui` succeeded and I've also tested output manually by compiling the following code:
```rust
fn _f() {
    let s = std::string::String::from("hello");
    let _c = s[0];

    let s = std::string::String::from("hello");
    let mut _c = s[0];

    let s = "hello";
    let _c = s[0];

    let s = "hello";
    let mut _c = &s[0];
}
```

Not sure if some docs should be changed too. I will also fix error message in the [Book :: Indexing into Strings](https://github.com/rust-lang/book/blob/db53e2e3cdf77beac853df6f29db4b3b86ea598c/src/ch08-02-strings.md#indexing-into-strings) if that PR will get approved :)

5 years agoRollup merge of #57302 - sinkuu:unused_assignments_fp, r=estebank
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:39 +0000 (22:56 +0100)]
Rollup merge of #57302 - sinkuu:unused_assignments_fp, r=estebank

Fix unused_assignments false positive

Fixes #22630.

In liveness analysis, make `continue` jump to the loop condition's `LiveNode` (`cond` as in comment) instead of the loop's one (`expr`).

https://github.com/rust-lang/rust/blob/069b0c410808c1d1d33b495e048b1186e9f8d57f/src/librustc/middle/liveness.rs#L1358-L1370

5 years agoRollup merge of #57212 - phansch:improve_rustc_book_contributing, r=steveklabnik
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:37 +0000 (22:56 +0100)]
Rollup merge of #57212 - phansch:improve_rustc_book_contributing, r=steveklabnik

docs(rustc): Link to the book's source in rustc

This makes the source of [the rustc book](https://doc.rust-lang.org/rustc/what-is-rustc.html) book a bit more discoverable.

5 years agoRollup merge of #57132 - daxpedda:master, r=steveklabnik
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:35 +0000 (22:56 +0100)]
Rollup merge of #57132 - daxpedda:master, r=steveklabnik

Document that `-C opt-level=0` implies `-C debug-assertions`.

I couldn't find it stated anywhere else (https://doc.rust-lang.org/nightly/rustc/codegen-options/index.html#opt-level).
It was a problem before here: https://github.com/rust-lang/rust/issues/39449, it got lost in the migration to the new documentation I assume.

On a sidenote: I think that `-C opt-level=0` having a sideeffect on another flag should be changed. Having compiler flags affecting others doesn't make much sense to me, they are used to fine tune anyway.
In any case, this plays no role in this PR.

5 years agoRollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
Mazdak Farrokhzad [Fri, 18 Jan 2019 21:56:34 +0000 (22:56 +0100)]
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis

Add a regression test for mutating a non-mut #[thread_local]

This should close #54901 since the regression has since been fixed.

5 years agoAuto merge of #57737 - Centril:rollup, r=Centril
bors [Fri, 18 Jan 2019 19:08:20 +0000 (19:08 +0000)]
Auto merge of #57737 - Centril:rollup, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #56594 (Remove confusing comment about ideally using `!` for `c_void`)
 - #57340 (Use correct tracking issue for c_variadic)
 - #57357 (Cleanup PartialEq docs.)
 - #57551 (resolve: Add a test for issue #57539)
 - #57636 (Fix sources sidebar not showing up)
 - #57646 (Fixes text becoming invisible when element targetted)
 - #57654 (Add some links in std::fs.)
 - #57683 (Document Unpin in std::prelude documentation)
 - #57685 (Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.)
 - #57710 (Fix non-clickable urls)

Failed merges:

r? @ghost

5 years agoRollup merge of #57710 - GuillaumeGomez:non-clickable, r=QuietMisdreavus
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:40 +0000 (18:06 +0100)]
Rollup merge of #57710 - GuillaumeGomez:non-clickable, r=QuietMisdreavus

Fix non-clickable urls

Fixes #57695

I didn't find anywhere where this rule was useful. Why did you add it @JohnHeitmann?

r? @QuietMisdreavus

5 years agoRollup merge of #57685 - pthariensflame:enhancement/pin-impl-applicability, r=without...
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:38 +0000 (18:06 +0100)]
Rollup merge of #57685 - pthariensflame:enhancement/pin-impl-applicability, r=withoutboats

Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.

This allows for comparing for equality or ordering a `Pin<P>` and a `Pin<Q>` as long as `P` and `Q` are correspondingly comparable themselves *even when `P` and `Q` are different types*.
An example might be comparing a `Pin<&mut OsString>` to a `Pin<&mut PathBuf>`, which might arise from pin projections from a pair of larger contexts that aren't `Unpin`.

5 years agoRollup merge of #57683 - xfix:patch-15, r=QuietMisdreavus
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:37 +0000 (18:06 +0100)]
Rollup merge of #57683 - xfix:patch-15, r=QuietMisdreavus

Document Unpin in std::prelude documentation

5 years agoRollup merge of #57654 - ehuss:fs-links, r=alexcrichton
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:36 +0000 (18:06 +0100)]
Rollup merge of #57654 - ehuss:fs-links, r=alexcrichton

Add some links in std::fs.

A few items were referenced, but did not have links.

5 years agoRollup merge of #57646 - GuillaumeGomez:fix-css, r=QuietMisdreavus
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:34 +0000 (18:06 +0100)]
Rollup merge of #57646 - GuillaumeGomez:fix-css, r=QuietMisdreavus

Fixes text becoming invisible when element targetted

Fixes #57628.

r? @QuietMisdreavus

5 years agoRollup merge of #57636 - GuillaumeGomez:fix-sources-sidebar, r=QuietMisdreavus
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:33 +0000 (18:06 +0100)]
Rollup merge of #57636 - GuillaumeGomez:fix-sources-sidebar, r=QuietMisdreavus

Fix sources sidebar not showing up

Fixes #57601.

The order of imports made it so that the sidebar creation was called before the sidebar sources were created. Like this, when the sources are loaded, they create the sidebar as expected.

r? @QuietMisdreavus

5 years agoRollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakis
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:32 +0000 (18:06 +0100)]
Rollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakis

resolve: Add a test for issue #57539

Add a test for the bugfix regression reported in https://github.com/rust-lang/rust/issues/57539

Closes https://github.com/rust-lang/rust/issues/57539

5 years agoRollup merge of #57357 - frewsxcv:frewsxcv-partial-eq, r=QuietMisdreavus
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:30 +0000 (18:06 +0100)]
Rollup merge of #57357 - frewsxcv:frewsxcv-partial-eq, r=QuietMisdreavus

Cleanup PartialEq docs.

- Cleanup the `impl PartialEq<BookFormat> for Book` implementation
- Implement `impl PartialEq<Book> for BookFormat` so it’s symmetric
  - Fixes https://github.com/rust-lang/rust/issues/53844.
- Removes the last example since it appears to be redundant with the
  previous two examples.

5 years agoRollup merge of #57340 - eqrion:doc/c_variadic, r=Mark-Simulacrum
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:29 +0000 (18:06 +0100)]
Rollup merge of #57340 - eqrion:doc/c_variadic, r=Mark-Simulacrum

Use correct tracking issue for c_variadic

Fixes #57306

5 years agoRollup merge of #56594 - sdroege:c_void-is-not-never, r=TimNN
Mazdak Farrokhzad [Fri, 18 Jan 2019 17:06:26 +0000 (18:06 +0100)]
Rollup merge of #56594 - sdroege:c_void-is-not-never, r=TimNN

Remove confusing comment about ideally using `!` for `c_void`

Using `!` for `c_void` would have the problem that pointers and
potentially references to an uninhabited type would be created, and at
least for references this is UB.

In addition document that newtype wrappers around `c_void` can be used
safely in place of `extern type` until the latter is stabilized.

----

I'm not 100% sure about the usage for opaque types as the [nomicon](https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs) still recommends using `#[repr(C)] pub struct Foo { _private: [u8; 0] }` but it seems like these two should be equivalent in the end? Also the `#[repr(C)]` (in both cases) should be unneeded because such types never being passed by value, never being dereferenced but only passed around as pointer or reference, so the representation of (*values* of) the type itself should not matter at all?

Also in context of `c_void` and `!` the second unresolved question in the [`extern type`](https://github.com/rust-lang/rust/issues/43467) stabilization ticket seems relevant

> In [std's](https://github.com/rust-lang/rust/blob/164619a8cfe6d376d25bd3a6a9a5f2856c8de64d/src/libstd/os/raw.rs#L59-L64) source, it is mentioned that LLVM expects i8* for C's void*.
> We'd need to continue to hack this for the two c_voids in std and libc.
> But perhaps this should be done across-the-board for all extern types?
> Somebody should check what Clang does.

Please correct me if my understanding is wrong and everything's actually fine as is.

5 years agoAuto merge of #56189 - rep-nop:keep_doc_test_executable, r=QuietMisdreavus
bors [Fri, 18 Jan 2019 16:18:11 +0000 (16:18 +0000)]
Auto merge of #56189 - rep-nop:keep_doc_test_executable, r=QuietMisdreavus

rustdoc: Add option to persist doc test executables

Fixes #37048.

This is the initial version of the code so the doctest executables can be used for stuff like code coverage (specifically https://github.com/xd009642/tarpaulin/issues/13) the folders it goes into were just a first idea, so any better ones are welcome.

Right now it creates a directory structure like:
```
  given_path/
          |_____ <filename>_rs_<linenum>/
          |_____ ...
          |_____ <filename>_rs_<linenum>/
                 |_____ rust_out

```
I couldn't figure out where it actually outputs the file w/ the name, I suspect its somewhere deeper in the compiler.

It also adds the unstable `--persist-doctests` flag to `rustdoc` that enables this behavior.

5 years agoAuto merge of #57065 - Zoxc:graph-tweaks, r=michaelwoerister
bors [Fri, 18 Jan 2019 11:34:11 +0000 (11:34 +0000)]
Auto merge of #57065 - Zoxc:graph-tweaks, r=michaelwoerister

Optimize try_mark_green and eliminate the lock on dep node colors

Blocked on https://github.com/rust-lang/rust/pull/56614

r? @michaelwoerister

5 years agoAuto merge of #56996 - clarcharr:spin_loop_hint, r=KodrAus
bors [Fri, 18 Jan 2019 07:36:13 +0000 (07:36 +0000)]
Auto merge of #56996 - clarcharr:spin_loop_hint, r=KodrAus

Move spin_loop_hint to core::hint module

As mentioned in #55002. The new name is kept unstable to decide whether the function should have `_hint` in its name.

5 years agoUse structured suggestion to surround struct literal with parenthesis
Esteban Küber [Fri, 18 Jan 2019 05:19:30 +0000 (21:19 -0800)]
Use structured suggestion to surround struct literal with parenthesis

5 years agofix compat-mode ui test
Mark Mansi [Fri, 18 Jan 2019 04:04:27 +0000 (22:04 -0600)]
fix compat-mode ui test

5 years agoUpdate tests
Mark Mansi [Tue, 11 Dec 2018 21:49:40 +0000 (15:49 -0600)]
Update tests

5 years agobetter lifetime error message
Mark Mansi [Mon, 3 Dec 2018 20:40:04 +0000 (14:40 -0600)]
better lifetime error message

5 years agoFix suggestions given mulitple bad lifetimes
Dan Robertson [Thu, 17 Jan 2019 13:53:21 +0000 (13:53 +0000)]
Fix suggestions given mulitple bad lifetimes

When given multiple lifetimes prior to type parameters in generic
parameters, do not ICE and print the correct suggestion.

5 years agoBless test.
Wesley Norris [Tue, 1 Jan 2019 01:03:33 +0000 (20:03 -0500)]
Bless test.

Bless test, remove submodule, and fix book entry.

bless test again? maybe it'll work this time...

5 years agoAdd book section and fix typo.
Wesley Norris [Mon, 31 Dec 2018 23:05:57 +0000 (18:05 -0500)]
Add book section and fix typo.

5 years agoMinor changes to wording and formatting.
Wesley Norris [Sun, 16 Dec 2018 22:31:36 +0000 (17:31 -0500)]
Minor changes to wording and formatting.

5 years agoBless test.
Wesley Norris [Sat, 8 Dec 2018 20:50:03 +0000 (15:50 -0500)]
Bless test.

5 years agoFix tidy error.
Wesley Norris [Sat, 8 Dec 2018 19:22:08 +0000 (14:22 -0500)]
Fix tidy error.

5 years agoPersist doc test executables to given path.
Wesley Norris [Sat, 8 Dec 2018 19:17:50 +0000 (14:17 -0500)]
Persist doc test executables to given path.

5 years agoFix non-clickable urls
Guillaume Gomez [Thu, 17 Jan 2019 20:28:23 +0000 (21:28 +0100)]
Fix non-clickable urls

5 years agoAuto merge of #57694 - pietroalbini:revert-beta-on-master, r=pietroalbini
bors [Thu, 17 Jan 2019 10:15:57 +0000 (10:15 +0000)]
Auto merge of #57694 - pietroalbini:revert-beta-on-master, r=pietroalbini

Revert "Auto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum"

For whatever reason bors merged this in master `:/`

r? @ghost

5 years agoRevert "Auto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum"
Pietro Albini [Thu, 17 Jan 2019 09:48:10 +0000 (10:48 +0100)]
Revert "Auto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum"

This reverts commit 722b4d695964906807b12379577bce5ee3d23e08, reversing
changes made to 956dba47d33fc8b2bdabcd50e5bfed264b570382.

5 years agoQuerify glob map usage (last use of CrateAnalysis)
Igor Matuszewski [Mon, 7 Jan 2019 10:46:44 +0000 (11:46 +0100)]
Querify glob map usage (last use of CrateAnalysis)

5 years agoRemove access level mention from DocContext
Igor Matuszewski [Mon, 7 Jan 2019 09:04:30 +0000 (10:04 +0100)]
Remove access level mention from DocContext

Leftover from https://github.com/rust-lang/rust/commit/c754e8240cfbeeaca1672c349eccba3d050f866c.

5 years agoAuto merge of #57520 - alexreg:tidy-copyright-lint, r=Mark-Simulacrum
bors [Thu, 17 Jan 2019 07:36:37 +0000 (07:36 +0000)]
Auto merge of #57520 - alexreg:tidy-copyright-lint, r=Mark-Simulacrum

Add lint for copyright headers to 'tidy' tool

r? @Mark-Simulacrum

CC @centril

5 years agoFix tidy errors.
Alexander Ronald Altman [Thu, 17 Jan 2019 05:03:29 +0000 (23:03 -0600)]
Fix tidy errors.

5 years agoAuto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum
bors [Thu, 17 Jan 2019 05:00:14 +0000 (05:00 +0000)]
Auto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum

Prepare beta 1.33.0

This PR includes the usual changes for a new beta, and suppresses a few lints on libcore: those lints are false positives caused by an internal attribute (`rustc_layout_scalar_valid_range_start`) and only happen on stage0.

r? @Mark-Simulacrum

5 years agoAdd test for linking non-existent static library
AB1908 [Thu, 17 Jan 2019 03:40:36 +0000 (03:40 +0000)]
Add test for linking non-existent static library

5 years agoAuto merge of #56869 - GuillaumeGomez:index-size-reduction, r=QuietMisdreavus
bors [Thu, 17 Jan 2019 02:12:17 +0000 (02:12 +0000)]
Auto merge of #56869 - GuillaumeGomez:index-size-reduction, r=QuietMisdreavus

Reduce search-index.js size

Coming from:

```
1735683 Dec 16 01:35 build/x86_64-apple-darwin/doc/search-index.js
```

to:

```
727755 Dec 16 01:51 build/x86_64-apple-darwin/doc/search-index.js
```

r? @QuietMisdreavus

5 years agoEnhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.
Alexander Ronald Altman [Thu, 17 Jan 2019 02:10:18 +0000 (20:10 -0600)]
Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.

5 years agoEnd fixing search index minification
Guillaume Gomez [Sun, 13 Jan 2019 23:46:11 +0000 (00:46 +0100)]
End fixing search index minification

5 years agoMinify search-index in one pass
Guillaume Gomez [Thu, 10 Jan 2019 20:26:41 +0000 (21:26 +0100)]
Minify search-index in one pass

5 years agoReduce search-index.js size
Guillaume Gomez [Sun, 16 Dec 2018 01:35:39 +0000 (02:35 +0100)]
Reduce search-index.js size

5 years agoDocument Unpin in std::prelude documentation
Konrad Borowski [Wed, 16 Jan 2019 23:39:15 +0000 (00:39 +0100)]
Document Unpin in std::prelude documentation

5 years agoAuto merge of #57392 - Xanewok:always-calc-glob-map, r=petrochenkov
bors [Wed, 16 Jan 2019 23:25:41 +0000 (23:25 +0000)]
Auto merge of #57392 - Xanewok:always-calc-glob-map, r=petrochenkov

Always calculate glob map but only for glob uses

Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance.

Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand).

r? @nikomatsakis

Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.

5 years agoFix error template
AB1908 [Wed, 16 Jan 2019 23:08:42 +0000 (23:08 +0000)]
Fix error template

5 years agoPrioritize variants as inherent associated items during name resolution
Vadim Petrochenkov [Thu, 10 Jan 2019 20:23:30 +0000 (23:23 +0300)]
Prioritize variants as inherent associated items during name resolution

5 years agoDon't explicitly increment the depth for new trait predicates
Aaron Hill [Wed, 16 Jan 2019 17:55:22 +0000 (12:55 -0500)]
Don't explicitly increment the depth for new trait predicates

5 years agoallow unused warnings related to rustc_layout_scalar_valid_range_start
Pietro Albini [Wed, 16 Jan 2019 16:55:23 +0000 (17:55 +0100)]
allow unused warnings related to rustc_layout_scalar_valid_range_start

5 years agoprepare beta 1.33.0
Pietro Albini [Wed, 16 Jan 2019 16:18:44 +0000 (17:18 +0100)]
prepare beta 1.33.0

5 years agoAuto merge of #57321 - petrochenkov:atokens, r=nikomatsakis
bors [Wed, 16 Jan 2019 15:01:20 +0000 (15:01 +0000)]
Auto merge of #57321 - petrochenkov:atokens, r=nikomatsakis

Implement basic input validation for built-in attributes

Correct top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is enforced for built-in attributes, built-in attributes must also fit into the "meta-item" syntax (aka the "classic attribute syntax").

For some subset of attributes (found by crater run), errors are lowered to deprecation warnings.

NOTE: This PR previously included https://github.com/rust-lang/rust/pull/57367 as well.

5 years agoAuto merge of #57416 - alexcrichton:remove-platform-intrinsics, r=nagisa
bors [Wed, 16 Jan 2019 12:15:10 +0000 (12:15 +0000)]
Auto merge of #57416 - alexcrichton:remove-platform-intrinsics, r=nagisa

rustc: Remove platform intrinsics crate

This was originally attempted in #57048 but it was realized that we
could fully remove the crate via the `"unadjusted"` ABI on intrinsics.
This means that all intrinsics in stdsimd are implemented directly
against LLVM rather than using the abstraction layer provided here. That
ends up meaning that this crate is no longer used at all.

This crate developed long ago to implement the SIMD intrinsics, but we
didn't end up using it in the long run. In that case let's remove it!

5 years agoRemove trailing whitespace
AB1908 [Wed, 16 Jan 2019 06:29:44 +0000 (06:29 +0000)]
Remove trailing whitespace

5 years agoAdd regression test to close #53787
AB1908 [Wed, 16 Jan 2019 05:32:03 +0000 (05:32 +0000)]
Add regression test to close #53787

5 years agoRemove `hir::Label`.
Nicholas Nethercote [Wed, 16 Jan 2019 05:20:32 +0000 (16:20 +1100)]
Remove `hir::Label`.

It's identical to `ast::Label`.

5 years agoUse `Lit` rather than `P<Lit>` in `hir::ExprKind`.
Nicholas Nethercote [Wed, 16 Jan 2019 02:51:24 +0000 (13:51 +1100)]
Use `Lit` rather than `P<Lit>` in `hir::ExprKind`.

It's simpler and makes some benchmark run up to 1% faster. It also makes
`hir::ExprKind` more like `ast::ExprKind` (which underwent the
equivalent change in #55777).

5 years agoUpdated Book and Reference submodules.
Alexander Regueiro [Sun, 13 Jan 2019 15:43:09 +0000 (15:43 +0000)]
Updated Book and Reference submodules.

5 years agoAdd some links in std::fs.
Eric Huss [Wed, 16 Jan 2019 02:46:09 +0000 (18:46 -0800)]
Add some links in std::fs.

A few items were referenced, but did not have links.

5 years agodemonstrate symmetry
Corey Farwell [Wed, 16 Jan 2019 02:21:24 +0000 (21:21 -0500)]
demonstrate symmetry

5 years agomake the contribution doc reference the guide more; deduplication
mark [Wed, 16 Jan 2019 02:02:28 +0000 (20:02 -0600)]
make the contribution doc reference the guide more; deduplication

5 years agoupdate test output
mark [Tue, 15 Jan 2019 22:40:10 +0000 (16:40 -0600)]
update test output

5 years agoFixes text becoming invisible when element targetted
Guillaume Gomez [Tue, 15 Jan 2019 22:21:10 +0000 (23:21 +0100)]
Fixes text becoming invisible when element targetted

5 years agoMove spin_loop_hint to core::hint module
Clar Fon [Wed, 19 Dec 2018 21:43:29 +0000 (16:43 -0500)]
Move spin_loop_hint to core::hint module

5 years agoupdate/add tests
mark [Tue, 15 Jan 2019 17:31:49 +0000 (11:31 -0600)]
update/add tests

5 years agofix nested matchers with ?
mark [Mon, 14 Jan 2019 21:50:33 +0000 (15:50 -0600)]
fix nested matchers with ?

5 years agoAuto merge of #57629 - matthiaskrgr:clippy_submodule_upd, r=oli-obk
bors [Tue, 15 Jan 2019 18:41:42 +0000 (18:41 +0000)]
Auto merge of #57629 - matthiaskrgr:clippy_submodule_upd, r=oli-obk

submodules: update clippy from c63b6349 to 1b89724b

Changes:
````
Really fix issue number in `map_clone` test
Fix issue number in `map_clone` test
Remove `map_clone` fixed known problem
Fix `map_clone` bad suggestion
Add run-rustfix to unnecessary_fold
Add run-rustfix to unit_arg test
Add run-rustfix for types test
Add run-rustfix to starts_ends_with
Add run-rustfix to replace_const test
Add run-rustfix to redundant_field_names
Missing docs: don't require documenting Global Asm items.
Add run-rustfix for precedence test
Add run-rustfix to mem_replace test
Add run-rustfix to map_clone test
Add run-rustfix to large_digit_groups
Add run-rustfix to into_iter_on_ref
Add run-rustfix to infallible_destructuring_match
Add rustfix to inconsistent_digit_grouping test
Add run-rustfix to explicit_write test
Add run-rustfix to excessive_precision test
Add run-rustfix to duration_subsec test
Disable deprecated_cfg_attr lint for inner attributes
Add run-rustfix to collapsible_if test
Update Readme
Update Readme for (arguably) better readability
rustup: the features if_while_or_patterns has been stabilized
Fix comments in clippy_lints/src/len_zero.rs
readme: update travis badge to reflect migration from travis-ci.org to travis-ci.com
Remove all copyright license headers
Move cast_ref_to_mut list to correctness group
Rustftmt
Don't import ty::Ref in cast_ref_to_mut lint
Move a hint to an error message in cast_ref_to_mut lint
Add a note to cast_ref_to_mut lint
Use ty::Ref instead of ty::TyKind::Ref
cast_ref_to_mut lint
Add missing ` in default lint
Improve tests and exclude nested impls
Update `unwrap_get` code review suggestions
Update known problems
Restrict use_self on nested items
Improve `get_unwrap` suggestion
````

5 years agoFix sources sidebar not showing up
Guillaume Gomez [Tue, 15 Jan 2019 16:57:06 +0000 (17:57 +0100)]
Fix sources sidebar not showing up

5 years agoMake the query comment into a doc comment
Igor Matuszewski [Tue, 15 Jan 2019 16:44:41 +0000 (17:44 +0100)]
Make the query comment into a doc comment

5 years agouse structured macro and path resolve suggestions
Andy Russell [Tue, 15 Jan 2019 16:27:58 +0000 (11:27 -0500)]
use structured macro and path resolve suggestions

5 years agoRemove an unused function argument
Oliver Scherer [Tue, 15 Jan 2019 16:11:07 +0000 (17:11 +0100)]
Remove an unused function argument

5 years agoAuto merge of #57630 - Centril:rollup, r=Centril
bors [Tue, 15 Jan 2019 13:56:16 +0000 (13:56 +0000)]
Auto merge of #57630 - Centril:rollup, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #56044 (Drop partially bound function parameters in the expected order)
 - #57352 (forbid manually impl'ing one of an object type's marker traits)
 - #57456 (RawVec doesn't always abort on allocation errors)
 - #57467 (Implement `check_attribute` to forbid `#[allow_internal_unsafe]`)
 - #57579 (Add core::iter::once_with())
 - #57587 (Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test)
 - #57608 (Simplify 'product' factorial example)
 - #57614 ([rustdoc] Fix crates filtering box not being filled)

Failed merges:

r? @ghost

5 years agoRollup merge of #57614 - GuillaumeGomez:fix-crate-filtering, r=QuietMisdreavus
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:14 +0000 (12:42 +0100)]
Rollup merge of #57614 - GuillaumeGomez:fix-crate-filtering, r=QuietMisdreavus

[rustdoc] Fix crates filtering box not being filled

Currently, the filter crate box (at the left of the search input) is always empty. To get the number of keys of dictionary in JS, you need to call `Object.keys()` on it.

r? @QuietMisdreavus

5 years agoRollup merge of #57608 - timvisee:master, r=frewsxcv
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:13 +0000 (12:42 +0100)]
Rollup merge of #57608 - timvisee:master, r=frewsxcv

Simplify 'product' factorial example

This simplifies the [`factorial(n: 32)`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#examples-46) implementation as example for the `Iterator::product()` function.
It currently uses unnecessary additional complexity.

Although very minimal, I do not want to include it in some other irrelevant PR.

5 years agoRollup merge of #57587 - Aaron1011:fix/const-pat-ice, r=alexcrichton
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:12 +0000 (12:42 +0100)]
Rollup merge of #57587 - Aaron1011:fix/const-pat-ice, r=alexcrichton

Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test

This ensures that the test passes, regardless of what the user has set
RUST_BACKTRACE to.

5 years agoRollup merge of #57579 - stjepang:once-with, r=SimonSapin
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:10 +0000 (12:42 +0100)]
Rollup merge of #57579 - stjepang:once-with, r=SimonSapin

Add core::iter::once_with()

Functions `iter::once()` and `iter::repeat()` construct iterators from values. The latter has the lazy variant `iter::repeat_with()`, but the former doesn't. This PR therefore adds `iter::once_with()`.

Another way to think of `iter::once_with()` is that it's a function that converts `FnOnce() -> T` into `Iterator<Item = T>`.

If this seems like a reasonable addition, I'll open a tracking issue and update the `#[feature(...)]` attributes.

5 years agoRollup merge of #57467 - JohnTitor:implement-the-check-attribute-1, r=oli-obk
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:08 +0000 (12:42 +0100)]
Rollup merge of #57467 - JohnTitor:implement-the-check-attribute-1, r=oli-obk

Implement `check_attribute` to forbid `#[allow_internal_unsafe]`

Fixes #56768.

r? @oli-obk

5 years agoRollup merge of #57456 - fintelia:patch-4, r=dtolnay
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:07 +0000 (12:42 +0100)]
Rollup merge of #57456 - fintelia:patch-4, r=dtolnay

RawVec doesn't always abort on allocation errors

5 years agoRollup merge of #57352 - arielb1:no-manual-markers, r=nikomatsakis
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:06 +0000 (12:42 +0100)]
Rollup merge of #57352 - arielb1:no-manual-markers, r=nikomatsakis

forbid manually impl'ing one of an object type's marker traits

This shouldn't break compatibility for crates that do not use
`feature(optin_builtin_traits)`, because as the test shows, it is
only possible to impl a marker trait for a trait object in the crate the
marker trait is defined in, which must define
`feature(optin_builtin_traits)`.

Fixes #56934.

r? @nikomatsakis

5 years agoRollup merge of #56044 - matthewjasper:function-param-drop-order, r=cramertj
Mazdak Farrokhzad [Tue, 15 Jan 2019 11:42:04 +0000 (12:42 +0100)]
Rollup merge of #56044 - matthewjasper:function-param-drop-order, r=cramertj

Drop partially bound function parameters in the expected order

Given the function

```rust
fn foo((_x, _): (LogDrop, LogDrop), (_, _y): (LogDrop, LogDrop)) {}
```

Prior to 1.12.0 we dropped both `_x` and `_y` before the rest of their
respective parameters, since then we dropped `_x` and `_y` after. The
original order appears to be the correct order, as the value created
later is dropped first, so we revert to that order and add a test for
it.

While this is technically a breaking change, I can't work out how
anyone could be relying on this without making their code very
brittle. If this is considered to be too likely to break real world code
then I can revert the change and change the test to check for the
current order.

5 years agoAuto merge of #57625 - drrlvn:patch-1, r=Centril
bors [Tue, 15 Jan 2019 11:18:24 +0000 (11:18 +0000)]
Auto merge of #57625 - drrlvn:patch-1, r=Centril

Stabilize FileExt::read_exact_at/write_all_at

r? alexcrichton

Closes #51984.

5 years agoQuerify entry_fn
Igor Matuszewski [Sun, 13 Jan 2019 12:06:26 +0000 (13:06 +0100)]
Querify entry_fn

5 years agosubmodules: update clippy from c63b6349 to 1b89724b
Matthias Krüger [Tue, 15 Jan 2019 09:40:11 +0000 (10:40 +0100)]
submodules: update clippy from c63b6349 to 1b89724b

Changes:
````
Really fix issue number in `map_clone` test
Fix issue number in `map_clone` test
Remove `map_clone` fixed known problem
Fix `map_clone` bad suggestion
Add run-rustfix to unnecessary_fold
Add run-rustfix to unit_arg test
Add run-rustfix for types test
Add run-rustfix to starts_ends_with
Add run-rustfix to replace_const test
Add run-rustfix to redundant_field_names
Missing docs: don't require documenting Global Asm items.
Add run-rustfix for precedence test
Add run-rustfix to mem_replace test
Add run-rustfix to map_clone test
Add run-rustfix to large_digit_groups
Add run-rustfix to into_iter_on_ref
Add run-rustfix to infallible_destructuring_match
Add rustfix to inconsistent_digit_grouping test
Add run-rustfix to explicit_write test
Add run-rustfix to excessive_precision test
Add run-rustfix to duration_subsec test
Disable deprecated_cfg_attr lint for inner attributes
Add run-rustfix to collapsible_if test
Update Readme
Update Readme for (arguably) better readability
rustup: the features if_while_or_patterns has been stabilized
Fix comments in clippy_lints/src/len_zero.rs
readme: update travis badge to reflect migration from travis-ci.org to travis-ci.com
Remove all copyright license headers
Move cast_ref_to_mut list to correctness group
Rustftmt
Don't import ty::Ref in cast_ref_to_mut lint
Move a hint to an error message in cast_ref_to_mut lint
Add a note to cast_ref_to_mut lint
Use ty::Ref instead of ty::TyKind::Ref
cast_ref_to_mut lint
Add missing ` in default lint
Improve tests and exclude nested impls
Update `unwrap_get` code review suggestions
Update known problems
Restrict use_self on nested items
Improve `get_unwrap` suggestion
````

5 years agoAddress comments
John Kåre Alsaker [Tue, 15 Jan 2019 09:39:35 +0000 (10:39 +0100)]
Address comments