]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #66101 - estebank:break-tail-e0308, r=Centril
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:17 +0000 (03:28 +0100)]
Rollup merge of #66101 - estebank:break-tail-e0308, r=Centril

Tweak type mismatch caused by break on tail expr

When `break;` has a type mismatch because the `Destination` points at a tail
expression with an obligation flowing from a return type, point at the
return type.

Fix #39968.

4 years agoRollup merge of #66098 - estebank:path-asciption-typo, r=Centril
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:15 +0000 (03:28 +0100)]
Rollup merge of #66098 - estebank:path-asciption-typo, r=Centril

Detect `::` -> `:` typo when involving turbofish

Fix #65569.

4 years agoRollup merge of #66093 - estebank:fmt-ice, r=Centril
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:14 +0000 (03:28 +0100)]
Rollup merge of #66093 - estebank:fmt-ice, r=Centril

Do not ICE with a precision flag in formatting str and no format arguments

Fix #66065.

4 years agoRollup merge of #66081 - RalfJung:ptr-offset, r=zackmdavis
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:12 +0000 (03:28 +0100)]
Rollup merge of #66081 - RalfJung:ptr-offset, r=zackmdavis

let caller of check_ptr_access_align control the error message

This is needed for https://github.com/rust-lang/miri/pull/1031

4 years agoRollup merge of #66068 - euclio:null-emitter, r=estebank
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:11 +0000 (03:28 +0100)]
Rollup merge of #66068 - euclio:null-emitter, r=estebank

use silent emitter for rustdoc highlighting pass

Partially addresses #63284.

4 years agoRollup merge of #66054 - petrochenkov:delspan, r=estebank
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:09 +0000 (03:28 +0100)]
Rollup merge of #66054 - petrochenkov:delspan, r=estebank

syntax: Avoid span arithmetic for delimiter tokens

The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it.
Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly.
If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries.

Fixes https://github.com/rust-lang/rust/issues/62524
r? @estebank

4 years agoRollup merge of #66027 - Mark-Simulacrum:panic-handler-query, r=alexcrichton
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:08 +0000 (03:28 +0100)]
Rollup merge of #66027 - Mark-Simulacrum:panic-handler-query, r=alexcrichton

Move has_panic_handler to query

Moves us off of a global Once instead re-querying the lang item each time. The conditions on when we set it to true change a little (previously we'd make sure a few more lang items were `Some`) but I think they in practice don't matter, we won't compile later on if we don't have them.

4 years agoRollup merge of #66014 - dkadashev:47319-type-param-def-location, r=estebank
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:06 +0000 (03:28 +0100)]
Rollup merge of #66014 - dkadashev:47319-type-param-def-location, r=estebank

Show type parameter name and definition in type mismatch error messages

Fixes #47319

r? estebank

4 years agoRollup merge of #65892 - pnkfelix:trim-special-derives, r=petrochenkov
Mazdak Farrokhzad [Wed, 6 Nov 2019 02:28:05 +0000 (03:28 +0100)]
Rollup merge of #65892 - pnkfelix:trim-special-derives, r=petrochenkov

Remove `PartialEq` and `Eq` from the `SpecialDerives`.

Now that PR #65519 landed, this is the follow-on work of removing `PartialEq` and `Eq` from the set of `SpecialDerives` .

4 years agoTweak type mismatch caused by break on tail expr
Esteban Küber [Tue, 5 Nov 2019 02:47:02 +0000 (18:47 -0800)]
Tweak type mismatch caused by break on tail expr

When `break;` has a type mismatch because the `Destination` points at a tail
expression with an obligation flowing from a return type, point at the
return type.

Fix #39968.

4 years agoAuto merge of #66121 - pietroalbini:rollup-8zrwe7l, r=pietroalbini
bors [Tue, 5 Nov 2019 20:22:27 +0000 (20:22 +0000)]
Auto merge of #66121 - pietroalbini:rollup-8zrwe7l, r=pietroalbini

Rollup of 8 pull requests

Successful merges:

 - #65948 (Improve MaybeUninit::get_{ref,mut} documentation)
 - #65953 (Allow specifying LLVM's MCTargetOptions::ABIName in target specification files)
 - #66012 (De-querify `trivial_dropck_outlives`.)
 - #66025 (`Span` cannot represent `span.hi < span.lo`)
 - #66047 (Don't double-count `simd_shuffle` promotion candidates)
 - #66053 (when Miri tests are not passing, do not add Miri component)
 - #66082 (clean highlightSourceLines code)
 - #66091 (Implemented the home_dir for VxWorks)

Failed merges:

r? @ghost

4 years agoDo not ICE whith a precision flag in formatting str and no format arguments
Esteban Küber [Mon, 4 Nov 2019 18:57:41 +0000 (10:57 -0800)]
Do not ICE whith a precision flag in formatting str and no format arguments

