Commit Graph

92239 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
ca9f04e41e
Rollup merge of #59862 - estebank:tweak-unstable-diag, r=petrochenkov
Tweak unstable diagnostic output
2019-04-12 20:36:15 +02:00
Mazdak Farrokhzad
2bc127dcc7
Rollup merge of #59859 - davidtwco:issue-59756, r=cramertj
Suggest removing `?` to resolve type errors.

Fixes #59756.
2019-04-12 20:36:13 +02:00
Mazdak Farrokhzad
8f111951a1
Rollup merge of #59847 - Kampfkarren:try-block-catch, r=estebank
Error when using `catch` after `try`

Part of https://github.com/rust-lang/rust/issues/31436
2019-04-12 20:36:11 +02:00
Mazdak Farrokhzad
29f9dd2364
Rollup merge of #59846 - euclio:not-a-module, r=davidtwco
clarify what the item is in "not a module" error

The motivation here was that I was trying to import an associated constant when I thought it was an enum variant, and got confused by this error.

Ideally I would like to add a note saying that associated constants, types, and methods cannot be imported, but I'm not sure that the associated items for a `Def` can be checked at resolve time.
2019-04-12 20:36:09 +02:00
Mazdak Farrokhzad
ed1dd1eb74
Rollup merge of #59820 - eddyb:proc-macro-rpc-opt, r=nnethercote
proc_macro: stop using LEB128 for RPC.

I'm not sure how much of an improvement this creates, it's pretty tricky to measure.
2019-04-12 20:36:07 +02:00
Mazdak Farrokhzad
1fb4837bb6
Rollup merge of #59781 - whitfin:issue-59378, r=oli-obk
Remove check_match from const_eval

This fixes #59378.

It seems that the `check_match` may be unnecessary, so this removes it per instructions provided in the issue. I re-ran the tests for `librustc_mir` and everything seemed fine!
2019-04-12 20:36:05 +02:00
Simon Sapin
fc928a18ba Stabilize the alloc crate.
This implements RFC 2480:

* https://github.com/rust-lang/rfcs/pull/2480
* https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md

Closes https://github.com/rust-lang/rust/issues/27783
2019-04-12 20:07:30 +02:00
Guillaume Gomez
4f28431e39 Apply resource-suffix to search-index and source-files scripts as well 2019-04-12 19:30:37 +02:00
bors
df25d79a33 Auto merge of #59733 - cramertj:wake-by-ref, r=withoutboats
Final (one can only hope) futures_api adjustments

Based on https://github.com/rust-lang/rust/pull/59119 -- this change is only the latter two commits.
cc https://github.com/rust-lang/rust/issues/59725

r? @withoutboats
2019-04-12 17:24:01 +00:00
Guillaume Gomez
796e6e37d6 Don't generate empty json variables 2019-04-12 19:17:46 +02:00
rchaser53
d01ac0d61e add the logic for when other_ty is FnDef 2019-04-12 23:57:06 +09:00
bors
9a612b2348 Auto merge of #59651 - tmandry:discr-index, r=eddyb
Add discr_index to multi-variant layouts

We remove the assumption that the discriminant is always field 0, in
preparations for layouts like generators where this is not (always) going to be
the case.

Specifically, upvars are going to go before the discriminant. In theory, it's possible to remove _that_ assumption instead and keep the discriminant at field index 0, but one assumption or the other had to go :)

There is one place I know of in the debuginfo code where we'll still need to remove assumptions that the discriminant is the _only_ field. I was planning on doing this along with the upcoming generator change, which will also include tests that exercise the code changing in this PR.

r? @eddyb
cc @oli-obk
cc @cramertj
2019-04-12 14:38:15 +00:00
Andrew Xu
98beb12706 Add a link to the licenses page 2019-04-12 22:14:21 +08:00
bors
5b96425699 Auto merge of #59910 - Centril:rollup-yjv7b06, r=Centril
Rollup of 15 pull requests

