Commit Graph

92095 Commits

Author SHA1 Message Date
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
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
Igor Matuszewski
bcd263e1f1 save-analysis: Simplify match arm for type node def 2019-04-11 23:53:59 +02:00
Esteban Küber
9b6b3d618c review comments 2019-04-11 14:45:23 -07:00
Igor Matuszewski
1ced262653 save-analysis: use qpath_def for associated types 2019-04-11 23:37:05 +02:00
Esteban Küber
66ed5d9cb0 Fix ui-fulldeps test 2019-04-11 14:21:13 -07: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
Mark Mansi
e149dc02a4 remove warn 2019-04-11 15:09:43 -05:00
Esteban Küber
146d040f0b Reword tracking issue note 2019-04-11 11:42:06 -07: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
Ryan Levick
8678164483 Impl RawFd converstion traits for TcpListener, TcpStream and UdpSocket 2019-04-11 17:35:36 +02: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
Michael Woerister
7b1df42acc Clean up handling of -Zpgo-gen commandline option. 2019-04-11 14:50:32 +02: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
Mark Mansi
6fd3f5acaf forgot one 2019-04-10 21:32:46 -05:00
Mark Mansi
d7f5c50a33 make duplicate matcher bindings a hard error 2019-04-10 21:29:17 -05:00
Kampfkarren
1156ce6f54 Feedback 2019-04-10 19:22:43 -07:00
Esteban Küber
3ab97062cf Tweak unstable diagnostic output 2019-04-10 18:10:30 -07:00
Esteban Küber
ac037c1359 Recover from missing semicolon based on the found token
When encountering one of a few keywords when a semicolon was
expected, suggest the semicolon and recover:

```
error: expected one of `.`, `;`, `?`, or an operator, found `let`
  --> $DIR/recover-missing-semi.rs:4:5
   |
LL |     let _: usize = ()
   |                      - help: missing semicolon here
LL |
LL |     let _ = 3;
   |     ^^^

error[E0308]: mismatched types
  --> $DIR/recover-missing-semi.rs:2:20
   |
LL |     let _: usize = ()
   |                    ^^ expected usize, found ()
   |
   = note: expected type `usize`
              found type `()`
```
2019-04-10 18:07:52 -07:00