]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #59242 - euclio:asm-ice, r=nagisa
bors [Mon, 25 Mar 2019 09:05:00 +0000 (09:05 +0000)]
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.

5 years agoAuto merge of #59240 - euclio:struct-field-span, r=oli-obk
bors [Mon, 25 Mar 2019 05:40:12 +0000 (05:40 +0000)]
Auto merge of #59240 - euclio:struct-field-span, r=oli-obk

use the identifier span for missing struct field

5 years agoAuto merge of #59195 - estebank:for-loop-move, r=petrochenkov
bors [Mon, 25 Mar 2019 00:38:15 +0000 (00:38 +0000)]
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.

5 years agoAuto merge of #59382 - davidtwco:rfc-2008-refactoring, r=petrochenkov
bors [Sun, 24 Mar 2019 21:26:57 +0000 (21:26 +0000)]
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

5 years agoAdd nll test
Esteban Küber [Sun, 24 Mar 2019 19:58:30 +0000 (12:58 -0700)]
Add nll test

5 years agoWhen moving out of a for loop head, suggest borrowing it
Esteban Küber [Thu, 14 Mar 2019 23:09:47 +0000 (16:09 -0700)]
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);
        }
    }
}
```

5 years agoRe-order fields in `Def::Ctor`.
David Wood [Sun, 24 Mar 2019 18:16:44 +0000 (19:16 +0100)]
Re-order fields in `Def::Ctor`.

This commit moves the `DefId` field of `Def::Ctor` to be the first
field.

5 years agoMove `CtorOf` into `hir::def`.
David Wood [Sun, 24 Mar 2019 17:54:56 +0000 (18:54 +0100)]
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.

5 years agoAuto merge of #59397 - kennytm:rollup, r=kennytm
bors [Sun, 24 Mar 2019 17:53:45 +0000 (17:53 +0000)]
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)

5 years agoRemove `CtorOf` from `Node::Ctor`.
David Wood [Sun, 24 Mar 2019 17:21:59 +0000 (18:21 +0100)]
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.

5 years agomake asm diagnostic instruction optional
Andy Russell [Fri, 19 Oct 2018 00:34:01 +0000 (20:34 -0400)]
make asm diagnostic instruction optional

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

5 years agoRevert changes to creation of fictive constructors for struct variants
Vadim Petrochenkov [Sun, 24 Mar 2019 15:41:09 +0000 (18:41 +0300)]
Revert changes to creation of fictive constructors for struct variants

5 years agoMerge `DefPathData::VariantCtor` and `DefPathData::StructCtor`
Vadim Petrochenkov [Sun, 24 Mar 2019 14:49:58 +0000 (17:49 +0300)]
Merge `DefPathData::VariantCtor` and `DefPathData::StructCtor`

5 years agoRollup merge of #59377 - smaeul:patch/system-llvm, r=nikic
kennytm [Sun, 24 Mar 2019 07:32:57 +0000 (15:32 +0800)]
Rollup merge of #59377 - smaeul:patch/system-llvm, r=nikic

Correct minimum system LLVM version in tests

Since commit 9452a8dfa3ba, 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.

5 years agoSlightly more uniform treatment of struct and variant constructors
Vadim Petrochenkov [Sun, 24 Mar 2019 12:29:57 +0000 (15:29 +0300)]
Slightly more uniform treatment of struct and variant constructors

5 years agoAuto merge of #58305 - scalexm:chalk-continued, r=nikomatsakis
bors [Sun, 24 Mar 2019 14:26:11 +0000 (14:26 +0000)]
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

5 years agoRemove `VariantDef::parent_did`
Vadim Petrochenkov [Sun, 24 Mar 2019 09:09:44 +0000 (12:09 +0300)]
Remove `VariantDef::parent_did`

5 years agoRollup merge of #59355 - varkor:const-param-struct-ice, r=petrochenkov
kennytm [Sun, 24 Mar 2019 07:32:54 +0000 (15:32 +0800)]
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

5 years agoRollup merge of #59328 - koalatux:iter-nth-back, r=scottmcm
kennytm [Sun, 24 Mar 2019 07:32:52 +0000 (15:32 +0800)]
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.

5 years agoRollup merge of #59296 - petrochenkov:stdup, r=estebank
kennytm [Sun, 24 Mar 2019 07:32:49 +0000 (15:32 +0800)]
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.

5 years agoRollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov
kennytm [Sun, 24 Mar 2019 07:32:48 +0000 (15:32 +0800)]
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.

5 years agoRemove methods is_struct/is_tuple/is_unit from VariantData
Vadim Petrochenkov [Sat, 23 Mar 2019 21:06:58 +0000 (00:06 +0300)]
Remove methods is_struct/is_tuple/is_unit from VariantData

5 years agoSeparate variant id and variant constructor id.
David Wood [Thu, 21 Mar 2019 22:38:50 +0000 (23:38 +0100)]
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.

5 years agoRollup merge of #59239 - gnzlbg:fix_spin_loop, r=nagisa
kennytm [Sun, 24 Mar 2019 07:32:45 +0000 (15:32 +0800)]
Rollup merge of #59239 - gnzlbg:fix_spin_loop, r=nagisa

Remove inline assembly from hint::spin_loop

This PR removes the inline assembly which was not required since these
instructions are available in core::arch, and extends support of
the spin_loop hint to arm targets with the v6 feature which also
support the yield instruction.

5 years agoRollup merge of #59213 - kornelski:robots, r=Mark-Simulacrum
kennytm [Sun, 24 Mar 2019 07:32:42 +0000 (15:32 +0800)]
Rollup merge of #59213 - kornelski:robots, r=Mark-Simulacrum

Track changes to robots.txt

Currently `robots.txt` of doc.rust-lang.org is not part of any repo, so there's [no way to contribute any changes to it](https://internals.rust-lang.org/t/deadlock-about-fixing-outdated-documentation-links-in-search-engines/9374), such as needed for #44894 and countless dupes of this issue.

I propose adding it to this repo. I'm not in control of the infrastructure, so I can't help to automate deployment of it, but even just having the file under source control is IMHO a step forward.

5 years agoAuto merge of #59199 - estebank:untrack-errors, r=eddyb
bors [Sun, 24 Mar 2019 05:38:10 +0000 (05:38 +0000)]
Auto merge of #59199 - estebank:untrack-errors, r=eddyb

Remove `track_errors` from `check_match`, `typeck_item_bodies` and `register_plugins`

In the spirit of continuing through errors in type checking (#39275), remove `track_errors` from a couple of locations in the codebase.

5 years agoAuto merge of #59084 - estebank:diagnostic-spans, r=davidtwco
bors [Sat, 23 Mar 2019 22:26:11 +0000 (22:26 +0000)]
Auto merge of #59084 - estebank:diagnostic-spans, r=davidtwco

Tweak some diagnostic spans

5 years agoFix span after rebase
Esteban Küber [Sat, 23 Mar 2019 21:10:29 +0000 (14:10 -0700)]
Fix span after rebase

5 years agoFix rebase
Esteban Küber [Sun, 17 Mar 2019 01:36:47 +0000 (18:36 -0700)]
Fix rebase

5 years agoMark duplicate import removal suggestion tool only
Esteban Küber [Mon, 11 Mar 2019 16:50:50 +0000 (09:50 -0700)]
Mark duplicate import removal suggestion tool only

5 years agoDeduplicate const eval error spans for better output
Esteban Küber [Mon, 11 Mar 2019 16:43:05 +0000 (09:43 -0700)]
Deduplicate const eval error spans for better output

5 years agoHide obvious suggestion from cli output
Esteban Küber [Mon, 11 Mar 2019 05:25:23 +0000 (22:25 -0700)]
Hide obvious suggestion from cli output

5 years agoTweak unnecessary import suggestion
Esteban Küber [Mon, 11 Mar 2019 03:05:01 +0000 (20:05 -0700)]
Tweak unnecessary import suggestion

5 years agoTweak unsupported negative trait bounds message
Esteban Küber [Mon, 11 Mar 2019 02:46:44 +0000 (19:46 -0700)]
Tweak unsupported negative trait bounds message

5 years agoSwap primary/secondary spans for E0458
Esteban Küber [Mon, 11 Mar 2019 01:03:59 +0000 (18:03 -0700)]
Swap primary/secondary spans for E0458

5 years agoSwap const evaluation lint spans to point at problem in primary span
Esteban Küber [Mon, 11 Mar 2019 00:28:52 +0000 (17:28 -0700)]
Swap const evaluation lint spans to point at problem in primary span

5 years agoTweak spans for E0599
Esteban Küber [Sun, 10 Mar 2019 23:20:15 +0000 (16:20 -0700)]
Tweak spans for E0599

5 years agoAuto merge of #59068 - ljedrz:kill_off_NodeId_stragglers, r=Zoxc
bors [Sat, 23 Mar 2019 17:34:18 +0000 (17:34 +0000)]
Auto merge of #59068 - ljedrz:kill_off_NodeId_stragglers, r=Zoxc

HirIdification: kill off NodeId stragglers

The final stages of HirIdification (#57578).

This PR, along with https://github.com/rust-lang/rust/pull/59042, should finalize the HirIdification process (at least the more straightforward bits).

- replace `NodeId` with `HirId` in `trait_impls`
- remove all `NodeId`s from `borrowck`
- remove all `NodeId`s from `typeck`
- remove all `NodeId`s from `mir`
- remove `trait_auto_impl` (unused)

I would be cool to also remove `NodeId` from `hir::def::Def`, `middle::privacy::AccessLevel`  and `hir::ItemId`, but I don't know if this is feasible.

I'll be happy to do more if I've missed anything.

5 years agoUse `if let` instead of `match`
varkor [Sat, 23 Mar 2019 13:05:36 +0000 (13:05 +0000)]
Use `if let` instead of `match`

5 years agoAuto merge of #59096 - ljedrz:HirIdify_AccessLevel, r=Zoxc
bors [Sat, 23 Mar 2019 12:21:27 +0000 (12:21 +0000)]
Auto merge of #59096 - ljedrz:HirIdify_AccessLevel, r=Zoxc

middle: replace NodeId with HirId in AccessLevels

Pushing the limits of HirIdification (#57578).

Replaces `NodeId` with `HirId` in `middle::privacy::AccessLevels`. Actually this time I was more successful and cracked it; I probably tried to HirIdify too much at once when I attempted it last time ^^.

r? @Zoxc

5 years agoAuto merge of #59058 - petrochenkov:assocrecov3, r=estebank
bors [Sat, 23 Mar 2019 05:51:16 +0000 (05:51 +0000)]
Auto merge of #59058 - petrochenkov:assocrecov3, r=estebank

 syntax: Better recovery for `$ty::AssocItem` and `ty!()::AssocItem`

This PR improves on https://github.com/rust-lang/rust/pull/46788 covering a few missing cases.

Fixes https://github.com/rust-lang/rust/issues/52307
Fixes https://github.com/rust-lang/rust/issues/53776
r? @estebank

5 years agoAdd note to address check_match errors
Esteban Küber [Sat, 23 Mar 2019 03:29:28 +0000 (20:29 -0700)]
Add note to address check_match errors

5 years agoaddress review comments
Esteban Küber [Mon, 18 Mar 2019 00:37:56 +0000 (17:37 -0700)]
address review comments

5 years agoDo not `track_errors` in `register_plugins`
Esteban Küber [Fri, 15 Mar 2019 02:38:20 +0000 (19:38 -0700)]
Do not `track_errors` in `register_plugins`

5 years agoContinue running after `typeck_item_bodies` has failed
Esteban Küber [Fri, 15 Mar 2019 02:29:02 +0000 (19:29 -0700)]
Continue running after `typeck_item_bodies` has failed

5 years agoRemove track_errors from check_match
Esteban Küber [Fri, 15 Mar 2019 02:16:31 +0000 (19:16 -0700)]
Remove track_errors from check_match

5 years agoAuto merge of #58929 - estebank:elide-object, r=zackmdavis
bors [Sat, 23 Mar 2019 02:40:15 +0000 (02:40 +0000)]
Auto merge of #58929 - estebank:elide-object, r=zackmdavis

Elide object safety errors on non-existent trait function

Fix #58734.

r? @zackmdavis

5 years agoCorrect minimum system LLVM version in tests
Samuel Holland [Fri, 22 Mar 2019 22:08:06 +0000 (17:08 -0500)]
Correct minimum system LLVM version in tests

Since commit 9452a8dfa3ba, 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.

5 years agoAuto merge of #59370 - Centril:rollup, r=Centril
bors [Fri, 22 Mar 2019 21:00:07 +0000 (21:00 +0000)]
Auto merge of #59370 - Centril:rollup, r=Centril

Rollup of 18 pull requests

Successful merges:

 - #59106 (Add peer_addr function to UdpSocket)
 - #59170 (Add const generics to rustdoc)
 - #59172 (Update and clean up several parts of CONTRIBUTING.md)
 - #59190 (consistent naming for Rhs type parameter in libcore/ops)
 - #59236 (Rename miri component to miri-preview)
 - #59266 (Do not complain about non-existing fields after parse recovery)
 - #59273 (some small HIR doc improvements)
 - #59291 (Make Option<ThreadId> no larger than ThreadId, with NonZeroU64)
 - #59297 (convert field/method confusion help to suggestions)
 - #59304 (Move some bench tests back from libtest)
 - #59309 (Add messages for different verbosity levels. Output copy actions.)
 - #59321 (Unify E0109, E0110 and E0111)
 - #59322 (Tweak incorrect escaped char diagnostic)
 - #59323 (use suggestions for "enum instead of variant" error)
 - #59327 (Add NAN test to docs)
 - #59329 (cleanup: Remove compile-fail-fulldeps directory again)
 - #59347 (Move one test from run-make-fulldeps to ui)
 - #59360 (Add tracking issue number for `seek_convenience`)

Failed merges:

r? @ghost

5 years agoRollup merge of #59360 - LukasKalbertodt:patch-2, r=rkruppe
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:41 +0000 (19:31 +0100)]
Rollup merge of #59360 - LukasKalbertodt:patch-2, r=rkruppe

Add tracking issue number for `seek_convenience`

We forgot to do that in #58422

5 years agoRollup merge of #59347 - petrochenkov:nomake, r=davidtwco
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:40 +0000 (19:31 +0100)]
Rollup merge of #59347 - petrochenkov:nomake, r=davidtwco

Move one test from run-make-fulldeps to ui

The test was written when `--extern` without path didn't exist.

5 years agoRollup merge of #59329 - petrochenkov:rmcff, r=alexcrichton
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:38 +0000 (19:31 +0100)]
Rollup merge of #59329 - petrochenkov:rmcff, r=alexcrichton

cleanup: Remove compile-fail-fulldeps directory again

It was already removed once in https://github.com/rust-lang/rust/pull/56444, but was partially resurrected by rebase of some other PR.

5 years agoRollup merge of #59327 - Xaeroxe:clamp-doc, r=scottmcm
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:37 +0000 (19:31 +0100)]
Rollup merge of #59327 - Xaeroxe:clamp-doc, r=scottmcm

Add NAN test to docs

Documents and tests NAN behavior for the new (f32, f64)::clamp function.

5 years agoRollup merge of #59323 - euclio:enum-instead-of-variant, r=varkor
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:36 +0000 (19:31 +0100)]
Rollup merge of #59323 - euclio:enum-instead-of-variant, r=varkor

use suggestions for "enum instead of variant" error

5 years agoRollup merge of #59322 - estebank:diag-tweak, r=davidtwco
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:34 +0000 (19:31 +0100)]
Rollup merge of #59322 - estebank:diag-tweak, r=davidtwco

Tweak incorrect escaped char diagnostic

5 years agoRollup merge of #59321 - varkor:unify-E0109-E0110-E0111, r=davidtwco
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:33 +0000 (19:31 +0100)]
Rollup merge of #59321 - varkor:unify-E0109-E0110-E0111, r=davidtwco

Unify E0109, E0110 and E0111

Error messages should no longer be restricted to specific generic kinds.

5 years agoRollup merge of #59309 - o01eg:verbose-copy-files, r=alexcrichton
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:31 +0000 (19:31 +0100)]
Rollup merge of #59309 - o01eg:verbose-copy-files, r=alexcrichton

Add messages for different verbosity levels. Output copy actions.

5 years agoRollup merge of #59304 - gnzlbg:bench_tests, r=alexcrichton
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:30 +0000 (19:31 +0100)]
Rollup merge of #59304 - gnzlbg:bench_tests, r=alexcrichton

Move some bench tests back from libtest

It doesn't make much sense to test these on rust-lang/libtest since they exercise the `#[bench]` macro which is part of rust-lang/rust.

