]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoUpdate Cargo and its dependencies
Alex Crichton [Sun, 10 Dec 2017 17:42:49 +0000 (09:42 -0800)]
Update Cargo and its dependencies

Just a routine update!

6 years agoAuto merge of #46894 - detrumi:fix-const-eval-trait, r=eddyb
bors [Sun, 24 Dec 2017 12:48:57 +0000 (12:48 +0000)]
Auto merge of #46894 - detrumi:fix-const-eval-trait, r=eddyb

Const-eval array lengths in rustdoc.

Fixes #46727
r? @eddyb

Big thanks to @eddyb for helping me figure this out.

6 years agoAuto merge of #46859 - gereeter:uninhabited-unions, r=eddyb
bors [Sun, 24 Dec 2017 10:07:22 +0000 (10:07 +0000)]
Auto merge of #46859 - gereeter:uninhabited-unions, r=eddyb

Only mark unions as uninhabited if all of their fields are uninhabited

Fixes #46845.

6 years agoAuto merge of #46888 - cramertj:nested-impl-trait-error, r=nikomatsakis
bors [Sun, 24 Dec 2017 07:34:13 +0000 (07:34 +0000)]
Auto merge of #46888 - cramertj:nested-impl-trait-error, r=nikomatsakis

Add a feature gate for nested uses of `impl Trait`

