Commit Graph

87870 Commits

Author SHA1 Message Date
Esteban Küber
f62f540b4e Point at function name span 2018-12-30 15:41:19 -08:00
Esteban Küber
1f65dc0770 Point at the return type span on type mismatch due to missing return
Do not point at the entire block span on fn return type mismatches
caused by missing return.
2018-12-30 13:55:00 -08:00
bors
59183180f7 Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkov
Implement RFC 2338, "Type alias enum variants"

This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following.

```rust
#![feature(type_alias_enum_variants)]

enum Foo {
    Bar(i32),
    Baz { i: i32 },
}

type Alias = Foo;

fn main() {
    let t = Alias::Bar(0);
    let t = Alias::Baz { i: 0 };
    match t {
        Alias::Bar(_i) => {}
        Alias::Baz { i: _i } => {}
    }
}
```

Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern.

Fixes issues #56199 and #56611.

N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible.

```rust
Option::<u8>::None; // OK
Option::None::<u8>; // OK, but lint in near future (hard error next edition?)
Alias::<u8>::None; // OK
Alias::None::<u8>; // Error
```

I do not know if this will need an FCP, but let's start one if so.
2018-12-29 21:03:11 +00:00
bors
007115746c Auto merge of #57197 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

Successful merges:

 - #57149 (Fix typo in pin documentation)
 - #57153 (Small: Fix span in char documentation)
 - #57159 (Update references to closed issue)
 - #57163 (Give the crate select chevron room to breathe.)
 - #57168 (Removed aligned ZST requirement from docs of read_/write_unaligned.)
 - #57174 (Update link to rustc guide)
 - #57177 (Fix warning when compiling rustc)

Failed merges:

r? @ghost
2018-12-29 18:12:57 +00:00
bors
d969c61e8c Auto merge of #56924 - ehuss:update-cargo-rls-miri, r=alexcrichton
Update cargo, rls, miri

Update cargo, rls, miri

Added `rustc-workspace-hack` to miri so that it shares the same features for serde as other tools.

cc @alexcrichton

## cargo