This PR moves these tests back here.

r? @alexcrichton

5 years agoRollup merge of #59297 - euclio:field-method-suggestions, r=estebank
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:28 +0000 (19:31 +0100)]
Rollup merge of #59297 - euclio:field-method-suggestions, r=estebank

convert field/method confusion help to suggestions

5 years agoRollup merge of #59291 - SimonSapin:nonzero-thread-id, r=alexcrichton
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:27 +0000 (19:31 +0100)]
Rollup merge of #59291 - SimonSapin:nonzero-thread-id, r=alexcrichton

Make Option<ThreadId> no larger than ThreadId, with NonZeroU64

5 years agoRollup merge of #59273 - llogiq:hir-docs, r=matthewjasper
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:25 +0000 (19:31 +0100)]
Rollup merge of #59273 - llogiq:hir-docs, r=matthewjasper

some small HIR doc improvements

5 years agoRollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkov
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:24 +0000 (19:31 +0100)]
Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkov

Do not complain about non-existing fields after parse recovery

When failing to parse struct-like enum variants, the ADT gets recorded
as having no fields. Record that we have actually recovered during
parsing of this variant to avoid complaing about non-existing fields
when actually using it.

Fix #57361.

5 years agoRollup merge of #59236 - mati865:miri-preview, r=oli-obk
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:22 +0000 (19:31 +0100)]
Rollup merge of #59236 - mati865:miri-preview, r=oli-obk

