Commit Graph

91276 Commits

Author SHA1 Message Date
topecongiro
c728ae0fd1 Update rustfmt to 1.2.0 2019-03-27 10:42:13 +09:00
bors
fbd34efb32 Auto merge of #59433 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #59150 (Expand suggestions for type ascription parse errors)
 - #59232 (Merge `Promoted` and `Static` in `mir::Place`)
 - #59267 (Provide suggestion when using field access instead of path)
 - #59315 (Add no_hash to query macro and move some queries over)
 - #59334 (Update build instructions in README.md)
 - #59362 (Demo `FromIterator` short-circuiting)
 - #59374 (Simplify checked_duration_since)
 - #59389 (replace redundant note in deprecation warning)
 - #59410 (Clarify `{Ord,f32,f64}::clamp` docs a little)
 - #59419 (Utilize `?` instead of `return None`.)

Failed merges:

r? @ghost
2019-03-26 17:25:16 +00:00
bors
07d350897c Auto merge of #59434 - Centril:bootstrap-to-2019-03-20, r=Mark-Simulacrum
Bump bootstrap compiler to 2019-03-20

Includes https://github.com/rust-lang/rust/pull/59295 and by extension https://github.com/rust-lang/rust/pull/59047, which unblocks https://github.com/rust-lang/rust/pull/58253, https://github.com/rust-lang/rust/pull/58837, and possibly https://github.com/rust-lang/rust/pull/59336, and so therefore:

@bors p=50

r? @Mark-Simulacrum

cc @pietroalbini
2019-03-26 13:58:30 +00:00
Mazdak Farrokhzad
d976dbe853 bump bootstrap; adjust stage0 uses in libsyntax_pos 2019-03-26 09:57:42 +01:00
Mazdak Farrokhzad
0b46f0e649 bump bootstrap; adjust stage0 uses in core::ptr. 2019-03-26 09:57:25 +01:00
Mazdak Farrokhzad
750983d356 bump bootstrap => 2019-03-20 2019-03-26 09:53:47 +01:00
Mazdak Farrokhzad
822b4fcb3b
Rollup merge of #59419 - frewsxcv:frewsxcv-qu, r=varkor
Utilize `?` instead of `return None`.

None
2019-03-26 09:05:53 +01:00
Mazdak Farrokhzad
0677eb1eaa
Rollup merge of #59410 - tbu-:pr_doc_clarifyclamp, r=joshtriplett
Clarify `{Ord,f32,f64}::clamp` docs a little

Explicitly call out when it returns NaN, adhere to the panic doc
guidelines.
2019-03-26 09:05:52 +01:00
Mazdak Farrokhzad
95e7a50166
Rollup merge of #59389 - euclio:deprecated-suggestion, r=varkor
replace redundant note in deprecation warning
2019-03-26 09:05:51 +01:00
Mazdak Farrokhzad
e298691ee9
Rollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmaster
Simplify checked_duration_since

This follows the same design as we updated to in #56490. Internally, all the system specific time implementations are checked, no panics. Then the panicking publicly exported API can just call the checked version of itself and make do with a single panic (`expect`) at the top.

Since the internal sys implementations are now checked, this gets rid of the extra `if self >= &earlier` check in `checked_duration_since`. Except likely making the generated machine code simpler, it also reduces the algorithm from "Check panic condition -> call possibly panicking method" to just "call non panicking method".

Added two test cases:
* Edge case: Make sure `checked_duration_since` on two equal `Instant`s produce a zero duration, not a `None`.
* Most common/intended usage: Make sure `later.checked_duration_since(earlier)`, returns an expected value.
2019-03-26 09:05:48 +01:00
Mazdak Farrokhzad
0616b73c2f
Rollup merge of #59362 - pnkfelix:demo-from-iterator-short-circuiting, r=Centril
Demo `FromIterator` short-circuiting

