]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #63299 - spastorino:in-projection-use-ref, r=oli-obk
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:50 +0000 (08:17 +0200)]
Rollup merge of #63299 - spastorino:in-projection-use-ref, r=oli-obk

Make qualify consts in_projection use PlaceRef

r? @oli-obk

4 years agoRollup merge of #63295 - RalfJung:align_offset, r=dtolnay
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:48 +0000 (08:17 +0200)]
Rollup merge of #63295 - RalfJung:align_offset, r=dtolnay

improve align_offset docs

Cc @shepmaster

4 years agoRollup merge of #63293 - shepmaster:align-to-doc, r=RalfJung
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:47 +0000 (08:17 +0200)]
Rollup merge of #63293 - shepmaster:align-to-doc, r=RalfJung

Clarify align_to's requirements and obligations

Based on discussions with @RalfJung around my misunderstandings when using this.

r? @RalfJung

4 years agoRollup merge of #63287 - Mark-Simulacrum:span-no-ref, r=Centril
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:45 +0000 (08:17 +0200)]
Rollup merge of #63287 - Mark-Simulacrum:span-no-ref, r=Centril

Don't store &Span

This is just needless indirection.

4 years agoRollup merge of #63285 - Mark-Simulacrum:rm-await-origin, r=Centril
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:44 +0000 (08:17 +0200)]
Rollup merge of #63285 - Mark-Simulacrum:rm-await-origin, r=Centril

Remove leftover AwaitOrigin

This was missed in PR #62293.

4 years agoRollup merge of #63272 - Mark-Simulacrum:clean-attr, r=petrochenkov
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:42 +0000 (08:17 +0200)]
Rollup merge of #63272 - Mark-Simulacrum:clean-attr, r=petrochenkov

Some more libsyntax::attr cleanup

Much smaller patch than the last one, mostly just finishing up by removing some Span arguments.

r? @petrochenkov

4 years agoRollup merge of #63264 - arielb1:revert-private-coherence-errors, r=estebank
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:41 +0000 (08:17 +0200)]
Rollup merge of #63264 - arielb1:revert-private-coherence-errors, r=estebank

Revert "Rollup merge of #62696 - chocol4te:fix_#62194, r=estebank"

This reverts commit df21a6f040a7011d509769a61ac7af9502636b33 (#62696), reversing
changes made to cc16d0486933e02237190366de2eb43df2215c11.

That PR makes error messages worse than before, and we couldn't come up with a way of actually making them better, so revert it for now. Any idea for making this error message better is welcome!

Fixes #63145.

r? @estebank

4 years agoRollup merge of #63260 - RalfJung:ptr-test, r=matklad
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:39 +0000 (08:17 +0200)]
Rollup merge of #63260 - RalfJung:ptr-test, r=matklad

fix UB in a test

We used to compare two mutable references that were supposed to point to the same thing. That's no good.

Compare them as raw pointers instead.

4 years agoRollup merge of #63230 - tmandry:disallow-possibly-uninitialized, r=Centril
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:38 +0000 (08:17 +0200)]
Rollup merge of #63230 - tmandry:disallow-possibly-uninitialized, r=Centril

Make use of possibly uninitialized data [E0381] a hard error

This is one of the behaviors we no longer allow in NLL. Since it can
lead to undefined behavior, I think it's definitely worth making it a
hard error without waiting to turn off migration mode (#58781).

Closes #60450.

My ulterior motive here is making it impossible to leave variables
partially initialized across a yield (see #60889, discussion at #63035), so
tests are included for that.

cc #54987

---

I'm not sure if bypassing the buffer is a good way of doing this. We could also make a `force_errors_buffer` or similar that gets recombined with all the errors as they are emitted. But this is simpler and seems fine to me.

r? @Centril
cc @cramertj @nikomatsakis @pnkfelix @RalfJung

4 years agoRollup merge of #63184 - JasonShin:master, r=sfackler
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:36 +0000 (08:17 +0200)]
Rollup merge of #63184 - JasonShin:master, r=sfackler

Explaining the reason why validation is performed in to_str of path.rs

I thought it's good to explain the reason for the validation during the conversion between Path/PathBuffer into str, which explains the reason for returning an Option at this point (good for beginners who are reading through the docs).

4 years agoRollup merge of #63017 - matklad:no-fatal, r=petrochenkov
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:34 +0000 (08:17 +0200)]
Rollup merge of #63017 - matklad:no-fatal, r=petrochenkov

Remove special code-path for handing unknown tokens

In `StringReader`, we have a buffer of fatal errors, which is used only in a single case: when we see something which is not a reasonable token at all, like `🦀`. I think a more straightforward thing to do here is to produce an explicit error token in this case, and let the next layer (the parser), deal with it.