Rename miri component to miri-preview

It should fix installation via `rustup` and indicates it's not stable yet.

5 years agoRollup merge of #59190 - greg-kargin:master, r=sanxiyn
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:21 +0000 (19:31 +0100)]
Rollup merge of #59190 - greg-kargin:master, r=sanxiyn

consistent naming for Rhs type parameter in libcore/ops

Rename RHS type parameter occurrences RHS->Rhs to make it consistent throughout files and follow naming conventions.

5 years agoRollup merge of #59172 - varkor:contributing-contributions, r=steveklabnik
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:19 +0000 (19:31 +0100)]
Rollup merge of #59172 - varkor:contributing-contributions, r=steveklabnik

Update and clean up several parts of CONTRIBUTING.md

5 years agoRollup merge of #59170 - varkor:const-generics-rustdoc, r=QuietMisdreavus,eddyb
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:18 +0000 (19:31 +0100)]
Rollup merge of #59170 - varkor:const-generics-rustdoc, r=QuietMisdreavus,eddyb

Add const generics to rustdoc

Split out from #53645. This work is a collaborative effort with @yodaldevoid.

The `FIXME`s are waiting on a refactor to `LazyConst`. I'll address these in a follow up, but I thought it would be better to implement the rest now to avoid bitrot.

r? @QuietMisdreavus

