Commit Graph

101635 Commits

Author SHA1 Message Date
Tomasz Miąsko
045fdd9fa9 Use build-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
Tomasz Miąsko
a03474bc54 Use run-pass for ui tests where appropriate 2019-11-04 13:57:42 +01:00
Tomasz Miąsko
a99fba5bc5 Remove no longer useful ui test 2019-11-04 13:57:42 +01:00
bors
ab6e47851b 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.
2019-11-04 09:00:39 +00:00
bors
cba9368537 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
2019-11-04 05:42:40 +00:00
Mark Rousskov
c68df7c503 Delete lint buffer from Session 2019-11-03 21:52:42 -05:00
Mark Rousskov
c0fdddcb60 Move crate type checking later
This allows us to directly pass in a lint buffer
2019-11-03 21:52:42 -05:00
Mark Rousskov
ea1ff8c07c Utilize Resolver lint buffer during HIR lowering 2019-11-03 21:52:42 -05:00
Mark Rousskov
bb0c930f82 Migrate resolver over to internal lint buffer 2019-11-03 21:52:42 -05:00
Mark Rousskov
1bd6b48914 Only permit taking buffered lints inside lint internals 2019-11-03 21:51:06 -05:00
Mark Rousskov
f530156ef5 Remove unused get_any method 2019-11-03 21:51:05 -05:00
bors
f49f388713 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.
2019-11-04 02:30:45 +00:00
bors
0d5264a03c 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
2019-11-03 21:55:48 +00:00
bors
b520af6fd5 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
2019-11-03 18:36:59 +00:00
bors
b43a682259 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
2019-11-03 15:14:09 +00:00
Amanieu d'Antras
f223e0d627 Fix macOS tests 2019-11-03 14:04:15 +00:00
Amanieu d'Antras
76660fde81 Make Emscripten unwinding use a valid type_info
This allows catch_panic to ignore C++ exceptions.
2019-11-03 14:04:15 +00:00
Amanieu d'Antras
ad61c88e72 Make SEH exceptions use a rust_panic type instead of unsigned __int64* 2019-11-03 14:03:21 +00:00
Amanieu d'Antras
83d6bf4929 Hack to make C++ exceptions test work on i686-pc-windows-gnu 2019-11-03 14:03:21 +00:00
Amanieu d'Antras
5f1a0afd22 Allow foreign exceptions to unwind through Rust code 2019-11-03 14:03:21 +00:00
Amanieu d'Antras
9a8bb3a26e Enable C++ exceptions on MSVC when building C++ tests 2019-11-03 14:03:20 +00:00
Amanieu d'Antras
246c606e75 Add -lstdc++ for run-make-fulldeps tests on MinGW 2019-11-03 14:03:20 +00:00
bors
8b07292671 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
2019-11-03 11:51:44 +00:00
Tomasz Miąsko
cfa2a2632a Use check-pass for never type tests 2019-11-03 10:20:11 +01:00
Tomasz Miąsko
6be770150b 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.
2019-11-03 10:20:11 +01:00
Tomasz Miąsko
d200a3f7ec Update error annotations in ui-fulldeps tests that successfully compile 2019-11-03 10:20:11 +01:00
Tomasz Miąsko
2c4862245a 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.
2019-11-03 10:20:11 +01:00
Tomasz Miąsko
f6c2c4dc43 Update error annotations positions
Since 8ec9d7242c, in the case of a local
macro expansion, the errors are now matched to macro definition
location. Update test cases accordingly.
2019-11-03 10:20:11 +01:00
Tomasz Miąsko
23ada9495f 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.
2019-11-03 10:20:11 +01:00
bors
aa51f04073 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)
2019-11-03 08:01:29 +00:00
bors
6c1b220fd7 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
2019-11-02 22:26:54 +00:00
Ralf Jung
b93f48f71a adjust for missing spans on x86 test runner 2019-11-02 23:13:00 +01:00
bors
91fd6283e6 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.
2019-11-02 18:22:32 +00:00
bors
f39205b5d9 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
2019-11-02 10:48:59 +00:00
Tomasz Miąsko
dae4c6e722 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.
2019-11-02 10:28:29 +01:00
Tomasz Miąsko
b10f75ca64 Remove erroneous error-pattern from run-pass test 2019-11-02 10:28:28 +01:00
bors
87cbf0a547 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
2019-11-01 18:23:04 +00:00
Tyler Mandry
d6e35d1334
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
2019-11-01 11:20:29 -07:00
Tyler Mandry
81505e7fdc
Rollup merge of #66005 - Wind-River:master_base, r=alexcrichton
vxWorks: remove code related unix socket

r? @alexcrichton
2019-11-01 11:20:28 -07:00
Tyler Mandry
5b707f8ca9
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
2019-11-01 11:20:26 -07:00
Tyler Mandry
665d6479c4
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
2019-11-01 11:20:25 -07:00
Tyler Mandry
1ea66850af
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
2019-11-01 11:20:24 -07:00
Tyler Mandry
959a563803
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.
2019-11-01 11:20:22 -07:00
Tyler Mandry
05de0d7c9f
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.
2019-11-01 11:20:21 -07:00
Tyler Mandry
9bf1613840
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!
2019-11-01 11:20:20 -07:00
Tyler Mandry
723f0ef518
Rollup merge of #65960 - lzutao:doc-iter-example, r=Centril
doc: reword iter module example and mention other methods
2019-11-01 11:20:18 -07:00
Tyler Mandry
4160e5aaba
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](caa1f8d7b3/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
2019-11-01 11:20:17 -07:00
Tyler Mandry
b7416348c8
Rollup merge of #65914 - estebank:type-alias-bounds-sugg, r=davidtwco
Use structured suggestion for unnecessary bounds in type aliases
2019-11-01 11:20:15 -07:00
Tyler Mandry
d75338e630
Rollup merge of #65902 - gilescope:issue62570, r=estebank
Make ItemContext available for better diagnositcs

Fix #62570
2019-11-01 11:20:14 -07:00
Tyler Mandry
48a9f59ae7
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
2019-11-01 11:20:12 -07:00