Commit Graph

107 Commits

Author SHA1 Message Date
Albert Larsan 40ba0e84d5 Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
Matthias Krüger 24e584b991 Rollup merge of #105694 - ouz-a:issue_105689, r=estebank
Don't create dummy if val has escaping bounds var

Skips creating/pushing obligations if val has escaping bounds vars.

Fixes #105689
2022-12-15 22:02:59 +01:00
Oli Scherer a5cd3bde95 Ensure no one constructs AliasTys themselves 2022-12-14 15:36:39 +00:00
ouz-a 75cf31faa8 skip if val has ecaping bound vars 2022-12-14 14:05:44 +03:00
Michael Goulet 61adaf8187 Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
Michael Goulet c13bd83528 squash OpaqueTy and ProjectionTy into AliasTy 2022-12-13 17:40:27 +00:00
Michael Goulet 5c6afb850c ProjectionTy.item_def_id -> ProjectionTy.def_id 2022-12-13 17:34:44 +00:00
Michael Goulet 7f3af72606 Use ty::OpaqueTy everywhere 2022-12-13 17:29:26 +00:00
Boxy c9bab74fb2 support Expr in is_const_evaluatable and compute 2022-12-05 23:17:55 +00:00
bors aff003becd Auto merge of #99798 - JulianKnodt:ac1, r=BoxyUwU
Add `ConstKind::Expr`

Starting to implement `ty::ConstKind::Abstract`, most of the match cases are stubbed out, some I was unsure what to add, others I didn't want to add until a more complete implementation was ready.

r? `@lcnr`
2022-11-25 22:56:59 +00:00
Boxy e58b932daf add FIXME for things that I couldn't find ways to trigger 2022-11-25 09:28:44 +00:00
kadmin f9750c1554 Add empty ConstKind::Abstract
Initial pass at expr/abstract const/s

Address comments

Switch to using a list instead of &[ty::Const], rm `AbstractConst`

Remove try_unify_abstract_consts

Update comments

Add edits

Recurse more

More edits

Prevent equating associated consts

Move failing test to ui

Changes this test from incremental to ui, and mark it as failing and a known bug.
Does not cause the compiler to ICE, so should be ok.
2022-11-25 09:28:43 +00:00
Santiago Pastorino 974e2837bb Introduce PredicateKind::Clause 2022-11-25 00:04:54 -03:00
Manish Goregaokar 53eab246db Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases

r? ````@lcnr````

fixes #99840
2022-11-22 22:54:38 -05:00
Oli Scherer 7658e0fccf Stop passing the self-type as a separate argument. 2022-11-21 20:39:46 +00:00
Oli Scherer ad57f88d3f Add helper to create the trait ref for a lang item 2022-11-21 20:35:17 +00:00
Oli Scherer ec8d01fdcc Allow iterators instead of requiring slices that will get turned into iterators 2022-11-21 20:33:55 +00:00
Oli Scherer 6f77c97b38 Assert that various types have the right amount of generic args and fix the sites that used the wrong amount 2022-11-21 20:31:59 +00:00
Oli Scherer ae80c764d4 Add an always-ambiguous predicate to make sure that we don't accidentlally allow trait resolution to prove false things during coherence 2022-11-21 16:35:04 +00:00
Michael Goulet c36ff28d42 drive-by: PolyExistentialPredicate 2022-11-19 04:04:27 +00:00
Oli Scherer 4f11f3b257 Convert predicates into Predicate in the Obligation constructor 2022-11-16 09:25:19 +00:00
Deadbeef b3a328eecf Use nominal_obligations_without_const in wf for FnDef 2022-11-09 02:08:22 +00:00
Nicholas Nethercote c8c25ce5a1 Rename some OwnerId fields.
spastorino noticed some silly expressions like `item_id.def_id.def_id`.

This commit renames several `def_id: OwnerId` fields as `owner_id`, so
those expressions become `item_id.owner_id.def_id`.

