]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #54078 - GabrielMajeri:expand-sync-docs, r=steveklabnik
Pietro Albini [Fri, 5 Oct 2018 20:33:10 +0000 (22:33 +0200)]
Rollup merge of #54078 - GabrielMajeri:expand-sync-docs, r=steveklabnik

Expand the documentation for the `std::sync` module

I've tried to expand the documentation for Rust's synchronization primitives. The module level documentation explains why synchronization is required when working with a multiprocessor system,
and then links to the appropiate structure in this module.

Fixes #29377, since this should be the last item on the checklist (documentation for `Atomic*` was fixed in #44854, but not ticked off the checklist).

5 years agoAuto merge of #54741 - oli-obk:impl_trait_hierarchy, r=cramertj
bors [Fri, 5 Oct 2018 15:32:19 +0000 (15:32 +0000)]
Auto merge of #54741 - oli-obk:impl_trait_hierarchy, r=cramertj

Nest the `impl Trait` existential item inside the return type

fixes #54045

r? @cramertj

5 years agoAuto merge of #54336 - petrochenkov:preuni, r=alexcrichton
bors [Fri, 5 Oct 2018 12:52:53 +0000 (12:52 +0000)]
Auto merge of #54336 - petrochenkov:preuni, r=alexcrichton

resolve: Some refactorings in preparation for uniform paths 2.0

The main result is that in-scope resolution performed during macro expansion / import resolution is now consolidated in a single function (`fn early_resolve_ident_in_lexical_scope`), which can now be used for resolving first import segments as well when uniform paths are enabled.

r? @ghost

5 years agoAuto merge of #52121 - jebrosen:macros2_feature, r=petrochenkov
bors [Fri, 5 Oct 2018 10:08:01 +0000 (10:08 +0000)]
Auto merge of #52121 - jebrosen:macros2_feature, r=petrochenkov

Merge `proc_macro_` expansion feature gates as `proc_macro_hygiene`

Merges `proc_macro_mod`, `proc_macro_expr`, `proc_macro_non_items`, and `proc_macro_gen` into a single feature: `proc_macro_hygiene`. These features are not all blocked on implementing macro hygiene *per se*, but rather on interactions with hygiene that have not been entirely resolved.

5 years agoReapply the macro_rules disambiguation changes from master
Vadim Petrochenkov [Thu, 4 Oct 2018 10:41:58 +0000 (14:41 +0400)]
Reapply the macro_rules disambiguation changes from master

5 years agoReapply the derive helper changes from master
Vadim Petrochenkov [Wed, 26 Sep 2018 10:11:34 +0000 (13:11 +0300)]
Reapply the derive helper changes from master

5 years agoexpansion: Remove restriction on use of macro attributes with test/bench
Vadim Petrochenkov [Tue, 18 Sep 2018 22:46:18 +0000 (01:46 +0300)]
expansion: Remove restriction on use of macro attributes with test/bench

The restrictions were introduced in https://github.com/rust-lang/rust/pull/54277 and no longer necessary now because legacy plugins are now expanded in usual left-to-right order

5 years agoresolve: Keep more precise traces for expanded macro resolutions
Vadim Petrochenkov [Tue, 18 Sep 2018 22:01:09 +0000 (01:01 +0300)]
resolve: Keep more precise traces for expanded macro resolutions

`NameBinding`s instead of `Def`s

5 years agoresolve: Merge resolution for `macro_rules` into the common early in-scope resolution...
Vadim Petrochenkov [Tue, 18 Sep 2018 00:19:26 +0000 (03:19 +0300)]
resolve: Merge resolution for `macro_rules` into the common early in-scope resolution function

`fn resolve_legacy_scope`/`fn resolve_lexical_macro_path_segment` -> `fn early_resolve_ident_in_lexical_scope`

5 years agoAuto merge of #54703 - davidtwco:issue-52086, r=nikomatsakis
bors [Fri, 5 Oct 2018 07:40:36 +0000 (07:40 +0000)]
Auto merge of #54703 - davidtwco:issue-52086, r=nikomatsakis

error message when trying to move from an Rc or Arc is ungreat

Fixes #52086.

r? @nikomatsakis

5 years agoresolve: Support value namespace in `fn resolve_lexical_macro_path_segment`
Vadim Petrochenkov [Sun, 16 Sep 2018 22:56:15 +0000 (01:56 +0300)]
resolve: Support value namespace in `fn resolve_lexical_macro_path_segment`

5 years agoexpansion: Expand attribute macros registered by legacy plugins in usual left-to...
Vadim Petrochenkov [Sat, 15 Sep 2018 20:57:07 +0000 (23:57 +0300)]
expansion: Expand attribute macros registered by legacy plugins in usual left-to-right order

5 years agoresolve: Integrate inert attributes registererd by legacy plugins into macro resolution
Vadim Petrochenkov [Sat, 15 Sep 2018 20:46:54 +0000 (23:46 +0300)]
resolve: Integrate inert attributes registererd by legacy plugins into macro resolution

5 years agoAddress review comments
Gabriel Majeri [Fri, 5 Oct 2018 05:50:17 +0000 (08:50 +0300)]
Address review comments

