]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #60780 - RalfJung:miri, r=oli-obk
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:19 +0000 (22:00 +0200)]
Rollup merge of #60780 - RalfJung:miri, r=oli-obk

fix Miri

This reverts https://github.com/rust-lang/rust/pull/60156, which turned out to be a dead end (see https://github.com/rust-lang/rust/pull/60469).

r? @oli-obk

5 years agoRollup merge of #60719 - varkor:xpy-test-folder, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:16 +0000 (22:00 +0200)]
Rollup merge of #60719 - varkor:xpy-test-folder, r=Mark-Simulacrum

Allow subdirectories to be tested by x.py test

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

As far as I can tell, multiple `--test-args` flags are ignored (only the first is respected), so if you specify a subdirectory, you won't also be able to filter using `--test-args`. If you don't specify a subdirectory, `--test-args` will continue working as usual, so this is strictly an improvement on the current state of affairs.

5 years agoRollup merge of #60444 - nikomatsakis:issue-60010-cycle-error-investigation, r=pnkfelix
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:13 +0000 (22:00 +0200)]
Rollup merge of #60444 - nikomatsakis:issue-60010-cycle-error-investigation, r=pnkfelix

forego caching for all participants in cycles, apart from root node

This is a targeted fix for #60010, which uncovered a pretty bad failure of our caching strategy in the face of coinductive cycles. The problem is explained in the comment in the PR on the new field, `in_cycle`, but I'll reproduce it here:

> Starts out as false -- if, during evaluation, we encounter a
> cycle, then we will set this flag to true for all participants
> in the cycle (apart from the "head" node). These participants
> will then forego caching their results. This is not the most
> efficient solution, but it addresses #60010. The problem we
> are trying to prevent:
>
> - If you have `A: AutoTrait` requires `B: AutoTrait` and `C: NonAutoTrait`
> - `B: AutoTrait` requires `A: AutoTrait` (coinductive cycle, ok)
> - `C: NonAutoTrait` requires `A: AutoTrait` (non-coinductive cycle, not ok)
>
> you don't want to cache that `B: AutoTrait` or `A: AutoTrait`
> is `EvaluatedToOk`; this is because they were only considered
> ok on the premise that if `A: AutoTrait` held, but we indeed
> encountered a problem (later on) with `A: AutoTrait. So we
> currently set a flag on the stack node for `B: AutoTrait` (as
> well as the second instance of `A: AutoTrait`) to supress
> caching.
>
> This is a simple, targeted fix. The correct fix requires
> deeper changes, but would permit more caching: we could
> basically defer caching until we have fully evaluated the
> tree, and then cache the entire tree at once.

I'm not sure what the impact of this fix will be in terms of existing crates or performance: we were accepting incorrect code before, so there will perhaps be some regressions, and we are now caching less.

As the comment above notes, we could do a lot better than this fix, but that would involve more invasive rewrites. I thought it best to start with something simple.

r? @pnkfelix -- but let's do crater/perf run
cc @arielb1

5 years agoRollup merge of #60443 - RalfJung:as_ptr, r=SimonSapin
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:11 +0000 (22:00 +0200)]
Rollup merge of #60443 - RalfJung:as_ptr, r=SimonSapin

as_ptr returns a read-only pointer

Add comments to `as_ptr` methods to warn that these are read-only pointers, and writing to them is UB.

[It was pointed out](https://internals.rust-lang.org/t/as-ptr-vs-as-mut-ptr/9940) that `CStr` does not even have an `as_mut_ptr`. I originally was going to add one, but there is no method at all that would mutate a `CStr`. Was that a deliberate choice or should I add an `as_mut_ptr` (similar to [what I did for `str`](https://github.com/rust-lang/rust/pull/58200))?

5 years agoRollup merge of #60130 - khuey:efficient_last, r=sfackler
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:09 +0000 (22:00 +0200)]
Rollup merge of #60130 - khuey:efficient_last, r=sfackler

Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators

Provided a `DoubleEndedIterator` has finite length, `Iterator::last` is equivalent to `DoubleEndedIterator::next_back`. But searching forwards through the iterator when it's unnecessary is obviously not good for performance. I ran into this on one of the collection iterators.

I tried adding appropriate overloads for a bunch of the iterator adapters like filter, map, etc, but I ran into a lot of type inference failures after doing so.

The other interesting case is what to do with `Repeat`. Do we consider it part of the contract that `Iterator::last` will loop forever on it? The docs do say that the iterator will be evaluated until it returns None. This is also relevant for the adapters, it's trivially easy to observe whether a `Map` adapter invoked its closure a zillion times or just once for the last element.

5 years agoAuto merge of #60787 - alexcrichton:error-type-id-destabilize-master, r=pietroalbini
bors [Tue, 14 May 2019 15:58:33 +0000 (15:58 +0000)]
Auto merge of #60787 - alexcrichton:error-type-id-destabilize-master, r=pietroalbini

Destabilize the `Error::type_id` function

This commit destabilizes the `Error::type_id` function in the standard library.
This does so by effectively reverting #58048, restoring the `#[unstable]`
attribute. The security mailing list has recently been notified of a
vulnerability relating to the stabilization of this function. First stabilized
in Rust 1.34.0, a stable function here allows users to implement a custom
return value for this function:

    struct MyType;

    impl Error for MyType {
fn type_id(&self) -> TypeId {
    // Enable safe casting to `String` by accident.
    TypeId::of::<String>()
}
    }