However currently this leads to duplicated error messages. What should we do with this? Naively, I would think that emitting (just emitting, not raising) `FatalError` should stop other errors, but looks like this is not the case? We can also probably tweak parser on the case-by-case basis, to avoid emitting "expected" errors if the current token is an `Err`. I personally also fine with cascading errors in this case: it's quite unlikely that you actually type a fully invalid token.

@petrochenkov, which approach should we take to fight cascading errors?

4 years agoRollup merge of #61457 - timvermeulen:double_ended_iters, r=scottmcm
Mazdak Farrokhzad [Tue, 6 Aug 2019 06:17:31 +0000 (08:17 +0200)]
Rollup merge of #61457 - timvermeulen:double_ended_iters, r=scottmcm

Implement DoubleEndedIterator for iter::{StepBy, Peekable, Take}

Now that `DoubleEndedIterator::nth_back` has landed, `StepBy` and `Take` can have an efficient `DoubleEndedIterator` implementation. I don't know if there was any particular reason for `Peekable` not having a `DoubleEndedIterator` implementation, but it's quite trivial and I don't see any drawbacks to having it.

I'm not very happy about the implementation of `Peekable::try_rfold`, but I didn't see another way to only take the value out of `self.peeked` in case `self.iter.try_rfold` didn't exit early.

I only added `Peekable::rfold` (in addition to `try_rfold`) because its `Iterator` implementation has both `fold` and `try_fold` (and for similar reasons I added `Take::try_rfold` but not `Take::rfold`). Do we have any guidelines on whether we want both? If we do want both, maybe we should investigate which iterator adaptors override `try_fold` but not `fold` and add the missing implementations. At the moment I think that it's better to always have iterator adaptors implement both, because some iterators have a simpler `fold` implementation than their `try_fold` implementation.

The tests that I added may not be sufficient because they're all just existing tests where `next`/`nth`/`fold`/`try_fold` are replaced by their DEI counterparts, but I do think all paths are covered. Is there anything in particular that I should probably also test?

4 years agoClarify align_to's requirements and obligations
Jake Goulding [Mon, 5 Aug 2019 15:57:55 +0000 (11:57 -0400)]
Clarify align_to's requirements and obligations

4 years agoMake use of possibly uninitialized data a hard error
Tyler Mandry [Sat, 3 Aug 2019 00:08:16 +0000 (17:08 -0700)]
Make use of possibly uninitialized data a hard error

