Commit Graph

155 Commits

Author SHA1 Message Date
Irina Popa b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
bors 448cc578a9 Auto merge of #48557 - matthewjasper:allow-trvial-bounds, r=nikomatsakis
Implement RFC 2056 trivial constraints in where clauses

This is an implementation of the new behaviour for #48214. Tests are mostly updated to show the effects of this. Feature gate hasn't been added yet.

Some things that are worth noting and are maybe not want we want

* `&mut T: Copy` doesn't allow as much as someone might expect because there is often an implicit reborrow.
* ~There isn't a check that a where clause is well-formed any more, so `where Vec<str>: Debug` is now allowed (without a `str: Sized` bound).~

r? @nikomatsakis
2018-05-16 09:03:38 +00:00
varkor 0a9371ab77 Add mk_param_from_def 2018-05-15 14:22:25 +01:00
varkor e9c28b2564 Use Kind instead of UnpackedKind in Substs methods 2018-05-15 14:22:25 +01:00
varkor d9190da982 Refactor Substs methods on generic parameters 2018-05-15 14:22:11 +01:00
Matthew Jasper 27183a9030 Feature gate trivial bounds 2018-05-15 11:43:57 +01:00
Matthew Jasper d0ec8ea1cc Implement RFC 2056 - trivial constraints 2018-05-15 11:37:33 +01:00
leonardo.yvens 804bcf7716 Better error reporting in Copy derive
In Copy derive, report all fulfillment erros when present and do not
report errors for types tainted with `TyErr`. Also report all fields
which are not Copy rather than just the first.

Also refactored `fn fully_normalize`, removing the not very useful
helper function along with a FIXME to the closed issue #26721 that's
looks out of context now.
2018-05-12 14:24:01 -03:00
bors 0a223d139c Auto merge of #50395 - Zoxc:small-tys, r=michaelwoerister
Optimize layout of TypeVariants

This makes references to `Slice` use thin pointers by storing the slice length in the slice itself. `GeneratorInterior` is replaced by storing the movability of generators in `TyGenerator` and the interior witness is stored in `GeneratorSubsts` (which is just a wrapper around `&'tcx Substs`, like `ClosureSubsts`). Finally the fields of `TypeAndMut` is stored inline in `TyRef`. These changes combine to reduce `TypeVariants` from 48 bytes to 24 bytes on x86_64.

r? @michaelwoerister
2018-05-10 14:14:35 +00:00
bors 472541731e Auto merge of #49711 - ibabushkin:auto_trait_refactor, r=nikomatsakis
Refactor auto trait handling in librustdoc to be accessible from librustc.

These commits transfer some of the functionality introduced in https://github.com/rust-lang/rust/pull/47833 to librustc with the intention of making the tools to work with auto traits accessible to third-party code, for example [rust-semverver](https://github.com/rust-lang-nursery/rust-semverver).

Some rough edges remain, and I'm certain some of the FIXMEs introduced will need some discussion, most notably the fairly ugly overall approach to pull out the core logic into librustc, which was previously fairly tightly coupled with various bits and bobs from librustdoc.

cc @Aaron1011
2018-05-09 16:56:30 +00:00
John Kåre Alsaker 710b4ad2a5 Store the GeneratorInterior in the new GeneratorSubsts 2018-05-08 16:21:58 +02:00
Aravind Gollakota 5cb0372160 Remove the stored obligation in OverflowError to simplify things
We will shortly refactor things so that it is no longer needed
2018-04-26 20:28:30 -05:00
Aravind Gollakota e5535fc7dd Introduce trait query mode and use it to set overflow error handling policy in traits::select 2018-04-26 20:28:30 -05:00
Aravind Gollakota bc16b8e92a Port existing callers of `evaluate_obligation` to the new canonical trait query
Except the one in coherence, which needs support for intercrate mode.
2018-04-26 20:28:30 -05:00
Aravind Gollakota 3ab3a9f509 Create a canonical trait query for `evaluate_obligation` 2018-04-26 20:28:29 -05:00
Aravind Gollakota 79f71f976a Refactor overflow handling in traits::select to propagate overflow instead of aborting eagerly
We store the obligation that caused the overflow as part of the OverflowError, and report it at the public API endpoints (rather than in the implementation internals).
2018-04-26 20:26:20 -05:00
Inokentiy Babushkin 7365bee506
Begun refactoring auto trait discovery for use outside rustc. 2018-04-26 21:54:22 +02:00
Tyler Mandry 9ffe9bea53 Remove methods with implicit Binder::skip_bound
Fixes #20664.
2018-04-24 22:12:07 -05:00
Tyler Mandry 98546f8b26 Make Binder's field private and clean up its usage 2018-04-24 22:12:07 -05:00
Niko Matsakis 7fa3c8f445 eliminate the `Lrc` of a slice and just return the slice
Also, introduce `Clauses` and `Goals` type alises for readability.
2018-04-23 13:28:14 -04:00
Niko Matsakis cfbf62f7df add `Goal::CannotProve` and extract `ProgramClause` struct 2018-04-23 13:28:14 -04:00
Fabian Zaiser 5a73fd5e1f Implement Chalk lowering rule Normalize-From-Impl 2018-04-15 23:32:57 +02:00
Tatsuyuki Ishi b15df80345 traits: Implement interning for Goal and Clause 2018-04-12 13:43:10 +09:00
Alex Crichton 72ac3ebf68 Rollup merge of #49497 - scalexm:hrtb, r=nikomatsakis
Chalkify - Tweak `Clause` definition and HRTBs