This, when combined with the `Error::downcast` family of functions, allows
safely casting a type to any other type, clearly a memory safety issue! A
formal announcement has been made to the [security mailing list](https://groups.google.com/forum/#!topic/rustlang-security-announcements/aZabeCMUv70) as well as [the blog](https://blog.rust-lang.org/2019/05/13/Security-advisory.html)

This commit simply destabilizes the `Error::type_id` which, although breaking
for users since Rust 1.34.0, is hoped to have little impact and has been deemed
sufficient to mitigate this issue for the stable channel. The long-term fate of
the `Error::type_id` API will be discussed at #60784.

5 years agoAdd comment
varkor [Tue, 14 May 2019 08:42:32 +0000 (09:42 +0100)]
Add comment

5 years agoAuto merge of #60794 - Centril:rollup-vlguvns, r=Centril
bors [Tue, 14 May 2019 03:09:46 +0000 (03:09 +0000)]
Auto merge of #60794 - Centril:rollup-vlguvns, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #60176 (Explain error when yielding a reference to a local variable)
 - #60201 (coretest: Downgrade deny to warn)
 - #60562 (Add #[doc(hidden)] attribute on compiler generated module.)
 - #60710 (Use `delay_span_bug` for error cases when checking `AnonConst` parent)
 - #60770 (add impl_trait_in_bindings to INCOMPLETE_FEATURES)

Failed merges:

r? @ghost

5 years agoupdate miri
Ralf Jung [Mon, 13 May 2019 09:39:30 +0000 (11:39 +0200)]
update miri

5 years agoRollup merge of #60770 - Pulkit07:issue60764, r=Centril
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:55 +0000 (21:36 +0200)]
Rollup merge of #60770 - Pulkit07:issue60764, r=Centril

add impl_trait_in_bindings to INCOMPLETE_FEATURES

impl_trait_in_bindings is not yet complete and can lead to compiler crashes.

Fixes #60764.

5 years agoRollup merge of #60710 - varkor:delay_span_bug-const-parent, r=matthewjasper
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:54 +0000 (21:36 +0200)]
Rollup merge of #60710 - varkor:delay_span_bug-const-parent, r=matthewjasper

Use `delay_span_bug` for error cases when checking `AnonConst` parent

Fixes #60704.
Fixes #60650.

5 years agoRollup merge of #60562 - iliekturtles:proc-macro-missing-docs, r=alexcrichton
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:52 +0000 (21:36 +0200)]
Rollup merge of #60562 - iliekturtles:proc-macro-missing-docs, r=alexcrichton

Add #[doc(hidden)] attribute on compiler generated module.

Resolves unavoidable `missing_docs` warning/error on proc-macro crates.
Resolves #42008.

Changes not yet tested locally, however I wanted to submit first since `rustc` takes forever to compile.

5 years agoRollup merge of #60201 - RalfJung:core-tests, r=alexcrichton
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:51 +0000 (21:36 +0200)]
Rollup merge of #60201 - RalfJung:core-tests, r=alexcrichton

coretest: Downgrade deny to warn

The `deny` causes a build failure in https://github.com/RalfJung/miri-test-libstd. Since we use `-D warnings` for rustc builds, `warn` should be enough to lead to compile errors here, without impeding external builds.

5 years agoRollup merge of #60176 - matthewjasper:yield-ref-to-local, r=pnkfelix
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:49 +0000 (21:36 +0200)]
Rollup merge of #60176 - matthewjasper:yield-ref-to-local, r=pnkfelix

Explain error when yielding a reference to a local variable

Closes #56508

5 years agoadd impl_trait_in_bindings to INCOMPLETE_FEATURES
Pulkit Goyal [Sun, 12 May 2019 21:37:05 +0000 (00:37 +0300)]
add impl_trait_in_bindings to INCOMPLETE_FEATURES

impl_trait_in_bindings is not yet complete and can lead to compiler crashes.

Fixes #60764.

5 years agoadd release notes for rust 1.34.2
Pietro Albini [Mon, 13 May 2019 15:30:14 +0000 (17:30 +0200)]
add release notes for rust 1.34.2

5 years agoDestabilize the `Error::type_id` function
Alex Crichton [Mon, 13 May 2019 15:14:02 +0000 (08:14 -0700)]
Destabilize the `Error::type_id` function

This commit destabilizes the `Error::type_id` function in the standard library.
This does so by effectively reverting #58048, restoring the `#[unstable]`
attribute. The security mailing list has recently been notified of a
vulnerability relating to the stabilization of this function. First stabilized
in Rust 1.34.0, a stable function here allows users to implement a custom
return value for this function:

    struct MyType;

    impl Error for MyType {
fn type_id(&self) -> TypeId {
    // Enable safe casting to `String` by accident.
    TypeId::of::<String>()
}
    }