5 years agoRollup merge of #59106 - LinusU:udp-peer-addr, r=kennytm
Mazdak Farrokhzad [Fri, 22 Mar 2019 18:31:16 +0000 (19:31 +0100)]
Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytm

Add peer_addr function to UdpSocket

Fixes #59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!

5 years agoAuto merge of #58953 - jethrogb:jb/unify-ffi, r=alexcrichton
bors [Fri, 22 Mar 2019 17:34:06 +0000 (17:34 +0000)]
Auto merge of #58953 - jethrogb:jb/unify-ffi, r=alexcrichton

Unify OsString/OsStr for byte-based implementations

As requested in #57860

r? @joshtriplett

5 years agoAuto merge of #57810 - MikaelUrankar:stack_t_bsd, r=nagisa
bors [Fri, 22 Mar 2019 14:19:42 +0000 (14:19 +0000)]
Auto merge of #57810 - MikaelUrankar:stack_t_bsd, r=nagisa

FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void*

…d* [1]

dragonflybsd still uses c_char [2]

[1] https://svnweb.freebsd.org/base/releng/11.2/sys/sys/signal.h?revision=334459&view=markup#l438
[2] https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/signal.h#L339

5 years agoRename miri component to miri-preview
Mateusz Mikuła [Fri, 22 Mar 2019 11:39:59 +0000 (12:39 +0100)]
Rename miri component to miri-preview