This allows us to delay stabilization of nested `impl Trait` until we have a plan to solve the problem posed [here](https://github.com/rust-lang/rust/issues/34511#issuecomment-350715858).

r? @nikomatsakis

6 years agoAuto merge of #46833 - diwic:7c-abort-ffi, r=arielb1
bors [Sun, 24 Dec 2017 02:42:15 +0000 (02:42 +0000)]
Auto merge of #46833 - diwic:7c-abort-ffi, r=arielb1

Prevent unwinding past FFI boundaries

Second attempt to write a patch to solve this.

r? @nikomatsakis

~~So, my biggest issue with this patch is the way the patch determines *what* functions should have an abort landing pad (in `construct_fn`). I would ideally have this code match [src/librustc_trans/callee.rs::get_fn](https://github.com/rust-lang/rust/blob/master/src/librustc_trans/callee.rs#L107-L115) but couldn't find an id that returns true for `is_foreign_item`. Also tried `tcx.has_attr("unwind")` with no luck.~~ FIXED

Other issues:

 * llvm.trap is an SIGILL on amd64. Ideally we could use panic-abort's version of aborting which is nicer but we don't want to depend on that library...

 * ~~Mir inlining is a stub currently.~~ FIXED (no-op)

Also, when reviewing please take into account that I'm new to the code and only partially know what I'm doing... and that I've mostly made made matches on `TerminatorKind::Abort` match either `TerminatorKind::Resume` or `TerminatorKind::Unreachable` based on what looked best.

6 years agoRemove unnecessary assert that unions have only one variant
Jonathan S [Sun, 24 Dec 2017 02:38:36 +0000 (20:38 -0600)]
Remove unnecessary assert that unions have only one variant

6 years agoAuto merge of #46881 - michaelwoerister:ensure-coherence, r=nikomatsakis
bors [Sat, 23 Dec 2017 23:06:13 +0000 (23:06 +0000)]
Auto merge of #46881 - michaelwoerister:ensure-coherence, r=nikomatsakis

incr.comp.: Cache check_match and use ensure() for coherence-related queries.

Some minor optimizations.

r? @nikomatsakis

6 years agoTestcase for const-eval array lengths
Wilco Kusee [Sat, 23 Dec 2017 10:16:03 +0000 (11:16 +0100)]
Testcase for const-eval array lengths

6 years agoAuto merge of #46864 - estebank:closure-type-err-sp, r=nikomatsakis
bors [Sat, 23 Dec 2017 04:40:39 +0000 (04:40 +0000)]
Auto merge of #46864 - estebank:closure-type-err-sp, r=nikomatsakis

Closure type error ui tweak

Do not point at the same span on all notes/help messages, and instead
show them without a span.

6 years agoAuto merge of #46857 - estebank:use-loop-sp, r=nikomatsakis
bors [Sat, 23 Dec 2017 02:08:27 +0000 (02:08 +0000)]
Auto merge of #46857 - estebank:use-loop-sp, r=nikomatsakis

Point at `while true` span instead of entire block

6 years agoAuto merge of #46842 - michaelwoerister:fingerprint-vec, r=nikomatsakis
bors [Fri, 22 Dec 2017 23:34:29 +0000 (23:34 +0000)]
Auto merge of #46842 - michaelwoerister:fingerprint-vec, r=nikomatsakis

incr.comp.: Use an array instead of a hashmap for storing result hashes.

Doing so should result in some of the core tracking components being faster.

r? @nikomatsakis

6 years agoAuto merge of #46838 - pnkfelix:issue-46112-followup, r=estebank
bors [Fri, 22 Dec 2017 16:02:31 +0000 (16:02 +0000)]
Auto merge of #46838 - pnkfelix:issue-46112-followup, r=estebank

Followup for #46112.

Sorting by crate-num should ensure that we favor `std::foo::bar` over
`any_other_crate::foo::bar`.

Interestingly, *this* change had a much larger impact on our internal
test suite than PR #46708 (which was my original fix to #46112).

6 years agoAuto merge of #46779 - Zoxc:par-merge-without-sync, r=arielb1
bors [Fri, 22 Dec 2017 12:34:45 +0000 (12:34 +0000)]
Auto merge of #46779 - Zoxc:par-merge-without-sync, r=arielb1

Work towards thread safety in rustc

This PR is split out from https://github.com/rust-lang/rust/pull/45912. It contains changes which do not require the `sync` module.

6 years agoAuto merge of #46752 - Yoric:nll, r=arielb1
bors [Fri, 22 Dec 2017 09:54:21 +0000 (09:54 +0000)]
Auto merge of #46752 - Yoric:nll, r=arielb1

Issue #46589 - Kill borrows on a local variable whenever we assign ov…

…er this variable

This is a first patch for the issue, handling the simple case while I figure out the data structures involved in the more complex cases.

6 years agoAuto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkov
bors [Fri, 22 Dec 2017 07:22:33 +0000 (07:22 +0000)]
Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkov

Do not emit type errors on recovered blocks

When a parse error occurs on a block, the parser will recover and create
a block with the statements collected until that point. Now a flag
stating that a recovery has been performed in this block is propagated
so that the type checker knows that the type of the block (which will be
identified as `()`) shouldn't be checked against the expectation to
reduce the amount of irrelevant diagnostic errors shown to the user.

Fix #44579.

6 years agoMark clippy as broken
Esteban Küber [Thu, 21 Dec 2017 23:09:26 +0000 (15:09 -0800)]
Mark clippy as broken

6 years agoAuto merge of #46922 - kennytm:rollup, r=kennytm
bors [Thu, 21 Dec 2017 23:01:27 +0000 (23:01 +0000)]
Auto merge of #46922 - kennytm:rollup, r=kennytm

Rollup of 14 pull requests

- Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918
- Failed merges:

6 years agoDo not emit type errors on recovered blocks
Esteban Küber [Thu, 14 Dec 2017 07:05:49 +0000 (23:05 -0800)]
Do not emit type errors on recovered blocks

When a parse error occurs on a block, the parser will recover and create
a block with the statements collected until that point. Now a flag
stating that a recovery has been performed in this block is propagated
so that the type checker knows that the type of the block (which will be
identified as `()`) shouldn't be checked against the expectation to
reduce the amount of irrelevant diagnostic errors shown to the user.

6 years agoRollup merge of #46918 - alexcrichton:fix-ordering, r=michaelwoerister
kennytm [Thu, 21 Dec 2017 18:50:59 +0000 (02:50 +0800)]
Rollup merge of #46918 - alexcrichton:fix-ordering, r=michaelwoerister

rustc: Sort CGUs before merging

This commit fixes some nondeterminism in compilation when using multiple codegen
units. The algorithm for splitting codegen units currently takes the
otherwise-would-be-for-incremental partitioning and then continuously merges the
two smallest codegen units until the desired number of codegen units are
reached.

We want to be sure to merge the same codegen units each time a compilation is
run but there's some subtle reorderings amongst all the items which was causing
this step to be slightly buggy. Notably this step involves sorting codegen units
by size, but if two codegen units had the same size they would appear in
different locations in the list each time.

This commit fixes this issue by sorting codegen units by name before doing the
loop to merge the two smallest. This means that we've got a deterministic
order going in and since we're using a stable sort this should mean that we're
always now getting a deterministic merging of codegen units.

Closes #46846

6 years agoAuto merge of #45930 - jplatte:generics_refactoring, r=eddyb
bors [Thu, 21 Dec 2017 20:12:13 +0000 (20:12 +0000)]
Auto merge of #45930 - jplatte:generics_refactoring, r=eddyb

Generics refactoring (groundwork for const generics)

These changes were suggested by @eddyb.

After this change, the `Generics` contain one `Vec` of an enum for the generic parameters, rather than two separate `Vec`s for lifetime and type parameters. Type params and const params will need to be in a shared `Vec` to preserve their ordering, and moving lifetimes into the same `Vec` should simplify the code that processes `Generics`.

6 years agoRollup merge of #46898 - tspiteri:int-overflow-not-underflow, r=steveklabnik
kennytm [Thu, 21 Dec 2017 18:50:57 +0000 (02:50 +0800)]
Rollup merge of #46898 - tspiteri:int-overflow-not-underflow, r=steveklabnik

docs: do not call integer overflows as underflows

In the API docs, integer overflow is sometimes called underflow. Underflow is really when the magnitude of a floating-point number is too small so the number underflows to subnormal or zero. With integers it is always overflow, even if the expected result is less than the minimum number that can be represented.

6 years agoRollup merge of #46890 - arielb1:contributing-improvements, r=steveklabnik
kennytm [Thu, 21 Dec 2017 18:50:56 +0000 (02:50 +0800)]
Rollup merge of #46890 - arielb1:contributing-improvements, r=steveklabnik

A few small improvements to the contributing docs

r? @steveklabnik

6 years agoRollup merge of #46884 - Manishearth:vec-docs, r=steveklabnik
kennytm [Thu, 21 Dec 2017 18:50:55 +0000 (02:50 +0800)]
Rollup merge of #46884 - Manishearth:vec-docs, r=steveklabnik

Clarify vec docs on deallocation (fixes #46879)

r? @steveklabnik

6 years agoRollup merge of #46878 - malbarbo:fix-armv5te, r=alexcrichton
kennytm [Thu, 21 Dec 2017 18:50:54 +0000 (02:50 +0800)]
Rollup merge of #46878 - malbarbo:fix-armv5te, r=alexcrichton

Update compiler_builtins

Fixes https://github.com/rust-lang/rust/issues/46822 (See https://github.com/rust-lang-nursery/compiler-builtins/pull/218)

6 years agoRollup merge of #46858 - QuietMisdreavus:external-doc-error, r=estebank
kennytm [Thu, 21 Dec 2017 18:50:53 +0000 (02:50 +0800)]
Rollup merge of #46858 - QuietMisdreavus:external-doc-error, r=estebank

tweaks and fixes for doc(include)

This PR makes a handful of changes around `#[doc(include="file.md")]` (https://github.com/rust-lang/rust/issues/44732):

* Turns errors when loading files into full errors. This matches the original RFC text.
* Makes the `missing_docs` lint check for `#[doc(include="file.md")]` as well as regular `#[doc="text"]` attributes.
* Loads files included by `#[doc(include="file.md")]` into dep-info, mirroring the behavior of `include_str!()` and friends.
* Adds or modifies tests to check for all of these.

6 years agoRollup merge of #46847 - GuillaumeGomez:more-sidebar-escape, r=QuietMisdreavus
kennytm [Thu, 21 Dec 2017 18:50:52 +0000 (02:50 +0800)]
Rollup merge of #46847 - GuillaumeGomez:more-sidebar-escape, r=QuietMisdreavus

Escape more items in the sidebar when needed

Fixes #46724.

r? @QuietMisdreavus

6 years agoRollup merge of #46839 - michaelwoerister:faster-span-hashing-2, r=nikomatsakis
kennytm [Thu, 21 Dec 2017 18:50:51 +0000 (02:50 +0800)]
Rollup merge of #46839 - michaelwoerister:faster-span-hashing-2, r=nikomatsakis

incr.comp.: Precompute small hash for filenames to save some work.

For each span we hash the filename of the file it points to. Since filenames can be quite long, especially with absolute paths, this PR pre-computes a hash of the filename and we then only hash the hash.

r? @nikomatsakis

6 years agoRollup merge of #46820 - nodakai:simplify-int-impl, r=alexcrichton
kennytm [Thu, 21 Dec 2017 18:50:50 +0000 (02:50 +0800)]
Rollup merge of #46820 - nodakai:simplify-int-impl, r=alexcrichton

libcore/num/mod.rs: simplify the int_impl! macro.

We can simply use generic intrinsics since cd1848a1a6 by @alexcrichton

Also, minimize unsafe blocks.

6 years agoRollup merge of #46814 - varkor:contrib-7, r=alexcrichton
kennytm [Thu, 21 Dec 2017 18:50:49 +0000 (02:50 +0800)]
Rollup merge of #46814 - varkor:contrib-7, r=alexcrichton

Prevent rustc overwriting input files

If rustc is invoked on a file that would be overwritten by the
compilation, the compilation now fails, to avoid accidental loss. This
resolves #13019. Kudos to @estebank, whose patch I finished off.

6 years agoRollup merge of #46809 - eddyb:issue-46769-optimal, r=arielb1
kennytm [Thu, 21 Dec 2017 18:50:49 +0000 (02:50 +0800)]
Rollup merge of #46809 - eddyb:issue-46769-optimal, r=arielb1

 rustc: do not raise the alignment of optimized enums to the niche's alignment.

This is the improved fix for #46769 that does not increase the size of any types (see also #46808).

6 years agoRollup merge of #46784 - bjorn3:patch-1, r=pnkfelix
kennytm [Thu, 21 Dec 2017 18:50:48 +0000 (02:50 +0800)]
Rollup merge of #46784 - bjorn3:patch-1, r=pnkfelix

Cleanup for libgraphviz

6 years agoRollup merge of #46780 - varkor:contrib-5, r=arielb1
kennytm [Thu, 21 Dec 2017 18:50:47 +0000 (02:50 +0800)]
Rollup merge of #46780 - varkor:contrib-5, r=arielb1

Fix ICE when calling non-functions within closures

The visitor for walking function bodies did not previously properly
handle error-cases for function calls. These are now ignored,
preventing the panic. This fixes #46771.

6 years agoRollup merge of #46636 - frewsxcv:frewsxcv-fn-box, r=estebank
kennytm [Thu, 21 Dec 2017 18:50:45 +0000 (02:50 +0800)]
Rollup merge of #46636 - frewsxcv:frewsxcv-fn-box, r=estebank

Replace libtest/lib.rs:FnBox with std::boxed::FnBox.

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

6 years agoMir: fixup nits in previous commit (f536143)
David Henningsson [Thu, 21 Dec 2017 18:32:26 +0000 (19:32 +0100)]
Mir: fixup nits in previous commit (f536143)

As suggested by arielb1.

Closes rust-lang/rust#18510

Signed-off-by: David Henningsson <diwic@ubuntu.com>
6 years agoAdd Encodable and Decodable impls for Arc<[T]>
John Kåre Alsaker [Sun, 3 Dec 2017 13:31:27 +0000 (14:31 +0100)]
Add Encodable and Decodable impls for Arc<[T]>

6 years agoRemove useless Rc
John Kåre Alsaker [Sun, 3 Dec 2017 13:25:09 +0000 (14:25 +0100)]
Remove useless Rc

6 years agoMake IndexVec implement Send and Sync
John Kåre Alsaker [Sun, 3 Dec 2017 13:22:23 +0000 (14:22 +0100)]
Make IndexVec implement Send and Sync

6 years agoAdd a -Z query-threads compiler option
John Kåre Alsaker [Sun, 3 Dec 2017 13:16:19 +0000 (14:16 +0100)]
Add a -Z query-threads compiler option

6 years agoRefactor code so the call to codemap.files() does not deadlock
John Kåre Alsaker [Sun, 3 Dec 2017 13:08:21 +0000 (14:08 +0100)]
Refactor code so the call to codemap.files() does not deadlock

6 years agoMake err_count thread safe
John Kåre Alsaker [Sun, 3 Dec 2017 13:04:51 +0000 (14:04 +0100)]
Make err_count thread safe

6 years agoMake mk_attr_id thread safe
John Kåre Alsaker [Sun, 3 Dec 2017 13:03:28 +0000 (14:03 +0100)]
Make mk_attr_id thread safe

6 years agoCombine GlobalArenas and DroplessArena into AllArenas
John Kåre Alsaker [Sun, 3 Dec 2017 12:57:25 +0000 (13:57 +0100)]
Combine GlobalArenas and DroplessArena into AllArenas

6 years agoIssue #46589 - Kill borrows on a local variable whenever we assign over this variable
David Teller [Fri, 15 Dec 2017 20:27:06 +0000 (14:27 -0600)]
Issue #46589 - Kill borrows on a local variable whenever we assign over this variable

6 years agoAdd a feature gate for nested uses of `impl Trait`
Taylor Cramer [Wed, 20 Dec 2017 18:18:37 +0000 (10:18 -0800)]
Add a feature gate for nested uses of `impl Trait`

6 years agorustc: Sort CGUs before merging
Alex Crichton [Thu, 21 Dec 2017 17:00:55 +0000 (09:00 -0800)]
rustc: Sort CGUs before merging

This commit fixes some nondeterminism in compilation when using multiple codegen
units. The algorithm for splitting codegen units currently takes the
otherwise-would-be-for-incremental partitioning and then continuously merges the
two smallest codegen units until the desired number of codegen units are
reached.

We want to be sure to merge the same codegen units each time a compilation is
run but there's some subtle reorderings amongst all the items which was causing
this step to be slightly buggy. Notably this step involves sorting codegen units
by size, but if two codegen units had the same size they would appear in
different locations in the list each time.

This commit fixes this issue by sorting codegen units by name before doing the
loop to merge the two smallest. This means that we've got a deterministic
order going in and since we're using a stable sort this should mean that we're
always now getting a deterministic merging of codegen units.

Closes #46846

6 years agoAuto merge of #46877 - Deewiant:gh46843, r=eddyb
bors [Thu, 21 Dec 2017 16:15:16 +0000 (16:15 +0000)]
Auto merge of #46877 - Deewiant:gh46843, r=eddyb

MIR: terminate unreachable blocks in construct_const

Fixes #46843.

#45821 added unreachable blocks in matches, which were terminated in
construct_fn but not in construct_const, causing a panic due to "no
terminator on block" when constants involved matching on enums.

The "unimplemented expression type" error may go away in the future, the
key is that we see the E0015 about using a non-const function and then
don't ICE.

6 years agoAuto merge of #46904 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 21 Dec 2017 13:34:09 +0000 (13:34 +0000)]
Auto merge of #46904 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #46827, #46853, #46860, #46861, #46887
- Failed merges:

6 years agoAdd GenericParam, refactor Generics in ast, hir, rustdoc
Jonas Platte [Mon, 16 Oct 2017 19:07:26 +0000 (21:07 +0200)]
Add GenericParam, refactor Generics in ast, hir, rustdoc

The Generics now contain one Vec of an enum for the generic parameters,
rather than two separate Vec's for lifetime and type parameters.

Additionally, places that previously used Vec<LifetimeDef> now use
Vec<GenericParam> instead.

6 years agoRollup merge of #46887 - pnkfelix:ensure-activations-are-from-assignments-to-locals...
Guillaume Gomez [Thu, 21 Dec 2017 12:18:21 +0000 (13:18 +0100)]
Rollup merge of #46887 - pnkfelix:ensure-activations-are-from-assignments-to-locals, r=arielb1

Ensure separate activations only occur for assignments to locals

Ensure separate activations only occur for assignments to locals, not projections.

Fix #46746.

(I didn't make a regression test because we do not really have a good way to directly express the case that we are trying to catch, because we cannot write MIR directly.)

6 years agoRollup merge of #46861 - GuillaumeGomez:fix-ios-sidebar, r=QuietMisdreavus
Guillaume Gomez [Thu, 21 Dec 2017 12:18:21 +0000 (13:18 +0100)]
Rollup merge of #46861 - GuillaumeGomez:fix-ios-sidebar, r=QuietMisdreavus

Fix sidebar on ios

r? @QuietMisdreavus

6 years agoRollup merge of #46860 - estebank:candidate-def-sp, r=petrochenkov
Guillaume Gomez [Thu, 21 Dec 2017 12:18:20 +0000 (13:18 +0100)]
Rollup merge of #46860 - estebank:candidate-def-sp, r=petrochenkov

Use def span for associated function suggestions

6 years agoRollup merge of #46853 - GuillaumeGomez:fix-rustdoc-warning, r=QuietMisdreavus
Guillaume Gomez [Thu, 21 Dec 2017 12:18:19 +0000 (13:18 +0100)]
Rollup merge of #46853 - GuillaumeGomez:fix-rustdoc-warning, r=QuietMisdreavus

Fix some rustdoc warnings

r? @QuietMisdreavus

cc @steveklabnik

6 years agoRollup merge of #46827 - petrochenkov:assocrecov2, r=estebank
Guillaume Gomez [Thu, 21 Dec 2017 12:18:18 +0000 (13:18 +0100)]
Rollup merge of #46827 - petrochenkov:assocrecov2, r=estebank

syntax: Follow-up to the incorrect qpath recovery PR

cc https://github.com/rust-lang/rust/pull/46788

Add tests checking that "priority" of qpath recovery is higher than priority of unary and binary operators
Fix regressed parsing of paths with fn-like generic arguments
r? @estebank

6 years agoEscape more items in the sidebar when needed
Guillaume Gomez [Tue, 19 Dec 2017 20:07:19 +0000 (21:07 +0100)]
Escape more items in the sidebar when needed

6 years agoAuto merge of #46772 - alexcrichton:thinlto-passes, r=michaelwoerister
bors [Thu, 21 Dec 2017 10:56:44 +0000 (10:56 +0000)]
Auto merge of #46772 - alexcrichton:thinlto-passes, r=michaelwoerister

rustc: Work around `DICompileUnit` bugs in LLVM

This commit implements a workaround for #46346 which basically just
avoids triggering the situation that LLVM's bug
https://bugs.llvm.org/show_bug.cgi?id=35562 arises. More details can be
found in the code itself but this commit is also intended to ...

Closes #46346

6 years agoAuto merge of #46754 - cramertj:refactor-arg-impl, r=nikomatsakis
bors [Thu, 21 Dec 2017 08:04:57 +0000 (08:04 +0000)]
Auto merge of #46754 - cramertj:refactor-arg-impl, r=nikomatsakis

Refactor argument-position impl Trait

Fixes https://github.com/rust-lang/rust/issues/46685, https://github.com/rust-lang/rust/issues/46470

r? @nikomatsakis
cc @chrisvittal

6 years agoAuto merge of #46531 - cramertj:no-mo-modrs, r=nikomatsakis
bors [Thu, 21 Dec 2017 05:24:45 +0000 (05:24 +0000)]
Auto merge of #46531 - cramertj:no-mo-modrs, r=nikomatsakis

Implement non-mod.rs mod statements

Fixes https://github.com/rust-lang/rust/issues/45385, cc https://github.com/rust-lang/rust/issues/44660

This will fail tidy right now because it doesn't recognize my UI tests as feature-gate tests. However, I'm not sure if compile-fail will work out either because compile-fail usually requires there to be error patterns in the top-level file, which isn't possible with this feature. What's the recommended way to handle this?

6 years agoMir: Abort on nounwind ABIs
David Henningsson [Tue, 19 Dec 2017 00:59:29 +0000 (01:59 +0100)]
Mir: Abort on nounwind ABIs

Generate Abort instead of Resume terminators on nounwind ABIs.

https://github.com/rust-lang/rust/issues/18510

Signed-off-by: David Henningsson <diwic@ubuntu.com>
6 years agoMir: Add Terminatorkind::Abort
David Henningsson [Tue, 19 Dec 2017 00:17:16 +0000 (01:17 +0100)]
Mir: Add Terminatorkind::Abort

The Abort Terminatorkind will cause an llvm.trap function call to be
emitted.

Signed-off-by: David Henningsson <diwic@ubuntu.com>
6 years agoAuto merge of #46083 - petrochenkov:morepriv, r=nikomatsakis
bors [Thu, 21 Dec 2017 02:48:17 +0000 (02:48 +0000)]
Auto merge of #46083 - petrochenkov:morepriv, r=nikomatsakis

Type privacy polishing

Various preparations before implementing https://github.com/rust-lang/rfcs/pull/2145 containing final minor breaking changes (mostly for unstable code or code using `allow(private_in_public)`).
(Continuation of https://github.com/rust-lang/rust/pull/42125, https://github.com/rust-lang/rust/pull/44633 and https://github.com/rust-lang/rust/pull/41332.)

It would be good to run crater on this.
r? @eddyb

6 years agodocs: do not call integer overflows as underflows
Trevor Spiteri [Thu, 21 Dec 2017 01:39:01 +0000 (02:39 +0100)]
docs: do not call integer overflows as underflows

6 years agoNever mark unions as uninhabited. Although I think this is wrong, it is certainly...
Jonathan S [Thu, 21 Dec 2017 01:36:41 +0000 (19:36 -0600)]
Never mark unions as uninhabited. Although I think this is wrong, it is certainly sound, and the general consensus seems to value not having footguns over some sort of aesthetic consistency.

6 years agoAlways report private-in-public in associated types as hard errors
Vadim Petrochenkov [Sat, 18 Nov 2017 17:32:24 +0000 (20:32 +0300)]
Always report private-in-public in associated types as hard errors

according to RFC 2145.

Fix a silly label message.

6 years agoProhibit access to private statics from other crates through macros 2.0
Vadim Petrochenkov [Sat, 18 Nov 2017 16:15:16 +0000 (19:15 +0300)]
Prohibit access to private statics from other crates through macros 2.0

6 years agoProperly check traits in type privacy
Vadim Petrochenkov [Sat, 18 Nov 2017 15:49:37 +0000 (18:49 +0300)]
Properly check traits in type privacy

6 years agoCheck associated type bindings for privacy and stability
Vadim Petrochenkov [Sat, 18 Nov 2017 15:38:56 +0000 (18:38 +0300)]
Check associated type bindings for privacy and stability

6 years agoAdd tests for associated item privacy
Vadim Petrochenkov [Sat, 23 Sep 2017 17:48:08 +0000 (20:48 +0300)]
Add tests for associated item privacy

6 years agoAuto merge of #46862 - nikomatsakis:nll-master, r=arielb1
bors [Wed, 20 Dec 2017 23:26:20 +0000 (23:26 +0000)]
Auto merge of #46862 - nikomatsakis:nll-master, r=arielb1

NLL feature complete (adds `feature(nll)`)!

This is the final PR for the nll-master branch; it brings over all remaining content.

The contents of the branch include:

- track causal information and use it to report extended errors
- handle `impl Trait` in NLL code
- improve printing of outlives errors
- add `#![feature(nll)]` and some more sample tests

The commits should for the most part build independently.

r? @pnkfelix (and/or @arielb1)

6 years agoConst-eval TyArray trait implementors
Wilco Kusee [Wed, 20 Dec 2017 22:13:15 +0000 (23:13 +0100)]
Const-eval TyArray trait implementors

6 years agofix truncated comment
Niko Matsakis [Wed, 20 Dec 2017 21:51:33 +0000 (16:51 -0500)]
fix truncated comment

6 years agoimprove comment about instantiating anon types
Niko Matsakis [Wed, 20 Dec 2017 21:48:41 +0000 (16:48 -0500)]
improve comment about instantiating anon types

6 years agoA few small improvements to the contributing docs
Ariel Ben-Yehuda [Wed, 20 Dec 2017 19:22:32 +0000 (21:22 +0200)]
A few small improvements to the contributing docs

6 years agoFix parsing of paths with fn-like generic arguments
Vadim Petrochenkov [Mon, 18 Dec 2017 20:59:31 +0000 (23:59 +0300)]
Fix parsing of paths with fn-like generic arguments

6 years agoAdd tests checking taht "priority" of qpath recovery is higher than unary and binary...
Vadim Petrochenkov [Mon, 18 Dec 2017 20:42:58 +0000 (23:42 +0300)]
Add tests checking taht "priority" of qpath recovery is higher than unary and binary operators

6 years agoMove impls for qpath recovery trait from `ast.rs`
Vadim Petrochenkov [Mon, 18 Dec 2017 20:26:59 +0000 (23:26 +0300)]
Move impls for qpath recovery trait from `ast.rs`

6 years agoconvert region-liveness-drop{-,-no-}may-dangle.rs into ui tests
Niko Matsakis [Wed, 20 Dec 2017 16:20:07 +0000 (11:20 -0500)]
convert region-liveness-drop{-,-no-}may-dangle.rs into ui tests

The "match exact bits of CFG" approach was fragile and uninformative.

6 years agoadd some run-pass tests for NLL showing that things work as expected
Niko Matsakis [Thu, 7 Dec 2017 22:38:15 +0000 (17:38 -0500)]
add some run-pass tests for NLL showing that things work as expected

6 years agowhen using feature(nll), don't warn about AST-based region errors
Niko Matsakis [Wed, 20 Dec 2017 09:54:35 +0000 (04:54 -0500)]
when using feature(nll), don't warn about AST-based region errors

Also, keep reporting AST-based region errors that are not occuring in
a fn body.

6 years agodocument and tweak the nll, use_mir, etc helpers
Niko Matsakis [Wed, 20 Dec 2017 09:26:54 +0000 (04:26 -0500)]
document and tweak the nll, use_mir, etc helpers

In particular, -Znll might as well imply -Zborrowck=mir by default,
just like `#![feature(nll)]` does.

Also, if NLL is in use, no reason to emit end regions. The NLL pass
just strips them out anyway.

6 years agofeature nll implies borrowck=mir
Santiago Pastorino [Tue, 19 Dec 2017 18:47:59 +0000 (15:47 -0300)]
feature nll implies borrowck=mir

6 years agofeature nll implies two-phase-borrows
Santiago Pastorino [Tue, 19 Dec 2017 18:28:13 +0000 (15:28 -0300)]
feature nll implies two-phase-borrows

6 years agoAdd nll feature and make nll imply nll_dump_cause
Santiago Pastorino [Tue, 19 Dec 2017 18:10:07 +0000 (15:10 -0300)]
Add nll feature and make nll imply nll_dump_cause

6 years agoAdd nll_dump_cause helper to Session
Santiago Pastorino [Tue, 19 Dec 2017 18:08:40 +0000 (15:08 -0300)]
Add nll_dump_cause helper to Session

6 years agouse `report_generic_bound_failure` when we can in the compiler
Niko Matsakis [Tue, 19 Dec 2017 16:12:56 +0000 (11:12 -0500)]
use `report_generic_bound_failure` when we can in the compiler

6 years agorefactor `report_generic_bound_failure` to be usable by NLL code
Niko Matsakis [Tue, 19 Dec 2017 16:10:53 +0000 (11:10 -0500)]
refactor `report_generic_bound_failure` to be usable by NLL code

6 years agoconnect NLL machinery to the `NiceRegionError` code
Niko Matsakis [Tue, 12 Dec 2017 14:06:35 +0000 (09:06 -0500)]
connect NLL machinery to the `NiceRegionError` code

6 years agogive precedence to `try_report_named_anon_conflict` method
Niko Matsakis [Tue, 12 Dec 2017 14:05:54 +0000 (09:05 -0500)]
give precedence to `try_report_named_anon_conflict` method

6 years agouse `Option<ErrorReported>` instead of `bool`
Niko Matsakis [Tue, 12 Dec 2017 13:39:20 +0000 (08:39 -0500)]
use `Option<ErrorReported>` instead of `bool`

Also allows us to replace `or_false` with `?`.

No functional change

6 years agointroduce a `NiceRegionError` type and define methods on that
Niko Matsakis [Tue, 12 Dec 2017 13:31:38 +0000 (08:31 -0500)]
introduce a `NiceRegionError` type and define methods on that

This is more convenient, and allows us to be more independent from
infcx, particularly with respect to `in_progress_tables` field.

No functional change.

6 years agonice_region_error: rustfmt
Niko Matsakis [Tue, 12 Dec 2017 13:04:29 +0000 (08:04 -0500)]
nice_region_error: rustfmt

6 years agoextract `find_anon_type` into its own module
Niko Matsakis [Tue, 12 Dec 2017 12:57:23 +0000 (07:57 -0500)]
extract `find_anon_type` into its own module

6 years agomake `util` fns private to nice_region_error
Niko Matsakis [Tue, 12 Dec 2017 12:54:45 +0000 (07:54 -0500)]
make `util` fns private to nice_region_error

6 years agomove nice-region-error reporting into its own module
Niko Matsakis [Tue, 12 Dec 2017 12:52:25 +0000 (07:52 -0500)]
move nice-region-error reporting into its own module

6 years agoonly dump causes if we have nothing better
Niko Matsakis [Thu, 14 Dec 2017 20:01:05 +0000 (15:01 -0500)]
only dump causes if we have nothing better

6 years agoAdd three point error handling to borrowck
Santiago Pastorino [Tue, 12 Dec 2017 20:29:37 +0000 (17:29 -0300)]
Add three point error handling to borrowck

Closes #45988

6 years agoMove categorize logic out of visit_local function
Niko Matsakis [Wed, 20 Dec 2017 19:36:56 +0000 (14:36 -0500)]
Move categorize logic out of visit_local function

6 years agoMove MirVisitable to visit.rs
Santiago Pastorino [Tue, 12 Dec 2017 14:59:09 +0000 (11:59 -0300)]
Move MirVisitable to visit.rs

6 years agoconnect NLL type checker to the impl trait code
Niko Matsakis [Sun, 10 Dec 2017 15:23:45 +0000 (10:23 -0500)]
connect NLL type checker to the impl trait code

We now add the suitable `impl Trait` constraints.

6 years agoextract `input_output` code into its own module
Niko Matsakis [Sun, 10 Dec 2017 14:56:13 +0000 (09:56 -0500)]
extract `input_output` code into its own module

No functional change.

6 years agopass `UniversalRegions` to MIR type-checker instead of fields
Niko Matsakis [Sun, 10 Dec 2017 14:55:43 +0000 (09:55 -0500)]
pass `UniversalRegions` to MIR type-checker instead of fields

No functional change.