This, when combined with the `Error::downcast` family of functions, allows
safely casting a type to any other type, clearly a memory safety issue! A
security announcement will be shortly posted to the security mailing list as
well as the Rust Blog, and when those links are available they'll be filled in
for this PR as well.

This commit simply destabilizes the `Error::type_id` which, although breaking
for users since Rust 1.34.0, is hoped to have little impact and has been deemed
sufficient to mitigate this issue for the stable channel. The long-term fate of
the `Error::type_id` API will be discussed at #60784.

5 years agomodify comment
Felix S Klock II [Mon, 13 May 2019 11:29:49 +0000 (13:29 +0200)]
modify comment

modify the comment on `in_cycle` to reflect changes requested by ariel and myself.

5 years agoAuto merge of #60649 - Xanewok:save-analysis-assoc-const-ice, r=oli-obk
bors [Mon, 13 May 2019 10:57:59 +0000 (10:57 +0000)]
Auto merge of #60649 - Xanewok:save-analysis-assoc-const-ice, r=oli-obk

save-analysis: Fix ICE when processing associated constant

Closes #59134
Closes https://github.com/rust-lang/rls/issues/1449

Thanks @swgillespie for helping tracking this down and fixing it!

r? @eddyb

5 years agoRevert "use SecRandomCopyBytes on macOS in Miri"
Ralf Jung [Mon, 13 May 2019 09:34:11 +0000 (11:34 +0200)]
Revert "use SecRandomCopyBytes on macOS in Miri"

This reverts commit 54aefc6a2d076b74921a8d78c5d8c68c13bfa4a7.

5 years agoAuto merge of #60765 - matthewjasper:fix-more-escaping-rescopes, r=oli-obk
bors [Mon, 13 May 2019 08:13:01 +0000 (08:13 +0000)]
Auto merge of #60765 - matthewjasper:fix-more-escaping-rescopes, r=oli-obk

Fix more escaping ReScopes

Closes #58840

5 years agoAuto merge of #60630 - nnethercote:use-Symbol-more, r=petrochenkov
bors [Mon, 13 May 2019 00:28:38 +0000 (00:28 +0000)]
Auto merge of #60630 - nnethercote:use-Symbol-more, r=petrochenkov

Use `Symbol` more

A `Symbol` can be equated with a string (e.g. `&str`). This involves a
TLS lookup to get the chars (and a Mutex lock in a parallel compiler)
and then a char-by-char comparison. This functionality is convenient but
avoids one of the main benefits of `Symbol`s, which is fast equality
comparisons.

This PR removes the `Symbol`/string equality operations, forcing a lot
of existing string occurrences to become `Symbol`s. Fortunately, these
are almost all static strings (many are attribute names) and we can add
static `Symbol`s as necessary, and very little extra interning occurs.
The benefits are (a) a slight speedup (possibly greater in a parallel
compiler), and (b) the code is a lot more principled about `Symbol` use.
The main downside is verbosity, particularly with more `use
syntax::symbol::symbols` items.

r? @Zoxc

5 years agoReturn a `Symbol` from `name_or_empty` functions.
Nicholas Nethercote [Wed, 8 May 2019 04:33:06 +0000 (14:33 +1000)]
Return a `Symbol` from `name_or_empty` functions.

5 years agoRemove the equality operation between `Symbol` and strings.
Nicholas Nethercote [Tue, 7 May 2019 06:03:44 +0000 (16:03 +1000)]
Remove the equality operation between `Symbol` and strings.

And also the equality between `Path` and strings, because `Path` is made
up of `Symbol`s.

5 years agoPass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.
Nicholas Nethercote [Wed, 8 May 2019 03:21:18 +0000 (13:21 +1000)]
Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.

5 years agoRename `syntax::symbol::symbols` as `syntax::symbol::sym`.
Nicholas Nethercote [Thu, 9 May 2019 23:57:08 +0000 (09:57 +1000)]
Rename `syntax::symbol::symbols` as `syntax::symbol::sym`.

Because it's going to be used a lot.

5 years agoAdd lots of static `Symbols`.
Nicholas Nethercote [Mon, 6 May 2019 23:55:12 +0000 (09:55 +1000)]
Add lots of static `Symbols`.

These will be used in the subsequent commits. Many of them are
attributes.

The commit also adds the ability to handle symbols that aren't
identifiers (e.g. "proc-macro").

5 years agoAuto merge of #60767 - Centril:rollup-4cbsb73, r=Centril
bors [Sun, 12 May 2019 20:28:19 +0000 (20:28 +0000)]
Auto merge of #60767 - Centril:rollup-4cbsb73, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #60694 (Fix HIR printing of existential type #60662)
 - #60750 (syntax: Remove some legacy nonterminal tokens)
 - #60751 (Assorted cleanup in parser & AST validation)
 - #60752 (Fix minor typos for ItemLocalId)

Failed merges:

r? @ghost