It should fix installation via rustup and indicates it's not stable yet

5 years agoAuto merge of #59035 - estebank:closure-instacall, r=davidtwco
bors [Fri, 22 Mar 2019 11:18:11 +0000 (11:18 +0000)]
Auto merge of #59035 - estebank:closure-instacall, r=davidtwco

When encountering `||{}()`, suggest the likely intended `(||{})()`

Fix #55851.

5 years agoAdd tracking issue number for `seek_convenience`
Lukas Kalbertodt [Fri, 22 Mar 2019 10:25:44 +0000 (11:25 +0100)]
Add tracking issue number for `seek_convenience`

5 years agoAuto merge of #58995 - Centril:refactor-build-manifest, r=alexcrichton
bors [Fri, 22 Mar 2019 08:06:48 +0000 (08:06 +0000)]
Auto merge of #58995 - Centril:refactor-build-manifest, r=alexcrichton

Refactor tools/build-mainfest

I saw some duplication in https://github.com/rust-lang/rust/pull/58990 and got an itch... Will likely need to be rebased when that lands. Hopefully the PR should have zero semantic changes...

r? @alexcrichton

5 years agoAuto merge of #59031 - estebank:recover-from-comaless, r=petrochenkov
bors [Fri, 22 Mar 2019 04:52:10 +0000 (04:52 +0000)]
Auto merge of #59031 - estebank:recover-from-comaless, r=petrochenkov

