]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoFixed Deref coercion explanation for DerefMut using shared references
danielhenrymantilla [Tue, 22 Jan 2019 10:30:59 +0000 (11:30 +0100)]
Fixed Deref coercion explanation for DerefMut using shared references

5 years agoAuto merge of #57475 - SimonSapin:signed, r=estebank
bors [Tue, 22 Jan 2019 05:42:11 +0000 (05:42 +0000)]
Auto merge of #57475 - SimonSapin:signed, r=estebank

Add signed num::NonZeroI* types

Multiple people have asked for them in https://github.com/rust-lang/rust/issues/49137. Given that the unsigned ones already exist, they are very easy to add and not an additional maintenance burden.

5 years agoAuto merge of #55009 - oli-obk:const_safety, r=RalfJung
bors [Mon, 21 Jan 2019 23:10:11 +0000 (23:10 +0000)]
Auto merge of #55009 - oli-obk:const_safety, r=RalfJung

Make raw ptr ops unsafe in const contexts

r? @RalfJung

cc @Centril

5 years agoFix some non-determinism in help messages for E0277 errors.
Simon Sapin [Mon, 21 Jan 2019 15:55:32 +0000 (16:55 +0100)]
Fix some non-determinism in help messages for E0277 errors.

The diagnostic for this error prints `the following implementations
were found` followed by the first N relevant impls, sorted.

This commit makes the sort happen before slicing,
so that the set of impls being printed is deterministic
when the input is not.

5 years agoDeclare some unconst operations as unsafe in const fn
Oliver Scherer [Fri, 7 Dec 2018 17:26:46 +0000 (18:26 +0100)]
Declare some unconst operations as unsafe in const fn

5 years agoAuto merge of #55045 - kleimkuhler:add-std-is_sorted, r=KodrAus
bors [Mon, 21 Jan 2019 13:55:45 +0000 (13:55 +0000)]
Auto merge of #55045 - kleimkuhler:add-std-is_sorted, r=KodrAus

Add `is_sorted` to `Iterator` and `[T]`