5 years agoRollup merge of #60752 - shiatsumat:minor-typos-hir, r=wesleywiser
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:11 +0000 (21:14 +0200)]
Rollup merge of #60752 - shiatsumat:minor-typos-hir, r=wesleywiser

Fix minor typos for ItemLocalId

* added comma after 'that is'
* "can be implement" -> "can be implemented"

5 years agoRollup merge of #60751 - Centril:general-cleanup, r=petrochenkov
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:10 +0000 (21:14 +0200)]
Rollup merge of #60751 - Centril:general-cleanup, r=petrochenkov

Assorted cleanup in parser & AST validation

r? @petrochenkov

Extracted out of a larger PR.

5 years agoRollup merge of #60750 - petrochenkov:noquotok2, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:08 +0000 (21:14 +0200)]
Rollup merge of #60750 - petrochenkov:noquotok2, r=Mark-Simulacrum

syntax: Remove some legacy nonterminal tokens

They were used by legacy quote macros removed in https://github.com/rust-lang/rust/pull/51285.

5 years agoRollup merge of #60694 - Pulkit07:issue60662, r=alexreg
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:07 +0000 (21:14 +0200)]
Rollup merge of #60694 - Pulkit07:issue60662, r=alexreg

Fix HIR printing of existential type #60662

This fixes https://github.com/rust-lang/rust/issues/60662

5 years agoDon't allow any ReScope in impl trait types
Matthew Jasper [Sun, 12 May 2019 17:51:40 +0000 (18:51 +0100)]
Don't allow any ReScope in impl trait types

This shouldn't be possible any more, but if it does happen, emit an
error rather than maybe panicking later when NLL finds a the ReScope.
Impl trait in bindings is sufficiently broken that I don't think this
breaks anything that works for it.

5 years agoAuto merge of #60679 - petrochenkov:lit2, r=matklad
bors [Sun, 12 May 2019 17:44:06 +0000 (17:44 +0000)]
Auto merge of #60679 - petrochenkov:lit2, r=matklad

Keep original literal tokens in AST

The original literal tokens (`token::Lit`) are kept in AST until lowering to HIR.

The tokens are kept together with their lowered "semantic" representation (`ast::LitKind`), so the size of `ast::Lit` is increased (this also increases the size of meta-item structs used for processing built-in attributes).
However, the size of `ast::Expr` stays the same.

The intent is to remove the "semantic" representation from AST eventually and keep literals as tokens until lowering to HIR (at least), and I'm going to work on that, but it would be good to land this sooner to unblock progress on the [lexer refactoring](https://github.com/rust-lang/rust/pull/59706).

Fixes a part of https://github.com/rust-lang/rust/issues/43081 (literal tokens that are passed to proc macros are always precise, including hexadecimal numbers, strings with their original escaping, etc)
Fixes a part of https://github.com/rust-lang/rust/issues/60495 (everything except for proc macro API doesn't need escaping anymore)
This also allows to eliminate a certain hack from the lexer (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/pretty-printing.20comments/near/165005357).

cc @matklad

5 years agoTreat generators the same as closure for escaping lifetimes
Matthew Jasper [Sun, 12 May 2019 16:52:33 +0000 (17:52 +0100)]
Treat generators the same as closure for escaping lifetimes

5 years agoAlways use the stronger outlives version for opaque types
Matthew Jasper [Sun, 12 May 2019 16:12:49 +0000 (17:12 +0100)]
Always use the stronger outlives version for opaque types

5 years agoAuto merge of #60244 - SimonSapin:dangling, r=oli-obk
bors [Sun, 12 May 2019 14:32:11 +0000 (14:32 +0000)]
Auto merge of #60244 - SimonSapin:dangling, r=oli-obk

const-stabilize NonNull::dangling and NonNull::cast

5 years agoAuto merge of #60474 - mati865:musl_toolchain, r=alexcrichton
bors [Sun, 12 May 2019 09:19:28 +0000 (09:19 +0000)]
Auto merge of #60474 - mati865:musl_toolchain, r=alexcrichton

 Make tests compatible with musl host

As an alternative to passing explicit linker all over the place I could try linking `cc` to musl gcc since this bootstraps itself.

Assigning for discussion:
r? @alexcrichton

5 years agoAuto merge of #60396 - cuviper:ordered-retain, r=scottmcm
bors [Sun, 12 May 2019 06:24:10 +0000 (06:24 +0000)]
Auto merge of #60396 - cuviper:ordered-retain, r=scottmcm

Document the order of {Vec,VecDeque,String}::retain

It's natural for `retain` to work in order from beginning to end, but
this wasn't actually documented to be the case. If we actually promise
this, then the caller can do useful things like track the index of each
element being tested, as [discussed in the forum][1]. This is now
documented for `Vec`, `VecDeque`, and `String`.

[1]: https://users.rust-lang.org/t/vec-retain-by-index/27697

`HashMap` and `HashSet` also have `retain`, and the `hashbrown`
implementation does happen to use a plain `iter()` order too, but it's
not certain that this should always be the case for these types.

r? @scottmcm