`item_id.owner_id.local_def_id` would be even clearer, but the use of
`def_id` for values of type `LocalDefId` is *very* widespread, so I left
that alone.
2022-10-29 20:28:38 +11:00
Oli Scherer 8286ea5a49 Move a wf-check into the site where the value is instantiated 2022-10-25 14:47:24 +00:00
lcnr 660ca48041 change ConstEvaluatable to use ty::Const 2022-10-18 16:09:04 +02:00
Yuki Okushi 24424d0acb Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8Ki
rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`

The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.
2022-10-10 00:09:42 +09:00
Michael Goulet 70f3c79c50 ImplItemKind::TyAlias => ImplItemKind::Type 2022-10-09 07:09:57 +00:00
Cameron Steffen 349415d1c6 Remove TypeckResults from InferCtxt 2022-10-07 07:06:19 -05:00
Oli Scherer c72c6e01c8 Merge the ~const and impl const checks and add some explanatory notes 2022-10-04 08:59:20 +00:00
Oli Scherer 33bcea8f61 Only allow ~const bounds for traits with #[const_trait] 2022-10-04 08:06:54 +00:00
bors 7a8636c843 Auto merge of #100982 - fee1-dead-contrib:const-impl-requires-const-trait, r=oli-obk
Require `#[const_trait]` on `Trait` for `impl const Trait`

r? `@oli-obk`
2022-09-22 04:22:24 +00:00
bors c524c7dd25 Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnr
Use only ty::Unevaluated<'tcx, ()> in type system

r? `@lcnr`
2022-09-17 03:04:22 +00:00
Deadbeef 4231661789 Do not require const predicates to hold when checking if a projection type is wf 2022-09-16 11:48:42 +08:00
b-naber a4bbb8db5c use ty::Unevaluated<'tcx, ()> in type system 2022-09-13 17:40:59 +02:00
Eric Holk 6c01273a15 Plumb dyn trait representation through ty::Dynamic 2022-09-12 16:55:55 -07:00
Jack Huey f29c91bf12 Create VarValue::Empty 2022-09-08 17:57:32 -04:00
Matthias Krüger 0a1c816dcd Rollup merge of #101503 - spastorino:add-debug-calls, r=compiler-errors
Add debug calls

`@oli-obk` requested this and other changes as a way of simplifying https://github.com/rust-lang/rust/pull/101345. This is just going to make the diff of https://github.com/rust-lang/rust/pull/101345 smaller.

r? `@oli-obk` `@cjgillot`
2022-09-07 21:48:16 +02:00
Santiago Pastorino e3a738a942 Add instrument and debug calls 2022-09-07 10:46:14 -03:00
Nicholas Nethercote 79db32b64e Pack Term in the same way as GenericArg.
This shrinks the `PredicateS` type, which is instanted frequently.
2022-09-05 15:08:52 +10:00
Oli Scherer 1fc9ef1edd tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
Michael Goulet c005e760f5 Rework point-at-arg 2022-08-21 02:34:52 +00:00
lcnr 1ec2b9bce8 wf correctly shallow_resolve consts 2022-08-13 21:04:52 +02:00
Deadbeef 666022730f Instantiate constness in wfcheck 2022-07-24 07:57:05 +00:00
Oli Scherer f40326027a Check generators for well formedness 2022-07-18 17:20:55 +00:00
Jack Huey a479f23f37 Don't pass InferCtxt to WfPredicates 2022-07-10 15:52:19 -04:00
Jack Huey 2d15f1ca42 Don't try to resolve inference variables in WF computation, just register 2022-07-10 15:25:33 -04:00
bors 47575bb066 Auto merge of #98816 - estebank:implicit-sized, r=oli-obk
Track implicit `Sized` obligations in type params

When we evaluate `ty::GenericPredicates` we introduce the implicit
`Sized` predicate of type params, but we do so with only the `Predicate`
its `Span` as context, we don't have an `Obligation` or
`ObligationCauseCode` we could influence. To try and carry this
information through, we add a new field to `ty::GenericPredicates` that
tracks both which predicates come from a type param and whether that
param has any bounds already (to use in suggestions).

We also suggest adding a `?Sized` bound if appropriate on E0599.

Address part of #98539.
2022-07-08 23:17:34 +00:00
Jack Huey 31e1a777e7 Move code from rustc_trait_selection/opaque_types to better places 2022-07-07 21:45:40 -04:00
Esteban Küber 385c79379c Track WellFormed obligations with an appropriate cause, instead of MiscObligation 2022-07-07 12:15:18 -07:00
Alan Egerton 4f0a64736b Update TypeVisitor paths 2022-07-06 06:41:53 +01:00