Commit Graph

84324 Commits

Author SHA1 Message Date
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
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
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
Pietro Albini
fdc16605ec
Rollup merge of #54769 - jacobherrington:patch-1, r=kennytm
Fix typo in CONTRIBUTING.md

I noticed a small typo while reading over this document.
2018-10-04 12:20:10 +02:00
Pietro Albini
c215c1927a
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.
2018-10-04 12:20:08 +02:00
Pietro Albini
bc4f86909e
Rollup merge of #54746 - llogiq:simplify-unused-lints, r=michaelwoerister
simplify some unused lints code

Those are but small simplifications for readability.
2018-10-04 12:20:07 +02:00
Pietro Albini
1dbc8b0d4b
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.
2018-10-04 12:20:05 +02:00
bors
8a0e5cbf12 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
2018-10-04 09:17:47 +00:00
bors
088fc7384c 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
2018-10-04 06:48:13 +00:00
bors
c67ea54d44 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
2018-10-04 03:08:22 +00:00
bors
d0787284da Auto merge of #54447 - KiChjang:issue-54331, r=nikomatsakis
Lower type ascriptions to HAIR and MIR

Fixes #54331.

r? @nikomatsakis
2018-10-04 00:26:00 +00:00
bors
4bf883b5e7 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
2018-10-03 21:46:21 +00:00
Andy Russell
b14dc69ee8
remove padding from multiline format string label
Fixes #53836.
2018-10-03 14:29:39 -04:00
bors
5597ee8a64 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)
2018-10-03 18:12:22 +00:00
scalexm
edb3f9777b Fix ty::UnnormalizedProjection in rustdoc 2018-10-03 18:49:27 +02:00
scalexm
608adfc3f0 Introduce TyKind::UnnormalizedProjection 2018-10-03 17:06:28 +02:00
David Wood
5872d3eacd
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.
2018-10-03 15:20:20 +02:00
ljedrz
f0de294a9b A handful of cleanups for rustc/mir 2018-10-03 15:07:18 +02:00
David Wood
9d408e0511
Update tests to demonstrate 2015 behaviour.
Adds a test to demonstrate behaviour of suggestions in the
2015 edition.
2018-10-03 14:43:58 +02:00
David Wood
c832579fb7
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.
2018-10-03 14:43:57 +02:00
David Wood
29e2376ac7
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.
2018-10-03 14:43:57 +02:00
Vadim Petrochenkov
078fc52cbc resolve: Prefer macro_rules definitions to in-module macro definitions in some cases 2018-10-03 16:12:39 +04:00
scalexm
8327976890 Remove duplicate predicates in explicit_predicates_of
Fixes #52187.
2018-10-03 13:57:47 +02:00
bors
6ddab3e078 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
2018-10-03 10:49:27 +00:00
Oliver Schneider
c793391e6d Move platform dependent output ui tests to compile-fail 2018-10-03 11:46:05 +02:00
Oliver Schneider
f5106a23c3 Poke in the dark and see if bors+windows stops screaming 2018-10-03 10:07:05 +02:00
Oliver Schneider
a9156e9731 Fix typo 2018-10-03 10:07:05 +02:00
Oliver Schneider
1f943849b1 Update error id to an unused one 2018-10-03 10:07:05 +02:00
Oliver Schneider
9e46c0b689 Only promote calls to #[rustc_promotable] const fns 2018-10-03 10:07:05 +02:00
Andre Bogus
989f480297 simplify some unused lints code 2018-10-03 09:00:21 +02:00
Zack M. Davis
1081bbbfc5 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.
2018-10-02 23:02:51 -07:00
Wesley Wiser
d686896f90
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).
2018-10-02 22:11:38 -04:00
bors
4cf11765dc 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
2018-10-02 23:29:58 +00:00
Son
30f2e96ab1 Remove main() in examples 2018-10-03 08:21:51 +10:00
jacob
84f75f0dbb
Fix typo in CONTRIBUTING.md
I noticed a small typo while reading over this document.
2018-10-02 16:59:48 -05:00
Pietro Albini
00e4b27796
Rollup merge of #54745 - abonander:cstr-const, r=oli-obk
make `CStr::from_bytes_with_nul_unchecked()` a const fn

closes #54678
2018-10-02 22:54:38 +02:00
Pietro Albini
1826970cf2
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.
2018-10-02 22:54:36 +02:00
Pietro Albini
d9d96637d4
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
2018-10-02 22:54:35 +02:00
Pietro Albini
958f1c5582
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`.
2018-10-02 22:54:34 +02:00
Pietro Albini
7e571eead8
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
2018-10-02 22:54:33 +02:00
Pietro Albini
32c1454a87
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.
2018-10-02 22:54:32 +02:00