5 years agoFix minor typos for ItemLocalId
Yusuke Matsushita [Sun, 12 May 2019 00:52:38 +0000 (09:52 +0900)]
Fix minor typos for ItemLocalId

* added comma before 'that is'
* "can be implement" -> "can be implemented"

5 years agoMinor cleanup in parse_assoc_expr_with.
Mazdak Farrokhzad [Sun, 12 May 2019 00:17:34 +0000 (02:17 +0200)]
Minor cleanup in parse_assoc_expr_with.

5 years agoparse_bottom_expr: extract common 'return' out.
Mazdak Farrokhzad [Sun, 12 May 2019 00:01:32 +0000 (02:01 +0200)]
parse_bottom_expr: extract common 'return' out.

5 years agosyntax::parse::parser: convert unnecessary '&mut self's to '&self'.
Mazdak Farrokhzad [Sun, 12 May 2019 00:00:06 +0000 (02:00 +0200)]
syntax::parse::parser: convert unnecessary '&mut self's to '&self'.

5 years agoast_validation: comments -> doc comments
Mazdak Farrokhzad [Sun, 5 May 2019 12:06:04 +0000 (14:06 +0200)]
ast_validation: comments -> doc comments

5 years agosyntax: Remove some legacy nonterminal tokens
Vadim Petrochenkov [Sat, 11 May 2019 19:44:33 +0000 (22:44 +0300)]
syntax: Remove some legacy nonterminal tokens

5 years agoFix HIR printing of existential type #60662
Pulkit Goyal [Thu, 9 May 2019 18:32:33 +0000 (21:32 +0300)]
Fix HIR printing of existential type #60662

This fixes https://github.com/rust-lang/rust/issues/60662

5 years agoAuto merge of #60748 - Centril:rollup-rr63jqo, r=Centril
bors [Sat, 11 May 2019 22:13:10 +0000 (22:13 +0000)]
Auto merge of #60748 - Centril:rollup-rr63jqo, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #60720 (Remove unnecessary unwraps)
 - #60727 (add comment to `Rc`/`Arc`'s `Eq` specialization)
 - #60733 (Cleanup the .await HIR lowering with .stmt(..).)
 - #60741 (Remove redundant "let mut" in write_graph_label)

Failed merges:

r? @ghost

5 years agoRollup merge of #60741 - shiatsumat:patch-let-mut-write-graph-label, r=varkor
Mazdak Farrokhzad [Sat, 11 May 2019 21:41:41 +0000 (23:41 +0200)]
Rollup merge of #60741 - shiatsumat:patch-let-mut-write-graph-label, r=varkor

Remove redundant "let mut" in write_graph_label

Removed the redundant "let mut" in the write_graph_label function (it caused "let mut let mut" for non-user-defined local variables).

5 years agoRollup merge of #60733 - Centril:cleanup-lowering-await, r=varkor
Mazdak Farrokhzad [Sat, 11 May 2019 21:41:40 +0000 (23:41 +0200)]
Rollup merge of #60733 - Centril:cleanup-lowering-await, r=varkor

Cleanup the .await HIR lowering with .stmt(..).

r? @cramertj

5 years agoRollup merge of #60727 - chpio:master, r=sfackler
Mazdak Farrokhzad [Sat, 11 May 2019 21:41:38 +0000 (23:41 +0200)]
Rollup merge of #60727 - chpio:master, r=sfackler

add comment to `Rc`/`Arc`'s `Eq` specialization

in addition to https://github.com/rust-lang/rust/pull/56550

https://github.com/rust-lang/rust/pull/42965#issuecomment-312702479

5 years agoRollup merge of #60720 - estebank:no-ice-thanks, r=zackmdavis
Mazdak Farrokhzad [Sat, 11 May 2019 21:41:37 +0000 (23:41 +0200)]
Rollup merge of #60720 - estebank:no-ice-thanks, r=zackmdavis

Remove unnecessary unwraps

Fix #60713.

5 years agoAuto merge of #60318 - jethrogb:jb/try-from-slice-to-infallible, r=sfackler
bors [Sat, 11 May 2019 19:13:12 +0000 (19:13 +0000)]
Auto merge of #60318 - jethrogb:jb/try-from-slice-to-infallible, r=sfackler

impl From<Infallible> for TryFromSliceError

I believe this was missed when TryFrom was stabilized. I think `TryFromSliceError` and `TryFromIntError` are the only two `TryFrom` error types that appear in `std`. I think trait implementations have to be insta-stable, but I'm not sure.

5 years agoAdd #[doc(hidden)] attribute on compiler generated proc-macro module.
Mike Boutin [Sun, 5 May 2019 14:25:01 +0000 (10:25 -0400)]
Add #[doc(hidden)] attribute on compiler generated proc-macro module.

Stops unavoidable `missing_docs` warning/error on proc-macro crates.
Resolves #42008.

5 years agoRemove redundant "let mut" in write_graph_label
Yusuke Matsushita [Sat, 11 May 2019 16:47:20 +0000 (01:47 +0900)]
Remove redundant "let mut" in write_graph_label

