]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #66042 - ohadravid:suggest-correct-code-when-ref-current-trait, r...
Pietro Albini [Tue, 5 Nov 2019 08:49:58 +0000 (09:49 +0100)]
Rollup merge of #66042 - ohadravid:suggest-correct-code-when-ref-current-trait, r=estebank

Suggest correct code when encountering an incorrect trait bound referencing the current trait

Fixes #65985 and also improves the suggestion for code like this:

```
trait Grab {
    type Value;
    fn grab(&self) -> Grab::Value;
}
```

To suggest `<Self as Grab>::Value`.

I wasn't sure which of the syntax versions is better (`<Self as ..>::` vs `Self::`), so I used the former simply because it was less change to the existing code.

r? @estebank

4 years agoRollup merge of #66038 - jdxcode:char-len, r=alexcrichton
Pietro Albini [Tue, 5 Nov 2019 08:49:56 +0000 (09:49 +0100)]
Rollup merge of #66038 - jdxcode:char-len, r=alexcrichton

doc(str): show example of chars().count() under len()

the docs are great at explaining that .len() isn't like in other
languages but stops short of explaining how to get the character length.

4 years agoRollup merge of #66019 - olegnn:fixed_std_iter_chain_docs, r=Mark-Simulacrum
Pietro Albini [Tue, 5 Nov 2019 08:49:55 +0000 (09:49 +0100)]
Rollup merge of #66019 - olegnn:fixed_std_iter_chain_docs, r=Mark-Simulacrum

Improved std::iter::Chain documentation

Replaces `strings two iterators` by `links two iterators` in `std::iter::Chain` documentation.

I didn't find any meaning of `strings` which can be evaluated as `links` or `joins`.

I don't think that `std::iter:Chain` works as a stringer or plays billiards. (https://www.lexico.com/en/definition/string).

4 years agoRollup merge of #65962 - kevincox:patch-1, r=sfackler
Pietro Albini [Tue, 5 Nov 2019 08:49:53 +0000 (09:49 +0100)]
Rollup merge of #65962 - kevincox:patch-1, r=sfackler

Fix logic in example.

The example claims SuperiorThanZero and presumably Zero is not Superior than itself so it should not be allowed.

4 years agoRollup merge of #65905 - cuviper:doc-unix-mode, r=Dylan-DPC
Pietro Albini [Tue, 5 Nov 2019 08:49:52 +0000 (09:49 +0100)]
Rollup merge of #65905 - cuviper:doc-unix-mode, r=Dylan-DPC

[doc] fixes for unix/vxworks `OpenOptionsExt::mode`

4 years agoRollup merge of #65720 - icefoxen:LLVMgetInstructionCount, r=rkruppe
Pietro Albini [Tue, 5 Nov 2019 08:49:50 +0000 (09:49 +0100)]
Rollup merge of #65720 - icefoxen:LLVMgetInstructionCount, r=rkruppe

Add FFI bindings for LLVM's Module::getInstructionCount()

Just to make it usable for profiling and such inside
rustc itself.  It was vaguely useful in
https://wiki.alopex.li/WhereRustcSpendsItsTime and I figured
I might as well upstream it; I may or may not ever get around
to doing more with it (hopefully I will), but it may be useful
for others.

4 years agoRollup merge of #65574 - tshepang:linked-list-disclaimer, r=Centril
Pietro Albini [Tue, 5 Nov 2019 08:49:48 +0000 (09:49 +0100)]
Rollup merge of #65574 - tshepang:linked-list-disclaimer, r=Centril

docs: improve disclaimer regarding LinkedList

4 years agoRollup merge of #65136 - ehuss:update-codegen-options, r=Dylan-DPC
Pietro Albini [Tue, 5 Nov 2019 08:49:47 +0000 (09:49 +0100)]
Rollup merge of #65136 - ehuss:update-codegen-options, r=Dylan-DPC

Update codegen option documentation.

Some documentation updates:

- Add more detail to codegen options.
- Add missing options:
    - `force-frame-pointers`
    - `default-linker-libraries`
    - `linker-plugin-lto`
- Add fragment anchors for all command-line-arguments.
- Add some cross links between options.

4 years agoAuto merge of #65911 - mati865:static-libstdcxx-mingw, r=alexcrichton
bors [Tue, 5 Nov 2019 00:30:58 +0000 (00:30 +0000)]
Auto merge of #65911 - mati865:static-libstdcxx-mingw, r=alexcrichton

Statically link libstdc++ on windows-gnu

Fixes https://github.com/rust-lang/rust/issues/61561 by not shipping `libstdc++-6.dll` which can conflict with the GCC.

4 years agoAuto merge of #65874 - Nadrieril:clarify-usefulness, r=varkor
bors [Mon, 4 Nov 2019 21:06:50 +0000 (21:06 +0000)]
Auto merge of #65874 - Nadrieril:clarify-usefulness, r=varkor

Clarify pattern-matching usefulness algorithm

This PR clarifies a bit the usefulness algorithm by emphasizing that each row of the matrix can be seen as a sort of stack from which we pop constructors. It also moves code around to increase separation of concerns.

This is part of my splitting of https://github.com/rust-lang/rust/pull/65160 into smaller PRs.