This is an initial implementation for the first step of [RFC 2351](https://github.com/rust-lang/rfcs/blob/master/text/2351-is-sorted.md)

Tracking issue: https://github.com/rust-lang/rust/issues/53485

5 years agoAuto merge of #57756 - matthiaskrgr:clippy_submodule_upd, r=oli-obk
bors [Mon, 21 Jan 2019 11:07:29 +0000 (11:07 +0000)]
Auto merge of #57756 - matthiaskrgr:clippy_submodule_upd, r=oli-obk

submodules: update clippy from 1b89724b to e648adf0

Fixes clippy toolstate

Changes:
````
Catch up with `format_args` change
Fix bad `while_let_on_iterator` suggestion.
rustup https://github.com/rust-lang/rust/pull/57747
Fixing issues pointed out by dogfood tests.
Update to collect all the files then throw the error.
Adding a test for checking if test files are missing.
Remove bors.toml
add applicability to lint name suggestion
````

r? @oli-obk

5 years agoDifferentiate between closure and function bodies
Oliver Scherer [Fri, 7 Dec 2018 17:25:55 +0000 (18:25 +0100)]
Differentiate between closure and function bodies

5 years agoAuto merge of #57792 - Centril:rollup, r=Centril
bors [Mon, 21 Jan 2019 08:32:19 +0000 (08:32 +0000)]
Auto merge of #57792 - Centril:rollup, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #56796 (Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`)
 - #57768 (Continue parsing after parent type args and suggest using angle brackets)
 - #57769 (Suggest correct cast for struct fields with shorthand syntax)
 - #57783 (Add "dereference boxed value" suggestion.)
 - #57784 (Add span for bad doc comment)

Failed merges:

r? @ghost

5 years agoAuto merge of #57708 - nbigaouette:pr-53774-fix-missing-rust-gdbui-install, r=Mark...
bors [Mon, 21 Jan 2019 03:12:26 +0000 (03:12 +0000)]
Auto merge of #57708 - nbigaouette:pr-53774-fix-missing-rust-gdbui-install, r=Mark-Simulacrum

Install missing 'rust-gdbui''

PR #53774 added `rust-gdbui` as wrapper to launch [gdbui](https://gdbgui.com/), similar to `rust-gdb`.

Unfortunately I've never seen the script in my local installation (from rustup, using rust 1.31.1). @tromey on the PR [suggested it might be missing](https://github.com/rust-lang/rust/pull/53774#issuecomment-419704939) from the installation process.

This PR simply adds a line for `rust-gdbui` too.

5 years agosubmodules: update clippy from 1b89724b to 1838bfe5
Matthias Krüger [Mon, 21 Jan 2019 01:58:57 +0000 (02:58 +0100)]
submodules: update clippy from 1b89724b to 1838bfe5

Changes:
````
Fixing typo in CONTRIBUTING.md
Fix breakage due to rust-lang/rust#57651
Run rustfmt
Fixed breakage due to rust-lang/rust#57489
Fix breakage due to rust-lang/rust#57755
Catch up with `format_args` change
Fix bad `while_let_on_iterator` suggestion.
rustup https://github.com/rust-lang/rust/pull/57747
Fixing issues pointed out by dogfood tests.
Update to collect all the files then throw the error.
Adding a test for checking if test files are missing.
Remove bors.toml
add applicability to lint name suggestion
````

5 years agoRollup merge of #57784 - JohnTitor:improve-error-message, r=estebank
Mazdak Farrokhzad [Mon, 21 Jan 2019 01:21:58 +0000 (02:21 +0100)]
Rollup merge of #57784 - JohnTitor:improve-error-message, r=estebank

Add span for bad doc comment

Fixes #57382

r? @estebank

5 years agoRollup merge of #57783 - davidtwco:issue-57741, r=estebank
Mazdak Farrokhzad [Mon, 21 Jan 2019 01:21:57 +0000 (02:21 +0100)]
Rollup merge of #57783 - davidtwco:issue-57741, r=estebank

Add "dereference boxed value" suggestion.

Contributes to #57741.

This PR adds a `help: consider dereferencing the boxed value` suggestion to discriminants of match statements when the match arms have type `T` and the discriminant has type `Box<T>`.

r? @estebank

5 years agoRollup merge of #57769 - estebank:cast-suggestion-struct-field, r=matthewjasper
Mazdak Farrokhzad [Mon, 21 Jan 2019 01:21:56 +0000 (02:21 +0100)]
Rollup merge of #57769 - estebank:cast-suggestion-struct-field, r=matthewjasper

Suggest correct cast for struct fields with shorthand syntax

```
error[E0308]: mismatched types
  --> $DIR/type-mismatch-struct-field-shorthand.rs:8:19
   |
LL |     let _ = RGB { r, g, b };
   |                   ^ expected f64, found f32
help: you can cast an `f32` to `f64` in a lossless way
   |
LL |     let _ = RGB { r: r.into(), g, b };
   |                   ^^^^^^^^^^^
```

Fix #52497.

5 years agoRollup merge of #57768 - estebank:type-args-sugg, r=zackmdavis
Mazdak Farrokhzad [Mon, 21 Jan 2019 01:21:55 +0000 (02:21 +0100)]
Rollup merge of #57768 - estebank:type-args-sugg, r=zackmdavis

Continue parsing after parent type args and suggest using angle brackets

```
error[E0214]: parenthesized parameters may only be used with a trait
--> $DIR/E0214.rs:2:15
   |
LL |     let v: Vec(&str) = vec!["foo"];
   |               ^^^^^^
   |               |
   |               only traits may use parentheses
   |               help: use angle brackets instead: `<&str>`
```

r? @zackmdavis

5 years agoRollup merge of #56796 - KrishnaSannasi:try_from_impl_change, r=shepmaster
Mazdak Farrokhzad [Mon, 21 Jan 2019 01:21:53 +0000 (02:21 +0100)]
Rollup merge of #56796 - KrishnaSannasi:try_from_impl_change, r=shepmaster

Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`

This is from this [comment](https://github.com/rust-lang/rust/issues/33417#issuecomment-447111156) I made.

This will expand the impls available for `TryFrom` and `TryInto`, without losing anything in the process.

5 years agoAuto merge of #57789 - ehuss:update-cargo, r=Mark-Simulacrum
bors [Mon, 21 Jan 2019 00:29:31 +0000 (00:29 +0000)]
Auto merge of #57789 - ehuss:update-cargo, r=Mark-Simulacrum

Update cargo

Pull in fix for #57774.

6 commits in ffe65875fd05018599ad07e7389e99050c7915be..907c0febe7045fa02dff2a35c5e36d3bd59ea50d
2019-01-17 23:57:50 +0000 to 2019-01-20 22:31:07 +0000
- Put mtime-on-use behind a feature flag. (rust-lang/cargo#6573)
- Fix a typo in the unstable docs (rust-lang/cargo#6569)
- Perhaps you meant: foo, bar or foobar (rust-lang/cargo#6550)
- Refactor: Create uninstall submodule (rust-lang/cargo#6557)
- Fix spurious Windows errors with switch_features_rerun. (rust-lang/cargo#6561)
- Stop building on master on Travis. (rust-lang/cargo#6562)

r? @Mark-Simulacrum

5 years agoUpdate cargo
Eric Huss [Sun, 20 Jan 2019 23:31:43 +0000 (15:31 -0800)]
Update cargo

5 years agoAuto merge of #57704 - lenoil98:patch-2, r=alexcrichton
bors [Sun, 20 Jan 2019 21:49:24 +0000 (21:49 +0000)]
Auto merge of #57704 - lenoil98:patch-2, r=alexcrichton

Update bootstrap.py

Add PowerPC64 support on FreeBSD

5 years agoAdd "dereference boxed value" suggestion.
David Wood [Sun, 20 Jan 2019 19:26:46 +0000 (20:26 +0100)]
Add "dereference boxed value" suggestion.

This commit adds a `help: consider dereferencing the boxed value`
suggestion to discriminants of match statements when the match arms have
type `T` and the discriminant has type `Box<T>`.

5 years agoFix tests
Yuki Okushi [Sun, 20 Jan 2019 19:52:30 +0000 (04:52 +0900)]
Fix tests

5 years agoAdd span for bad doc comment
Yuki Okushi [Sun, 20 Jan 2019 19:52:16 +0000 (04:52 +0900)]
Add span for bad doc comment

5 years agoAuto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavus
bors [Sun, 20 Jan 2019 19:01:38 +0000 (19:01 +0000)]
Auto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavus

rustdoc: overhaul code block lexing errors

Fixes #53919.

This PR moves the reporting of code block lexing errors from rendering time to an early pass, so we can use the compiler's error reporting mechanisms. This dramatically improves the diagnostics in this situation: we now de-emphasize the lexing errors as a note under a warning that has a span and suggestion instead of just emitting errors at the top level.

Additionally, this PR generalizes the markdown -> source span calculation function, which should allow other rustdoc warnings to use better spans in the future.

Last, the PR makes sure that the code block is always emitted in the docs, even if it fails to highlight correctly.

Of note:
- The new pass unfortunately adds another pass over the docs to gather the doc blocks for syntax-checking. I wonder if this could be combined with the pass that looks for testable blocks? I'm not familiar with that code, so I don't know how feasible that is.
- `pulldown_cmark` doesn't make it easy to find the spans of the code blocks, so the code that calculates the spans is a little nasty. It works for all the test cases I threw at it, but I wouldn't be surprised if an edge case would break it. Should have a thorough review.
- This PR worsens the state of #56885, since those certain fatal lexing errors are now emitted before docs get generated at all.

5 years agoreview comment
Esteban Küber [Sun, 20 Jan 2019 17:11:42 +0000 (09:11 -0800)]
review comment

5 years agoAuto merge of #57697 - dotdash:fast_lex_reg_resol_item_bodies, r=nagisa
bors [Sun, 20 Jan 2019 16:24:27 +0000 (16:24 +0000)]
Auto merge of #57697 - dotdash:fast_lex_reg_resol_item_bodies, r=nagisa

Use a faster early exit during region expansion

Turns out that the equality check for regions is rather expensive, and
the current early exit check works in such a way, that the comparison is
even done twice. As we only really care about the case of equal scopes,
we can perform a faster, more specialized check and move it up one
level, so we can eventually skip the additional full comparison as well.

5 years agoAuto merge of #57680 - cuviper:codegen-rebuild, r=Mark-Simulacrum
bors [Sun, 20 Jan 2019 13:46:03 +0000 (13:46 +0000)]
Auto merge of #57680 - cuviper:codegen-rebuild, r=Mark-Simulacrum

[rustbuild] Rebuild std after changes to codegen backends

Use `clear_if_dirty` on std for backend changes, just as we do for
changes to rustc itself, so new codegen is correctly applied to all
later compiler stages.

Fixes #48298.

5 years agoAuto merge of #57655 - mtak-:fix-tls-dtors-macos, r=alexcrichton
bors [Sun, 20 Jan 2019 11:08:37 +0000 (11:08 +0000)]
Auto merge of #57655 - mtak-:fix-tls-dtors-macos, r=alexcrichton

OSX: fix #57534 registering thread dtors while running thread dtors

r? @alexcrichton

- "fast" `thread_local` destructors get run even on the main thread
- "fast" `thread_local` dtors, can initialize other `thread_local`'s

One corner case where this fix doesn't work, is when a C++ `thread_local` triggers the initialization of a rust `thread_local`.

I did not add any std::thread specific flag to indicate that the thread is currently exiting, which would be checked before registering a new dtor (I didn't really know where to stick that). I think this does the trick tho!

Let me know if anything needs tweaking/fixing/etc.

resolves this for macos: https://github.com/rust-lang/rust/issues/28129
fixes: https://github.com/rust-lang/rust/issues/57534

5 years agoDo not suggest angle brackets when there are no type arguments
Esteban Küber [Sun, 20 Jan 2019 10:45:38 +0000 (02:45 -0800)]
Do not suggest angle brackets when there are no type arguments

5 years agoAuto merge of #57651 - JohnTitor:give-char-type, r=estebank
bors [Sun, 20 Jan 2019 08:26:12 +0000 (08:26 +0000)]
Auto merge of #57651 - JohnTitor:give-char-type, r=estebank

Implement new literal type `Err`

Fixes #57384

I removed `return Ok`, otherwise, two errors occur. Any solutions?

r? @estebank

5 years agoRemove whitespace
Yuki Okushi [Sun, 20 Jan 2019 05:59:10 +0000 (14:59 +0900)]
Remove whitespace

5 years agoFix tests
Yuki Okushi [Sun, 20 Jan 2019 05:53:28 +0000 (14:53 +0900)]
Fix tests

5 years agoRevert change
Yuki Okushi [Sun, 20 Jan 2019 05:53:16 +0000 (14:53 +0900)]
Revert change

5 years agoMark incorrect recovered `char` literals as `TyErr` to avoid type errors
Yuki Okushi [Sun, 20 Jan 2019 05:51:54 +0000 (14:51 +0900)]
Mark incorrect recovered `char` literals as `TyErr` to avoid type errors

5 years agoSuggest correct cast for struct fields with shorthand syntax
Esteban Küber [Sun, 20 Jan 2019 04:18:56 +0000 (20:18 -0800)]
Suggest correct cast for struct fields with shorthand syntax

5 years agoAuto merge of #57602 - alexcrichton:test-appveyor, r=alexcrichton
bors [Sun, 20 Jan 2019 04:16:42 +0000 (04:16 +0000)]
Auto merge of #57602 - alexcrichton:test-appveyor, r=alexcrichton

Remove GCE cloud setting from AppVeyor config

AppVeyor has informed us that this may no longer be necessary after some
infrastructure upgrades on their side, so let's see how this goes!

5 years agoSuggest usage of angle brackets
Esteban Küber [Sun, 20 Jan 2019 03:25:28 +0000 (19:25 -0800)]
Suggest usage of angle brackets

5 years agoAccept parenthesized type args for error recovery
Esteban Küber [Sun, 20 Jan 2019 02:44:20 +0000 (18:44 -0800)]
Accept parenthesized type args for error recovery

5 years agoContinune parsing after encountering Trait with paren args
Esteban Küber [Sat, 19 Jan 2019 22:48:43 +0000 (14:48 -0800)]
Continune parsing after encountering Trait with paren args

5 years agoAuto merge of #57761 - Centril:rollup, r=Centril
bors [Sat, 19 Jan 2019 21:21:12 +0000 (21:21 +0000)]
Auto merge of #57761 - Centril:rollup, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #57452 (Improve docs for Formatter)
 - #57689 (Redo `hir::Stmt`)
 - #57723 (Point at cause for expectation in return type type error)
 - #57736 (Remove delay_span_bug from qualify_min_const_fn)

Failed merges:

r? @ghost

5 years ago[WIP] Fix tests
Yuki Okushi [Sat, 19 Jan 2019 19:37:58 +0000 (04:37 +0900)]
[WIP] Fix tests

5 years ago[WIP] Improve error behavior
Yuki Okushi [Sat, 19 Jan 2019 19:37:29 +0000 (04:37 +0900)]
[WIP] Improve error behavior

5 years agoRollup merge of #57736 - phansch:remove_delay, r=oli-obk
Mazdak Farrokhzad [Sat, 19 Jan 2019 18:41:24 +0000 (19:41 +0100)]
Rollup merge of #57736 - phansch:remove_delay, r=oli-obk

Remove delay_span_bug from qualify_min_const_fn

This is causing issues with a new Clippy lint that will be able to
detect possible const functions.

As per https://github.com/rust-lang/rust-clippy/pull/3648#discussion_r247927450

r? @oli-obk

5 years agoRollup merge of #57723 - estebank:fix, r=davidtwco
Mazdak Farrokhzad [Sat, 19 Jan 2019 18:41:22 +0000 (19:41 +0100)]
Rollup merge of #57723 - estebank:fix, r=davidtwco

Point at cause for expectation in return type type error

Various improvements and fixes for type errors in return expressions.

Fix #57664.

5 years agoRollup merge of #57689 - nnethercote:redo-hir-Stmt, r=petrochenkov
Mazdak Farrokhzad [Sat, 19 Jan 2019 18:41:21 +0000 (19:41 +0100)]
Rollup merge of #57689 - nnethercote:redo-hir-Stmt, r=petrochenkov

Redo `hir::Stmt`

A couple of changes that make things simpler and more consistent.

This should probably wait until after 1.32 lands to land, to avoid late breakage for tools.

5 years agoRollup merge of #57452 - steveklabnik:improve-formatter-docs, r=frewsxcv
Mazdak Farrokhzad [Sat, 19 Jan 2019 18:41:20 +0000 (19:41 +0100)]
Rollup merge of #57452 - steveklabnik:improve-formatter-docs, r=frewsxcv

Improve docs for Formatter

Some improvements to `std::fmt::Formatter` to make it a bit more consistent with other documentation, as well as calling out that you don't ever instantiate one yourself.

5 years agoAuto merge of #57721 - ehuss:update-cargo, r=alexcrichton
bors [Sat, 19 Jan 2019 18:37:03 +0000 (18:37 +0000)]
Auto merge of #57721 - ehuss:update-cargo, r=alexcrichton

Update cargo

Unblocks #56884  cc @euclio

6 commits in 2b4a5f1f0bb6e13759e88ea9512527b0beba154f..ffe65875fd05018599ad07e7389e99050c7915be
2019-01-12 04:13:12 +0000 to 2019-01-17 23:57:50 +0000
- Better error message for bad manifest with `cargo install`. (rust-lang/cargo#6560)
- relax rustdoc output assertion (rust-lang/cargo#6559)
- touch some files when we use them (rust-lang/cargo#6477)
- Add documentation for new package/publish feature flags. (rust-lang/cargo#6553)
- Update chat link to Discord. (rust-lang/cargo#6554)
- Fix typo (rust-lang/cargo#6552)

r? @alexcrichton

5 years agoAuto merge of #57755 - Centril:rollup, r=Centril
bors [Sat, 19 Jan 2019 15:52:58 +0000 (15:52 +0000)]
Auto merge of #57755 - Centril:rollup, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #57486 (Simplify `TokenStream` some more)
 - #57502 (make trait-aliases work across crates)
 - #57598 (Add missing unpretty option help message)
 - #57649 (privacy: Account for associated existential types)
 - #57659 (Fix release manifest generation)
 - #57699 (add applicability to remaining suggestions)
 - #57719 (Tweak `expand_node`)

Failed merges:

r? @ghost

5 years agoRollup merge of #57719 - nnethercote:expand_node-FIDDLING, r=nikomatsakis
Mazdak Farrokhzad [Sat, 19 Jan 2019 13:21:24 +0000 (14:21 +0100)]
Rollup merge of #57719 - nnethercote:expand_node-FIDDLING, r=nikomatsakis

Tweak `expand_node`

These commits speed up the `unicode_normalization` benchmark a little.

5 years agoRollup merge of #57699 - euclio:applicability-ify, r=petrochenkov
Mazdak Farrokhzad [Sat, 19 Jan 2019 13:21:23 +0000 (14:21 +0100)]
Rollup merge of #57699 - euclio:applicability-ify, r=petrochenkov

add applicability to remaining suggestions

Fixes #50723.

I noticed that the suggestion methods on `DiagnosticBuilder` weren't actually deprecated due to #57679. This PR deprecates them properly and fixes the remaining usages.

There's also a PR for clippy at rust-lang/rust-clippy#3667.

5 years agoRollup merge of #57659 - jethrogb:jb/release-manifest, r=alexcrichton
Mazdak Farrokhzad [Sat, 19 Jan 2019 13:21:22 +0000 (14:21 +0100)]
Rollup merge of #57659 - jethrogb:jb/release-manifest, r=alexcrichton

Fix release manifest generation

r? @alexcrichton

5 years agoRollup merge of #57649 - petrochenkov:privexist, r=arielb1
Mazdak Farrokhzad [Sat, 19 Jan 2019 13:21:21 +0000 (14:21 +0100)]
Rollup merge of #57649 - petrochenkov:privexist, r=arielb1

privacy: Account for associated existential types

Turns out they *can* be associated (but only in impls, not traits).
Fixes https://github.com/rust-lang/rust/issues/53546#issuecomment-454372879

r? @arielb1

5 years agoRollup merge of #57598 - h-michael:unpretty-help, r=oli-obk
Mazdak Farrokhzad [Sat, 19 Jan 2019 13:21:19 +0000 (14:21 +0100)]
Rollup merge of #57598 - h-michael:unpretty-help, r=oli-obk

Add missing unpretty option help message

There are some missing help messages that is printed `ructc -Zunpretty help` and receiving invalid option.

related with #16419, #45721, #21085, #31916

5 years agoRollup merge of #57502 - nikomatsakis:fix-trait-alias-1b, r=nikomatsakis
Mazdak Farrokhzad [Sat, 19 Jan 2019 13:21:18 +0000 (14:21 +0100)]
Rollup merge of #57502 - nikomatsakis:fix-trait-alias-1b, r=nikomatsakis

make trait-aliases work across crates

This is rebase of a small part of @alexreg's PR #55994. It focuses just on the changes that integrate trait aliases properly into crate metadata, excluding the stylistic edits and the trait objects.

The stylistic edits I also rebased and can open a separate PR.

The trait object stuff I found challenging and decided it basically needed to be reimplemented. For now I've excluded it.

Since this is really @alexreg's work (I really just rebased) I am going to make it r=me once it is working.

Fixes #56488.
Fixes #57023.

5 years agoRollup merge of #57486 - nnethercote:simplify-TokenStream-more, r=petrochenkov
Mazdak Farrokhzad [Sat, 19 Jan 2019 13:21:17 +0000 (14:21 +0100)]
Rollup merge of #57486 - nnethercote:simplify-TokenStream-more, r=petrochenkov

Simplify `TokenStream` some more

These commits simplify `TokenStream`, remove `ThinTokenStream`, and avoid some clones. The end result is simpler code and a slight perf win on some benchmarks.

r? @petrochenkov

5 years agoAuto merge of #57370 - petrhosek:llvm-flags, r=alexcrichton
bors [Sat, 19 Jan 2019 13:11:53 +0000 (13:11 +0000)]
Auto merge of #57370 - petrhosek:llvm-flags, r=alexcrichton

Support passing cflags/cxxflags/ldflags to LLVM build

This may be needed with some host compilers.

5 years agoAuto merge of #57752 - Centril:rollup, r=Centril
bors [Sat, 19 Jan 2019 10:27:59 +0000 (10:27 +0000)]
Auto merge of #57752 - Centril:rollup, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #57268 (Add a target option "merge-functions", and a corresponding -Z flag (works around #57356))
 - #57476 (Move glob map use to query and get rid of CrateAnalysis)
 - #57501 (High priority resolutions for associated variants)
 - #57573 (Querify `entry_fn`)
 - #57610 (Fix nested `?` matchers)
 - #57634 (Remove an unused function argument)
 - #57653 (Make the contribution doc reference the guide more)
 - #57666 (Generalize `huge-enum.rs` test and expected stderr for more cross platform cases)
 - #57698 (Fix typo bug in DepGraph::try_mark_green().)
 - #57746 (Update README.md)

Failed merges:

r? @ghost

5 years agoRollup merge of #57746 - mark-i-m:patch-2, r=Centril
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:34 +0000 (09:03 +0100)]
Rollup merge of #57746 - mark-i-m:patch-2, r=Centril

Update README.md

Point contributors to the rustc-guide...

r? @steveklabnik

5 years agoRollup merge of #57698 - michaelwoerister:issue57692, r=Zoxc
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:33 +0000 (09:03 +0100)]
Rollup merge of #57698 - michaelwoerister:issue57692, r=Zoxc

Fix typo bug in DepGraph::try_mark_green().

r? @Zoxc

Fixes #57692.

5 years agoRollup merge of #57666 - pnkfelix:generalize-huge-enum-test-to-work-cross-platform...
Mazdak Farrokhzad [Sat, 19 Jan 2019 08:03:32 +0000 (09:03 +0100)]
Rollup merge of #57666 - pnkfelix:generalize-huge-enum-test-to-work-cross-platform, r=nikomatsakis

Generalize `huge-enum.rs` test and expected stderr for more cross platform cases

With this change, I am able to build and test cross-platform `rustc`

In particular, I can use the following in my `config.toml`:

```
[build]
host = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"]
target = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"]
```

Before this change, my attempt to run the test suite would fail
because the error output differs depending on what your host and
targets are.

----

To be concrete, here are the actual messages one can observe:

```
% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=x86_64-unknown-linux-gnu
error: the type `std::option::Option<[u32; 35184372088831]>` is too big for the current architecture

error: aborting due to previous error

% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=i686-unknown-linux-gnu
error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture

error: aborting due to previous error

% ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=i686-unknown-linux-gnu
error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture

error: aborting due to previous error

% ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=x86_64-unknown-linux-gnu
error: the type `[u32; 35184372088831]` is too big for the current architecture

error: aborting due to previous error
```

To address these variations, I changed the test to be more aggressive
in its normalization strategy. We cannot (and IMO should not)
guarantee that `Option` will appear in the error output here. So I
normalized both types `Option<[u32; N]>` and `[u32; N]` to just `TYPE`

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 #57253 - Zoxc:incr-passes2, r=michaelwoerister
bors [Sat, 19 Jan 2019 07:42:43 +0000 (07:42 +0000)]
Auto merge of #57253 - Zoxc:incr-passes2, r=michaelwoerister

Make privacy checking, intrinsic checking and liveness checking incremental

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

r? @michaelwoerister

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 agoUpdate README.md
Who? Me?! [Fri, 18 Jan 2019 21:28:23 +0000 (15:28 -0600)]
Update README.md

Point contributors to the rustc-guide...

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 agoRemove delay_span_bug from qualify_min_const_fn
Philipp Hansch [Fri, 18 Jan 2019 15:46:51 +0000 (16:46 +0100)]
Remove delay_span_bug from qualify_min_const_fn

This is causing issues with a new Clippy lint that will be able to
detect possible const functions.

As per https://github.com/rust-lang/rust-clippy/pull/3648#discussion_r247927450

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 agoPoint at return type when appropriate
Esteban Küber [Fri, 18 Jan 2019 08:12:09 +0000 (00:12 -0800)]
Point at return type when appropriate

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 agoFix test after rebase
Esteban Küber [Fri, 18 Jan 2019 06:51:01 +0000 (22:51 -0800)]
Fix test after rebase

5 years agoCorrect error location indicated by comments
Kevin Leimkuhler [Fri, 18 Jan 2019 06:33:25 +0000 (22:33 -0800)]
Correct error location indicated by comments