Commit Graph

87824 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
scalexm
6f488b945e Rename functions giving WF clauses for builtin types 2018-12-27 19:21:15 +01:00
scalexm
7b8da7908f Add utilities for creating generic types 2018-12-27 19:21:15 +01:00
scalexm
ec7362442c Return an instantiated environment instead of a generic one 2018-12-27 19:21:15 +01:00
scalexm
8cadd59674 Correctly lift empty lists of clauses and goals 2018-12-27 19:21:15 +01:00
scalexm
37ef0c38b7 Fix visit_ex_clause_with
The sub-visits were incorrectly combined with an `&&` instead of
an `||`.
2018-12-27 19:21:15 +01:00
scalexm
50f8ae364b Add a def-id in ty::ParamEnv 2018-12-27 19:21:15 +01:00
scalexm
69007bd660 Implement "lifetime juggling" methods from chalk integration trait
Fixes #55097.
2018-12-27 19:21:15 +01:00
scalexm
9b87f590dc Implement is_coinductive
Fixes #55096.
2018-12-27 19:21:15 +01:00
bors
bc09637e21 Auto merge of #56852 - kennytm:test-publish-toolstate-in-ci, r=Mark-Simulacrum
Added a job to dry-run the publish_toolstate.py once

Closes #56848.

Requires #56847 to be merged first.
2018-12-27 17:16:59 +00:00
bors
f2b92174e3 Auto merge of #56838 - Aaron1011:fix/rustdoc-infer-unify, r=nikomatsakis
Call poly_project_and_unify_type on types that contain inference types

Commit f57247c48c (Ensure that Rusdoc discovers all necessary auto
trait bounds) added a check to ensure that we only attempt to unify a
projection predicatre with inference variables. However, the check it
added was too strict - instead of checking that a type *contains* an
inference variable (e.g. '&_', 'MyType<_>'), it required the type to
*be* an inference variable (i.e. only '_' would match).

This commit relaxes the check to use 'ty.has_infer_types', ensuring that
we perform unification wherever possible.

Fixes #56822
2018-12-27 14:35:58 +00:00
Vadim Petrochenkov
bc16edeb28 Fix rebase and more CI failures 2018-12-27 15:51:37 +03:00
Vadim Petrochenkov
37af04ff8d Address review comments and CI failures 2018-12-27 15:51:37 +03:00
Vadim Petrochenkov
15cefe4b2a Make sure feature gate errors are recoverable 2018-12-27 15:51:37 +03:00
Vadim Petrochenkov
b99fb2f544 Fix trace_macros and log_syntax 2018-12-27 15:51:36 +03:00
Vadim Petrochenkov
4ac592516f Get rid of Block::recovered 2018-12-27 15:51:36 +03:00
Vadim Petrochenkov
fff01ccfa8 Do not abort compilation if expansion produces errors
Fix a number of uncovered deficiencies in diagnostics
2018-12-27 15:51:36 +03:00
Vadim Petrochenkov
a5c52c72ae AST/HIR: Introduce ExprKind::Err for better error recovery in the front-end 2018-12-27 15:51:36 +03:00
bors
d174173552 Auto merge of #57133 - SimonSapin:zero, r=oli-obk
Remove the private generic NonZero<T> wrapper type

Instead, use `#[rustc_layout_scalar_valid_range_start(1)]` directly on relevant libcore types.
2018-12-27 12:01:08 +00:00
bors
d2986970ad Auto merge of #57119 - jethrogb:jb/sgx-os-mod2, r=joshtriplett
Add `io` and `arch` modules to `std::os::fortanix_sgx`

This PR adds two more (unstable) modules to `std::os::fortanix_sgx` for the `x86_64-fortanix-unknown-sgx` target.

### io
`io` allows conversion between raw file descriptors and Rust types, similar to `std::os::unix::io`.

### arch
`arch` exposes the `ENCLU[EREPORT]` and `ENCLU[EGETKEY]` instructions. The current functions are very likely not going to be the final form of these functions (see also https://github.com/fortanix/rust-sgx/issues/15), but this should be sufficient to enable experimentation in libraries. I tried using the actual types (from the [`sgx-isa` crate](https://crates.io/crates/sgx-isa)) instead of byte arrays, but that would make `std` dependent on the `bitflags` crate which I didn't want to do at this time.
2018-12-27 09:21:06 +00:00
bors
39bc8f5899 Auto merge of #57129 - RalfJung:check-bounds, r=oli-obk
make Alloc::check_bounds_ptr private; you should use Memory::check_bounds_ptr instead

r? @oli-obk
2018-12-27 06:48:18 +00:00
kennytm
854abd319e
Added a job to dry-run the publish_toolstate.py once 2018-12-27 13:57:29 +08:00
Esteban Küber
5e952e3479 Add span label to unused string formatting argument
Fix #55350.
2018-12-26 20:36:02 -08:00
Esteban Küber
5e75001c59 Point at correct span for arguments in format strings
When a format string has escaped whitespace characters format
arguments were shifted by one per each escaped character. Account
for these escaped characters when synthesizing the spans.

Fix #55155.
2018-12-26 20:36:02 -08:00
bors
a1bad57fa5 Auto merge of #57069 - estebank:str-err, r=@cramertj
Various changes to string format diagnostics

- Point at opening mismatched formatting brace
- Account for differences between raw and regular strings
- Account for differences between the code snippet and `InternedString`
- Add more tests

```
error: invalid format string: expected `'}'`, found `'t'`
  --> $DIR/ifmt-bad-arg.rs:85:1
   |
LL | ninth number: {
   |               - because of this opening brace
LL | tenth number: {}",
   | ^ expected `}` in format string
   |
   = note: if you intended to print `{`, you can escape it using `{{`
```

Fix #53837.
2018-12-27 02:00:17 +00:00