This is one of the behaviors we no longer allow in NLL. Since it can
lead to undefined behavior, I think it's definitely worth making it a
hard error without waiting to turn off migration mode (#58781).

Closes #60450.

My ulterior motive here is making it impossible to leave variables
partially initialized across a yield (see discussion at #63035), so
tests are included for that.

4 years agoMake qualify consts in_projection use PlaceRef
Santiago Pastorino [Mon, 5 Aug 2019 18:58:07 +0000 (20:58 +0200)]
Make qualify consts in_projection use PlaceRef

4 years agoAuto merge of #59369 - oli-obk:unwrap_usICE, r=eddyb,nikomatsakis
bors [Mon, 5 Aug 2019 19:06:50 +0000 (19:06 +0000)]
Auto merge of #59369 - oli-obk:unwrap_usICE, r=eddyb,nikomatsakis

`unwrap_usize` should at least try to evaluate the underlying constant

r? @eddyb

fixes #59016

I know that I'm still using `ParamEnv` wrongly, but that's a preexisting issue not amplified by this PR.

4 years agoimprove align_offset docs
Ralf Jung [Mon, 5 Aug 2019 16:38:10 +0000 (18:38 +0200)]
improve align_offset docs

4 years agoGet rid of one more useless `lift` invocation
Oliver Scherer [Mon, 5 Aug 2019 15:49:40 +0000 (17:49 +0200)]
Get rid of one more useless `lift` invocation

4 years agoUpdate to new passing-ui-test scheme
Oliver Scherer [Fri, 26 Jul 2019 05:57:42 +0000 (07:57 +0200)]
Update to new passing-ui-test scheme

4 years agoPrevent array length printing cycle with debug assertions
Oliver Scherer [Sun, 26 May 2019 15:33:32 +0000 (17:33 +0200)]
Prevent array length printing cycle with debug assertions

4 years agoFixup: eval_usize needs param env
Oliver Scherer [Sun, 26 May 2019 13:27:04 +0000 (15:27 +0200)]
Fixup: eval_usize needs param env

4 years agoAddress comment and formatting nits
Oliver Scherer [Fri, 17 May 2019 09:13:55 +0000 (11:13 +0200)]
Address comment and formatting nits

4 years agoClear the ParamEnv where its information is irrelevant
Oliver Scherer [Sun, 31 Mar 2019 16:35:39 +0000 (18:35 +0200)]
Clear the ParamEnv where its information is irrelevant

4 years agoFiddle param env through to `try_eval_bits` in most places
Oliver Scherer [Mon, 25 Mar 2019 23:13:09 +0000 (00:13 +0100)]
Fiddle param env through to `try_eval_bits` in most places

4 years agoAdd regression tests
Oliver Scherer [Fri, 22 Mar 2019 17:33:12 +0000 (18:33 +0100)]
Add regression tests

4 years agoDon't abort on unevaluated constants without at least tryting to eval them
Oliver Scherer [Fri, 22 Mar 2019 17:30:35 +0000 (18:30 +0100)]
Don't abort on unevaluated constants without at least tryting to eval them

4 years agoClean up the `ty::Const::assert*` methods
Oliver Scherer [Fri, 22 Mar 2019 16:30:15 +0000 (17:30 +0100)]
Clean up the `ty::Const::assert*` methods

4 years agoAuto merge of #61491 - stjepang:impls-for-accesserror, r=dtolnay
bors [Mon, 5 Aug 2019 15:30:40 +0000 (15:30 +0000)]
Auto merge of #61491 - stjepang:impls-for-accesserror, r=dtolnay

Add a few trait impls for AccessError

4 years agoDon't store &Span
Mark Rousskov [Mon, 5 Aug 2019 14:28:23 +0000 (10:28 -0400)]
Don't store &Span

This is just needless indirection.

4 years agofix slice comparison
Ralf Jung [Mon, 5 Aug 2019 13:30:08 +0000 (15:30 +0200)]
fix slice comparison

Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove leftover AwaitOrigin
Mark Rousskov [Mon, 5 Aug 2019 13:14:51 +0000 (09:14 -0400)]
Remove leftover AwaitOrigin

This was missed in PR #62293.

4 years agoMake mk_attr_id private to libsyntax
Mark Rousskov [Sun, 4 Aug 2019 23:35:29 +0000 (19:35 -0400)]
Make mk_attr_id private to libsyntax

4 years agoDrop explicit span argument from mk_name_value_item
Mark Rousskov [Sun, 4 Aug 2019 22:03:34 +0000 (18:03 -0400)]
Drop explicit span argument from mk_name_value_item

4 years agoDrop span argument from mk_list_item
Mark Rousskov [Sun, 4 Aug 2019 21:59:06 +0000 (17:59 -0400)]
Drop span argument from mk_list_item

4 years agoadapt rustdoc to infailable lexer
Aleksey Kladov [Tue, 30 Jul 2019 10:45:08 +0000 (13:45 +0300)]
adapt rustdoc to infailable lexer

4 years agoadd unknown token
Aleksey Kladov [Tue, 30 Jul 2019 09:31:41 +0000 (12:31 +0300)]
add unknown token

4 years agoremove special code path for unknown tokens
Aleksey Kladov [Tue, 30 Jul 2019 09:33:32 +0000 (12:33 +0300)]
remove special code path for unknown tokens

4 years agoTest content, not value
Ralf Jung [Mon, 5 Aug 2019 09:21:15 +0000 (11:21 +0200)]
Test content, not value

Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoAuto merge of #63079 - RalfJung:ctfe-no-align, r=oli-obk
bors [Mon, 5 Aug 2019 08:16:51 +0000 (08:16 +0000)]
Auto merge of #63079 - RalfJung:ctfe-no-align, r=oli-obk

CTFE: simplify ConstValue by not checking for alignment

I hope the test suite actually covers the problematic cases here?

r? @oli-obk

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

4 years agoAuto merge of #63248 - petrochenkov:nomarker, r=matthewjasper
bors [Mon, 5 Aug 2019 04:36:51 +0000 (04:36 +0000)]
Auto merge of #63248 - petrochenkov:nomarker, r=matthewjasper

Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion infrastructure to elsewhere

As described in https://github.com/rust-lang/rust/pull/62086#issuecomment-515195477.

Reminder:
- `derive(PartialEq, Eq)` makes the type it applied to a "structural match" type, so constants of this type can be used in patterns (and const generics in the future).
- `derive(Copy)` notifies other derives that the type it applied to implements `Copy`, so `derive(Clone)` can generate optimized code and other derives can generate code working with `packed` types and types with `rustc_layout_scalar_valid_range` attributes.

First, the special behavior is now enabled after properly resolving the derives, rather than after textually comparing them with `"Copy"`, `"PartialEq"` and `"Eq"` in `fn add_derived_markers`.

The markers are no longer kept as attributes in AST since derives cannot modify items and previously did it through hacks in the expansion infra.
Instead, the markers are now kept in a "global context" available from all the necessary places, namely - resolver.

For `derive(PartialEq, Eq)` the markers are created by the derive macros themselves and then consumed during HIR lowering to add the `#[structural_match]` attribute in HIR.
This is still a hack, but now it's a hack local to two specific macros rather than affecting the whole expansion infra.
Ideally we should find the way to put `#[structural_match]` on the impls rather than on the original item, and then consume it in `rustc_mir`, then no hacks in expansion and lowering will be required.
(I'll make an issue about this for someone else to solve, after this PR lands.)

The marker for `derive(Copy)` cannot be emitted by the `Copy` macro itself because we need to know it *before* the `Copy` macro is expanded for expanding other macros.
So we have to do it in resolve and block expansion of any derives in a `derive(...)` container until we know for sure whether this container has `Copy` in it or not.
Nasty stuff.

r? @eddyb or @matthewjasper

4 years agoAuto merge of #63245 - RalfJung:miri-error, r=oli-obk
bors [Mon, 5 Aug 2019 00:57:19 +0000 (00:57 +0000)]
Auto merge of #63245 - RalfJung:miri-error, r=oli-obk

More Miri error tweaks

* Add `err_` version of the `_format!` macros
* Add `UbExperimental` variant so that Miri can mark some UB as experimental (e.g. Stacked Borrows)

r? @oli-obk

4 years agoAuto merge of #63213 - varkor:itemkind-tyalias, r=Centril
bors [Sun, 4 Aug 2019 20:03:28 +0000 (20:03 +0000)]
Auto merge of #63213 - varkor:itemkind-tyalias, r=Centril

Rename `ItemKind::Ty` to `ItemKind::TyAlias`

The current name is not entirely clear without context and `TyAlias` is consistent with `ItemKind::TraitAlias`.

4 years agoRename `Target::Ty` to `Target::TyAlias`
varkor [Fri, 2 Aug 2019 20:01:00 +0000 (21:01 +0100)]
Rename `Target::Ty` to `Target::TyAlias`

4 years agoRename `ItemImplKind::Type` to `ItemImplKind::TyAlias`
varkor [Fri, 2 Aug 2019 19:59:07 +0000 (20:59 +0100)]
Rename `ItemImplKind::Type` to `ItemImplKind::TyAlias`

4 years agoRename `ItemKind::Ty` to `ItemKind::TyAlias`
varkor [Fri, 2 Aug 2019 10:02:08 +0000 (11:02 +0100)]
Rename `ItemKind::Ty` to `ItemKind::TyAlias`

4 years agoRevert "Rollup merge of #62696 - chocol4te:fix_#62194, r=estebank"
Ariel Ben-Yehuda [Sun, 4 Aug 2019 16:52:43 +0000 (19:52 +0300)]
Revert "Rollup merge of #62696 - chocol4te:fix_#62194, r=estebank"

This reverts commit df21a6f040a7011d509769a61ac7af9502636b33, reversing
changes made to cc16d0486933e02237190366de2eb43df2215c11.

4 years agoAuto merge of #62816 - estebank:type-ascription-macros, r=petrochenkov
bors [Sun, 4 Aug 2019 16:19:04 +0000 (16:19 +0000)]
Auto merge of #62816 - estebank:type-ascription-macros, r=petrochenkov

Point at type ascription before macro invocation on expansion parse error

Fix https://github.com/rust-lang/rust/issues/47666. Follow up to https://github.com/rust-lang/rust/pull/62791.

r? @petrochenkov

4 years agoAdd #[stable] to Error impl
Stjepan Glavina [Sun, 4 Aug 2019 13:11:08 +0000 (15:11 +0200)]
Add #[stable] to Error impl

4 years agofix UB in a test
Ralf Jung [Sun, 4 Aug 2019 12:12:11 +0000 (14:12 +0200)]
fix UB in a test

4 years agoAuto merge of #63048 - Aaron1011:feature/rustdoc-reexport-doc, r=GuillaumeGomez
bors [Sun, 4 Aug 2019 11:30:12 +0000 (11:30 +0000)]
Auto merge of #63048 - Aaron1011:feature/rustdoc-reexport-doc, r=GuillaumeGomez

Use doc comments from 'pub use' statements

Split off from #62855

Currently, rustdoc ignores any doc comments found on 'pub use'
statements. As described in issue #58700, this makes it impossible to
properly document procedural macros. Any doc comments must be written on
the procedural macro definition, which must occur in a dedicated
proc-macro crate. This means that any doc comments or doc tests cannot
reference items defined in re-exporting crate, despite the fact that
such items may be required to use the procedural macro.

To solve this issue, this commit allows doc comments to be written on
'pub use' statements. For consistency, this applies to *all* 'pub use'
statements, not just those importing procedural macros.

When inlining documentation, documentation on 'pub use' statements will
be prepended to the documentation of the inlined item. For example,
the following items:

```rust

mod other_mod {
    /// Doc comment from definition
    pub struct MyStruct;
}

/// Doc comment from 'pub use'
///
pub use other_mod::MyStruct;
```

will caues the documentation for the re-export of 'MyStruct' to be
rendered as:

```
Doc comment from 'pub use'
Doc comment from definition
```

Note the empty line in the 'pub use' doc comments - because doc comments
are concatenated as-is, this ensure that the doc comments on the
definition start on a new line.

4 years agoAssumptionNotHeld is used only once in Miri and never caught... remove from enum
Ralf Jung [Sun, 4 Aug 2019 09:59:14 +0000 (11:59 +0200)]
AssumptionNotHeld is used only once in Miri and never caught... remove from enum

4 years agomove AssumptionNotHeld to UB
Ralf Jung [Sun, 4 Aug 2019 09:21:41 +0000 (11:21 +0200)]
move AssumptionNotHeld to UB

4 years agoAuto merge of #63233 - RalfJung:get_unchecked, r=Centril
bors [Sun, 4 Aug 2019 07:53:25 +0000 (07:53 +0000)]
Auto merge of #63233 - RalfJung:get_unchecked, r=Centril

clarify that unchecked indexing is UB even if the reference is never used

4 years agofix links
Ralf Jung [Sun, 4 Aug 2019 07:52:36 +0000 (09:52 +0200)]
fix links

relative links do not work because this is included in several places

4 years agoAuto merge of #63199 - ehuss:fix-rustc-guide-toolstate, r=kennytm
bors [Sun, 4 Aug 2019 03:36:10 +0000 (03:36 +0000)]
Auto merge of #63199 - ehuss:fix-rustc-guide-toolstate, r=kennytm

Fix rustc-guide toolstate tracking.

The rustc-guide is still not saving its toolstate.  It needs to be done explicitly.

Note: There are some confusing bits here, like without `--no-fail-fast`, it saves the wrong value in `toolstates.json`.  Also, "rustbook" is always added as "test-fail".  Presumably [this code](https://github.com/rust-lang/rust/blame/63c1f17d950bfefc8f356777f124f304f0575c76/src/bootstrap/tool.rs#L201-L205) assumes everything fails until it passes tests, which is a bit confusing for things that don't run tests.

cc @mark-i-m

4 years agoAuto merge of #63235 - Xanewok:update-rls, r=Centril
bors [Sat, 3 Aug 2019 23:57:22 +0000 (23:57 +0000)]
Auto merge of #63235 - Xanewok:update-rls, r=Centril

Update Rustfmt and RLS

Closes #63195

cc @topecongiro

4 years agoMove special treatment of `derive(Copy, PartialEq, Eq)` from expansion infrastructure...
Vadim Petrochenkov [Sat, 3 Aug 2019 01:22:44 +0000 (04:22 +0300)]
Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion infrastructure to elsewhere

4 years agoAuto merge of #63059 - Centril:sound-bind-by-move, r=matthewjasper
bors [Sat, 3 Aug 2019 20:11:25 +0000 (20:11 +0000)]
Auto merge of #63059 - Centril:sound-bind-by-move, r=matthewjasper

Make `#![feature(bind_by_move_pattern_guards)]` sound without `#[feature(nll)]`

Implements https://github.com/rust-lang/rust/issues/15287#issuecomment-507054617 making `#![feature(bind_by_move_pattern_guards)]]` sound without also having `#![feature(nll)]`. The logic here is that if we see a `match` guard, we will refuse to downgrade NLL errors to warnings. This is in preparation for hopefully stabilizing the former feature in https://github.com/rust-lang/rust/pull/63118.

As fall out from the implementation we also:
Fixes https://github.com/rust-lang/rust/issues/31287
Fixes https://github.com/rust-lang/rust/issues/27282

r? @matthewjasper

4 years agoadd variant for experimental UB (like Stacked Borrows)
Ralf Jung [Sat, 3 Aug 2019 18:36:05 +0000 (20:36 +0200)]
add variant for experimental UB (like Stacked Borrows)

4 years agoalso add macros for free-form error messages
Ralf Jung [Sat, 3 Aug 2019 18:35:52 +0000 (20:35 +0200)]
also add macros for free-form error messages

4 years agoAuto merge of #63242 - pietroalbini:move-azure-pipelines, r=Mark-Simulacrum
bors [Sat, 3 Aug 2019 16:23:31 +0000 (16:23 +0000)]
Auto merge of #63242 - pietroalbini:move-azure-pipelines, r=Mark-Simulacrum

ci: move .azure-pipelines to src/ci/azure-pipelines

As discussed in the last infra meeting this PR moves the Azure Pipelines configuration to `src/ci/azure-pipelines`, to clean up the root directory.

r? @Mark-Simulacrum

4 years agoci: move .azure-pipelines to src/ci/azure-pipelines
Pietro Albini [Sat, 3 Aug 2019 16:15:01 +0000 (18:15 +0200)]
ci: move .azure-pipelines to src/ci/azure-pipelines

4 years agocargotest: servo -> caac107ae8145ef2fd20365e2b8fadaf09c2eb3b
Mazdak Farrokhzad [Sat, 3 Aug 2019 12:53:01 +0000 (14:53 +0200)]
cargotest: servo -> caac107ae8145ef2fd20365e2b8fadaf09c2eb3b

4 years agoAuto merge of #63234 - Centril:rollup-h9t731z, r=Centril
bors [Sat, 3 Aug 2019 12:20:42 +0000 (12:20 +0000)]
Auto merge of #63234 - Centril:rollup-h9t731z, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62954 (Fix typo in Delimited::open_tt)
 - #63146 (Cleanup syntax::attr)
 - #63218 (rustbuild: RISC-V is no longer an experimental LLVM target)
 - #63227 (dead_code: Properly inspect fields in struct patterns with type relative paths)
 - #63229 (A bit of Miri error cleanup)

Failed merges:

r? @ghost

4 years agoApply suggestions from code review
Ralf Jung [Sat, 3 Aug 2019 11:45:15 +0000 (13:45 +0200)]
Apply suggestions from code review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoRollup merge of #63229 - RalfJung:miri-error, r=oli-obk
Mazdak Farrokhzad [Sat, 3 Aug 2019 11:12:04 +0000 (13:12 +0200)]
Rollup merge of #63229 - RalfJung:miri-error, r=oli-obk

A bit of Miri error cleanup

Some cleanup after https://github.com/rust-lang/rust/pull/62969.

r? @oli-obk
Cc @saleemjaffer

4 years agoRollup merge of #63227 - jakubadamw:issue-63151, r=estebank
Mazdak Farrokhzad [Sat, 3 Aug 2019 11:12:02 +0000 (13:12 +0200)]
Rollup merge of #63227 - jakubadamw:issue-63151, r=estebank

dead_code: Properly inspect fields in struct patterns with type relative paths

Closes #63151.

4 years agoRollup merge of #63218 - lenary:riscv-non-experimental, r=alexcrichton
Mazdak Farrokhzad [Sat, 3 Aug 2019 11:12:01 +0000 (13:12 +0200)]
Rollup merge of #63218 - lenary:riscv-non-experimental, r=alexcrichton

rustbuild: RISC-V is no longer an experimental LLVM target

This moves RISC-V from the experimental LLVM targets to the
regular LLVM targets. RISC-V was made non-experimental in
https://reviews.llvm.org/rL366399

I have also sorted the list of LLVM targets, and changed the code
around setting llvm_exp_targets (and its default) to match the code
setting llvm_targets (and its default), ensuring future changes to
the defaults, as LLVM targets become stable, affect as few places as
possible.

Given WebAssembly is in `LLVM_ALL_TARGETS` and is therefore built by default (and has been since October 2018), I'm not sure why rust still has it in `experimental-targets`. I'm happy to update this PR to move it into the main list of LLVM targets.

r? @alexcrichton

4 years agoRollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkov
Mazdak Farrokhzad [Sat, 3 Aug 2019 11:11:59 +0000 (13:11 +0200)]
Rollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkov

Cleanup syntax::attr

Mostly removing needless arguments to constructors

r? @petrochenkov

4 years agoRollup merge of #62954 - ia0:fix_typo_span, r=Centril
Mazdak Farrokhzad [Sat, 3 Aug 2019 11:11:57 +0000 (13:11 +0200)]
Rollup merge of #62954 - ia0:fix_typo_span, r=Centril

Fix typo in Delimited::open_tt

4 years agoUpdate Rustfmt and RLS
Igor Matuszewski [Sat, 3 Aug 2019 11:05:42 +0000 (13:05 +0200)]
Update Rustfmt and RLS

4 years agoclarify that unchecked indexing is UB even if the reference is never used
Ralf Jung [Sat, 3 Aug 2019 10:46:20 +0000 (12:46 +0200)]
clarify that unchecked indexing is UB even if the reference is never used

4 years agoAuto merge of #62946 - RalfJung:miri_type_dispatch_first, r=oli-obk
bors [Sat, 3 Aug 2019 08:33:07 +0000 (08:33 +0000)]
Auto merge of #62946 - RalfJung:miri_type_dispatch_first, r=oli-obk

Miri: dispatch first on the type

Based on the fact that Miri now always has intptrcast available, we can change binops and casts to first check the type of the source operand and then decide based on that what to do, instead of considering the value (pointer vs bits) first.

4 years agoFix rustc-guide toolstate tracking.
Eric Huss [Thu, 1 Aug 2019 20:18:12 +0000 (13:18 -0700)]
Fix rustc-guide toolstate tracking.

4 years agoAuto merge of #63180 - varkor:trait-alias-impl-trait, r=Centril
bors [Sat, 3 Aug 2019 02:21:23 +0000 (02:21 +0000)]
Auto merge of #63180 - varkor:trait-alias-impl-trait, r=Centril

Change opaque type syntax from `existential type` to type alias `impl Trait`

This implements a new feature gate `type_alias_impl_trait` (this is slightly different from the originally proposed feature name, but matches what has been used in discussion since), deprecating the old `existential_types` feature.

The syntax for opaque types has been changed. In addition, the "existential" terminology has been replaced with "opaque", as per previous discussion and the RFC.

This makes partial progress towards implementing https://github.com/rust-lang/rust/issues/63063.

r? @Centril

4 years agoAuto merge of #63228 - Centril:rollup-x39p5ga, r=Centril
bors [Fri, 2 Aug 2019 22:44:53 +0000 (22:44 +0000)]
Auto merge of #63228 - Centril:rollup-x39p5ga, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #63107 (Added support for armv7-unknown-linux-gnueabi/musleabi)
 - #63121 (On `format!()` arg count mismatch provide extra info)
 - #63196 (build_helper: try less confusing method names)
 - #63206 (remove unsupported test case)
 - #63208 (Round generator sizes to a multiple of their alignment)
 - #63212 (Pretty print attributes in `print_arg`)
 - #63215 (Clarify semantics of mem::zeroed)

Failed merges:

r? @ghost

4 years agobless
Ralf Jung [Fri, 2 Aug 2019 22:20:06 +0000 (00:20 +0200)]
bless

4 years agoRollup merge of #63215 - gnzlbg:patch-6, r=Centril
Mazdak Farrokhzad [Fri, 2 Aug 2019 22:09:14 +0000 (00:09 +0200)]
Rollup merge of #63215 - gnzlbg:patch-6, r=Centril

Clarify semantics of mem::zeroed

Clarifies the semantics of `mem::zeroed`.

r? @Centril

cc @RalfJung

4 years agoRollup merge of #63212 - Centril:param-attrs-pretty, r=davidtwco
Mazdak Farrokhzad [Fri, 2 Aug 2019 22:09:12 +0000 (00:09 +0200)]
Rollup merge of #63212 - Centril:param-attrs-pretty, r=davidtwco

Pretty print attributes in `print_arg`

Fixes https://github.com/rust-lang/rust/issues/63210.
cc https://github.com/rust-lang/rust/issues/60406

r? @petrochenkov

4 years agoRollup merge of #63208 - tmandry:issue-62658, r=cramertj
Mazdak Farrokhzad [Fri, 2 Aug 2019 22:09:11 +0000 (00:09 +0200)]
Rollup merge of #63208 - tmandry:issue-62658, r=cramertj

Round generator sizes to a multiple of their alignment

Fixes #62658.

r? @cramertj
cc @eddyb

4 years agoRollup merge of #63206 - BaoshanPang:master, r=alexcrichton
Mazdak Farrokhzad [Fri, 2 Aug 2019 22:09:09 +0000 (00:09 +0200)]
Rollup merge of #63206 - BaoshanPang:master, r=alexcrichton

remove unsupported test case

r? @alexcrichton

4 years agoRollup merge of #63196 - RalfJung:build_helper, r=alexcrichton
Mazdak Farrokhzad [Fri, 2 Aug 2019 22:09:07 +0000 (00:09 +0200)]
Rollup merge of #63196 - RalfJung:build_helper, r=alexcrichton

build_helper: try less confusing method names

build_helper's `*_silent` methods were likely called that way because they do not print the command being run to stdout. [In the original file this all makes sense](https://github.com/rust-lang/rust/commit/046e6874c47ec55e23b7a566bca51d2920562485#diff-5c3d6537a43ecae03014e118a7fe3321). But later it also gained `*_suppressed` methods and the difference between `silent` and `suppressed` is far from clear.

So rename `run` (which prints the command being run) to `run_verbose`. Then we can call the methods that just run a command and show its output but nothing extra `run` and `try_run`.

`run_verbose` (formerly `run`) is unused from what I can tell. Should I remove it?

r? @alexcrichton
Cc @Mark-Simulacrum
Also see https://github.com/rust-lang/rust/pull/63089#discussion_r308018890.

4 years agoRollup merge of #63121 - estebank:formatting-pos, r=alexcrichton
Mazdak Farrokhzad [Fri, 2 Aug 2019 22:09:06 +0000 (00:09 +0200)]
Rollup merge of #63121 - estebank:formatting-pos, r=alexcrichton

On `format!()` arg count mismatch provide extra info

When positional width and precision formatting flags are present in a
formatting string that has an argument count mismatch, provide extra
information pointing at them making it easiser to understand where the
problem may lay:

```
error: 4 positional arguments in format string, but there are 3 arguments
  --> $DIR/ifmt-bad-arg.rs:78:15
   |
LL |     println!("{} {:.*} {}", 1, 3.2, 4);
   |               ^^ ^^--^ ^^      --- this parameter corresponds to the precision flag
   |                    |
   |                    this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
   |
   = note: positional arguments are zero-based
   = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html

error: 4 positional arguments in format string, but there are 3 arguments
  --> $DIR/ifmt-bad-arg.rs:81:15
   |
LL |     println!("{} {:07$.*} {}", 1, 3.2, 4);
   |               ^^ ^^-----^ ^^      --- this parameter corresponds to the precision flag
   |                    |  |
   |                    |  this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
   |                    this width flag expects an `usize` argument at position 7, but there are 3 arguments
   |
   = note: positional arguments are zero-based
   = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html

error: invalid reference to positional argument 7 (there are 3 arguments)
  --> $DIR/ifmt-bad-arg.rs:84:18
   |
LL |     println!("{} {:07$} {}", 1, 3.2, 4);
   |                  ^^^--^
   |                     |
   |                     this width flag expects an `usize` argument at position 7, but there are 3 arguments
   |
   = note: positional arguments are zero-based
   = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
```

Fix #49384.

4 years agoRollup merge of #63107 - adrian-budau:master, r=alexcrichton
Mazdak Farrokhzad [Fri, 2 Aug 2019 22:09:04 +0000 (00:09 +0200)]
Rollup merge of #63107 - adrian-budau:master, r=alexcrichton

Added support for armv7-unknown-linux-gnueabi/musleabi

Fixes #63101

Some things that are not done and I hope someone can help me with:

* During the ci build of `armv7-unknown-linux-gnueabi` `openssl` must be built (to build cargo) but `openssl` does not yet support this target. This feels slightly like a chicken-and-egg problem, any feedback is welcome.
* Should I add any tests for any of these targets?

4 years agodead_code: Properly inspect fields in struct patterns with type relative paths
Jakub Adam Wieczorek [Fri, 2 Aug 2019 20:57:29 +0000 (20:57 +0000)]
dead_code: Properly inspect fields in struct patterns with type relative paths

4 years agodedup free-form Unsupported errors; add macros for free-form UB and Unsupported cases
Ralf Jung [Fri, 2 Aug 2019 21:41:24 +0000 (23:41 +0200)]
dedup free-form Unsupported errors; add macros for free-form UB and Unsupported cases

4 years agobe less British
Ralf Jung [Fri, 2 Aug 2019 21:24:27 +0000 (23:24 +0200)]
be less British

4 years agofix rebase fallout
Ralf Jung [Thu, 1 Aug 2019 07:12:48 +0000 (09:12 +0200)]
fix rebase fallout

4 years agoconst_prop no longer does ptr-to-int casts
Ralf Jung [Thu, 25 Jul 2019 08:47:11 +0000 (10:47 +0200)]
const_prop no longer does ptr-to-int casts

4 years agobless all the things
Ralf Jung [Thu, 25 Jul 2019 07:11:53 +0000 (09:11 +0200)]
bless all the things

4 years agotrailing full stops
Ralf Jung [Thu, 25 Jul 2019 07:08:00 +0000 (09:08 +0200)]
trailing full stops

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoadd is_any_ptr type test; this also helps pacify tidy
Ralf Jung [Wed, 24 Jul 2019 23:02:41 +0000 (01:02 +0200)]
add is_any_ptr type test; this also helps pacify tidy

4 years agoget rid of some remaining type-based dispatching in cast code
Ralf Jung [Wed, 24 Jul 2019 22:22:05 +0000 (00:22 +0200)]
get rid of some remaining type-based dispatching in cast code

4 years agoalso test error messages
Ralf Jung [Mon, 29 Jul 2019 13:34:40 +0000 (15:34 +0200)]
also test error messages

4 years agomiri: validity checks alignment even when machine otherwise does not
Ralf Jung [Mon, 29 Jul 2019 13:27:01 +0000 (15:27 +0200)]
miri: validity checks alignment even when machine otherwise does not

4 years agoassert consistency
Ralf Jung [Sun, 28 Jul 2019 16:17:58 +0000 (18:17 +0200)]
assert consistency

4 years agotidy is reaching new levels every day...
Ralf Jung [Sun, 28 Jul 2019 12:01:27 +0000 (14:01 +0200)]
tidy is reaching new levels every day...

4 years agoCTFE: simplify Value type by not checking for alignment
Ralf Jung [Sun, 28 Jul 2019 11:44:11 +0000 (13:44 +0200)]
CTFE: simplify Value type by not checking for alignment

4 years agoimprove error when CTFE does ptr-int-cast; update tests
Ralf Jung [Wed, 24 Jul 2019 22:06:47 +0000 (00:06 +0200)]
improve error when CTFE does ptr-int-cast; update tests

4 years agofix casts from fat pointers
Ralf Jung [Wed, 24 Jul 2019 18:09:18 +0000 (20:09 +0200)]
fix casts from fat pointers