5 years agoAuto merge of #54017 - alexcrichton:wasm-atomics2, r=sfackler
bors [Fri, 5 Oct 2018 01:57:01 +0000 (01:57 +0000)]
Auto merge of #54017 - alexcrichton:wasm-atomics2, r=sfackler

std: Start implementing wasm32 atomics

This commit is an initial start at implementing the standard library for
wasm32-unknown-unknown with the experimental `atomics` feature enabled. None of
these changes will be visible to users of the wasm32-unknown-unknown target
because they all require recompiling the standard library. The hope with this is
that we can get this support into the standard library and start iterating on it
in-tree to enable experimentation.

Currently there's a few components in this PR:

* Atomic fences are disabled on wasm as there's no corresponding atomic op and
  it's not clear yet what the convention should be, but this will change in the
  future!
* Implementations of `Mutex`, `Condvar`, and `RwLock` were all added based on
  the atomic intrinsics that wasm has.
* The `ReentrantMutex` and thread-local-storage implementations panic currently
  as there's no great way to get a handle on the current thread's "id" yet.

Right now the wasm32 target with atomics is unfortunately pretty unusable,
requiring a lot of manual things here and there to actually get it operational.
This will likely continue to evolve as the story for atomics and wasm unfolds,
but we also need more LLVM support for some operations like custom `global`
directives for this to work best.

5 years agoAuto merge of #54649 - nikomatsakis:universes-refactor-1, r=scalexm
bors [Thu, 4 Oct 2018 20:28:57 +0000 (20:28 +0000)]
Auto merge of #54649 - nikomatsakis:universes-refactor-1, r=scalexm

adopt "placeholders" to represent universally quantified regions

This does a few preliminary refactorings that lay some groundwork for moving towards universe integration. Two things, primarily:

- Rename from "skolemized" to "placeholder"
- When instantiating `for<'a, 'b, 'c>`, just create one universe for all 3 regions, and distinguish them from one another using the `BoundRegion`.
    - This is more accurate, and I think that in general we'll be moving towards a model of separating "binder" (universe, debruijn index) from "index within binder" in a number of places.
    - In principle, it feels the current setup of making lots of universes could lead to us doing the wrong thing, but I've actually not been able to come up with an example where this is so.

r? @scalexm
cc @arielb1

5 years agoAuto merge of #54666 - matthewjasper:mir-function-spans, r=pnkfelix
bors [Thu, 4 Oct 2018 16:34:27 +0000 (16:34 +0000)]
Auto merge of #54666 - matthewjasper:mir-function-spans, r=pnkfelix

[NLL] Improve "borrow later used here" messages

* In the case of two conflicting borrows, the later used message says which borrow it's referring to
* If the later use is a function call (from the users point of view) say that the later use is for the call. Point just to the function.

r? @pnkfelix
Closes #48643

5 years agos/skol_predicate/placeholder_predicate
Niko Matsakis [Wed, 3 Oct 2018 00:10:40 +0000 (20:10 -0400)]
s/skol_predicate/placeholder_predicate

5 years agofix typo: s/tained/tainted/
Niko Matsakis [Wed, 3 Oct 2018 00:10:16 +0000 (20:10 -0400)]
fix typo: s/tained/tainted/

5 years agoremove occurences of `skolemization`
Niko Matsakis [Wed, 3 Oct 2018 00:09:32 +0000 (20:09 -0400)]
remove occurences of `skolemization`

5 years agoremove all occurences of `skolemize`
Niko Matsakis [Tue, 2 Oct 2018 20:50:20 +0000 (16:50 -0400)]
remove all occurences of `skolemize`

5 years agobuild up the placeholder indices as we go
Niko Matsakis [Fri, 28 Sep 2018 18:35:43 +0000 (14:35 -0400)]
build up the placeholder indices as we go

Avoids a linear walk over the regions at the end.

5 years agoextend NLL universe code to have >1 placeholder within one universe
Niko Matsakis [Thu, 27 Sep 2018 21:57:35 +0000 (17:57 -0400)]
extend NLL universe code to have >1 placeholder within one universe

5 years agocreate just one subuniverse per binder -- no need for more, really
Niko Matsakis [Fri, 7 Sep 2018 20:58:35 +0000 (16:58 -0400)]
create just one subuniverse per binder -- no need for more, really

5 years agoreorder the placeholders and inference variables in hr::sub
Niko Matsakis [Fri, 7 Sep 2018 14:00:01 +0000 (10:00 -0400)]
reorder the placeholders and inference variables in hr::sub

5 years agorename skolemized to placeholder
Niko Matsakis [Fri, 7 Sep 2018 13:46:53 +0000 (09:46 -0400)]
rename skolemized to placeholder

5 years agoselect.rs: rustfmt
Niko Matsakis [Fri, 7 Sep 2018 13:34:09 +0000 (09:34 -0400)]
select.rs: rustfmt

5 years agoAuto merge of #54784 - Manishearth:clippyup, r=oli-obk
bors [Thu, 4 Oct 2018 14:08:12 +0000 (14:08 +0000)]
Auto merge of #54784 - Manishearth:clippyup, r=oli-obk

Update clippy

None