Recover from missing comma between enum variants and from bad `pub` kw

Fix #56579. Fix #56473.

5 years agoFix ICE with const generic param in struct
varkor [Fri, 22 Mar 2019 01:49:42 +0000 (01:49 +0000)]
Fix ICE with const generic param in struct

5 years agoAuto merge of #58981 - estebank:elseless-if, r=davidtwco
bors [Thu, 21 Mar 2019 23:42:41 +0000 (23:42 +0000)]
Auto merge of #58981 - estebank:elseless-if, r=davidtwco

Point at coercion reason for `if` expressions without else clause if caused by return type

```
error[E0317]: if may be missing an else clause
  --> $DIR/if-without-else-as-fn-expr.rs:2:5
   |
LL |   fn foo(bar: usize) -> usize {
   |                         ----- found `usize` because of this return type
LL | /     if bar % 5 == 0 {
LL | |         return 3;
LL | |     }
   | |_____^ expected (), found usize
   |
   = note: expected type `()`
              found type `usize`
   = note: `if` expressions without `else` must evaluate to `()`
```

Fix #25228.

5 years agoUnify OsString/OsStr for byte-based implementations
Jethro Beekman [Tue, 5 Mar 2019 23:05:44 +0000 (15:05 -0800)]
Unify OsString/OsStr for byte-based implementations

