Commit Graph

84378 Commits

Author SHA1 Message Date
Pietro Albini
ee745d6abf
Rollup merge of #54804 - euclio:inverted-parameters, r=estebank
add suggestion for inverted function parameters

Fixes #54065.
2018-10-05 22:33:15 +02:00
Pietro Albini
3810657ae3
Rollup merge of #54787 - varkor:unused-mut-in-desugaring, r=nikomatsakis
Only warn about unused `mut` in user-written code

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

r? @pnkfelix
cc @blitzerr
2018-10-05 22:33:13 +02:00
Pietro Albini
9e8f522e80
Rollup merge of #54781 - phansch:master, r=varkor
Add examples to `TyKind::FnDef` and `TyKind::FnPtr` docs

This adds two examples to the docs of `TyKind::FnDef` and `TyKind::FnPtr`.

I found these two types a bit confusing when I learned about them and I think adding these examples might help others.
2018-10-05 22:33:12 +02:00
Pietro Albini
5efac03f34
Rollup merge of #54717 - ljedrz:cleanup_ty_p1, r=davidtwco
Cleanup rustc/ty part 1

Part 2 will follow soon; I wouldn't want these changes to rot too quickly.

- improve stack shifting and remove related allocations
- move a faster early return up
- improve allocations
- use Cow<str> where applicable
- simplify common patterns
- whitespace fixes
2018-10-05 22:33:11 +02:00
Pietro Albini
6b24de1edd
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).
2018-10-05 22:33:10 +02:00
bors
2155f27b64 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
2018-10-05 15:32:19 +00:00
Andy Russell
f5db411410
add suggestion for inverted function parameters
Fixes #54065.
2018-10-05 10:33:19 -04:00
bors
60c846046e 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
2018-10-05 12:52:53 +00:00
bors
766e21c7d7 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.
2018-10-05 10:08:01 +00:00
Vadim Petrochenkov
0d8e9cd4df Reapply the macro_rules disambiguation changes from master 2018-10-05 11:46:12 +04:00
Vadim Petrochenkov
c29fb80c05 Reapply the derive helper changes from master 2018-10-05 11:40:52 +04:00
Vadim Petrochenkov
8994c6d417 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
2018-10-05 11:40:40 +04:00
Vadim Petrochenkov
60a1d4e6c2 resolve: Keep more precise traces for expanded macro resolutions
`NameBinding`s instead of `Def`s
2018-10-05 11:40:40 +04:00
Vadim Petrochenkov
050bd32958 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`
2018-10-05 11:40:40 +04:00
bors
61f5ca7d64 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
2018-10-05 07:40:36 +00:00
Vadim Petrochenkov
05a46815e4 resolve: Support value namespace in fn resolve_lexical_macro_path_segment 2018-10-05 11:40:19 +04:00
Vadim Petrochenkov
7b69088d15 expansion: Expand attribute macros registered by legacy plugins in usual left-to-right order 2018-10-05 11:40:19 +04:00
Vadim Petrochenkov
dd6347a6b9 resolve: Integrate inert attributes registererd by legacy plugins into macro resolution 2018-10-05 11:40:19 +04:00
ljedrz
7ad21a88e6 rustc/ty: improve stack shifting and remove related allocations 2018-10-05 09:00:54 +02:00
ljedrz
0ee6b54c24 rustc/ty: move a faster early return up 2018-10-05 09:00:54 +02:00
ljedrz
e153103c38 rustc/ty: improve allocations 2018-10-05 09:00:53 +02:00
ljedrz
029e2618d0 rustc/ty: simplify common patterns 2018-10-05 09:00:53 +02:00
ljedrz
91fc573172 rustc/ty: use Cow<str> where applicable 2018-10-05 09:00:39 +02:00
ljedrz
2ff117df50 rustc/ty: whitespace fixes 2018-10-05 08:58:05 +02:00
Gabriel Majeri
6ba5584712 Address review comments 2018-10-05 08:50:17 +03:00
bors
b8bea5a0a6 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.
2018-10-05 01:57:01 +00:00
bors
8c4ad4e9e4 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
2018-10-04 20:28:57 +00:00
Philipp Hansch
769b3832fd
Further improve docs for FnDef and FnPtr 2018-10-04 20:30:02 +02:00
bors
a57f1c9c95 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
2018-10-04 16:34:27 +00:00
Niko Matsakis
85b99561c6 s/skol_predicate/placeholder_predicate 2018-10-04 11:02:40 -04:00
Niko Matsakis
b99a8d7056 fix typo: s/tained/tainted/ 2018-10-04 11:02:40 -04:00
Niko Matsakis
068a6a256c remove occurences of skolemization 2018-10-04 11:02:40 -04:00
Niko Matsakis
21aaaac29b remove all occurences of skolemize 2018-10-04 11:02:40 -04:00
Niko Matsakis
cdb95b0f21 build up the placeholder indices as we go
Avoids a linear walk over the regions at the end.
2018-10-04 11:02:40 -04:00
Niko Matsakis
0887456401 extend NLL universe code to have >1 placeholder within one universe 2018-10-04 11:02:40 -04:00
Niko Matsakis
4c2fc333f0 create just one subuniverse per binder -- no need for more, really 2018-10-04 11:02:40 -04:00
Niko Matsakis
f8dd084ef1 reorder the placeholders and inference variables in hr::sub 2018-10-04 11:02:40 -04:00
Niko Matsakis
4cd4eae435 rename skolemized to placeholder 2018-10-04 11:02:40 -04:00
Niko Matsakis
a96510d066 select.rs: rustfmt 2018-10-04 11:02:39 -04:00
bors
5de52817c4 Auto merge of #54784 - Manishearth:clippyup, r=oli-obk
Update clippy

None
2018-10-04 14:08:12 +00:00
varkor
ea3d8f510d Ignore desugarings when comparing duplicate trait error messages 2018-10-04 14:48:32 +01:00
bors
5472b0718f 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
2018-10-04 11:39:50 +00:00
Oliver Schneider
b0643add6d Update Cargo.lock 2018-10-04 12:51:58 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
54c416d841
Add features to the workspace hack 2018-10-04 12:40:04 +02:00
Pietro Albini
71aded852f
Rollup merge of #54795 - euclio:ifmt-bad-arg, r=estebank
remove padding from multiline format string label

Fixes #53836.
2018-10-04 12:20:17 +02:00
Pietro Albini
2503db8e61
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
2018-10-04 12:20:16 +02:00
Pietro Albini
bc2859d5a6
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
2018-10-04 12:20:15 +02:00
Pietro Albini
cbc9477bda
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
2018-10-04 12:20:13 +02:00
Pietro Albini
7523cdf101
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
2018-10-04 12:20:12 +02:00
Pietro Albini
2fda2f6f13
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
2018-10-04 12:20:11 +02:00