4 years agoAccount for typo in turbofish and suggest `::`
Esteban Küber [Tue, 5 Nov 2019 18:29:54 +0000 (10:29 -0800)]
Account for typo in turbofish and suggest `::`

4 years agoReview feedback: alpha-rename field from `copy_derives` to `containers_derving_copy`.
Felix S. Klock II [Mon, 4 Nov 2019 09:09:58 +0000 (10:09 +0100)]
Review feedback: alpha-rename field from `copy_derives` to `containers_derving_copy`.

4 years agoReview feedback: Remove more stuff! Simplify simplify simplify!
Felix S. Klock II [Wed, 30 Oct 2019 10:13:00 +0000 (11:13 +0100)]
Review feedback: Remove more stuff! Simplify simplify simplify!

4 years agoRemove `PartialEq` and `Eq` from the `SpecialDerives`.
Felix S. Klock II [Mon, 28 Oct 2019 11:40:12 +0000 (12:40 +0100)]
Remove `PartialEq` and `Eq` from the `SpecialDerives`.

4 years agoRollup merge of #66091 - Wind-River:master_xyz, r=cramertj
Pietro Albini [Tue, 5 Nov 2019 13:37:08 +0000 (14:37 +0100)]
Rollup merge of #66091 - Wind-River:master_xyz, r=cramertj

Implemented the home_dir for VxWorks

Use HOME's value if it is set;
otherwise return NONE.

4 years agoRollup merge of #66082 - GuillaumeGomez:cleanup-highlightsourcelines, r=kinnison
Pietro Albini [Tue, 5 Nov 2019 13:37:07 +0000 (14:37 +0100)]
Rollup merge of #66082 - GuillaumeGomez:cleanup-highlightsourcelines, r=kinnison

clean highlightSourceLines code

This is the first part of https://github.com/rust-lang/rust/issues/66046. Now that I've splitted the hashchange stuff and the source code lines highlighting, I'll be able to fix the whole issue once and for all.

r? @kinnison

4 years agoRollup merge of #66053 - RalfJung:miri-toolstate, r=pietroalbini
Pietro Albini [Tue, 5 Nov 2019 13:37:05 +0000 (14:37 +0100)]
Rollup merge of #66053 - RalfJung:miri-toolstate, r=pietroalbini

when Miri tests are not passing, do not add Miri component

Second attempt, this time based on the JSON files that exist since https://github.com/rust-lang/rust/pull/65274.

Fixes https://github.com/rust-lang/rust/issues/60301
r? @pietroalbini @alexcrichton

4 years agoRollup merge of #66047 - ecstatic-morse:issue-66016, r=eddyb
Pietro Albini [Tue, 5 Nov 2019 13:37:03 +0000 (14:37 +0100)]
Rollup merge of #66047 - ecstatic-morse:issue-66016, r=eddyb

Don't double-count `simd_shuffle` promotion candidates

Resolves #66016.

The `#[rustc_args_required_const]` attribute was added to `simd_shuffle*` in rust-lang/stdarch#825. This caused `promote_consts` to double-count its second argument when recording promotion candidates, which caused the promotion candidate compatibility check to fail.

Once `stdarch` is updated in-tree to include rust-lang/stdarch#825, all special logic around `simd_shuffle` can and should be removed.

4 years agoRollup merge of #66025 - petrochenkov:lohi, r=eddyb
Pietro Albini [Tue, 5 Nov 2019 13:37:01 +0000 (14:37 +0100)]
Rollup merge of #66025 - petrochenkov:lohi, r=eddyb

`Span` cannot represent `span.hi < span.lo`

So we can remove the corresponding checks from various code

4 years agoRollup merge of #66012 - nnethercote:dequery-trivial_dropck_outlives, r=michaelwoerister
Pietro Albini [Tue, 5 Nov 2019 13:36:59 +0000 (14:36 +0100)]
Rollup merge of #66012 - nnethercote:dequery-trivial_dropck_outlives, r=michaelwoerister

De-querify `trivial_dropck_outlives`.

It's sufficiently simple and fast that memoizing it is a slight
pessimization.

r? @michaelwoerister

4 years agoRollup merge of #65953 - keystone-enclave:llvm_abiname, r=alexcrichton
Pietro Albini [Tue, 5 Nov 2019 13:36:57 +0000 (14:36 +0100)]
Rollup merge of #65953 - keystone-enclave:llvm_abiname, r=alexcrichton

Allow specifying LLVM's MCTargetOptions::ABIName in target specification files

This addresses #65024, as it allows RISC-V target specification files to set `"llvm-abiname": "lp64d"`.

Other languages (read: C) usually expose this codegen parameter under a compiler argument like `-mabi=<XYZ>`.