while looking at a FIXME in `FromIterator for Option` and `FromIterator for Result`, I realized that the current documentation does not have example code showing exactly what is meant by "no further elements are taken."

The code snippets provided here are meant to correct that.
2019-03-26 09:05:47 +01:00
Mazdak Farrokhzad
e132e43e85
Rollup merge of #59334 - ewk:readme, r=Mark-Simulacrum
Update build instructions in README.md

Add additional instructions when `sudo ./x.py install` fails to
complete the build.

This resolves issues #40108 and #49269.

r? @steveklabnik
2019-03-26 09:05:46 +01:00
Mazdak Farrokhzad
4fbe25cc6b
Rollup merge of #59315 - Zoxc:move-query, r=oli-obk
Add no_hash to query macro and move some queries over

r? @oli-obk
2019-03-26 09:05:44 +01:00
Mazdak Farrokhzad
ba55822801
Rollup merge of #59267 - estebank:assoc-const-as-field, r=davidtwco
Provide suggestion when using field access instead of path

When trying to access an associated constant as if it were a field of
an instance, provide a suggestion for the correct syntax.

Fix #57316.
2019-03-26 09:05:43 +01:00
Mazdak Farrokhzad
90c2d641eb
Rollup merge of #59232 - saleemjaffer:mir_place_refactor, r=oli-obk
Merge `Promoted` and `Static` in `mir::Place`

fixes #53848
2019-03-26 09:05:40 +01:00
Mazdak Farrokhzad
b316514dbd
Rollup merge of #59150 - estebank:type-ascription, r=varkor
Expand suggestions for type ascription parse errors

Fix #51222. CC #48016, #47666, #54516, #34255.
2019-03-26 09:05:39 +01:00
bors
54479c624c Auto merge of #59136 - jethrogb:jb/sgx-std-test, r=sanxiyn
SGX target: fix std unit tests

This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass.

#59009 must be merged first.
2019-03-26 01:48:34 +00:00
Corey Farwell
28c602a94e Utilize ? instead of return None. 2019-03-25 23:29:49 +01:00
Jethro Beekman
f229422cc1 SGX target: fix std unit tests 2019-03-25 11:31:19 -07:00
bors
4c27fb19ba Auto merge of #59258 - euclio:suggestions-filter-crate, r=oli-obk
filter suggestions from extern prelude

Fixes #59027.

Modifies the candidate gathering code to call `filter_fn` on extern crates, which causes them to be filtered out when looking for a type.
2019-03-25 16:34:15 +00:00
bors
d91b32b4dc Auto merge of #59256 - petrochenkov:derval2, r=Zoxc
Make meta-item API compatible with `LocalInternedString::get` soundness fix

r? @Zoxc
2019-03-25 12:21:46 +00:00
Tobias Bucher
0bb36a2f90 Clarify {Ord,f32,f64}::clamp docs a little
Explicitly call out when it returns NaN, adhere to the panic doc
guidelines.
2019-03-25 12:52:42 +01:00
Felix S Klock II
0e83e96852
add missing braces
add missing braces analogous to those suggested by killercup
2019-03-25 11:50:11 +01:00
Pascal Hertleif
6315221b39
Update src/libcore/option.rs
Co-Authored-By: pnkfelix <pnkfelix@pnkfx.org>
2019-03-25 11:48:08 +01:00
bors
3f36ac4e83 Auto merge of #59242 - euclio:asm-ice, r=nagisa
make asm diagnostic instruction optional