Successful merges:

 - #59680 (Document the -Z flag to the rustc book)
 - #59711 (Add back the substring test)
 - #59806 (compiletest: Improve no_prefer_dynamic docs)
 - #59809 (Make trait_methods_not_found use a lock)
 - #59811 (Kill dead code dominator code.)
 - #59814 (Fix broken links on std::boxed doc page)
 - #59821 (improve unknown enum variant errors)
 - #59831 (Remove strange formatting in `Ordering` docs.)
 - #59836 (std::ops::Div examples: correct nominator to numerator)
 - #59857 (SGX target: fix cfg(test) build)
 - #59876 (Update TRPL to use mdbook 0.2)
 - #59880 (Remove note about transmute for float bitpatterns.)
 - #59889 (Update diagnostics.rs)
 - #59891 (Fix the link to sort_by_cached_key)
 - #59894 (save-analysis: Pull associated type definition using `qpath_def`)

Failed merges:

r? @ghost
2019-04-12 11:46:01 +00:00
Ralf Jung
1ce6645d1f MaybeUninit: remove deprecated functions 2019-04-12 12:41:17 +02:00
Felix S. Klock II
633fc9eef0 Revert PR #59401 to fix issue #59652 (a stable-to-beta regression).
This is result of squashing two revert commits:

Revert "compile all crates under test w/ -Zemit-stack-sizes"

This reverts commit 7d365cf27f.

Revert "bootstrap: build compiler-builtins with -Z emit-stack-sizes"

This reverts commit 8b8488ce8f.
2019-04-12 12:30:41 +02:00
Mazdak Farrokhzad
7a8329f5da
Rollup merge of #59894 - Xanewok:save-assoc-ty-qpath, r=eddyb
save-analysis: Pull associated type definition using `qpath_def`

Closes https://github.com/rust-lang/rls/issues/1390

This (probably?) fixes the case where we run the save-analysis code on the following snippet:
```rust
trait Test<'a> {
    type Thing: Test2;
}

trait Test2 {
    fn print();
}

#[allow(unused)]
fn example<T>(t: T)
    where T: for<'a> Test<'a>
{
    T::Thing::print(); //~ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
    // ^ only errors in save-analysis mode
}
```

The chain is as follows:
- culprit is `hir_ty_to_ty`
- which calls `ast_ty_to_ty` in the `ItemCtxt`
- which calls `associated_path_to_ty`
- which finally fails on `projected_ty_from_poly_trait_ref`
3de0106789/src/librustc_typeck/collect.rs (L212-L224)

I'm not exactly sure why `hir_ty_to_ty` fails - is it because it needs more setup from typeck to work correctly? I'm guessing the fix is okay since we just pull the already typeck'd data (we run save-analysis after all the analysis passes are complete) from the tables.

With this change we can 'go to def' on all segments in the `T::Thing::print()` path.
2019-04-12 12:18:11 +02:00
Mazdak Farrokhzad
dddcd928dd
Rollup merge of #59891 - rust-lang:sort_by_cached_key, r=jonas-schievink
Fix the link to sort_by_cached_key

It's a primitive slice method, not a standalone function.
2019-04-12 12:18:09 +02:00
Mazdak Farrokhzad
cb7079fe72
Rollup merge of #59889 - andrewbanchich:minor-text-fixes, r=estebank
Update diagnostics.rs

Add `a` and other minor text improvements
2019-04-12 12:18:07 +02:00
Mazdak Farrokhzad
257dbb826d
Rollup merge of #59880 - solson:transmute-float, r=alexcrichton
Remove note about transmute for float bitpatterns.