5 years agoMove one test from run-make-fulldeps to ui
Vadim Petrochenkov [Thu, 21 Mar 2019 20:36:50 +0000 (23:36 +0300)]
Move one test from run-make-fulldeps to ui

5 years agoAuto merge of #58948 - petrochenkov:overlap, r=cramertj
bors [Thu, 21 Mar 2019 20:22:07 +0000 (20:22 +0000)]
Auto merge of #58948 - petrochenkov:overlap, r=cramertj

hygiene: Fix identifier comparison in impl overlap check

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

5 years agohygiene: Fix identifier comparison in impl overlap check
Vadim Petrochenkov [Tue, 5 Mar 2019 19:34:37 +0000 (22:34 +0300)]
hygiene: Fix identifier comparison in impl overlap check

5 years agoUpdate cargo
MikaelUrankar [Thu, 21 Mar 2019 16:02:28 +0000 (17:02 +0100)]
Update cargo

5 years agoFreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void* [1]
MikaelUrankar [Mon, 21 Jan 2019 17:52:57 +0000 (18:52 +0100)]
FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void* [1]
dragonflybsd still uses c_char [2]

[1] https://svnweb.freebsd.org/base/releng/11.2/sys/sys/signal.h?revision=334459&view=markup#l438
[2] https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/signal.h#L339

5 years agouse suggestions for "enum instead of variant" error
Andy Russell [Wed, 20 Mar 2019 18:54:43 +0000 (14:54 -0400)]
use suggestions for "enum instead of variant" error

5 years agoAuto merge of #58422 - LukasKalbertodt:seek-convenience, r=alexcrichton
bors [Thu, 21 Mar 2019 14:28:18 +0000 (14:28 +0000)]
Auto merge of #58422 - LukasKalbertodt:seek-convenience, r=alexcrichton

Add provided methods `Seek::{stream_len, stream_position}`

This adds two new, provided methods to the `io::Seek` trait:
- `fn stream_len(&mut self) -> Result<u64>`
- `fn stream_position(&mut self) -> Result<u64>`

Both are added for convenience and to improve readability in user code. Reading `file.stream_len()` is much better than to manually seek two or three times. Similarly, `file.stream_position()` is much more clear than `file.seek(SeekFrom::Current(0))`.