5 years agoAuto merge of #54809 - pietroalbini:rollup, r=pietroalbini
bors [Thu, 4 Oct 2018 11:39:50 +0000 (11:39 +0000)]
Auto merge of #54809 - pietroalbini:rollup, r=pietroalbini

Rollup of 10 pull requests

Successful merges:

 - #53523 (Add doc for impl From for Std Error)
 - #54746 (simplify some unused lints code)
 - #54761 (Make spec_extend use for_each())
 - #54769 (Fix typo in CONTRIBUTING.md)
 - #54773 (Update a FIXME in memory.rs)
 - #54777 (abolish ICE when pretty-printing async block)
 - #54780 (Remove duplicate predicates in `explicit_predicates_of`)
 - #54788 (A handful of cleanups for rustc/mir)
 - #54789 (Introduce `TyKind::UnnormalizedProjection`)
 - #54795 (remove padding from multiline format string label)

Failed merges:

r? @ghost

5 years agoUpdate Cargo.lock
Oliver Schneider [Thu, 4 Oct 2018 10:51:58 +0000 (12:51 +0200)]
Update Cargo.lock

5 years agoAdd features to the workspace hack
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer [Thu, 4 Oct 2018 10:40:04 +0000 (12:40 +0200)]
Add features to the workspace hack

5 years agoRollup merge of #54795 - euclio:ifmt-bad-arg, r=estebank
Pietro Albini [Thu, 4 Oct 2018 10:20:17 +0000 (12:20 +0200)]
Rollup merge of #54795 - euclio:ifmt-bad-arg, r=estebank

remove padding from multiline format string label

Fixes #53836.

5 years agoRollup merge of #54789 - scalexm:unnormalized, r=nikomatsakis
Pietro Albini [Thu, 4 Oct 2018 10:20:16 +0000 (12:20 +0200)]
Rollup merge of #54789 - scalexm:unnormalized, r=nikomatsakis

Introduce `TyKind::UnnormalizedProjection`

Introduce a new variant used for lazy normalization in chalk integration. Mostly `bug!` everywhere.

r? @nikomatsakis

5 years agoRollup merge of #54788 - ljedrz:cleanup_rustc_mir, r=oli-obk
Pietro Albini [Thu, 4 Oct 2018 10:20:15 +0000 (12:20 +0200)]
Rollup merge of #54788 - ljedrz:cleanup_rustc_mir, r=oli-obk

A handful of cleanups for rustc/mir

- use the "regular" `into()` instead of `graphviz::IntoCow` in `mod.rs`
- `format!("{}", x)` > `x.to_string()`
- remove one unnecessary `String` allocation
- shorten the logic of one loop
- `assert!(x == y)` > `assert_eq!(x, y)`
- whitespace & formatting fixes

r? @oli-obk

5 years agoRollup merge of #54780 - scalexm:dup-predicates, r=nikomatsakis
Pietro Albini [Thu, 4 Oct 2018 10:20:13 +0000 (12:20 +0200)]
Rollup merge of #54780 - scalexm:dup-predicates, r=nikomatsakis

Remove duplicate predicates in `explicit_predicates_of`

I took a more brutal approach than described in #52187. I could have used the `linked_hash_map` crate but this seems overkill, especially as we need a vec storage in the end.

r? @nikomatsakis

5 years agoRollup merge of #54777 - zackmdavis:async_pretty_ice, r=cramertj
Pietro Albini [Thu, 4 Oct 2018 10:20:12 +0000 (12:20 +0200)]
Rollup merge of #54777 - zackmdavis:async_pretty_ice, r=cramertj

abolish ICE when pretty-printing async block