25 commits in 2cf1f5dda2f7ed84e94c4d32f643e0f1f15352f0..0d1f1bbeabd5b43a7f3ecfa16540af8e76d5efb4
2018-12-11 03:44:04 +0000 to 2018-12-19 14:45:14 +0000
- Remove Stale bot's configuration (rust-lang/cargo#6463)
- Add labels to issue templates (rust-lang/cargo#6464)
- Fix new man page links. (rust-lang/cargo#6459)
- Fix metabuild compile errors with --message-format=json. (rust-lang/cargo#6432)
- Support alt-registry names in [patch] table. (rust-lang/cargo#6456)
- Update the rustup URL (rust-lang/cargo#6455)
- New man pages. (rust-lang/cargo#6405)
- Reify the DepFingerprint type (rust-lang/cargo#6451)
- Extract Fingerprint::new (rust-lang/cargo#6449)
- Upgrade the metabuild to Rust 2018 (rust-lang/cargo#6448)
- Make edition comparing code consistent (rust-lang/cargo#6450)
- Document `name` and `authors` in [package] (rust-lang/cargo#6447)
- Travis: only use mdbook 0.1.7. (rust-lang/cargo#6443)
- Update git2-curl requirement from 0.8.1 to 0.9.0 (rust-lang/cargo#6439)
- Update git2 requirement from 0.7.5 to 0.8.0 (rust-lang/cargo#6438)
- Display errors when `cargo fix` fails. (rust-lang/cargo#6419)
- cargo fix: fix targets with shared sources. (rust-lang/cargo#6434)
- Fix panic-in-panic in tests. (rust-lang/cargo#6431)
- More Rust 2018 edition cleanups (rust-lang/cargo#6422)
- Cleanup some trait impls for SourceId (rust-lang/cargo#6429)
- Remove a nightly check from doc tests (rust-lang/cargo#6427)
- Replace CargoError with failure::Error (rust-lang/cargo#6425)
- Allow testsuite warnings in dev (rust-lang/cargo#6426)
- add `--dry-run` option to cargo update (rust-lang/cargo#6371)
- Migrate to some Rust 2018 idioms (rust-lang/cargo#6416)

## rls

16 commits in bd5b899afb05e14d33e210ede3da241ca1ca088f..6f5e4bba7b1586fca6e0ea7724cadb5683b2f308
2018-12-10 08:53:00 +0100 to 2018-12-21 17:11:08 +0100
- Update jsonrpc-core (rust-lang-nursery/rls#1206)
- Use `home_dir` from `home` crate (rust-lang-nursery/rls#1207)
- Update cargo. (rust-lang-nursery/rls#1204)
- Fix deprecated `trim_{left,right}` warnings (rust-lang-nursery/rls#1203)
- Respect ${CARGO,RUSTUP}_HOME for tooltip relative dirs (rust-lang-nursery/rls#1201)
- Separate tooltip tests that require Racer fallback (rust-lang-nursery/rls#1200)
- tests: Don't generate tooltip results in tests/fixtures (rust-lang-nursery/rls#1199)
- Overhaul fixture handling in tests (rust-lang-nursery/rls#1190)
- Don't return symbols with empty names (rust-lang-nursery/rls#1193)
- Don't check AppVeyor CI status for bors
- Properly infer full_docs (rust-lang-nursery/rls#1192)
- Update cargo (rust-lang-nursery/rls#1191)
- Improve hover test_tooltip tests (rust-lang-nursery/rls#1175)
- Fix unused warnings (rust-lang-nursery/rls#1185)
- Workaround rust-lang-nursery/rls#703 to prevent obscure failures due to sccache. (rust-lang-nursery/rls#1177)
- Disable travis cache (rust-lang-nursery/rls#1182)

## miri

14 commits in bccadeb4f7cbeeb14097a365653148afe8bbd159..6c2fc6daf1ac6849d1243b213f5a3fb07feeef29
2018-12-08 11:07:22 +0100 to 2018-12-26 14:28:25 +0100
- use memory::check_bounds_ptr for offset check (solson/miri#589)
- Fix comparing function pointers (solson/miri#587)
- fix for infallible allocation (solson/miri#586)
- fix test for latest nightly (solson/miri#585)
- Treat ref-to-raw cast like a reborrow: do a special kind of retag (solson/miri#572)
- Test cargo-miri on Windows (solson/miri#578)
- Cargo miri tweaks and test that we can exclude tests (solson/miri#580)
- Fix cargo miri test (solson/miri#550)
- fix for latest nightly (solson/miri#574)
- Add rustc-workspace-hack. (solson/miri#575)
- use RUSTC_WRAPPER for the cargo hook (solson/miri#573)
- do not auto-detect the targets in the sysroot, instead specify target manually through env var (solson/miri#570)
- Cleanup: Avoid repeating signatures, get rid of to_bytes hack (solson/miri#568)
- Support building and running with full MIR on foreign architectures, drop support for missing MIR (solson/miri#566)
2018-12-29 15:35:59 +00:00
bors
419044956a Auto merge of #57181 - petrochenkov:impice3, r=estebank
resolve: Fix another ICE in import validation

Imports are allowed to have ambiguous resolutions as long as all of them have same `Def`.
As it turned out, it's possible for different `Module`s to have same `Def` when `extern crate` items are involved.

Fixes https://github.com/rust-lang/rust/issues/56596
2018-12-29 12:55:48 +00:00
kennytm
68f370ce05
Rollup merge of #57177 - varkor:fix-duration_as_u128-warning, r=estebank
Fix warning when compiling rustc
2018-12-29 18:50:32 +08:00
kennytm
aed3eaafee
Rollup merge of #57174 - linclark:patch-1, r=varkor
Update link to rustc guide
2018-12-29 18:50:30 +08:00
kennytm
9a67b18888
Rollup merge of #57168 - kennytm:fix-unaligned-docs, r=rkruppe
Removed aligned ZST requirement from docs of read_/write_unaligned.

This is just a copy-paste error.
2018-12-29 18:50:29 +08:00
kennytm
af56d2bf1a
Rollup merge of #57163 - JohnHeitmann:chevron-fix, r=estebank
Give the crate select chevron room to breathe.

Before:
![screen shot 2018-12-27 at 10 26 10 pm](https://user-images.githubusercontent.com/4282480/50505100-9ff24300-0a26-11e9-9b74-37bdee6faf83.png)

After:
![screen shot 2018-12-27 at 10 25 57 pm](https://user-images.githubusercontent.com/4282480/50505110-a54f8d80-0a26-11e9-9fa2-7fed21773207.png)
2018-12-29 18:50:28 +08:00
kennytm
291d51c92d
Rollup merge of #57159 - ids1024:closed-issue, r=Centril
Update references to closed issue

Issue #28979 was closed with a link to #55467.
2018-12-29 18:50:27 +08:00
kennytm
97e591ae0c
Rollup merge of #57153 - estebank:doc, r=cramertj
Small: Fix span in char documentation
2018-12-29 18:50:26 +08:00
kennytm
72b27a7254
Rollup merge of #57149 - rust-lang:sgrif-patch-1, r=rkruppe
Fix typo in pin documentation

Affect is a verb, effect is a noun
2018-12-29 18:50:24 +08:00
bors
d5175f4405 Auto merge of #57160 - petrochenkov:impice2, r=estebank
resolve: Fix an ICE in import validation

Fixes ICE reported in the comment https://github.com/rust-lang/rust/issues/56596#issuecomment-449866807
2018-12-29 10:17:10 +00:00
bors
35a64f8bbf Auto merge of #57140 - estebank:str-err, r=varkor
Tweaks to format string diagnostics

Add label spans and fix incorrect spans.

Fix #55155, fix #55350.
2018-12-29 07:28:15 +00:00
Alexander Regueiro
a4fa7ef2b9 Fixed stderr files for ui tests. 2018-12-29 05:45:45 +00:00
Eric Huss
5739364784 Update cargo, rls, miri 2018-12-28 17:23:01 -08:00
bors
43d26b1f35 Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus
Add no-crate filter option on rustdoc

@onur asked me about it so here it is!

r? @QuietMisdreavus
2018-12-29 01:22:04 +00:00
bors
d9e3edb74b Auto merge of #57138 - matthiaskrgr:clippy, r=oli-obk
submodules: update clippy from fc24fce7 to 721f688e

Fixes clippy toolstate.

Changes:
````
rustup https://github.com/rust-lang/rust/pull/57069
Rustfmt.
fix breakage from rust-lang/rust#57088
fix a couple of ftrivial typos (NFC).
update CARGO_CLIPPY_HELP string to suggest tool lints.
rustc_tools_util: add readme
rustc_tool_utils: expand Cargo.toml with a few keywords in preparation for crates.io release
Fix macro detection in `empty_loop`.
Changed `macro_backtrace()` to `in_macro()`.
Fix lint detection on macro expansion.
````

r? @oli-obk
2018-12-28 22:41:04 +00:00
Vadim Petrochenkov
2af1d6f4dd resolve: Fix another ICE in import validation 2018-12-29 00:15:19 +03:00
bors
60e825389d Auto merge of #57118 - Zoxc:query-stats, r=wesleywiser
Add a command line flag to print some query stats

r? @michaelwoerister
2018-12-28 20:02:23 +00:00
varkor
04c1a92fa0 Fix warning when compiling rustc 2018-12-28 19:28:57 +00:00
Lin Clark
d30465fbfc
Update link to rustc guide 2018-12-28 13:34:00 -05:00
Matthias Krüger
1654ef8fa3 submodules: update clippy from fc24fce7 to f7bdf500
Fixes clippy toolstate

Changes:
````
Match on ast/hir::ExprKind::Err
Update *.stderr files
Use -Zui-testing flag
Mention S-inactive-closed PRs in the CONTRIBUTING.md
tests: fix formatting and update test output
base tests: make sure to fail CI if tests need formatting
base tests: switch to nightly toolchain before checking formatting of tests with rustfmt
rustup https://github.com/rust-lang/rust/pull/57069
Rustfmt.
fix breakage from rust-lang/rust#57088
fix a couple of ftrivial typos (NFC).
update CARGO_CLIPPY_HELP string to suggest tool lints.
rustc_tools_util: add readme
rustc_tool_utils: expand Cargo.toml with a few keywords in preparation for crates.io release
Fix macro detection in `empty_loop`.
Changed `macro_backtrace()` to `in_macro()`.
Fix lint detection on macro expansion.
````
2018-12-28 19:18:15 +01:00
bors
3cda631ea4 Auto merge of #57167 - Dylan-DPC:feature/non-zero-getters, r=SimonSapin
Make the getter for NonZero types into a const fn

Closes https://github.com/rust-lang/rust/issues/53331

Rework of #56739

cc @Lokathor

r? @oli-obk
2018-12-28 15:10:17 +00:00
kennytm
9223512fbe
Removed aligned ZST requirement from docs of read_/write_unaligned.
This is just a copy-paste error.
2018-12-28 22:00:33 +08:00
Oliver Scherer
39f95fa7c7
Update src/test/ui/consts/const-nonzero.rs
Co-Authored-By: Dylan-DPC <dylan.dpc@gmail.com>
2018-12-28 17:45:49 +05:30
dylan_DPC
d11a58b676 Make the getter for NonZero types into a const fn 2018-12-28 16:58:55 +05:30
bors
48742c68d9 Auto merge of #57137 - cramertj:unpin-prelude, r=SimonSapin
Add Unpin to std prelude, not just core

r? @alexcrichton
2018-12-28 10:54:16 +00:00
bors
ee49bf8964 Auto merge of #55519 - fhartwig:hashmap-index-example, r=Centril
Add example of using the indexing operator to HashMap docs

Fixes #52575
2018-12-28 06:52:15 +00:00
John Heitmann
94dd67bc6e Give the crate select chevron room to breathe. 2018-12-27 22:26:54 -08:00
bors
e8ca35e63d Auto merge of #57155 - petrochenkov:dcrate3, r=dtolnay
Resolve `$crate`s for pretty-printing at more appropriate time

Doing it in `BuildReducedGraphVisitor` wasn't a good idea, identifiers wasn't actually visited half of the time.
As a result some `$crate`s weren't resolved and were therefore pretty-printed as `$crate` literally, which turns into two tokens during re-parsing of the pretty-printed text.

Now we are visiting and resolving `$crate` identifiers in an item right before sending that item to a proc macro attribute or derive.

Fixes https://github.com/rust-lang/rust/issues/57089
2018-12-28 02:54:14 +00:00
Vadim Petrochenkov
ce73bc7d47 resolve: Fix an ICE in import validation 2018-12-28 05:43:31 +03:00
Ian Douglas Scott
0c58eec86c
Update references to closed issue
Issue #28979 was closed with a link to #55467.
2018-12-27 16:49:12 -08:00
bors
f8caa321c7 Auto merge of #56999 - petrochenkov:macrecov2, r=estebank
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-end

This way we can avoid aborting compilation if expansion produces errors and generate `ExprKind::Err`s instead.
2018-12-27 22:27:27 +00:00
Vadim Petrochenkov
e40d7d9643 Resolve $crates for pretty-printing at more appropriate time 2018-12-28 00:44:47 +03:00
Vadim Petrochenkov
24af9f88a5 Add test demonstrating disintegration of $crate into $ and crate 2018-12-28 00:34:24 +03:00
bors
fb86d604bf Auto merge of #56384 - scalexm:chalk, r=nikomatsakis
Implement the new-style trait solver

Final PR of what I believe to be a minimally working implementation of the new-style trait solver.

The new trait solver can be used by providing the `-Z chalk` command line flag. It is currently used everywhere in `rustc_typeck`, and for everything relying on `rustc::infer::canonical::query_response::enter_canonical_trait_query`.

The trait solver is invoked in rustc by using the `evaluate_goal` canonical query. This is not optimal because each call to `evaluate_goal` creates a new `chalk_engine::Forest`, hence rustc cannot use answers to intermediate goals produced by the root goal. We'll need to change that but I guess that's ok for now.

Some next steps, I think, are:
* handle region constraints: region constraints are computed but are completely ignored for now, I think we may need additional support from `chalk_engine` (as a side effect, types or trait references with outlive requirements cannot be proved well-formed)
* deactivate eager normalization in the presence of `-Z chalk` in order to leverage the lazy normalization strategy of the new-style trait solver
* add the remaining built-in impls (only `Sized` is supported currently)
* transition the compiler to using generic goals instead of predicates that still refer to named type parameters etc

I added a few very simple tests to check that the new solver has the right behavior, they won't be needed anymore once it is mature enough. Additionally it shows off that we get [implied bounds](https://github.com/rust-lang/rust/issues/44491) for free.

r? @nikomatsakis
2018-12-27 19:47:56 +00:00
Esteban Küber
93d8343b83 Fix span in char documentation 2018-12-27 11:36:05 -08:00
scalexm
993d213fda Set a def_id in ParamEnv only with -Z chalk 2018-12-27 19:21:17 +01:00
scalexm
81d6f9cc81 Add tests 2018-12-27 19:21:16 +01:00
scalexm
3790f08a42 Fix tcx.environment for inherent impls 2018-12-27 19:21:16 +01:00
scalexm
8e2bdaacac Add wf_clause_for_fn_def 2018-12-27 19:21:16 +01:00
scalexm
26e0ea8148 Use TraitEngine in enter_canonical_trait_query 2018-12-27 19:21:16 +01:00
scalexm
da9467d147 Handle sub-typing in chalk-engine 2018-12-27 19:21:16 +01:00
scalexm
ba6314a0d6 Integrate chalk engine 2018-12-27 19:21:16 +01:00
scalexm
ea4187a842 Fix binding levels in implied bounds rules 2018-12-27 19:21:16 +01:00
scalexm
c0d7803950 Fix replacement of escaping bound types
Multiple references to the same `BoundTy` were not using the same
result.
2018-12-27 19:21:16 +01:00
scalexm
e5992e7ae9 Fix Sized requirement for empty tuples in program_clauses 2018-12-27 19:21:16 +01:00
scalexm
dfcad82509 Add builtin impls for Sized in chalk_context::program_clauses 2018-12-27 19:21:16 +01:00