Removed the redundant "let mut" in the write_graph_label function (it caused "let mut let mut" for non-user-defined local variables).

5 years agoAuto merge of #60739 - Manishearth:clippyup, r=Manishearth
bors [Sat, 11 May 2019 16:26:12 +0000 (16:26 +0000)]
Auto merge of #60739 - Manishearth:clippyup, r=Manishearth

Update clippy

r? @ghost

5 years agoUpdate clippy
Manish Goregaokar [Sat, 11 May 2019 15:56:38 +0000 (08:56 -0700)]
Update clippy

5 years agoAddress comments + Fix tests
Vadim Petrochenkov [Sat, 11 May 2019 13:03:27 +0000 (16:03 +0300)]
Address comments + Fix tests

5 years agoCleanup the .await HIR lowering with .stmt(..).
Mazdak Farrokhzad [Sat, 11 May 2019 13:42:14 +0000 (15:42 +0200)]
Cleanup the .await HIR lowering with .stmt(..).

5 years agoMove literal parsing code into a separate file
Vadim Petrochenkov [Fri, 10 May 2019 23:31:34 +0000 (02:31 +0300)]
Move literal parsing code into a separate file

Remove some dead code

5 years agoAuto merge of #60714 - varkor:existential-global-lift-ice, r=oli-obk
bors [Sat, 11 May 2019 12:25:11 +0000 (12:25 +0000)]
Auto merge of #60714 - varkor:existential-global-lift-ice, r=oli-obk

Fix ICE with un-feature-gated existential type

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

r? @oli-obk

5 years agoSimplify conversions between tokens and semantic literals
Vadim Petrochenkov [Fri, 10 May 2019 00:00:51 +0000 (03:00 +0300)]
Simplify conversions between tokens and semantic literals

5 years agoEliminate `comments::Literal`
Vadim Petrochenkov [Thu, 9 May 2019 16:04:04 +0000 (19:04 +0300)]
Eliminate `comments::Literal`

5 years agoIntroduce `hir::Lit` not keeping the original token
Vadim Petrochenkov [Thu, 9 May 2019 15:04:24 +0000 (18:04 +0300)]
Introduce `hir::Lit` not keeping the original token

5 years agoKeep the original token in `ast::Lit`
Vadim Petrochenkov [Wed, 8 May 2019 23:17:32 +0000 (02:17 +0300)]
Keep the original token in `ast::Lit`

5 years agoTurn `ast::Lit` into a struct
Vadim Petrochenkov [Wed, 8 May 2019 23:00:29 +0000 (02:00 +0300)]
Turn `ast::Lit` into a struct

5 years agoAuto merge of #60717 - varkor:impl-const-generic, r=matthewjasper
bors [Sat, 11 May 2019 09:24:45 +0000 (09:24 +0000)]
Auto merge of #60717 - varkor:impl-const-generic, r=matthewjasper

Fix a bug preventing const parameters from being used in const generic impls

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

5 years agoadd comment to `Rc`/`Arc`'s `Eq` specialization
Thomas Heck [Sat, 11 May 2019 08:23:07 +0000 (10:23 +0200)]
add comment to `Rc`/`Arc`'s `Eq` specialization

5 years agoAuto merge of #60700 - petrochenkov:preintern, r=nnethercote
bors [Sat, 11 May 2019 06:42:36 +0000 (06:42 +0000)]
Auto merge of #60700 - petrochenkov:preintern, r=nnethercote

syntax_pos: Optimize symbol interner pre-filling slightly

r? @nnethercote

5 years agoAuto merge of #60721 - estebank:ice-ice-baby, r=varkor
bors [Sat, 11 May 2019 03:56:11 +0000 (03:56 +0000)]
Auto merge of #60721 - estebank:ice-ice-baby, r=varkor

Avoid ICE by using delay_span_bug

Fix #59406, fix #53498.

5 years agoAvoid ICE by using delay_span_bug
Esteban Küber [Sat, 11 May 2019 01:22:25 +0000 (18:22 -0700)]
Avoid ICE by using delay_span_bug

5 years agoAdd examples of ordered retain
Josh Stone [Sat, 11 May 2019 01:01:50 +0000 (18:01 -0700)]
Add examples of ordered retain

5 years agoRemove unnecessary unwraps
Esteban Küber [Fri, 10 May 2019 23:57:03 +0000 (16:57 -0700)]
Remove unnecessary unwraps

5 years agoAllow subdirectories to be tested by x.py test
varkor [Fri, 10 May 2019 23:42:29 +0000 (00:42 +0100)]
Allow subdirectories to be tested by x.py test

5 years agoAdd test for const impl
varkor [Fri, 10 May 2019 23:08:40 +0000 (00:08 +0100)]
Add test for const impl

5 years agoUnwrap singleton block expressions in const arguments
varkor [Fri, 10 May 2019 23:08:19 +0000 (00:08 +0100)]
Unwrap singleton block expressions in const arguments

5 years agoAuto merge of #59288 - Centril:hir-if-to-match, r=oli-obk
bors [Fri, 10 May 2019 22:58:52 +0000 (22:58 +0000)]
Auto merge of #59288 - Centril:hir-if-to-match, r=oli-obk