@jnetterf reported an ICE when the unused-parentheses lint triggered around an async block (#54752). In order to compose an autofixable suggestion, the lint invokes the pretty-printer on the unnecessarily-parenthesized expression. (One wonders why the lint doesn't just use `SourceMap::span_to_snippet` instead, to preserve the formatting of the original source?—but to answer that, you'd have to ask the author of 5c9f806d.)

But then the pretty-printer panics when trying to call `<pprust::State as PrintState>::end` when `State.boxes` is empty. Empirically, the problem would seem to be solved if we start some "boxes" beforehand in the `ast::ExprKind::Async` arm of the big match in `print_expr_outer_attr_style`, exactly like we do in the immediately-preceding match arm for `ast::ExprKind::Block`—it would seem pretty ("pretty") reasonable for the pretty-printing of async blocks to work a lot like the pretty-printing of ordinary non-async blocks, right??

Of course, it would be shamefully cargo-culty to commit code on the basis of this kind of mere reasoning-by-analogy (in contrast to understanding the design of the pretty-printer in such detail that the correctness of the patch is comprehended with all the lucid certainty of mathematical proof, rather than being merely surmised by intuition). But maybe we care more about fixing the bug with high probability today, than with certainty in some indefinite hypothetical future?  Maybe the effort is worth [a fifth of a shirt](https://hacktoberfest.digitalocean.com/stats/zackmdavis)??

Humbly resolves #54752.

r? @cramertj

5 years agoRollup merge of #54773 - rust-lang:wesleywiser-patch-1, r=oli-obk
Pietro Albini [Thu, 4 Oct 2018 10:20:11 +0000 (12:20 +0200)]
Rollup merge of #54773 - rust-lang:wesleywiser-patch-1, r=oli-obk

Update a FIXME in memory.rs

In  #51833, I improved the performance of `copy_undef_mask()`. As such, the old FIXME wasn't appropriate anymore. The main remaining thing left to do is to implement a fast path for non-overlapping copies (per @oli-obk).

r? @oli-obk

5 years agoRollup merge of #54769 - jacobherrington:patch-1, r=kennytm
Pietro Albini [Thu, 4 Oct 2018 10:20:10 +0000 (12:20 +0200)]
Rollup merge of #54769 - jacobherrington:patch-1, r=kennytm

Fix typo in CONTRIBUTING.md

I noticed a small typo while reading over this document.

5 years agoRollup merge of #54761 - Lucretiel:patch-1, r=cramertj
Pietro Albini [Thu, 4 Oct 2018 10:20:08 +0000 (12:20 +0200)]
Rollup merge of #54761 - Lucretiel:patch-1, r=cramertj

Make spec_extend use for_each()

`for_each` will use an iterator's own implementation of `try_fold`, which I understand to be generally preferable (because nested iterator adapter's will use each other's `try_fold` and be designed for the specific adaptation in a way that promotes performance and inlining.

5 years agoRollup merge of #54746 - llogiq:simplify-unused-lints, r=michaelwoerister
Pietro Albini [Thu, 4 Oct 2018 10:20:07 +0000 (12:20 +0200)]
Rollup merge of #54746 - llogiq:simplify-unused-lints, r=michaelwoerister

simplify some unused lints code

Those are but small simplifications for readability.

5 years agoRollup merge of #53523 - phungleson:fix-impl-from-for-std-error, r=GuillaumeGomez
Pietro Albini [Thu, 4 Oct 2018 10:20:05 +0000 (12:20 +0200)]
Rollup merge of #53523 - phungleson:fix-impl-from-for-std-error, r=GuillaumeGomez

Add doc for impl From for Std Error

As part of issue #51430 (cc @skade).

I am not sure if it is going to a correct direction so put up here so that people can comment.

5 years agoAuto merge of #54638 - christianpoveda:master, r=kennytm
bors [Thu, 4 Oct 2018 09:17:47 +0000 (09:17 +0000)]
Auto merge of #54638 - christianpoveda:master, r=kennytm

Add checking for tool distribution in Tier 1

This fixes https://github.com/rust-lang/rust/issues/54483
r? @kennytm

5 years agoAuto merge of #53851 - oli-obk:local_promotion, r=eddyb
bors [Thu, 4 Oct 2018 06:48:13 +0000 (06:48 +0000)]
Auto merge of #53851 - oli-obk:local_promotion, r=eddyb

Limit the promotion of const fns to the libstd and the `rustc_promotable` attribute

There are so many questions around promoting const fn calls... it seems saner to try to limit automatic promotion to const fns which were explicitly opted in for promotion.

I added the attribute to all public stable const fns that were already promotable (e.g. not Cell::new) in order to not cause any breakage

r? @eddyb

cc @nikomatsakis

5 years agoAuto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
bors [Thu, 4 Oct 2018 03:08:22 +0000 (03:08 +0000)]
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis

handle outlives predicates in trait evaluation

This handles higher-ranked outlives predicates in trait evaluation the same way they are handled in projection.

Fixes #54302. I think this is a more correct fix than #54401 because it fixes the root case in evaluation instead of making evaluation used in less cases. However, we might want to go to a direction closer to @nikomatsakis's solution with Chalk.

r? @nikomatsakis

5 years agoAuto merge of #54447 - KiChjang:issue-54331, r=nikomatsakis
bors [Thu, 4 Oct 2018 00:26:00 +0000 (00:26 +0000)]
Auto merge of #54447 - KiChjang:issue-54331, r=nikomatsakis

Lower type ascriptions to HAIR and MIR

Fixes #54331.

r? @nikomatsakis

5 years agoAuto merge of #54391 - davidtwco:issue-54230, r=petrochenkov
bors [Wed, 3 Oct 2018 21:46:21 +0000 (21:46 +0000)]
Auto merge of #54391 - davidtwco:issue-54230, r=petrochenkov

suggest `crate::...` for "local" paths in 2018

Fixes #54230.

This commit adds suggestions for unresolved imports in the cases where
there could be a missing `crate::`, `super::`, `self::` or a missing
external crate name before an import.

r? @nikomatsakis

5 years agoClearer later use messages for calls
Matthew Jasper [Sat, 29 Sep 2018 10:47:47 +0000 (11:47 +0100)]
Clearer later use messages for calls

Give a special message when the later use is from a call. Use the span
of the callee instead of the whole expression. For conflicting borrow
messages say that the later use is of the first borrow.

5 years agoRecord whether a Call in MIR corresponds to a call in HIR
Matthew Jasper [Sat, 29 Sep 2018 09:34:12 +0000 (10:34 +0100)]
Record whether a Call in MIR corresponds to a call in HIR

5 years agoremove padding from multiline format string label
Andy Russell [Wed, 3 Oct 2018 18:29:02 +0000 (14:29 -0400)]
remove padding from multiline format string label

Fixes #53836.

5 years agoAuto merge of #54605 - petrochenkov:mambig, r=alexcrichton
bors [Wed, 3 Oct 2018 18:12:22 +0000 (18:12 +0000)]
Auto merge of #54605 - petrochenkov:mambig, r=alexcrichton

resolve: Disambiguate a subset of conflicts "macro_rules" vs "macro name in module"

Currently if macro name may refer to both a `macro_rules` macro definition and a macro defined/imported into module we conservatively report an ambiguity error.
Unfortunately, these errors became a source of regressions when macro modularization was enabled - see issue https://github.com/rust-lang/rust/issues/54472.

This PR disambiguates such conflicts in favor of `macro_rules` if both the `macro_rules` item and in-module macro name are defined in the same normal (named) module and `macro_rules` is closer in scope to the point of use (see the tests for examples).
This is a subset of more general approach described in https://github.com/rust-lang/rust/issues/54472#issuecomment-424666659.
The subset is enough to fix all the regressions from https://github.com/rust-lang/rust/issues/54472, but it can be extended to apply to all "macro_rules" vs "macro name in module" conflicts in the future.

To give an analogy, this is equivalent to scoping rules for `let` variables and items defined in blocks (`macro_rules` behaves like "`let` at module level" in general).
```rust
{ // beginning of the block
    use xxx::m; // (1)

    // Starting from the beginning of the block and until here m!() refers to (1)
    macro_rules! m { ... } // (2)
    // Starting from here and until the end of the block m!() refers to (2)
} // end of the block
```
More complex examples with `use` and `macro_rules` from different modules still report ambiguity errors, even if equivalent examples with `let` are legal.

Fixes https://github.com/rust-lang/rust/issues/54472 (stable-to-beta regression)

5 years agoFix `ty::UnnormalizedProjection` in rustdoc
scalexm [Wed, 3 Oct 2018 16:49:27 +0000 (18:49 +0200)]
Fix `ty::UnnormalizedProjection` in rustdoc

5 years agoUpdate clippy
Manish Goregaokar [Wed, 3 Oct 2018 12:13:06 +0000 (14:13 +0200)]
Update clippy

5 years agoIntroduce `TyKind::UnnormalizedProjection`
scalexm [Wed, 3 Oct 2018 15:06:28 +0000 (17:06 +0200)]
Introduce `TyKind::UnnormalizedProjection`

5 years agoDeterministic external crate suggestion.
David Wood [Wed, 3 Oct 2018 13:20:20 +0000 (15:20 +0200)]
Deterministic external crate suggestion.

This commit ensures that the external crate suggestion is deterministic
by using a `BTreeMap` rather than a `FxHashMap`. This is particularly
useful as `std` and `core` will often contain the same items and
therefore the suggestion would previously suggest either for any given
error - in this case, the suggestion will always prefer `std` now.

5 years agoA handful of cleanups for rustc/mir
ljedrz [Wed, 3 Oct 2018 13:07:18 +0000 (15:07 +0200)]
A handful of cleanups for rustc/mir

5 years agoUpdate tests to demonstrate 2015 behaviour.
David Wood [Fri, 28 Sep 2018 09:32:04 +0000 (11:32 +0200)]
Update tests to demonstrate 2015 behaviour.

Adds a test to demonstrate behaviour of suggestions in the
2015 edition.

5 years agoRemoved hardcoded crate.
David Wood [Fri, 28 Sep 2018 09:30:55 +0000 (11:30 +0200)]
Removed hardcoded crate.

Previously, `meta` crate was hardcoded as attempting to resolve a path
with it would ICE. Now, we attempt to load each extern crate first so
that resolving a path involving that crate doesn't error.

5 years agoAdd suggestions for unresolved imports.
David Wood [Thu, 20 Sep 2018 15:15:52 +0000 (17:15 +0200)]
Add suggestions for unresolved imports.

This commit adds suggestions for unresolved imports in the cases where
there could be a missing `crate::`, `super::`, `self::` or a missing
external crate name before an import.

5 years agoresolve: Prefer `macro_rules` definitions to in-module macro definitions in some...
Vadim Petrochenkov [Thu, 27 Sep 2018 01:49:40 +0000 (04:49 +0300)]
resolve: Prefer `macro_rules` definitions to in-module macro definitions in some cases

5 years agoRemove duplicate predicates in `explicit_predicates_of`
scalexm [Wed, 3 Oct 2018 09:47:09 +0000 (11:47 +0200)]
Remove duplicate predicates in `explicit_predicates_of`
Fixes #52187.

5 years agoAuto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
bors [Wed, 3 Oct 2018 10:49:27 +0000 (10:49 +0000)]
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis

NLL fails to suggest "try removing `&mut` here"

Fixes #51191.

This PR adds ``try removing `&mut` here`` suggestions to functions where a mutable borrow is being taken of a `&mut self` or a `self: &mut Self`. This PR also enables the suggestion for adding a `mut` pattern to by-value implicit self arguments without `mut` patterns already.

r? @nikomatsakis

5 years agoMove platform dependent output ui tests to compile-fail
Oliver Schneider [Wed, 3 Oct 2018 09:46:05 +0000 (11:46 +0200)]
Move platform dependent output ui tests to compile-fail

5 years agoPoke in the dark and see if bors+windows stops screaming
Oliver Schneider [Tue, 2 Oct 2018 09:33:17 +0000 (11:33 +0200)]
Poke in the dark and see if bors+windows stops screaming

5 years agoFix typo
Oliver Schneider [Tue, 2 Oct 2018 08:56:27 +0000 (10:56 +0200)]
Fix typo

5 years agoUpdate error id to an unused one
Oliver Schneider [Mon, 1 Oct 2018 12:28:15 +0000 (14:28 +0200)]
Update error id to an unused one

5 years agoOnly promote calls to `#[rustc_promotable]` const fns
Oliver Schneider [Fri, 31 Aug 2018 11:50:14 +0000 (13:50 +0200)]
Only promote calls to `#[rustc_promotable]` const fns

5 years agosimplify some unused lints code
Andre Bogus [Mon, 1 Oct 2018 21:15:22 +0000 (23:15 +0200)]
simplify some unused lints code

5 years agoabolish ICE when pretty-printing async block
Zack M. Davis [Wed, 3 Oct 2018 04:43:05 +0000 (21:43 -0700)]
abolish ICE when pretty-printing async block

Joshua Netterfield reported an ICE when the unused-parentheses lint
triggered around an async block (#54752). In order to compose an
autofixable suggestion, the lint invokes the pretty-printer on the
unnecessarily-parenthesized expression. (One wonders why the lint
doesn't just use `SourceMap::span_to_snippet` instead, to preserve the
formatting of the original source?—but for that, you'd have to ask the
author of 5c9f806d.)

But then the pretty-printer panics when trying to call `<pprust::State
as PrintState>::end` when `State.boxes` is empty. Empirically, the
problem would seem to be solved if we start some "boxes" beforehand in
the `ast::ExprKind::Async` arm of the big match in
`print_expr_outer_attr_style`, exactly like we do in the
immediately-preceding match arm for `ast::ExprKind::Block`—it would
seem pretty ("pretty") reasonable for the pretty-printing of async
blocks to work a lot like the pretty-printing of ordinary non-async
blocks, right??

Of course, it would be shamefully cargo-culty to commit code on the
basis of this kind of mere reasoning-by-analogy (in contrast to
understanding the design of the pretty-printer in such detail that the
correctness of the patch is comprehended with all the lucid certainty
of mathematical proof, rather than being merely surmised by
intuition). But maybe we care more about fixing the bug with high
probability today, than with certainty in some indefinite hypothetical
future?  Maybe the effort is worth a fifth of a shirt??

Humbly resolves #54752.

5 years agoMerge the `proc_macro_` expansion feature gates into a single `proc_macro_hygiene...
jeb [Fri, 6 Jul 2018 01:09:35 +0000 (19:09 -0600)]
Merge the `proc_macro_` expansion feature gates into a single `proc_macro_hygiene` gate.

5 years agoUpdate a FIXME in memory.rs
Wesley Wiser [Wed, 3 Oct 2018 02:11:38 +0000 (22:11 -0400)]
Update a FIXME in memory.rs

In  #51833, I improved the performance of `copy_undef_mask()`. As such, the old FIXME wasn't appropriate anymore. The main remaining thing left to do is to implement a fast path for non-overlapping copies (per @oli-obk).

5 years agoAuto merge of #54767 - pietroalbini:rollup, r=pietroalbini
bors [Tue, 2 Oct 2018 23:29:58 +0000 (23:29 +0000)]
Auto merge of #54767 - pietroalbini:rollup, r=pietroalbini

Rollup of 10 pull requests

Successful merges:

 - #54269 (#53840: Consolidate pattern check errors)
 - #54458 (Allow both explicit and elided lifetimes in the same impl header)
 - #54603 (Add `crate::` to trait suggestions in Rust 2018.)
 - #54648 (Update Cargo's submodule)
 - #54680 (make run-pass tests with empty main just compile-pass tests)
 - #54687 (Use impl_header_lifetime_elision in libcore)
 - #54699 (Re-export `getopts` so custom drivers can reference it.)
 - #54702 (do not promote comparing function pointers)
 - #54728 (Renumber `proc_macro` tracking issues)
 - #54745 (make `CStr::from_bytes_with_nul_unchecked()` a const fn)

Failed merges:

r? @ghost

5 years agoRemove main() in examples
Son [Tue, 2 Oct 2018 22:21:51 +0000 (08:21 +1000)]
Remove main() in examples

5 years agoFix typo in CONTRIBUTING.md
jacob [Tue, 2 Oct 2018 21:59:48 +0000 (16:59 -0500)]
Fix typo in CONTRIBUTING.md

I noticed a small typo while reading over this document.

5 years agoRollup merge of #54745 - abonander:cstr-const, r=oli-obk
Pietro Albini [Tue, 2 Oct 2018 20:54:38 +0000 (22:54 +0200)]
Rollup merge of #54745 - abonander:cstr-const, r=oli-obk

make `CStr::from_bytes_with_nul_unchecked()` a const fn

closes #54678

5 years agoRollup merge of #54728 - alexcrichton:renumber-issues, r=nikomatsakis
Pietro Albini [Tue, 2 Oct 2018 20:54:36 +0000 (22:54 +0200)]
Rollup merge of #54728 - alexcrichton:renumber-issues, r=nikomatsakis

Renumber `proc_macro` tracking issues

Lots of issue links in the compiler still point to https://github.com/rust-lang/rust/issues/38356 which is a bit of a monster issue that isn't serving much purpose any more. I've split the issue into a number of more fine-grained tracking issues to track stabilizations.

5 years agoRollup merge of #54702 - RalfJung:fn-ptr-promotion, r=oli-obk
Pietro Albini [Tue, 2 Oct 2018 20:54:35 +0000 (22:54 +0200)]
Rollup merge of #54702 - RalfJung:fn-ptr-promotion, r=oli-obk

do not promote comparing function pointers

This *could* break existing code that relied on fn ptr comparison getting promoted to `'static` lifetime.

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

5 years agoRollup merge of #54699 - DiamondLovesYou:reexport-getopts, r=pnkfelix
Pietro Albini [Tue, 2 Oct 2018 20:54:34 +0000 (22:54 +0200)]
Rollup merge of #54699 - DiamondLovesYou:reexport-getopts, r=pnkfelix

Re-export `getopts` so custom drivers can reference it.

Otherwise, custom drivers will have to use their own copy of `getopts`, which won't match the types used in `CompilerCalls`.

5 years agoRollup merge of #54687 - scottmcm:more-elision, r=dtolnay
Pietro Albini [Tue, 2 Oct 2018 20:54:33 +0000 (22:54 +0200)]
Rollup merge of #54687 - scottmcm:more-elision, r=dtolnay

Use impl_header_lifetime_elision in libcore

The feature is approved for stabilization, so let's use it to remove about 300 `'a`s.

Tracking issue for the feature: https://github.com/rust-lang/rust/issues/15872

5 years agoRollup merge of #54680 - RalfJung:compile-pass, r=pnkfelix
Pietro Albini [Tue, 2 Oct 2018 20:54:32 +0000 (22:54 +0200)]
Rollup merge of #54680 - RalfJung:compile-pass, r=pnkfelix

make run-pass tests with empty main just compile-pass tests

Many run-pass tests have an empty main, so there is not actually any point in running them. This makes them `compile-pass` tests instead, saving some time (generating the binary and then running it).

For now I did this only for `run-pass/issues`; if there is interest I can also do it for the other directories. I used `^\s*fn\s+main\(\s*\)\s*\{\s*\}` as regexp to identify these files.

5 years agoRollup merge of #54648 - alexcrichton:update-cargo, r=nikomatsakis
Pietro Albini [Tue, 2 Oct 2018 20:54:30 +0000 (22:54 +0200)]
Rollup merge of #54648 - alexcrichton:update-cargo, r=nikomatsakis

Update Cargo's submodule

Bring in a few updates and fixes, mostly a standard update.

5 years agoRollup merge of #54603 - davidtwco:issue-54559, r=nikomatsakis
Pietro Albini [Tue, 2 Oct 2018 20:54:29 +0000 (22:54 +0200)]
Rollup merge of #54603 - davidtwco:issue-54559, r=nikomatsakis

Add `crate::` to trait suggestions in Rust 2018.

Fixes #54559.

In the 2018 edition, when suggesting traits to import that implement a
given method that is being invoked, suggestions will now include the
`crate::` prefix if the suggested trait is local to the current crate.

r? @nikomatsakis

5 years agoRollup merge of #54458 - scottmcm:bug-54456, r=nikomatsakis
Pietro Albini [Tue, 2 Oct 2018 20:54:28 +0000 (22:54 +0200)]
Rollup merge of #54458 - scottmcm:bug-54456, r=nikomatsakis

Allow both explicit and elided lifetimes in the same impl header

While still prohibiting explicit and in-band in the same header.

Fixes #54456

As usual, I don't know the broader context of the code I'm changing, so please let me know whatever I can do better.

Pre-existing test that mixing explicit and in-band remains an error: https://github.com/rust-lang/rust/blob/master/src/test/ui/in-band-lifetimes/E0688.rs

5 years agoRollup merge of #54269 - PramodBisht:issue/53840, r=estebank
Pietro Albini [Tue, 2 Oct 2018 20:54:27 +0000 (22:54 +0200)]
Rollup merge of #54269 - PramodBisht:issue/53840, r=estebank

#53840: Consolidate pattern check errors

#53840  on this PR we are aggregating `cannot bind by-move and by-ref in the same pattern` message present on the different lines into one diagnostic message. Here we are first gathering those `spans` on `vector` then we are throwing them with the help of `MultiSpan`
r? @estebank

Addresses: #53480

5 years agoAuto merge of #54343 - blitzerr:master, r=nikomatsakis
bors [Tue, 2 Oct 2018 20:46:49 +0000 (20:46 +0000)]
Auto merge of #54343 - blitzerr:master, r=nikomatsakis

First shot at #54015

Closes #54015

5 years agoMake spec_extend use for_each()
Nathan West [Tue, 2 Oct 2018 19:35:25 +0000 (12:35 -0700)]
Make spec_extend use for_each()

5 years agomake `CStr::from_bytes_with_nul_unchecked()` a const fn
Austin Bonander [Tue, 2 Oct 2018 11:26:16 +0000 (04:26 -0700)]
make `CStr::from_bytes_with_nul_unchecked()` a const fn

closes #54678

5 years agomake `CStr::from_bytes_with_nul_unchecked()` a const fn
Austin Bonander [Tue, 2 Oct 2018 10:42:01 +0000 (03:42 -0700)]
make `CStr::from_bytes_with_nul_unchecked()` a const fn

closes #54678

5 years agomove some more tests
Ralf Jung [Tue, 2 Oct 2018 11:14:19 +0000 (13:14 +0200)]
move some more tests

5 years agoAuto merge of #54742 - Manishearth:clippyup, r=oli-obk
bors [Tue, 2 Oct 2018 10:36:25 +0000 (10:36 +0000)]
Auto merge of #54742 - Manishearth:clippyup, r=oli-obk

Update clippy

r? @oli-obk @kennytm

5 years agoFix rustdoc
Oliver Schneider [Tue, 2 Oct 2018 10:31:05 +0000 (12:31 +0200)]
Fix rustdoc

5 years agoUpdate clippy
Manish Goregaokar [Tue, 2 Oct 2018 09:11:35 +0000 (11:11 +0200)]
Update clippy

5 years agoNest the `impl Trait` existential item inside the return type
Oliver Schneider [Tue, 2 Oct 2018 08:54:34 +0000 (10:54 +0200)]
Nest the `impl Trait` existential item inside the return type

5 years agoConsolidate pattern check errors
Pramod Bisht [Tue, 2 Oct 2018 05:51:02 +0000 (05:51 +0000)]
Consolidate pattern check errors

we are consolidating `cannot bind by-move and by-ref in the same
pattern` message present on the different lines into single diagnostic
message.

To do this, we are first gathering those spans into the vector
after that we are throwing them with the help of MultiSpan in
a separate block.

Addresses: #53840

5 years agoAuto merge of #54701 - arielb1:outlives-later, r=nikomatsakis
bors [Tue, 2 Oct 2018 04:22:55 +0000 (04:22 +0000)]
Auto merge of #54701 - arielb1:outlives-later, r=nikomatsakis

normalize param-env type-outlives predicates last

The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.

Fixes #54467

r? @nikomatsakis
beta-nominating because this is required for inferred_outlives_bounds, which is in beta

5 years agoAuto merge of #54694 - csmoe:self_this, r=estebank
bors [Tue, 2 Oct 2018 01:09:36 +0000 (01:09 +0000)]
Auto merge of #54694 - csmoe:self_this, r=estebank

Suggest to use self for fake-self from other languages

Closes https://github.com/rust-lang/rust/issues/54019
r? @estebank

5 years agoAttempt to resolve linking issues.
David Wood [Thu, 27 Sep 2018 22:56:41 +0000 (00:56 +0200)]
Attempt to resolve linking issues.

This commit takes a different approach to add the `crate::` prefix to
item paths than previous commits. Previously, recursion was stopped
after a prelude crate name was pushed to the path. It is theorized that
this was the cause of the linking issues since the same path logic is
used for symbol names and that not recursing meant that details were
being missed that affect symbol names. As of this commit, instead of
ceasing recursion, a flag is passed through to any subsequent recursive
calls so that the same effect can be achieved by checking that flag.

5 years agoMove prelude crate names into `Session`.
David Wood [Thu, 27 Sep 2018 19:38:11 +0000 (21:38 +0200)]
Move prelude crate names into `Session`.

Avoid hardcoding and special-casing the `std` crate name in the item
path logic by moving the prelude crate name logic into the `Session`
type so it can be reused in the item path logic and resolve module.

5 years agoAdd `crate::` to trait suggestions in Rust 2018.
David Wood [Wed, 26 Sep 2018 23:17:54 +0000 (01:17 +0200)]
Add `crate::` to trait suggestions in Rust 2018.

In the 2018 edition, when suggesting traits to import that implement a
given method that is being invoked, suggestions will now include the
`crate::` prefix if the suggested trait is local to the current crate.

5 years agoImprove mutability error suggestions.
David Wood [Mon, 1 Oct 2018 17:20:57 +0000 (19:20 +0200)]
Improve mutability error suggestions.

This commit improves mutability error suggestions by suggesting the
removal of `&mut` where a mutable borrow is being taken of a `&mut self`
or a `self: &mut Self`.

5 years agoImprove implicit self mutability suggestions.
David Wood [Mon, 1 Oct 2018 15:46:04 +0000 (17:46 +0200)]
Improve implicit self mutability suggestions.

This commit adds an `ImplicitSelfKind` to the HIR and the MIR that keeps
track of whether a implicit self argument is immutable by-value, mutable
by-value, immutable reference or mutable reference so that the addition
of the `mut` keyword can be suggested for the immutable by-value case.