r? @nikomatsakis
2018-04-05 11:18:16 -07:00
scalexm 71dc1626bd Tweak `Clause` definition and HRTBs 2018-03-30 10:29:01 +02:00
bors dca14701a5 Auto merge of #49313 - sgrif:sg-revert-stuff, r=nikomatsakis
Remove universes from `ty::ParamEnv`

This change was never meant to land. #48407 takes an alternate approach. However, that PR is now blocked on some issues with canonicalization, and rebasing these reverts gets harder each time, so let's just get this bit out of the way now.

r? @nikomatsakis
2018-03-29 05:44:40 +00:00
Sean Griffin 1171ebf6f1 Revert "introduce `UniverseIndex` into `ParamEnv`"
This reverts commit d4df52cacb.
2018-03-23 13:18:50 -06:00
csmoe 0c4062a94d import trait engine to typeck 2018-03-23 09:22:07 +08:00
csmoe 20703b3d09 introduce trait engine mod 2018-03-23 09:21:29 +08:00
bors 7c396ebd0b Auto merge of #48985 - scalexm:lowering, r=nikomatsakis
MVP for chalkification

r? @nikomatsakis
2018-03-18 07:35:43 +00:00
scalexm e8f3ed5db2 Add documentation 2018-03-14 15:19:17 +01:00
scalexm 2bbd16de13 Move code into librustc_traits 2018-03-14 14:45:30 +01:00
scalexm 04b228c3e2 Address niko's nits 2018-03-14 14:14:33 +01:00
scalexm 1271f0bd25 Add MVP for chalkification 2018-03-14 13:39:58 +01:00
Andrew Cann 5b32211e62 Add note about fallback to `!: !Trait` error 2018-03-14 12:44:52 +08:00
Niko Matsakis e4728e494e transition various normalization functions to the new methods
In particular:

- `fully_normalize_monormophic_ty` => `normalize_erasing_regions`
- `normalize_associated_type_in_env` => `normalize_erasing_regions`
- `fully_normalize_associated_types_in` => `normalize_erasing_regions`
- `erase_late_bound_regions_and_normalize` => `normalize_erasing_late_bound_regions`
2018-03-13 11:22:07 -04:00
Niko Matsakis 3a50b41da4 introduce `infcx.at(..).normalize(..)` operation [VIC]
It is backed by the new `normalize_projection_ty` query, which uses
canonicalization.
2018-03-13 11:22:05 -04:00
Niko Matsakis 6d0f9319df refactor `ParamEnv::empty(Reveal)` into two distinct methods
- `ParamEnv::empty()` -- does not reveal all, good for typeck
- `ParamEnv::reveal_all()` -- does, good for trans
- `param_env.with_reveal_all()` -- converts an existing parameter environment
2018-03-13 11:21:30 -04:00
Oliver Schneider b33e4e784e
Fully use miri in trans 2018-03-08 08:34:05 +01:00
Alex Crichton 8121db3340 Merge branch 'refactor-select' of https://github.com/aravind-pg/rust into update-cargo 2018-03-07 07:11:47 -08:00
Tatsuyuki Ishi 517f861fc5 Remove ty::Predicate::Equate and ty::EquatePredicate (dead code) 2018-03-04 10:25:51 +09:00
Aravind Gollakota 81f0b962f3 Refactor away `inferred_obligations` from the trait selector 2018-03-03 18:47:17 -06:00
John Kåre Alsaker b74e97cf42 Replace Rc with Lrc for shared data 2018-03-02 10:48:52 +01:00
Niko Matsakis d4df52cacb introduce `UniverseIndex` into `ParamEnv`
Always using root environment for now.
2018-03-01 08:04:26 -07:00
Niko Matsakis e7efce2361 add some comments to `Obligation` 2018-03-01 08:04:26 -07:00
kennytm af55518bcf
Rollup merge of #48479 - mark-i-m:rustc-guide, r=nikomatsakis
Start moving to the rustc guide!

r? @nikomatsakis

cc #48478
2018-02-28 19:15:34 +08:00
Mark Mansi 968ce252a8 Change links to readmes 2018-02-25 15:24:14 -06:00
Manish Goregaokar 58af0c7b64
Rollup merge of #48296 - ishitatsuyuki:exp-unblow, r=nikomatsakis
Fix exponential projection complexity on nested types

This implements solution 1 from https://github.com/rust-lang/rust/issues/38528#issuecomment-366263076.

The code quality is currently extremely poor, but we can improve them during review.

Blocking issues:

- we probably don't want a quadratic deduplication for obligations.
- is there an alternative to deduplication?

Based on #48315.

Needs changelog. Noticable improvement on compile time is expected.

Fix #38528
Close #39684
Close #43757
2018-02-24 15:52:07 -08:00
Manish Goregaokar 1e67c1315b
Rollup merge of #48123 - nikomatsakis:issue-47244-expected-num-args, r=estebank
detect wrong number of args when type-checking a closure

Instead of creating inference variables for those argument types, use
the trait error-reporting code to give a nicer error. This also
improves some other spans for existing tests.

Fixes #47244

r? @estebank
2018-02-23 10:24:48 -08:00
Tatsuyuki Ishi 5a2bec9f45 impl_or_trait_obligations: deduplicate obligations 2018-02-22 18:40:49 +09:00