[let_chains, 1/6] Remove hir::ExprKind::If

Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239.

r? @oli-obk

5 years agoAdd test
varkor [Fri, 10 May 2019 21:11:19 +0000 (22:11 +0100)]
Add test

5 years agoAllow fallible `lift_to_global` in existential type writeback
varkor [Fri, 10 May 2019 21:06:03 +0000 (22:06 +0100)]
Allow fallible `lift_to_global` in existential type writeback

5 years agoAuto merge of #60708 - Centril:rollup-j5smdo0, r=Centril
bors [Fri, 10 May 2019 19:56:15 +0000 (19:56 +0000)]
Auto merge of #60708 - Centril:rollup-j5smdo0, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #60529 (RFC 2008: Uninhabitedness fixes for enum variants and tests)
 - #60620 (Fix a couple of FIXMEs in ext::tt::transcribe)
 - #60659 (Tweak `Symbol` and `InternedString`)
 - #60692 (Extend #60676 test for nested mut patterns.)
 - #60697 (add regression test for #60629)
 - #60701 (Update mailmap for mati865)

Failed merges:

r? @ghost

5 years agoAdd a test for failed inference of const types
varkor [Fri, 10 May 2019 19:53:46 +0000 (20:53 +0100)]
Add a test for failed inference of const types

5 years agoAdd a test for invalid const arguments
varkor [Fri, 10 May 2019 19:53:35 +0000 (20:53 +0100)]
Add a test for invalid const arguments

5 years agoMake const parent errors delay_span_bugs
varkor [Fri, 10 May 2019 19:53:21 +0000 (20:53 +0100)]
Make const parent errors delay_span_bugs

5 years agoRollup merge of #60701 - mati865:mailmap, r=Mark-Simulacrum
Mazdak Farrokhzad [Fri, 10 May 2019 18:31:13 +0000 (20:31 +0200)]
Rollup merge of #60701 - mati865:mailmap, r=Mark-Simulacrum

Update mailmap for mati865

5 years agoRollup merge of #60697 - hellow554:fix_60629, r=michaelwoerister
Mazdak Farrokhzad [Fri, 10 May 2019 18:31:11 +0000 (20:31 +0200)]
Rollup merge of #60697 - hellow554:fix_60629, r=michaelwoerister

add regression test for #60629

This bug was fixed, but I don't know which one. (I think it even doesn't matter at all).

Added a regression test.

```
op@OP ~/m/r/s/t/incremental> rustc --version
rustc 1.35.0-nightly (acd8dd6a5 2019-04-05)
op@OP ~/m/r/s/t/incremental> rustc -C incremental= --cfg rpass1 issue-60629.rs
warning: struct is never constructed: `A`
 --> issue-60629.rs:3:1
  |
3 | struct A;
  | ^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default

op@OP ~/m/r/s/t/incremental> rustc -C incremental= --cfg rpass2 issue-60629.rs
error: internal compiler error: src/librustc/ty/query/plumbing.rs:1195: Cannot force dep node: coherent_trait(core[c27c]::ops[0]::drop[0]::Drop[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:635:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.35.0-nightly (acd8dd6a5 2019-04-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -C incremental
```

with latest nightly it does not crash anymore, so nothing more to do.

Fixes #60629

(accidentally removed the remote branch on github, therefore GH closed the other PR.)

r? @nikomatsakis

5 years agoRollup merge of #60692 - davidtwco:pr-60676-followup, r=Centril
Mazdak Farrokhzad [Fri, 10 May 2019 18:31:10 +0000 (20:31 +0200)]
Rollup merge of #60692 - davidtwco:pr-60676-followup, r=Centril

Extend #60676 test for nested mut patterns.

At request of @centril, this commit extends the existing test added by #60676 to include nested `mut` patterns.

cc @Centril

5 years agoRollup merge of #60659 - nnethercote:tweak-Symbol-and-InternedString, r=Zoxc
Mazdak Farrokhzad [Fri, 10 May 2019 18:31:09 +0000 (20:31 +0200)]
Rollup merge of #60659 - nnethercote:tweak-Symbol-and-InternedString, r=Zoxc

Tweak `Symbol` and `InternedString`

Some minor improvements to speed and code cleanliness.

r? @Zoxc

5 years agoRollup merge of #60620 - mark-i-m:transcribe-2, r=petrochenkov
Mazdak Farrokhzad [Fri, 10 May 2019 18:31:07 +0000 (20:31 +0200)]
Rollup merge of #60620 - mark-i-m:transcribe-2, r=petrochenkov

Fix a couple of FIXMEs in ext::tt::transcribe

_Blocked on #60618_