You can find prior discussions [in this internals thread](https://internals.rust-lang.org/t/pre-rfc-idea-extend-io-seek-with-convenience-methods-with-e-g-stream-len/9262). I think I addressed all concerns in that thread.

I already wrote three RFCs to add a small new API to libstd but I noticed that many public changes to libstd happen without an RFC. So I figured I can try opening a PR directly without going through RFCs first. After all, we do have rfcbot here too. If you think this change is too big to merge without an RFC, I can still close this PR and write an RFC.

5 years agoFix undefined behavior in hint::spin_loop for x86 targets without SSE2
gnzlbg [Sat, 16 Mar 2019 17:07:58 +0000 (18:07 +0100)]
Fix undefined behavior in hint::spin_loop for x86 targets without SSE2

The pause instruction requires SSE2 but was being unconditionally used
on targets without it, resulting in undefined behavior.

This PR fixes that by only using the pause intrinsic if SSE2 is available.

It also removes the inline assembly which was not required since these
instructions are available in core::arch, and extends support of
the spin_loop hint to arm targets with the v6 feature which also
support the yield instruction.

Closes #59237 .

5 years agoAuto merge of #58927 - GuillaumeGomez:default-keyword, r=QuietMisdreavus
bors [Thu, 21 Mar 2019 08:55:50 +0000 (08:55 +0000)]
Auto merge of #58927 - GuillaumeGomez:default-keyword, r=QuietMisdreavus

Add default keyword handling in rustdoc

Fixes #58898.

r? @QuietMisdreavus

5 years agoAuto merge of #58913 - Milack27:patch_buf_reader, r=joshtriplett
bors [Thu, 21 Mar 2019 05:41:13 +0000 (05:41 +0000)]
Auto merge of #58913 - Milack27:patch_buf_reader, r=joshtriplett

Add new test case for possible bug in BufReader

When reading a large chunk from a BufReader, if all the bytes from the buffer have been already consumed, the internal buffer is bypassed entirely. However, it is not invalidated, and it's possible to access its contents using the `seek_relative` method, because it tries to reuse the existing buffer.

5 years agoAuto merge of #58902 - matthewjasper:generator-cleanup-blocks, r=davidtwco
bors [Thu, 21 Mar 2019 02:18:27 +0000 (02:18 +0000)]
Auto merge of #58902 - matthewjasper:generator-cleanup-blocks, r=davidtwco

Fixes for the generator transform

* Moves cleanup annotations in pretty printed MIR so that they can be tested
* Correctly determines which drops are in cleanup blocks when elaborating generator drops
* Use the correct state for poisoning a generator

Closes #58892

5 years agoAuto merge of #58897 - Mark-Simulacrum:tool-rework, r=alexcrichton
bors [Wed, 20 Mar 2019 23:02:17 +0000 (23:02 +0000)]
Auto merge of #58897 - Mark-Simulacrum:tool-rework, r=alexcrichton

Rework how bootstrap tools are built

This makes bootstrap tools buildable and testable in stage 0 with the downloaded bootstrap compiler, futhermore, it makes it such that they cannot be built in any other stage.

Notably, this will also mean that compiletest may need to wait a cycle before it can use changes to `libtest`, as it no longer depends on the in-tree libtest.

5 years agoFix f64 test
Jacob Kiesel [Wed, 20 Mar 2019 22:59:46 +0000 (16:59 -0600)]
Fix f64 test

5 years agocleanup: Remove compile-fail-fulldeps directory again
Vadim Petrochenkov [Wed, 20 Mar 2019 22:17:45 +0000 (01:17 +0300)]
cleanup: Remove compile-fail-fulldeps directory again

5 years agoFix formatting and add unit tests for panic cases
Jacob Kiesel [Wed, 20 Mar 2019 21:16:50 +0000 (15:16 -0600)]
Fix formatting and add unit tests for panic cases

5 years agoAdd NAN test to docs
Jacob Kiesel [Wed, 20 Mar 2019 21:07:16 +0000 (15:07 -0600)]
Add NAN test to docs

5 years agoexpand the fixme
Niko Matsakis [Wed, 20 Mar 2019 16:52:36 +0000 (12:52 -0400)]
expand the fixme

5 years agorefactor so that `relate_ty_var` can accommodate vid on a or b side
Niko Matsakis [Wed, 20 Mar 2019 16:45:24 +0000 (12:45 -0400)]
refactor so that `relate_ty_var` can accommodate vid on a or b side

5 years agonll_relate/mod.rs: rustfmt
Niko Matsakis [Wed, 20 Mar 2019 16:45:03 +0000 (12:45 -0400)]
nll_relate/mod.rs: rustfmt

5 years agoFix a bug in implied bounds
scalexm [Fri, 8 Feb 2019 14:37:26 +0000 (15:37 +0100)]
Fix a bug in implied bounds

5 years agoFix a bug in chalk lowering
scalexm [Fri, 8 Feb 2019 14:29:22 +0000 (15:29 +0100)]
Fix a bug in chalk lowering

Some where clauses were not subtituted for generic bound type vars.

5 years agoAdd unsize impls for arrays
scalexm [Fri, 8 Feb 2019 12:10:52 +0000 (13:10 +0100)]
Add unsize impls for arrays

5 years agoReorganize `chalk_context::program_clauses`
scalexm [Fri, 8 Feb 2019 11:44:16 +0000 (12:44 +0100)]
Reorganize `chalk_context::program_clauses`