4 years agoAuto merge of #66078 - petrochenkov:gateout, r=Centril
bors [Mon, 4 Nov 2019 12:16:00 +0000 (12:16 +0000)]
Auto merge of #66078 - petrochenkov:gateout, r=Centril

expand: Feature gate out-of-line modules in proc macro input

Extracted from https://github.com/rust-lang/rust/pull/64273.

We are currently gating attributes applied directly to `mod` items because there are unresolved questions about out-of-line modules and their behavior is very likely to change.

However, you can sneak an out-of-line module into an attribute macro input using modules nested into other items like
```rust
#[my_attr]
fn m() {
    #[path = "zzz.rs"]
    mod n; // what tokens does the `my_attr` macro see?
}
```
This PR prevents that and emits a feature gate error for this case as well.

r? @Centril
It would be great to land this before beta.

4 years agoexpand: Feature gate out-of-line modules in proc macro input
Vadim Petrochenkov [Sat, 7 Sep 2019 22:42:12 +0000 (01:42 +0300)]
expand: Feature gate out-of-line modules in proc macro input

4 years agoAuto merge of #65835 - Mark-Simulacrum:lockless-lintbuffer, r=nikomatsakis
bors [Mon, 4 Nov 2019 09:00:39 +0000 (09:00 +0000)]
Auto merge of #65835 - Mark-Simulacrum:lockless-lintbuffer, r=nikomatsakis

Remove LintBuffer from Session

This moves the `LintBuffer` from `Session` into the `Resolver`, where it is used until lowering is done and then consumed by early lint passes. This also happily removes the failure mode of buffering lints too late where it would have previously lead to ICEs; it is statically no longer possible to do so.

I suspect that with a bit more work a similar move could be done for the lint buffer inside `ParseSess`, but this PR doesn't touch it (in part to keep itself small).

The last commit is the "interesting" commit -- the ones before it don't work (though they compile) as they sort of prepare the various crates for the lint buffer to be passed in rather than accessed through Session.

4 years agoAuto merge of #64878 - XAMPPRocky:relnotes-1.39.0, r=XAMPPRocky
bors [Mon, 4 Nov 2019 05:42:40 +0000 (05:42 +0000)]
Auto merge of #64878 - XAMPPRocky:relnotes-1.39.0, r=XAMPPRocky

Updated RELEASES.md for 1.39.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-1.39.0/RELEASES.md)

r? @Mark-Simulacrum
cc @rust-lang/release

4 years agoDelete lint buffer from Session
Mark Rousskov [Fri, 25 Oct 2019 17:41:51 +0000 (13:41 -0400)]
Delete lint buffer from Session

4 years agoMove crate type checking later
Mark Rousskov [Fri, 25 Oct 2019 17:23:18 +0000 (13:23 -0400)]
Move crate type checking later

This allows us to directly pass in a lint buffer

4 years agoUtilize Resolver lint buffer during HIR lowering
Mark Rousskov [Fri, 25 Oct 2019 13:20:18 +0000 (09:20 -0400)]
Utilize Resolver lint buffer during HIR lowering

4 years agoMigrate resolver over to internal lint buffer
Mark Rousskov [Fri, 25 Oct 2019 13:15:33 +0000 (09:15 -0400)]
Migrate resolver over to internal lint buffer

4 years agoOnly permit taking buffered lints inside lint internals
Mark Rousskov [Fri, 25 Oct 2019 12:08:53 +0000 (08:08 -0400)]
Only permit taking buffered lints inside lint internals

4 years agoRemove unused get_any method
Mark Rousskov [Fri, 25 Oct 2019 12:06:01 +0000 (08:06 -0400)]
Remove unused get_any method

4 years agoAuto merge of #65838 - estebank:resilient-recovery, r=Centril
bors [Mon, 4 Nov 2019 02:30:45 +0000 (02:30 +0000)]
Auto merge of #65838 - estebank:resilient-recovery, r=Centril

Reduce amount of errors given unclosed delimiter

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix #63690.

4 years agoAuto merge of #65780 - GuillaumeGomez:move-help-popup-generation-code, r=Mark-Simulacrum
bors [Sun, 3 Nov 2019 21:55:48 +0000 (21:55 +0000)]
Auto merge of #65780 - GuillaumeGomez:move-help-popup-generation-code, r=Mark-Simulacrum

Move help popup generation code

The first commit is just a small cleanup.

The idea behind this PR is to reduce a bit more the generated HTML files by moving the duplicated code into one place instead.

r? @kinnison

4 years agoAuto merge of #65646 - Amanieu:foreign-exceptions, r=nikomatsakis
bors [Sun, 3 Nov 2019 18:36:59 +0000 (18:36 +0000)]
Auto merge of #65646 - Amanieu:foreign-exceptions, r=nikomatsakis

Allow foreign exceptions to unwind through Rust code and Rust panics to unwind through FFI

This PR fixes interactions between Rust panics and foreign (mainly C++) exceptions.