4 years agoRollup merge of #65948 - danielhenrymantilla:doc/maybe_uninit_ref_mut, r=RalfJung
Pietro Albini [Tue, 5 Nov 2019 13:36:55 +0000 (14:36 +0100)]
Rollup merge of #65948 - danielhenrymantilla:doc/maybe_uninit_ref_mut, r=RalfJung

Improve MaybeUninit::get_{ref,mut} documentation

As mentioned in https://github.com/rust-lang/rust/issues/63568#issuecomment-544106668, `MaybeUninit`'s `get_{ref,mut}` documentation is lacking, so this PR attempts to fix that.

That being said, and as @RalfJung mentions in that thread,

> In particular, we should clarify that all the UB rules for these methods equally apply when calling the raw ptr methods and creating a reference manually.

these other docs also need to be improved, which I can do in this PR ~~(hence the `[WIP]`)~~.

Finally, since all these documentations are related to clearly establishing when dealing with uninitialized memory which patterns are known to be sound and which patterns are currently UB (that is, until, if ever, the rules around references to unintialized integers get relaxed, this documentation will treat them as UB, and advise against such patterns (_e.g._, it is not possible to use uninitialized buffers with the `Read` API)), I think that adding even more examples to the main documentation of `MaybeUninit` inherent definition wouldn't hurt either.