A crater run would be nice to make sure my understanding is correct. A quick google search seems to indicate these are extremely rare errors if they are possible (which I don't believe they are).

r? @petrochenkov

cc #2887 (there is only one FIXME left and it is hygiene-related)

5 years agoRollup merge of #60529 - davidtwco:rfc-2008-uninhabited, r=petrochenkov
Mazdak Farrokhzad [Fri, 10 May 2019 18:31:06 +0000 (20:31 +0200)]
Rollup merge of #60529 - davidtwco:rfc-2008-uninhabited, r=petrochenkov

RFC 2008: Uninhabitedness fixes for enum variants and tests

Part of #44109.

At the request of @Centril, this PR adds tests asserting that uninhabited non-exhaustive types are considered inhabited in extern crates. In adding these tests, I fixed an oversight in the implementation of RFC 2008 on enum variants that resulted in non-exhaustive enum variants being considered uninhabited in extern crates.

Before this PR, these lines would error:

```rust
// extern crate
pub enum UninhabitedVariants {
    #[non_exhaustive] Tuple(!),
    #[non_exhaustive] Struct { x: ! }
}

pub enum PartiallyInhabitedVariants {
    Tuple(u8),
    #[non_exhaustive] Struct { x: ! }
}

// current crate
match uninhabited_variant() /* fn() -> Option<UninhabitedVariants> */ {
    Some(_x) => (), //~ ERROR unreachable pattern
    None => (),
}

while let PartiallyInhabitedVariants::Struct { x, .. } = partially_inhabited_variant() /* fn() -> PartiallyInhabitedVariants */ {
    //~^ ERROR unreachable pattern
}
```

cc @Centril
r? @petrochenkov

5 years agocheck_match: add FIXME for removing of hack.
Mazdak Farrokhzad [Fri, 10 May 2019 17:55:52 +0000 (19:55 +0200)]
check_match: add FIXME for removing of hack.

5 years agoadd test checking that 'if cond { .. }' where 'cond: &mut? bool' isn't accepted.
Mazdak Farrokhzad [Thu, 25 Apr 2019 03:48:26 +0000 (05:48 +0200)]
add test checking that 'if cond { .. }' where 'cond: &mut? bool' isn't accepted.

5 years agoVarious test changes
Mazdak Farrokhzad [Tue, 19 Mar 2019 03:47:07 +0000 (04:47 +0100)]
Various test changes

5 years agoAdjust mir-opt tests for new HIR without If
Mazdak Farrokhzad [Wed, 24 Apr 2019 10:50:05 +0000 (12:50 +0200)]
Adjust mir-opt tests for new HIR without If

5 years agoRemove hir::ExprKind::If and replace it with lowering to hir::ExprKind::Match.
Mazdak Farrokhzad [Mon, 11 Mar 2019 15:43:27 +0000 (16:43 +0100)]
Remove hir::ExprKind::If and replace it with lowering to hir::ExprKind::Match.

5 years agoAdd a bunch more tests.
David Wood [Sat, 4 May 2019 11:07:04 +0000 (12:07 +0100)]
Add a bunch more tests.

5 years agoMove uninhabited tests into subdirectory.
David Wood [Sat, 4 May 2019 10:08:57 +0000 (11:08 +0100)]
Move uninhabited tests into subdirectory.

This commit just tries to tidy up a little.

5 years agoFix uninhabitedness of non-exhaustive enums.
David Wood [Sat, 4 May 2019 10:03:06 +0000 (11:03 +0100)]
Fix uninhabitedness of non-exhaustive enums.

This commit ensures that non-exhaustive enums are considered inhabited
when used in extern crates.

5 years agoFix inhabitedness of non-exhaustive variants.
David Wood [Sat, 4 May 2019 00:17:26 +0000 (01:17 +0100)]
Fix inhabitedness of non-exhaustive variants.

This commit ensures that non-exhaustive variants are considered
inhabited when used in extern crates.

5 years agoAdd uninhabitedness tests w/ `#[non_exhaustive]`.
David Wood [Sat, 4 May 2019 00:15:26 +0000 (01:15 +0100)]
Add uninhabitedness tests w/ `#[non_exhaustive]`.

This commit adds tests checking that uninhabited non-exhaustive types
are considered inhabited when used in another crate.

5 years agoAuto merge of #60588 - cuviper:be-simd-swap, r=alexcrichton
bors [Fri, 10 May 2019 15:29:40 +0000 (15:29 +0000)]
Auto merge of #60588 - cuviper:be-simd-swap, r=alexcrichton

Revert "Disable big-endian simd in swap_nonoverlapping_bytes"

This reverts commit 77bd4dc65406ba3cedbc779e6f6280868231912e (#43159).

Issue #42778 was formerly easy to reproduce on two big-endian targets,
`powerpc64` and `s390x`, so we disabled SIMD on this function for all
big-endian targets as a workaround.

I have re-tested this code on `powerpc64` and `s390x`, each with the
bundled LLVM 8 and with external LLVM 7 and LLVM 6, and the problems no
longer appear. So it seems safe to remove this workaround, although I'm
still a little uncomfortable that we never found a root-cause...

Closes #42778.
r? @arielb1

5 years agoturn a couple of fixmes into span_bugs
Mark Mansi [Tue, 7 May 2019 22:58:58 +0000 (17:58 -0500)]
turn a couple of fixmes into span_bugs