C++ exceptions (and other FFI exceptions) can now safely unwind through Rust code:
- The FFI function causing the unwind must be marked with `#[unwind(allowed)]`. If this is not the case then LLVM may optimize landing pads away with the assumption that they are unreachable.
- Drop code will be executed as the exception unwinds through the stack, as with a Rust panic.
- `catch_unwind` will *not* catch the exception, instead the exception will silently continue unwinding past it.

Rust panics can now safely unwind through C++ code:
- C++ destructors will be called as the stack unwinds.
- The Rust panic can only be caught with `catch (...)`, after which it can be either rethrown or discarded.
- C++ cannot name the type of the Rust exception object used for unwinding, which means that it can't be caught explicitly or have its contents inspected.

Tests have been added to ensure all of the above works correctly.

Some notes about non-C++ exceptions:
- `pthread_cancel` and `pthread_exit` use unwinding on glibc. This has the same behavior as a C++ exception: destructors are run but it cannot be caught by `catch_unwind`.
- `longjmp` on Windows is implemented using unwinding. Destructors are run on MSVC, but not on MinGW. In both cases the unwind cannot be caught by `catch_unwind`.
- As with C++ exceptions, you need to mark the relevant FFI functions with `#[unwind(allowed)]`, otherwise LLVM will optimize out the destructors since they seem unreachable.

I haven't updated any of the documentation, so officially unwinding through FFI is still UB. However this is a step towards making it well-defined.

Fixes #65441

cc @gnzlbg
r? @alexcrichton

4 years agoAuto merge of #65759 - tmiasko:ui, r=petrochenkov
bors [Sun, 3 Nov 2019 15:14:09 +0000 (15:14 +0000)]
Auto merge of #65759 - tmiasko:ui, r=petrochenkov

Validate error patterns and error annotation in ui tests when present

Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when #65506 is merged even
more ui tests will.

Fixes #56277

4 years agoFix macOS tests
Amanieu d'Antras [Sun, 3 Nov 2019 11:23:44 +0000 (11:23 +0000)]
Fix macOS tests

4 years agoMake Emscripten unwinding use a valid type_info
Amanieu d'Antras [Sun, 27 Oct 2019 22:33:16 +0000 (22:33 +0000)]
Make Emscripten unwinding use a valid type_info

This allows catch_panic to ignore C++ exceptions.

4 years agoMake SEH exceptions use a rust_panic type instead of unsigned __int64*
Amanieu d'Antras [Sun, 27 Oct 2019 22:33:25 +0000 (22:33 +0000)]
Make SEH exceptions use a rust_panic type instead of unsigned __int64*

4 years agoHack to make C++ exceptions test work on i686-pc-windows-gnu
Amanieu d'Antras [Sat, 26 Oct 2019 16:41:55 +0000 (17:41 +0100)]
Hack to make C++ exceptions test work on i686-pc-windows-gnu

4 years agoAllow foreign exceptions to unwind through Rust code
Amanieu d'Antras [Mon, 21 Oct 2019 01:46:04 +0000 (02:46 +0100)]
Allow foreign exceptions to unwind through Rust code

4 years agoEnable C++ exceptions on MSVC when building C++ tests
Amanieu d'Antras [Sat, 26 Oct 2019 01:47:06 +0000 (02:47 +0100)]
Enable C++ exceptions on MSVC when building C++ tests

4 years agoAdd -lstdc++ for run-make-fulldeps tests on MinGW
Amanieu d'Antras [Tue, 22 Oct 2019 13:12:33 +0000 (14:12 +0100)]
Add -lstdc++ for run-make-fulldeps tests on MinGW

4 years agoAttempt to clarify LTO and codegen-units.
Eric Huss [Sat, 2 Nov 2019 16:47:14 +0000 (09:47 -0700)]
Attempt to clarify LTO and codegen-units.

4 years agoAuto merge of #65827 - AnthonyMikh:out_of_the_loop, r=estebank
bors [Sun, 3 Nov 2019 11:51:44 +0000 (11:51 +0000)]
Auto merge of #65827 - AnthonyMikh:out_of_the_loop, r=estebank

Remove a loop which runs exactly once

Though the code seems to work properly, it is worth removing the loop entirely in order to not confuse the reader.

r? @estebank

