Commit Graph

88351 Commits

Author SHA1 Message Date
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
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
Sean Griffin
1cd1ddbbaa
Fix typo in pin documentation
Affect is a verb, effect is a noun
2018-12-27 08:53:43 -07: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
Ralf Jung
c118b17953 use a better way to get at the type parameter 2018-12-27 14:25:05 +01: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
Ralf Jung
fff905bc69 panic when calling MaybeUninhabited::into_inner on uninhabited type 2018-12-27 13:04:53 +01: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
csmoe
8d77c7c037 retrieve ty info from place_ty
describe index with _
2018-12-27 17:25:45 +08: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
Esteban Küber
862ebc4c38 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
2018-12-26 14:29:43 -08:00
bors
79bbce488e Auto merge of #57124 - sunjay:stable_duration_as_u128, r=Centril
Stabilize Duration::{as_millis, as_micros, as_nanos}

Fixes #50202. 🎉

This is the stabilization PR for the `duration_as_u128` feature. I have never made one of these before so please let me know if I missed a step. I followed the [guide in the Rust Forge](https://forge.rust-lang.org/stabilization-guide.html) and also found some old stabilization PRs ([1](https://github.com/rust-lang/rust/pull/57002), [2](https://github.com/rust-lang/rust/pull/56207)) for similar features to base my work on.
2018-12-26 22:19:40 +00:00
Alexander Regueiro
5adf8c358a Changed resolution of enum variants to low priority. 2018-12-26 21:56:47 +00:00
Alexander Regueiro
ab239f37aa Minor cosmetic changes 2018-12-26 21:56:42 +00:00
Alexander Regueiro
87532e99e5 Minor clean-up 2018-12-26 21:54:18 +00:00