Commit Graph

91995 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Igor Matuszewski
bcd263e1f1 save-analysis: Simplify match arm for type node def 2019-04-11 23:53:59 +02:00
Igor Matuszewski
1ced262653 save-analysis: use qpath_def for associated types 2019-04-11 23:37:05 +02:00
Josh Stone
90d9727919
Fix the link to sort_by_cached_key
It's a primitive slice method, not a standalone function.
2019-04-11 14:04:52 -07:00
Andrew Banchich
aefc1581b1
Update diagnostics.rs
Add `a` and other minor text improvements
2019-04-11 16:12:04 -04:00
Mateusz Mikuła
7276eb5a43 musl: do not compress debug section
Old linkers are unable to decompress them and fail to link binaries
2019-04-11 18:58:14 +02:00
bors
3de0106789 Auto merge of #59780 - RalfJung:miri-unsized, r=oli-obk
Miri: unsized locals and by-value dyn traits

r? @oli-obk
Cc @eddyb

Fixes https://github.com/rust-lang/miri/issues/449
2019-04-11 15:44:22 +00:00
Oliver Middleton
ae2a68bcf5 Fix broken links on std::boxed doc page 2019-04-11 15:27:35 +01:00
Scott Olson
f54df44907 Remove note about transmute for float bitpatterns. 2019-04-11 07:56:35 -06:00
bors
850912704e Auto merge of #59211 - nox:refcell-borrow-state, r=KodrAus
Introduce RefCell::try_borrow_unguarded

*Come sit next to the fireplace with me, this is going to be a long story.*

So, you may already be aware that Servo has weird design constraints that forces us developers working on it to do weird things. The thing that interests us today is that we do layout on a separate thread with its own thread pool to do some things in parallel, whereas the data it uses comes from the script thread, which implements the entire DOM and related pieces, with `!Sync` data types such as `RefCell<T>`.

The invariant we maintain is that script does not do anything ever with the DOM data as long as layout is doing its job. That's all nice and all, but one thing we don't ensure is that we don't actually know if script was currently mutably borrowing some `RefCell<T>` prior to starting layout, which may lead to aliasing mutable memory and obviously undefined behaviour.

This PR reinstates `RefCell::borrow_state` so that [this method](https://github.com/servo/servo/blob/master/components/script/dom/bindings/cell.rs#L23-L30) can make use of it and return `None` if the cell was mutably borrowed.

Cc @SimonSapin
2019-04-11 12:49:49 +00:00
Carol (Nichols || Goulding)
023487867c
Update TRPL to use mdbook 0.2 2019-04-11 07:56:25 -04:00
bors
ee1474acc4 Auto merge of #58972 - QuietMisdreavus:intra-doc-link-imports, r=GuillaumeGomez
rustdoc: don't process `Crate::external_traits` when collecting intra-doc links

Part of https://github.com/rust-lang/rust/issues/58745, closes https://github.com/rust-lang/rust/pull/58917

The `collect-intra-doc-links` pass keeps track of the modules it recurses through as it processes items. This is used to know what module to give the resolver when looking up links. When looking through the regular items of the crate, this works fine, but the `DocFolder` trait as written doesn't just process the main crate hierarchy - it also processes the trait items in the `external_traits` map. This is useful for other passes (so they can strip out `#[doc(hidden)]` items, for example), but here it creates a situation where we're processing items "outside" the regular module hierarchy. Since everything in `external_traits` is defined outside the current crate, we can't fall back to finding its module scope like we do with local items.

Skipping this collection saves us from emitting some spurious warnings. We don't even lose anything by skipping it, either - the docs loaded from here are only ever rendered through `html::render::document_short` which strips any links out, so the fact that the links haven't been loaded doesn't matter. Hopefully this removes most of the remaining spurious resolution warnings from intra-doc links.

r? @GuillaumeGomez
2019-04-11 08:48:26 +00:00
bors
d21bebe18d Auto merge of #59799 - Zoxc:vs2019, r=alexcrichton
Update cmake, cc and compiler_builtins for VS 2019 support

r? @alexcrichton
2019-04-11 05:56:11 +00:00
Jethro Beekman
e2d1d667e2 SGX target: fix cfg(test) build 2019-04-10 14:08:54 -07:00
John Kåre Alsaker
7b28ddc39d Update Cargo.lock 2019-04-10 21:18:35 +02:00
John Kåre Alsaker
cf0454ca1a Don't build test helpers for wasm32 2019-04-10 21:17:33 +02:00
John Kåre Alsaker
b70124ed47 Don't require a C compiler on wasm32 2019-04-10 21:17:32 +02:00
John Kåre Alsaker
81a1121341 Update cmake, cc and compiler_builtins for VS 2019 support 2019-04-10 21:17:31 +02:00
bors
96d700f1b7 Auto merge of #59810 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy, rls and miri

Let's give this another try.
r? @Manishearth
cc @Xanewok
2019-04-10 15:54:39 +00:00
Christian
cdeb7455ea Updated the description of -Z in the rustc book. 2019-04-10 12:20:47 +02:00
Christian
7acfa453df Updated the documentation, now claiming the -Z is associated to unstable compiler flags, instead of flags for debugging. 2019-04-10 12:10:25 +02:00
Anders Kaseorg
38264937fc std::ops::Div examples: correct nominator to numerator
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-04-09 21:43:41 -07:00
John Kåre Alsaker
223f1c7d1f Remove useless ?Sized bound 2019-04-10 03:58:13 +02:00
Eric Huss
3e01901fcd Remove strange formatting in Ordering docs. 2019-04-09 15:41:38 -07:00
Andy Russell
757ef38431
improve unknown enum variant errors 2019-04-09 14:19:20 -04:00
John Kåre Alsaker
04762ddfbb Fix a typo 2019-04-09 17:07:36 +02:00
Edd Barrett
3262d1e252 Kill dead code dominator code. 2019-04-09 11:48:31 +01:00
Matthias Krüger
beeeb4360e update Cargo.lock 2019-04-09 10:50:08 +02:00