4 years agoUse check-pass for never type tests
Tomasz Miąsko [Sat, 2 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Use check-pass for never type tests

4 years agoAvoid matching type in huge-struct test error annotation
Tomasz Miąsko [Tue, 29 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Avoid matching type in huge-struct test error annotation

The concrete type that will be too big is target dependent. Avoid
matching it in error annotation to make test work correctly across
different targets.

4 years agoUpdate error annotations in ui-fulldeps tests that successfully compile
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Update error annotations in ui-fulldeps tests that successfully compile

4 years agoValidate error patterns and error annotation in ui tests when present
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Validate error patterns and error annotation in ui tests when present

Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when #65506 is merged even
more ui tests will.

4 years agoUpdate error annotations positions
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Update error annotations positions

Since 8ec9d7242c3352fbc617d907bec3632215811356, in the case of a local
macro expansion, the errors are now matched to macro definition
location. Update test cases accordingly.

4 years agoAvoid mixing error patterns with error annotations
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Avoid mixing error patterns with error annotations

When both error patterns and error annotations are present in an ui
test, only error patterns are validated against the output.

Replace the error pattern with an error annotation to avoid silently
ignoring the other error annotation.

4 years agoAuto merge of #65779 - kevgrasso:E0308highlight, r=estebank
bors [Sun, 3 Nov 2019 08:01:29 +0000 (08:01 +0000)]
Auto merge of #65779 - kevgrasso:E0308highlight, r=estebank

Highlight only relevant parts of type path in type errors

Resolves #57413.

Unfortunately the current Rust UI testing setup can't test that the correct colors are being used in a given output, so here's a screenshot of a small test program I wrote:
![image](https://user-images.githubusercontent.com/480789/67530063-f272af00-f68b-11e9-9f96-a211fc7666d4.png)

4 years agoAuto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikic
bors [Sat, 2 Nov 2019 22:26:54 +0000 (22:26 +0000)]
Auto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikic

Make <*const/mut T>::offset_from `const fn`

This reenables offset_of cc @mjbshaw  after https://github.com/rust-lang/rust/pull/63075 broke it

4 years agoadjust for missing spans on x86 test runner
Ralf Jung [Sat, 2 Nov 2019 22:13:00 +0000 (23:13 +0100)]
adjust for missing spans on x86 test runner

4 years agoAuto merge of #65429 - Timmmm:withoptions, r=Mark-Simulacrum
bors [Sat, 2 Nov 2019 18:22:32 +0000 (18:22 +0000)]
Auto merge of #65429 - Timmmm:withoptions, r=Mark-Simulacrum

Add File::with_options

This provides a more fluent API to create files with options, and also avoids the need to import OpenOptions.

This implements @aldanor's [suggestion](https://github.com/rust-lang/rfcs/pull/2615#issuecomment-448591304) which was popular.

4 years agoAdd FFI bindings for Module::getInstructionCount()
Simon Heath [Wed, 23 Oct 2019 13:08:26 +0000 (09:08 -0400)]
Add FFI bindings for Module::getInstructionCount()

Just to make it useable for profiling and such inside
rustc itself.  It was vaguely useful in
https://wiki.alopex.li/WhereRustcSpendsItsTime and I figured
I might as well upstream it; I may or may not ever get around
to doing more with it (hopefully I will), but it may be useful
for others.

4 years agoRename SuperiorThanZero -> GreaterThanZero
Kevin Cox [Sat, 2 Nov 2019 13:12:07 +0000 (13:12 +0000)]
Rename SuperiorThanZero -> GreaterThanZero

4 years agoSuggest more likely code when encountering an incorrect assoc item referencing the...
Ohad Ravid [Sat, 2 Nov 2019 08:49:05 +0000 (09:49 +0100)]
Suggest more likely code when encountering an incorrect assoc item referencing the current trait

4 years agoAuto merge of #66004 - eddyb:revert-early-gate, r=petrochenkov
bors [Sat, 2 Nov 2019 10:48:59 +0000 (10:48 +0000)]
Auto merge of #66004 - eddyb:revert-early-gate, r=petrochenkov

Partially revert the early feature-gatings added in #65742.

The intent here is to address #65860 ASAP (in time for beta, ideally), while leaving as much of #65742 around as possible, to make it easier to re-enable later.

Therefore, I've only kept the parts of the revert that re-add the old (i.e. non-early) feature-gating checks that were removed in #65742, and the test reverts.

I've disabled the new early feature-gating checks from #65742 entirely for now, but it would be easy to put them behind a `-Z` flag, or turn them into warnings, which would allow us to keep tests for both the early and late versions of the checks - assuming that's desirable.

cc @nikomatsakis @Mark-Simulacrum @Centril

4 years agoUpdate error annotations in tests that successfully compile
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Update error annotations in tests that successfully compile

Those annotation are silently ignored rather than begin validated
against compiler output. Update them before validation is enabled,
to avoid test failures.

4 years agoRemove erroneous error-pattern from run-pass test
Tomasz Miąsko [Thu, 24 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Remove erroneous error-pattern from run-pass test

4 years agoSuggest correct code when encountering an incorrect trait bound referencing the curre...
Ohad Ravid [Fri, 1 Nov 2019 12:50:36 +0000 (13:50 +0100)]
Suggest correct code when encountering an incorrect trait bound referencing the current trait

4 years agodoc(str): show example of chars().count() under len()
Jeff Dickey [Sat, 2 Nov 2019 02:42:33 +0000 (19:42 -0700)]
doc(str): show example of chars().count() under len()

the docs are great at explaining that .len() isn't like in other
languages but stops short of explaining how to get the character length.

r? @steveklabnik

4 years agoAuto merge of #66021 - tmandry:rollup-y13l6n9, r=tmandry
bors [Fri, 1 Nov 2019 18:23:04 +0000 (18:23 +0000)]
Auto merge of #66021 - tmandry:rollup-y13l6n9, r=tmandry

Rollup of 16 pull requests

Successful merges:

 - #65112 (Add lint and tests for unnecessary parens around types)
 - #65470 (Don't hide ICEs from previous incremental compiles)
 - #65471 (Add long error explanation for E0578)
 - #65857 (rustdoc: Resolve module-level doc references more locally)
 - #65902 (Make ItemContext available for better diagnositcs)
 - #65914 (Use structured suggestion for unnecessary bounds in type aliases)
 - #65946 (Make `promote_consts` emit the errors when required promotion fails)
 - #65960 (doc: reword iter module example and mention other methods)
 - #65963 (update submodules to rust-lang)
 - #65972 (Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets)
 - #65977 (Fix incorrect diagnostics for expected type in E0271 with an associated type)
 - #65995 (Add error code E0743 for "C-variadic has been used on a non-foreign function")
 - #65997 (Fix outdated rustdoc of Once::init_locking function)
 - #66002 (Stabilize float_to_from_bytes feature)
 - #66005 (vxWorks: remove code related unix socket)
 - #66018 (Revert PR 64324: dylibs export generics again (for now))

Failed merges:

r? @ghost

4 years agoRollup merge of #66018 - pnkfelix:issue-64872-revert-64324, r=alexcrichton
Tyler Mandry [Fri, 1 Nov 2019 18:20:29 +0000 (11:20 -0700)]
Rollup merge of #66018 - pnkfelix:issue-64872-revert-64324, r=alexcrichton

Revert PR 64324: dylibs export generics again (for now)

As discussed on PR #65781, this is a targeted attempt to undo the main semantic change from PR #64324, by putting `dylib` back in the set of crate types that export generic symbols.

The main reason to do this is that PR #64324 had unanticipated side-effects that caused bugs like #64872, and in the opinion of @alexcrichton and myself, the impact of #64872 is worse than #64319.

In other words, it is better for us, in the short term, to reopen #64319 as currently unfixed for now than to introduce new bugs like #64872.

Fix #64872

Reopen #64319

4 years agoRollup merge of #66005 - Wind-River:master_base, r=alexcrichton
Tyler Mandry [Fri, 1 Nov 2019 18:20:28 +0000 (11:20 -0700)]
Rollup merge of #66005 - Wind-River:master_base, r=alexcrichton

vxWorks: remove code related unix socket

r? @alexcrichton

4 years agoRollup merge of #66002 - lzutao:stablilize-float_to_from_bytes, r=SimonSapin
Tyler Mandry [Fri, 1 Nov 2019 18:20:26 +0000 (11:20 -0700)]
Rollup merge of #66002 - lzutao:stablilize-float_to_from_bytes, r=SimonSapin

Stabilize float_to_from_bytes feature

FCP completed in https://github.com/rust-lang/rust/issues/60446#issuecomment-548440175
Closes #60446

4 years agoRollup merge of #65997 - spastorino:fix-init_locking-rustdoc, r=Mark-Simulacrum
Tyler Mandry [Fri, 1 Nov 2019 18:20:25 +0000 (11:20 -0700)]
Rollup merge of #65997 - spastorino:fix-init_locking-rustdoc, r=Mark-Simulacrum

Fix outdated rustdoc of Once::init_locking function

r? @Mark-Simulacrum

related to https://github.com/rust-lang/rust/pull/65979

4 years agoRollup merge of #65995 - GuillaumeGomez:add-err-code-E0743, r=estebank
Tyler Mandry [Fri, 1 Nov 2019 18:20:24 +0000 (11:20 -0700)]
Rollup merge of #65995 - GuillaumeGomez:add-err-code-E0743, r=estebank

Add error code E0743 for "C-variadic has been used on a non-foreign function"

Fixes https://github.com/rust-lang/rust/issues/65967

4 years agoRollup merge of #65977 - ohadravid:fix-incorrect-diagnostics-with-an-associated-type...
Tyler Mandry [Fri, 1 Nov 2019 18:20:22 +0000 (11:20 -0700)]
Rollup merge of #65977 - ohadravid:fix-incorrect-diagnostics-with-an-associated-type, r=estebank

Fix incorrect diagnostics for expected type in E0271 with an associated type

With code like the following code:

```rust
#[derive(Debug)]
struct Data {}

fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) {
    for item in iterator {
        println!("{:?}", item)
    }
}

fn main() {
    let v = vec![Data {}];

    do_stuff(v.into_iter());
}
```

the diagnostic (in nightly & stable) wrongly complains about the expected type:

```
error[E0271]: type mismatch resolving `<std::vec::IntoIter<Data> as std::iter::Iterator>::Item == &Data`
  --> src/main.rs:15:5
   |
5  | fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) {
   |    --------                             --------------- required by this bound in `do_stuff`
...
15 |     do_stuff(v.into_iter());
   |     ^^^^^^^^ expected struct `Data`, found &Data
   |
   = note: expected type `Data`
              found type `&Data`
```

This PR fixes this issue by flipping the expected/actual values where appropriate, so it looks like this:

```
error[E0271]: type mismatch resolving `<std::vec::IntoIter<Data> as std::iter::Iterator>::Item == &Data`
  --> main.rs:15:5
   |
5  | fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) {
   |    --------                             --------------- required by this bound in `do_stuff`
...
15 |     do_stuff(v.into_iter());
   |     ^^^^^^^^ expected &Data, found struct `Data`
   |
   = note: expected type `&Data`
              found type `Data`
```

This improves the output of a lot of existing tests (check out `associated-types-binding-to-type-defined-in-supertrait`!).

The only change which I wasn't too sure about is in the test `associated-types-overridden-binding-2`, but I think it's an improvement and the underlying problem is with handling of `trait_alias`.

Fix #57226, fix #64760, fix #58092.

4 years agoRollup merge of #65972 - braiins:vkr-arm-panicking, r=alexcrichton
Tyler Mandry [Fri, 1 Nov 2019 18:20:21 +0000 (11:20 -0700)]
Rollup merge of #65972 - braiins:vkr-arm-panicking, r=alexcrichton

Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets

If `__LITTLE_ENDIAN__` is missing, libunwind assumes big endian
and reads unwinding instructions wrong on ARM EHABI.

Fix #65765

Technical background in referenced bug.

I didn't run any automated tests, just built a simple panicking program using the fixed toolchain and panicking started to work. Tried with `catch_unwind()` and that seems to work now too. libunwind's log seems ok now, I can paste it if needed.

4 years agoRollup merge of #65963 - steveklabnik:update-submodules, r=Centril
Tyler Mandry [Fri, 1 Nov 2019 18:20:20 +0000 (11:20 -0700)]
Rollup merge of #65963 - steveklabnik:update-submodules, r=Centril

update submodules to rust-lang

These are the repositories I've moved from rust-lang-nursery to
rust-lang, so we should update the submodules too.

I have not tested that this builds at all, so please make sure CI is green!

4 years agoRollup merge of #65960 - lzutao:doc-iter-example, r=Centril
Tyler Mandry [Fri, 1 Nov 2019 18:20:18 +0000 (11:20 -0700)]
Rollup merge of #65960 - lzutao:doc-iter-example, r=Centril

doc: reword iter module example and mention other methods

4 years agoRollup merge of #65946 - ecstatic-morse:refactor-promotion2, r=eddyb
Tyler Mandry [Fri, 1 Nov 2019 18:20:17 +0000 (11:20 -0700)]
Rollup merge of #65946 - ecstatic-morse:refactor-promotion2, r=eddyb

Make `promote_consts` emit the errors when required promotion fails

A very minimal version of #65942.

This will cause a generic "argument X is required to be a constant" message for `simd_shuffle` LLVM intrinsics instead of the [custom one](https://github.com/rust-lang/rust/blob/caa1f8d7b3b021c86a70ff62d23a07d97acff4c4/src/librustc_mir/transform/qualify_consts.rs#L1616). It may be possible to remove this special-casing altogether after rust-lang/stdarch#825.

r? @eddyb

4 years agoRollup merge of #65914 - estebank:type-alias-bounds-sugg, r=davidtwco
Tyler Mandry [Fri, 1 Nov 2019 18:20:15 +0000 (11:20 -0700)]
Rollup merge of #65914 - estebank:type-alias-bounds-sugg, r=davidtwco

Use structured suggestion for unnecessary bounds in type aliases

4 years agoRollup merge of #65902 - gilescope:issue62570, r=estebank
Tyler Mandry [Fri, 1 Nov 2019 18:20:14 +0000 (11:20 -0700)]
Rollup merge of #65902 - gilescope:issue62570, r=estebank

Make ItemContext available for better diagnositcs

Fix #62570

4 years agoRollup merge of #65857 - kinnison:kinnison/issue-55364, r=Manisheart,GuillaumeGomez
Tyler Mandry [Fri, 1 Nov 2019 18:20:12 +0000 (11:20 -0700)]
Rollup merge of #65857 - kinnison:kinnison/issue-55364, r=Manisheart,GuillaumeGomez

rustdoc: Resolve module-level doc references more locally

Module level docs should resolve intra-doc links as locally as
possible.  As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in *inner* documentation comments within the (sub-)module rather
that from the context of its parent.

I'm hoping that this fixes #55364 though right now I'm not sure it's the right fix.

r? @GuillaumeGomez

4 years agoRollup merge of #65471 - GuillaumeGomez:long-err-explanation-E0578, r=Dylan-DPC
Tyler Mandry [Fri, 1 Nov 2019 18:20:11 +0000 (11:20 -0700)]
Rollup merge of #65471 - GuillaumeGomez:long-err-explanation-E0578, r=Dylan-DPC

Add long error explanation for E0578

Part of #61137

r? @kinnison

4 years agoRollup merge of #65470 - traxys:fix_65401, r=michaelwoerister
Tyler Mandry [Fri, 1 Nov 2019 18:20:09 +0000 (11:20 -0700)]
Rollup merge of #65470 - traxys:fix_65401, r=michaelwoerister

Don't hide ICEs from previous incremental compiles

I think this fixes #65401, the compiler does not fail to ICE after the first compilation, tested on the last snippet of [this comment](https://github.com/rust-lang/rust/issues/63154#issuecomment-541592381).
I am not very sure of the fix as I don't understand much of the structure of the compiler.

4 years agoRollup merge of #65112 - jack-t:type-parens-lint, r=varkor
Tyler Mandry [Fri, 1 Nov 2019 18:20:07 +0000 (11:20 -0700)]
Rollup merge of #65112 - jack-t:type-parens-lint, r=varkor

Add lint and tests for unnecessary parens around types

This is my first contribution to the Rust project, so I apologize if I'm not doing things the right way.

The PR fixes #64169. It adds a lint and tests for unnecessary parentheses around types. I've run `tidy` and `rustfmt` &mdash; I'm not totally sure it worked right, though &mdash; and I've tried to follow the instructions linked in the readme.

I tried to think through all the variants of `ast::TyKind` to find exceptions to this lint, and I could only find the one mentioned in the original issue, which concerns types with `dyn`. I'm not a Rust expert, thought, so I may well be missing something.

There's also a problem with getting this to build. The new lint catches several things in the, e.g., `core`. Because `x.py` seems to build with an equivalent of `-Werror`, what would have been warnings cause the build to break. I got it to build and the tests to pass with `--warnings warn` on my `x.py build` and `x.py test` commands.

4 years agoClarifications suggested by varkor
Nadrieril [Sun, 27 Oct 2019 17:14:43 +0000 (17:14 +0000)]
Clarifications suggested by varkor

4 years agoFactor out witness reconstruction
Nadrieril [Sun, 27 Oct 2019 17:07:05 +0000 (17:07 +0000)]
Factor out witness reconstruction

4 years agoFactor out constructor subtraction
Nadrieril [Sun, 27 Oct 2019 16:58:04 +0000 (16:58 +0000)]
Factor out constructor subtraction

4 years agoDefine a MissingConstructors struct for cleanliness
Nadrieril [Sun, 27 Oct 2019 16:36:50 +0000 (16:36 +0000)]
Define a MissingConstructors struct for cleanliness

4 years agoWording
Nadrieril [Mon, 23 Sep 2019 17:09:30 +0000 (19:09 +0200)]
Wording

4 years ago`specialize` conceptually operates on a single pattern
Nadrieril [Mon, 23 Sep 2019 15:58:41 +0000 (17:58 +0200)]
`specialize` conceptually operates on a single pattern

4 years agoClarify some variable names
Nadrieril [Mon, 23 Sep 2019 15:44:24 +0000 (17:44 +0200)]
Clarify some variable names

4 years agoRefactor "wild constructor" construction
Nadrieril [Mon, 23 Sep 2019 15:37:42 +0000 (17:37 +0200)]
Refactor "wild constructor" construction

4 years agoExtract constructor application as a Constructor method
Nadrieril [Mon, 23 Sep 2019 15:36:42 +0000 (17:36 +0200)]
Extract constructor application as a Constructor method

4 years agoRemove duplicate logic in compute_missing_constructors
Nadrieril [Mon, 23 Sep 2019 14:37:01 +0000 (16:37 +0200)]
Remove duplicate logic in compute_missing_constructors

This is equivalent to the previous code in terms of performance. The
expensive path is clearly identical. The fast path is also the same,
because in both cases we loop until we get a non-empty `refined_ctors`,
and then stop there. So the new code doesn't compute anything more
than the previous did.

4 years agoRemove some redundancy
Nadrieril [Mon, 23 Sep 2019 14:07:23 +0000 (16:07 +0200)]
Remove some redundancy

4 years agoFactor out some pattern-stack related functions
Nadrieril [Fri, 1 Nov 2019 16:33:34 +0000 (16:33 +0000)]
Factor out some pattern-stack related functions

4 years agoAbstract out pattern stacks to make the code more legible
Nadrieril [Fri, 1 Nov 2019 15:44:58 +0000 (15:44 +0000)]
Abstract out pattern stacks to make the code more legible

4 years agoFixed std::iter::Chain documentation
Oleg Nosov [Fri, 1 Nov 2019 15:00:25 +0000 (18:00 +0300)]
Fixed std::iter::Chain documentation

4 years agoui test formulation of regression test for issue 64872.
Felix S. Klock II [Wed, 30 Oct 2019 15:32:40 +0000 (16:32 +0100)]
ui test formulation of regression test for issue 64872.

(Many thanks to alex for 1. making this even smaller than what I had
originally minimized, and 2. pointing out that there is precedent for
having ui tests with crate dependency chains of length > 2, thus
allowing me to avoid encoding this as a run-make test.)

4 years agotargeted revert of PR rust-lang/rust#64324 (just undo change to dylib generics export).
Felix S. Klock II [Fri, 1 Nov 2019 12:46:05 +0000 (13:46 +0100)]
targeted revert of PR rust-lang/rust#64324 (just undo change to dylib generics export).

Includes the anticipated fallout to run-make-fulldeps test suite from
this change. (We need to reopen issue 64319 as part of landing this.)

4 years agoAuto merge of #65718 - eddyb:codegen-var-debuginfo, r=nikomatsakis
bors [Fri, 1 Nov 2019 11:34:51 +0000 (11:34 +0000)]
Auto merge of #65718 - eddyb:codegen-var-debuginfo, r=nikomatsakis

rustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen.

These are all the codegen changes necessary for #56231.

The refactors were performed locally to codegen, and in several steps, to ease reviewing and avoid introducing changes in behavior (as I'm not sure our debuginfo tests cover enough).

r? @michaelwoerister cc @nagisa @rkruppe @oli-obk

4 years agoUpdated RELEASES.md for 1.39.0
Erin Power [Sat, 28 Sep 2019 18:10:39 +0000 (20:10 +0200)]
Updated RELEASES.md for 1.39.0

4 years agoAuto merge of #65698 - msizanoen1:dual-proc-macro-hash, r=petrochenkov
bors [Fri, 1 Nov 2019 06:35:40 +0000 (06:35 +0000)]
Auto merge of #65698 - msizanoen1:dual-proc-macro-hash, r=petrochenkov

Dual proc macro hash

This PR changes current `-Z dual-proc-macro` mechanism from resolving only by name to including the hash of the host crate inside the transistive dependency information to prevent name conflicts.
Fix partially #62558

4 years agoAuto merge of #65459 - ecstatic-morse:graphviz-subgraph, r=estebank
bors [Fri, 1 Nov 2019 03:15:31 +0000 (03:15 +0000)]
Auto merge of #65459 - ecstatic-morse:graphviz-subgraph, r=estebank

Fix `-Zunpretty=mir-cfg` to render multiple items

`-Zunpretty=mir-cfg` outputs DOT to stdout for all items being compiled. However, it puts all of these items in separate `digraph`s, which means the result of redirecting that output to a file is not valid. Most dot renderers (I have tried `dot` and `xdot`) cannot render the output.

This PR checks to see if `write_mir_graphviz` will  process multiple items, and writes them each as a `subgraph` in a single, top-level `digraph`. As a result, DOT can be viewed without manually editing the output file. The output is unchanged when printing a single item (e.g.`-Zunpretty=mir-cfg=item_name`).

Here's the output of `xdot` for a rust file containing three items:
![three-items](https://user-images.githubusercontent.com/29463364/66889712-4bf62200-ef98-11e9-83b5-60faa2a300dd.png)

The borders are a result of the nonstandard–but well-supported–[`cluster` prefix](https://graphviz.gitlab.io/_pages/doc/info/lang.html) (search for "Subgraphs and Clusters"). They will not appear if your renderer does not support this extension, but the graph will still render properly.

4 years agorustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen.
Eduard-Mihai Burtescu [Wed, 23 Oct 2019 10:12:11 +0000 (13:12 +0300)]
rustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen.

4 years agorustc_codegen_ssa: hide address ops from the declare_local interface.
Eduard-Mihai Burtescu [Thu, 12 Sep 2019 09:29:46 +0000 (12:29 +0300)]
rustc_codegen_ssa: hide address ops from the declare_local interface.

4 years agorustc_codegen_ssa: move debuginfo scopes into FunctionDebugContext.
Eduard-Mihai Burtescu [Wed, 11 Sep 2019 14:52:39 +0000 (17:52 +0300)]
rustc_codegen_ssa: move debuginfo scopes into FunctionDebugContext.

4 years agorustc_codegen_ssa: change set_var_name back to taking a &str.
Eduard-Mihai Burtescu [Tue, 22 Oct 2019 09:36:00 +0000 (12:36 +0300)]
rustc_codegen_ssa: change set_var_name back to taking a &str.

4 years agorustc_codegen_ssa: move all set_var_name calls to mir::debuginfo.
Eduard-Mihai Burtescu [Fri, 13 Sep 2019 17:04:54 +0000 (20:04 +0300)]
rustc_codegen_ssa: move all set_var_name calls to mir::debuginfo.

4 years agorustc_codegen_ssa: move local variable debuginfo to mir::debuginfo.
Eduard-Mihai Burtescu [Fri, 13 Sep 2019 07:28:14 +0000 (10:28 +0300)]
rustc_codegen_ssa: move local variable debuginfo to mir::debuginfo.

4 years agorustc_codegen_ssa: move debuginfo-related things to a new mir::debuginfo module.
Eduard-Mihai Burtescu [Wed, 4 Sep 2019 16:44:58 +0000 (19:44 +0300)]
rustc_codegen_ssa: move debuginfo-related things to a new mir::debuginfo module.

4 years agosyntax: disable the new early feature-gatings added in #65742.
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 17:34:06 +0000 (19:34 +0200)]
syntax: disable the new early feature-gatings added in #65742.

4 years agoRevert "pre-expansion gate trait_alias."
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 16:50:31 +0000 (18:50 +0200)]
Revert "pre-expansion gate trait_alias."

This reverts commit 2d182b82ce5ecfe8090ba3d4e78f1cd72c072ef1.

4 years agoRevert "pre-expansion gate associated_type_bounds"
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 16:49:22 +0000 (18:49 +0200)]
Revert "pre-expansion gate associated_type_bounds"

This reverts commit c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.

4 years agoRevert "pre-expansion gate crate_visibility_modifier"
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 16:48:11 +0000 (18:48 +0200)]
Revert "pre-expansion gate crate_visibility_modifier"

This reverts commit 04c661ba021730bc13d33c6d55cb9aad05026f36.

4 years agoRevert "pre-expansion gate const_generics"
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 16:46:29 +0000 (18:46 +0200)]
Revert "pre-expansion gate const_generics"

This reverts commit 49cbfa1a6f6469ddbc0e88161e52104cc87aea9b.