Commit Graph

46 Commits

Author SHA1 Message Date
Irina Popa b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
Matthew Jasper 27183a9030 Feature gate trivial bounds 2018-05-15 11:43:57 +01: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 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
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
scalexm 71dc1626bd Tweak `Clause` definition and HRTBs 2018-03-30 10:29:01 +02: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
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
Niko Matsakis 23837c1901 improve TypeFoldable/Lift macros and make a bunch of stuff use them
Improvements:

- Use Clone not Copy for the "simple cases"
- Separate TypeFoldable and Lift for the "simple cases"
- Support generics type parameters
- Support named fields in enum variants
- etc
2018-03-13 11:21:29 -04:00
Tatsuyuki Ishi 517f861fc5 Remove ty::Predicate::Equate and ty::EquatePredicate (dead code) 2018-03-04 10:25:51 +09:00
John Kåre Alsaker 77bc26f4f3 Require yield types to be sized 2018-01-29 10:02:04 +01:00
Ariel Ben-Yehuda d049e5d19e avoid type-live-for-region obligations on dummy nodes
Type-live-for-region obligations on DUMMY_NODE_ID cause an ICE, and it
turns out that in the few cases they are needed, these obligations are not
needed anyway because they are verified elsewhere.

Fixes #46069.
2017-11-25 22:57:59 +02:00
Niko Matsakis 0d78e40e88 convert EXTRA_REQUIREMENT_IN_IMPL into a hard error
cc #37166
2017-11-15 16:49:21 -05:00
Niko Matsakis 64206b44b9 move region constraints into inference context 2017-11-15 16:49:21 -05:00
leonardo.yvens 06506bb751 [Syntax Breaking] Rename DefaultImpl to AutoImpl
DefaultImpl is a highly confusing name for what we now call auto impls,
as in `impl Send for ..`. The name auto impl is not formally decided
but for sanity anything is better than `DefaultImpl` which refers
neither to `default impl` nor to `impl Default`.
2017-11-03 16:13:20 -02:00
Eduard-Mihai Burtescu 74349fa288 rustc: evaluate fixed-length array length expressions lazily. 2017-09-11 08:41:16 +03:00
Alex Crichton 04c66c30a7 Merge remote-tracking branch 'origin/master' into gen 2017-08-21 21:47:07 -07:00
bors 942711e115 Auto merge of #43690 - scalexm:issue-28229, r=nikomatsakis
Generate builtin impls for `Clone`

This fixes a long-standing ICE and limitation where some builtin types implement `Copy` but not `Clone` (whereas `Clone` is a super trait of `Copy`).

However, this PR has a few side-effects:
* `Clone` is now marked as a lang item.
* `[T; N]` is now `Clone` if `T: Clone` (currently, only if `T: Copy` and for `N <= 32`).
* `fn foo<'a>() where &'a mut (): Clone { }` won't compile anymore because of how bounds for builtin traits are handled (e.g. same thing currently if you replace `Clone` by `Copy` in this example). Of course this function is unusable anyway, an error would pop as soon as it is called.

Hence, I'm wondering wether this PR would need an RFC...
Also, cc-ing @nikomatsakis, @arielb1.

Related issues: #28229, #24000.
2017-08-22 01:34:54 +00:00
Alex Crichton b31998ec93 Merge remote-tracking branch 'origin/master' into gen 2017-08-21 10:41:56 -07:00
Guillaume Gomez c3c99b92c7 Handle structs, unions and enums unsized field/variant separately 2017-08-18 10:24:53 +02:00
scalexm 91aa99607f Do not store `ty` 2017-08-14 15:07:21 +02:00
scalexm 0c3ac648f8 Make `Clone` a lang item and generate builtin impls.
Fixes #28229.
Fixes #24000.
2017-08-14 15:07:21 +02:00
John Kåre Alsaker d861982ca6 Generator literal support 2017-07-28 15:46:23 +02:00
Zack M. Davis f668999153 use field init shorthand in src/librustc
The field init shorthand syntax was stabilized in 1.17.0 (aebd94f); we
are now free to use it in the compiler.
2017-07-05 22:37:10 -07:00
Masaki Hara 17fca8b460
Check explicitly that tuple initializer is Sized. 2017-06-29 21:23:33 +09:00
Esteban Küber c023856b38 Detect missing `;` on methods with return type `()`
- Point out the origin of a type requirement when it is the return type
  of a method
- Point out possibly missing semicolon when the return type is () and
  the implicit return makes sense as a statement
- Suggest changing the return type of methods with default return type
- Don't suggest changing the return type on fn main()
- Don't suggest changing the return type on impl fn
2017-06-24 01:09:27 -07:00
Niko Matsakis 5fb0f0dc2e strip param-env from infcx 2017-06-01 13:31:09 -04:00
Niko Matsakis 7832db8031 fix long line 2017-04-11 20:32:48 -04:00
Niko Matsakis 58609ef879 add Subtype predicate 2017-04-11 20:32:46 -04:00
Niko Matsakis eeb6447bbf add an `ObligationCauseCode` we'll use later (`ReturnNoExpression`) 2017-03-30 07:55:29 -04:00
Eduard-Mihai Burtescu ba11640179 rustc_typeck: hook up collect and item/body check to on-demand. 2017-02-25 18:35:25 +02:00
Mark-Simulacrum 64e97d9b33 Remove BuiltinBound and BuiltinBounds. 2016-11-28 06:37:08 -07:00
Niko Matsakis 19c1a47713 remove TypeOrigin and use ObligationCause instead
In general having all these different structs for "origins" is not
great, since equating types can cause obligations and vice-versa.  I
think we should gradually collapse these things. We almost certainly
also need to invest a big more energy into the `error_reporting` code to
rationalize it: this PR does kind of the minimal effort in that
direction.
2016-11-15 16:12:41 -05:00
Niko Matsakis 61c777baec introduce new origin for `Trait+'b`
This helps us to preserve the existing errors.
2016-11-01 14:08:56 -04:00
Niko Matsakis ddabd509a8 compare-method lint 2016-11-01 14:08:56 -04:00
Niko Matsakis bd5fa7532d cleanup error reporting and add `ui` tests 2016-11-01 14:04:14 -04:00
Eduard Burtescu 08bf9f69b9 typeck: leak auto trait obligations through impl Trait. 2016-08-12 06:46:31 +03:00
Masood Malekghassemi 8628ccec8f Add inferred obligation storage to all Vtable variants and SelectionContext 2016-05-11 14:40:24 -07:00
Eduard Burtescu a1c170fc35 rustc: Split local type contexts interners from the global one. 2016-05-11 04:14:58 +03:00
Eduard Burtescu 20652162ca rustc: More interning for data used in Ty<'tcx>. 2016-05-11 04:14:58 +03:00
Eduard Burtescu 8f72d8127f rustc: Generalize a minimum set of functions over 'tcx != 'gcx. 2016-05-11 04:14:58 +03:00
Eduard Burtescu 5efdde0de1 rustc: move cfg, infer, traits and ty from middle to top-level. 2016-03-27 01:05:54 +02:00