This particular usecase has been safely abstracted in these `std` functions: [f32::to_bits](https://doc.rust-lang.org/std/primitive.f32.html#method.to_bits), [f32::from_bits](https://doc.rust-lang.org/std/primitive.f32.html#method.from_bits), [f64::to_bits](https://doc.rust-lang.org/std/primitive.f64.html#method.to_bits), [f64::from_bits](https://doc.rust-lang.org/std/primitive.f64.html#method.from_bits). So, I think we shouldn't recommend an unnecessary use of `unsafe` here anymore.
2019-04-12 12:18:05 +02:00
Mazdak Farrokhzad
ef90d940dc
Rollup merge of #59876 - integer32llc:update-trpl-to-mdbook-0.2, r=steveklabnik
Update TRPL to use mdbook 0.2

I ran linkchecker locally and it passed. Let's see if I did it correctly...
2019-04-12 12:18:02 +02:00
Mazdak Farrokhzad
c852cc5443
Rollup merge of #59857 - jethrogb:jb/sgx-test, r=Centril
SGX target: fix cfg(test) build
2019-04-12 12:18:01 +02:00
Mazdak Farrokhzad
740c9ea703
Rollup merge of #59836 - andersk:nominator, r=Centril
std::ops::Div examples: correct nominator to numerator
2019-04-12 12:17:59 +02:00
Mazdak Farrokhzad
94b7b6a604
Rollup merge of #59831 - ehuss:ordering-docs, r=kennytm
Remove strange formatting in `Ordering` docs.

I can't really fathom what the intent of the brackets is. The [original PR](#12956) doesn't give any hints. I think it seems fine without them.
2019-04-12 12:17:58 +02:00
Mazdak Farrokhzad
24ee611eac
Rollup merge of #59821 - euclio:unknown-enum-variants, r=davidtwco
improve unknown enum variant errors

Fixes #56517.
2019-04-12 12:17:56 +02:00
Mazdak Farrokhzad
484e703a0b
Rollup merge of #59814 - ollie27:dead_boxed_links, r=QuietMisdreavus
Fix broken links on std::boxed doc page

r? @QuietMisdreavus
2019-04-12 12:17:55 +02:00
Mazdak Farrokhzad
ba10b13e80
Rollup merge of #59811 - vext01:dead-dominator-code, r=oli-obk
Kill dead code dominator code.

Hi,

Whilst fiddling around in the dominator code, I found some (I think) unused code. This code *was* used at the time it was imported, but over time it seems to have become redundant.

I've tested a build up to stage 1 with no problems. Maybe the tests will turn up something though.

P.S.

There is a FIXME comment in `dominators/mod.rs`:
```
    pub fn is_dominated_by(&self, node: Node, dom: Node) -> bool {
        // FIXME -- could be optimized by using post-order-rank
        self.dominators(node).any(|n| n == dom)
    }
```

I'm not sure of the intention of this comment. The `Dominators` struct already operates over post-order rank nodes. Any ideas?
2019-04-12 12:17:54 +02:00
Mazdak Farrokhzad
f4c8cc9538
Rollup merge of #59809 - Zoxc:trait_methods_not_found, r=estebank
Make trait_methods_not_found use a lock

r? @estebank
2019-04-12 12:17:52 +02:00
Mazdak Farrokhzad
2f71ecbb5e
Rollup merge of #59806 - phansch:compiletest_docs2, r=oli-obk
compiletest: Improve no_prefer_dynamic docs

This adds some extra docs for the `no-prefer-dynamic` header.

And also a `s/must_compile_successfully/compile_pass`.

`must_compile_successfully` has been renamed to `compile_pass` at some
point in the past and this comment was still referring to the old name.
2019-04-12 12:17:51 +02:00
Mazdak Farrokhzad
d77b7d9dc3
Rollup merge of #59711 - GuillaumeGomez:substring-test, r=QuietMisdreavus
Add back the substring test

Fixes #58331.

r? @QuietMisdreavus
2019-04-12 12:17:49 +02:00
Mazdak Farrokhzad
59e95ddfa8
Rollup merge of #59680 - DevQps:document-rustc-z-flag, r=cramertj
Document the -Z flag to the rustc book

# Description

Changes:
- Added new documentation on the `-Z` flag of rustc in the command-line arguments section of the rustc book.

If I need to rephrase anything or if you have any improvements, please let me know! I deliberately did not create an exhaustive list of all options since they are likely to change over time and per toolchain version.

closes #41142
2019-04-12 12:17:48 +02:00
bors
876a3bcb15 Auto merge of #59622 - GuillaumeGomez:improve-one-char-search, r=QuietMisdreavus
Ensure that exact matches come first in rustdoc search

Fixes #59287.

cc @scottmcm

r? @QuietMisdreavus
2019-04-12 08:59:03 +00:00
flip1995
136d66f011
Uplift get_def_path from Clippy
This uplifts `get_def_path` from Clippy. This is a follow up on the
implementation of internal lints: #59316

The internal lint implementation also copied the implementation of the
`AbsolutePathPrinter`. To get rid of this code duplication this also
uplifts the `get_def_path` function from Clippy.

This also renames `match_path` to `match_def_path`, as it was originally
named in Clippy.
2019-04-12 10:38:39 +02:00
Chris Gregory
e9c9d1c305 Add comment that field projectin also works with mutable fields 2019-04-12 01:29:30 -05:00
bors
2226c09699 Auto merge of #59536 - Zoxc:the-arena, r=eddyb
Introduce an arena type which may be used to allocate a list of types with destructors

You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena.

Based on https://github.com/rust-lang/rust/pull/59517 and https://github.com/rust-lang/rust/pull/59533. Look at the last commit for the interesting changes.

An alternative to https://github.com/rust-lang/rust/pull/56448. cc @michaelwoerister @eddyb

r? @oli-obk
2019-04-12 06:10:19 +00:00
Chris Gregory
ac5e755164 Make BufWriter use get_mut instead of manipulating inner in Write implementation
get_mut allows us to abstract over the implementation detail of inner being
optional.
2019-04-11 23:57:29 -05:00
Esteban Küber
13a05a27e9 Continue evaluating after missing main 2019-04-11 20:01:19 -07:00
bors
0369e6c539 Auto merge of #59886 - mati865:musl_toolchain, r=alexcrichton
musl: do not compress debug section

This should be beta nominated.

Fixes https://github.com/rust-lang/rust/issues/59411 (this time for real).

Test with `DEPLOY=1 ./src/ci/docker/run.sh dist-x86_64-musl`, without `DEPLOY=1` libs are built without debuginfo.

r? @alexcrichton
2019-04-12 02:24:16 +00:00
Chris Gregory
94a5c3b2b2 Remove [mut] syntax in pin docs 2019-04-11 21:21:19 -05:00
Nicholas Nethercote
ca1ab3ed30 In -Zprint-type-size output, sort enum variants by size.
It's useful to see the biggest variants first.
2019-04-12 12:18:23 +10:00
Tyler Mandry
7c626a67ba Add discr_index to multi-variant layouts
We relax the assumption that the discriminant is always field 0, in
preparations for layouts like generators where this is not going to be
the case.
2019-04-11 17:44:43 -07:00
Tyler Mandry
b58624727c describe_enum_variant: Reduce code duplication 2019-04-11 17:44:43 -07:00
David Wood
5158063c3e
Switch to multipart suggestions.
This commit changes the suggestion so that it is split into multiple
parts in an effort to reduce the impact the applied suggestion could
have on formatting.
2019-04-12 01:54:33 +02:00
David Wood
137ffa1022
Improve robustness of nested check.
This commit removes the assumption that the start of a use statement
will always be on one line with a single space - which was silly in the
first place.
2019-04-12 01:54:33 +02:00
David Wood
7c955409e3
Handle edge cases.
This commit introduces more dirty span manipulation into the compiler
in order to handle the various edge cases in moving/renaming the macro
import so it is at the root of the import.
2019-04-12 01:54:33 +02:00
David Wood
d589cf9111
Handle renamed imports.
This commit extends the suggestion to handle imports that are aliased to
another name.
2019-04-12 01:54:32 +02:00
David Wood
d84907bbcc
Suggest macro import from crate root.
This commit suggests importing a macro from the root of a crate as the
intent may have been to import a macro from the definition location that
was annotated with `#[macro_export]`.
2019-04-12 01:54:32 +02:00
bors
cd8b437362 Auto merge of #59227 - Zoxc:fix-get, r=eddyb
Fix lifetime on LocalInternedString::get function

cc @eddyb @nnethercote
2019-04-11 23:36:13 +00:00
Esteban Küber
fd4c6e903b Remove duplicated redundant spans 2019-04-11 16:15:48 -07:00
Igor Matuszewski
bcd263e1f1 save-analysis: Simplify match arm for type node def 2019-04-11 23:53:59 +02:00