`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so
the instruction shouldn't be blindly unwrapped.

Reopening from #55193. I was unable to trigger the assertion on Windows after rebasing.

Fixes #23458.
Fixes #55216.
2019-03-25 09:05:00 +00:00
bors
60eca54a7c Auto merge of #59240 - euclio:struct-field-span, r=oli-obk
use the identifier span for missing struct field
2019-03-25 05:40:12 +00:00
Esteban Küber
4beea1720a Deduplicate code for path suggestion 2019-03-24 19:43:02 -07:00
Esteban Küber
5390414379 Provide suggestion when using field access instead of path
When trying to access an associated constant as if it were a field of
an instance, provide a suggestion for the correct syntax.
2019-03-24 19:21:54 -07:00
bors
46914715e2 Auto merge of #59195 - estebank:for-loop-move, r=petrochenkov
When moving out of a for loop head, suggest borrowing it

When encountering code like the following, suggest borrowing the for loop
head to avoid moving it into the for loop pattern:

```
fn main() {
    let a = vec![1, 2, 3];
    for i in &a {
        for j in a {
            println!("{} * {} = {}", i, j, i * j);
        }
    }
}
```

Fix #25534.
2019-03-25 00:38:15 +00:00
bors
3752b3d3a5 Auto merge of #59382 - davidtwco:rfc-2008-refactoring, r=petrochenkov
Separate `DefId`s for variants and their constructors

Part of #44109. Split off from #59376. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion.

r? @petrochenkov
2019-03-24 21:26:57 +00:00
Esteban Küber
66202c113a Add nll test 2019-03-24 12:58:30 -07:00
Esteban Küber
ae883dc826 When moving out of a for loop head, suggest borrowing it
When encountering code like the following, suggest borrowing the for loop
head to avoid moving it into the for loop pattern:

```
fn main() {
    let a = vec![1, 2, 3];
    for i in &a {
        for j in a {
            println!("{} * {} = {}", i, j, i * j);
        }
    }
}
```
2019-03-24 11:46:13 -07:00
David Wood
23cae1d3f0
Re-order fields in Def::Ctor.
This commit moves the `DefId` field of `Def::Ctor` to be the first
field.
2019-03-24 19:16:44 +01:00
David Wood
88f8f07794
Move CtorOf into hir::def.
This commit moves the definition of `CtorOf` from `rustc::hir` to
`rustc::hir::def` and adds imports wherever it is used.
2019-03-24 18:54:56 +01:00
bors
0576ac109b Auto merge of #59397 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

Successful merges:

 - #59213 (Track changes to robots.txt)
 - #59239 (Remove inline assembly from hint::spin_loop)
 - #59251 (Use a valid name for graphviz graphs)
 - #59296 (Do not encode gensymed imports in metadata)
 - #59328 (Implement specialized nth_back() for Box and Windows.)
 - #59355 (Fix ICE with const generic param in struct)
 - #59377 (Correct minimum system LLVM version in tests)
2019-03-24 17:53:45 +00:00
David Wood
db4770f699
Remove CtorOf from Node::Ctor.
This commit removes `CtorOf` from `Node::Ctor` as the parent of the
constructor can be determined by looking at the node's parent in the few
places where knowing this is necessary.
2019-03-24 18:21:59 +01:00
Andy Russell
4728433c9e
make asm diagnostic instruction optional
`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so
the instruction shouldn't be blindly unwrapped.
2019-03-24 12:21:03 -04:00
Vadim Petrochenkov
782a6debe4 Revert changes to creation of fictive constructors for struct variants 2019-03-24 18:41:09 +03:00
Andy Russell
8d7c2bb06a
replace redundant note in deprecation warning 2019-03-24 11:02:37 -04:00
Vadim Petrochenkov
2cbc25e6fc Merge DefPathData::VariantCtor and DefPathData::StructCtor 2019-03-24 17:59:18 +03:00
kennytm
00478a0f3c
Rollup merge of #59377 - smaeul:patch/system-llvm, r=nikic
Correct minimum system LLVM version in tests

Since commit 9452a8dfa3, the new debug info format is only generated
for LLVM 8 and newer versions. However, the tests still assume that LLVM
7 will use the new debug info format. Fix the tests (and a comment in
the code) to match the actual version check.
2019-03-24 22:43:48 +08:00
Vadim Petrochenkov
5bcf9f4f11 Slightly more uniform treatment of struct and variant constructors 2019-03-24 17:36:43 +03:00
bors
c7b5f4d0f7 Auto merge of #58305 - scalexm:chalk-continued, r=nikomatsakis
(WIP) Small fixes in chalkification