___

  - [Rendered](http://dreamy-ritchie-99d637.netlify.com/core/mem/union.maybeuninit#method.get_ref)

4 years agoAuto merge of #66083 - RalfJung:miri-offset-from, r=oli-obk
bors [Tue, 5 Nov 2019 12:46:29 +0000 (12:46 +0000)]
Auto merge of #66083 - RalfJung:miri-offset-from, r=oli-obk

fix Miri offset_from

This is needed to make https://github.com/rust-lang/miri/pull/1032 pass.

4 years agoexpand comment explaining integer exception
Ralf Jung [Tue, 5 Nov 2019 09:41:19 +0000 (10:41 +0100)]
expand comment explaining integer exception

4 years agoAuto merge of #66109 - pietroalbini:rollup-2npidna, r=pietroalbini
bors [Tue, 5 Nov 2019 09:31:36 +0000 (09:31 +0000)]
Auto merge of #66109 - pietroalbini:rollup-2npidna, r=pietroalbini

Rollup of 10 pull requests

Successful merges:

 - #65136 (Update codegen option documentation.)
 - #65574 (docs: improve disclaimer regarding LinkedList)
 - #65720 (Add FFI bindings for LLVM's Module::getInstructionCount())
 - #65905 ([doc] fixes for unix/vxworks `OpenOptionsExt::mode`)
 - #65962 (Fix logic in example.)
 - #66019 (Improved std::iter::Chain documentation)
 - #66038 (doc(str): show example of chars().count() under len())
 - #66042 (Suggest correct code when encountering an incorrect trait bound referencing the current trait)
 - #66073 (Do not needlessly write-lock)
 - #66096 (Add a failing UI test for multiple loops of all kinds in a `const`)

Failed merges:

r? @ghost

4 years agoRollup merge of #66096 - ecstatic-morse:const-loop-test, r=Centril
Pietro Albini [Tue, 5 Nov 2019 08:50:00 +0000 (09:50 +0100)]
Rollup merge of #66096 - ecstatic-morse:const-loop-test, r=Centril

Add a failing UI test for multiple loops of all kinds in a `const`

This simply demonstrates the current behavior and ensures we don't allow anything by accident.

The new const checker will be able to improve the diagnostics here. While working on it, I didn't see very many tests with non-`while` loops in a `const`, and there were no tests with multiple loops.

4 years agoRollup merge of #66073 - Mark-Simulacrum:no-borrow-mut, r=Centril
Pietro Albini [Tue, 5 Nov 2019 08:49:59 +0000 (09:49 +0100)]
Rollup merge of #66073 - Mark-Simulacrum:no-borrow-mut, r=Centril

Do not needlessly write-lock

Just removes a needless `borrow_mut()` by using `borrow()` instead.

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 #65938 - eddyb:fn-abi-rename, r=oli-obk
bors [Tue, 5 Nov 2019 05:47:31 +0000 (05:47 +0000)]
Auto merge of #65938 - eddyb:fn-abi-rename, r=oli-obk

rustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.

I was trying to tweak the API of `FnType` (now `FnAbi`) and the name kept bothering me.

`FnAbi` is to a function signature a bit like a layout is to a type, so the name still isn't perfect yet, but at least it doesn't have the misleading `Type` in it anymore.

If this can't land I think I can continue my original refactor without it, so I'm not strongly attached to it.

r? @nagisa cc @oli-obk

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 agoDetect `::` -> `:` typo when involving turbofish
Esteban Küber [Tue, 5 Nov 2019 00:19:55 +0000 (16:19 -0800)]
Detect `::` -> `:` typo when involving turbofish

4 years agoAdd tests for loop constructs in consts
Dylan MacKenzie [Mon, 4 Nov 2019 21:09:02 +0000 (13:09 -0800)]
Add tests for loop constructs in consts

These errors are suboptimal, but they will be fixed by the new
`check_consts` pass.

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 agoMinor style improvements
Daniel Henry-Mantilla [Sun, 3 Nov 2019 20:53:21 +0000 (21:53 +0100)]
Minor style improvements

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoImplemented the home_dir for VxWorks
Umesh Kalappa [Wed, 30 Oct 2019 08:38:32 +0000 (01:38 -0700)]
Implemented the home_dir for VxWorks

4 years agoalso test different integers
Ralf Jung [Mon, 4 Nov 2019 12:31:29 +0000 (13:31 +0100)]
also test different integers

4 years agotest offset_from with two integers
Ralf Jung [Mon, 4 Nov 2019 12:30:00 +0000 (13:30 +0100)]
test offset_from with two integers

4 years agoMiri: ptr_offset_from: support offset_from with twice the same non-null integer
Ralf Jung [Mon, 4 Nov 2019 12:24:27 +0000 (13:24 +0100)]
Miri: ptr_offset_from: support offset_from with twice the same non-null integer

4 years agoMiri: offset_from: do int-to-ptr casts when needed
Ralf Jung [Mon, 4 Nov 2019 12:07:36 +0000 (13:07 +0100)]
Miri: offset_from: do int-to-ptr casts when needed

4 years agoclean highlightSourceLines code
Guillaume Gomez [Mon, 4 Nov 2019 12:14:36 +0000 (13:14 +0100)]
clean highlightSourceLines code

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 agolet caller of check_ptr_access_align control the error message
Ralf Jung [Mon, 4 Nov 2019 11:28:13 +0000 (12:28 +0100)]
let caller of check_ptr_access_align control the error message

4 years agomore correct error msg
Ralf Jung [Mon, 4 Nov 2019 09:10:40 +0000 (10:10 +0100)]
more correct error msg

4 years agoavoid using nightly features
Ralf Jung [Mon, 4 Nov 2019 09:08:58 +0000 (10:08 +0100)]
avoid using nightly features

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 agouse silent emitter for rustdoc highlighting pass
Andy Russell [Sun, 3 Nov 2019 17:04:01 +0000 (12:04 -0500)]
use silent emitter for rustdoc highlighting pass

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 agoDo not needlessly write-lock
Mark Rousskov [Sun, 3 Nov 2019 21:52:27 +0000 (16:52 -0500)]
Do not needlessly write-lock

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 agosyntax: Avoid span arithmetics for delimiter tokens
Vadim Petrochenkov [Sun, 3 Nov 2019 11:58:01 +0000 (14:58 +0300)]
syntax: Avoid span arithmetics for delimiter tokens

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 agodon't fail manifest creation if the toolstate file is missing or mal-formed
Ralf Jung [Sun, 3 Nov 2019 10:55:05 +0000 (11:55 +0100)]
don't fail manifest creation if the toolstate file is missing or mal-formed

4 years agowhen Miri tests are not passing, do not add Miri component
Ralf Jung [Sun, 3 Nov 2019 10:47:07 +0000 (11:47 +0100)]
when Miri tests are not passing, do not add Miri component

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 agorustc_codegen_ssa: rename FnTypeLlvmExt to FnAbiLlvmExt.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 17:30:31 +0000 (19:30 +0200)]
rustc_codegen_ssa: rename FnTypeLlvmExt to FnAbiLlvmExt.

4 years agorustc_codegen_ssa: rename ArgTypeMethods to ArgAbiMethods.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 17:29:42 +0000 (19:29 +0200)]
rustc_codegen_ssa: rename ArgTypeMethods to ArgAbiMethods.

4 years agorustc: rename {Fn,Arg}TypeExt to {Fn,Arg}AbiExt.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 17:17:16 +0000 (19:17 +0200)]
rustc: rename {Fn,Arg}TypeExt to {Fn,Arg}AbiExt.

4 years agorustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.
Eduard-Mihai Burtescu [Tue, 29 Oct 2019 14:35:26 +0000 (16:35 +0200)]
rustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.

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 agoDon't double-count `simd_shuffle` promotion candidates
Dylan MacKenzie [Sat, 2 Nov 2019 18:23:16 +0000 (11:23 -0700)]
Don't double-count `simd_shuffle` promotion candidates

The proper attribute was added to `simd_shuffle*` in
rust-lang/stdarch#825. This caused `promote_consts` to double-count its
second argument when recording promotion candidates, which caused
the promotion candidate compatibility check to fail.

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.