Small fixes around region constraints and builtin impls. There are still some type inference errors, for example the following code errors out:
```rust
fn main() {
    let mut x: Vec<i32> = Vec::new();
    //                    ^^^^^^^^ cannot infer type for `std::vec::Vec<_>`
}
```
but explicitly specifying `Vec::<i32>::new` works.

With these few fixes, the following code now passes type-checking:
```rust
fn main() {
    let mut x: Vec<i32> = Vec::<i32>::new();
    x.push(5);
    println!("{:?}", x);
}
```

I also fixed the implied bounds bug as discussed on Zulip and in https://github.com/rust-lang-nursery/chalk/pull/206

cc @tmandry
r? @nikomatsakis
2019-03-24 14:26:11 +00:00
Vadim Petrochenkov
7f5a8dcdb9 Remove VariantDef::parent_did 2019-03-24 14:41:35 +03:00
kennytm
70cf325502
Rollup merge of #59355 - varkor:const-param-struct-ice, r=petrochenkov
Fix ICE with const generic param in struct

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

r? @petrochenkov
2019-03-24 19:00:18 +08:00
kennytm
cb2dde63d5
Rollup merge of #59328 - koalatux:iter-nth-back, r=scottmcm
Implement specialized nth_back() for Box and Windows.

Hi there, this is my first pull request to rust :-)

I started implementing some specializations for DoubleEndedIterator::nth_back() and these are the first two. The problem has been discussed in #54054 and nth_back() is tracked in #56995.

I'm stuck with the next implementation so I though I do a PR for the ones I'm confident with to get some feedback.
2019-03-24 19:00:10 +08:00
kennytm
1d286f7918
Rollup merge of #59296 - petrochenkov:stdup, r=estebank
Do not encode gensymed imports in metadata

(Unless they are underscore `_` imports which are re-gensymed on crate loading, see https://github.com/rust-lang/rust/pull/56392.)

We cannot encode gensymed imports properly in metadata and if we encode them improperly, we can get erroneous name conflicts downstream.
Gensymed imports are produced by the compiler, so we control their set, and can be sure that none of them needs being encoded for use from other crates.

A workaround that fixes https://github.com/rust-lang/rust/issues/59243.
2019-03-24 19:00:04 +08:00
kennytm
42b7d2c170
Rollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov
Use a valid name for graphviz graphs

Hiridification has broken graphviz output because `HirId` has a more complex display implemetation than `NodeId`. Since the id was just used to generate a distinct identifier, we just pull out the various constituent indexed.
2019-03-24 18:59:42 +08:00
Vadim Petrochenkov
c667c2fc08 Remove methods is_struct/is_tuple/is_unit from VariantData 2019-03-24 12:10:16 +03:00
David Wood
5c3d1e5d76 Separate variant id and variant constructor id.
This commit makes two changes - separating the `NodeId` that identifies
an enum variant from the `NodeId` that identifies the variant's
constructor; and no longer creating a `NodeId` for `Struct`-style enum
variants and structs.

Separation of the variant id and variant constructor id will allow the
rest of RFC 2008 to be implemented by lowering the visibility of the
variant's constructor without lowering the visbility of the variant
itself.

No longer creating a `NodeId` for `Struct`-style enum variants and
structs mostly simplifies logic as previously this `NodeId` wasn't used.
There were various cases where the `NodeId` wouldn't be used unless
there was an unit or tuple struct or enum variant but not all uses of
this `NodeId` had that condition, by removing this `NodeId`, this must
be explicitly dealt with. This change mostly applied cleanly, but there
were one or two cases in name resolution and one case in type check
where the existing logic required a id for `Struct`-style enum variants
and structs.
2019-03-24 12:10:16 +03:00