238 Commits

Author SHA1 Message Date
Boxy 90c8d6bbe4 add predicate evaluation logic 2023-02-17 09:32:39 +00:00
bors 9556b56dbd Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwU
Switch to `EarlyBinder` for `type_of` query

Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78.

Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`.

r? `@lcnr`
2023-02-17 04:45:15 +00:00
Kyle Matsuda c183110cc2 remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
Kyle Matsuda d822b97a27 change usages of type_of to bound_type_of 2023-02-16 17:01:52 -07:00
Michael Goulet 95f35fe443 Deny some late-bound ty/ct in some positions, add tests 2023-02-16 03:39:59 +00:00
Camille GILLOT 03dff82d59 Add of_trait to DefKind::Impl. 2023-02-14 19:55:44 +00:00
Alan Egerton dea342d861 Make visiting traits generic over the Interner 2023-02-13 10:24:49 +00:00
Alan Egerton ba55a453eb Alias folding/visiting traits instead of re-export 2023-02-13 10:24:46 +00:00
klensy 4f5f9f0a13 remove unused imports 2023-02-06 17:40:18 +03:00
Camille GILLOT 15d6325747 Remove HirId -> LocalDefId map from HIR. 2023-01-28 09:55:26 +00:00
Camille GILLOT 1974b6b68d Introduce GeneratorWitnessMIR. 2023-01-27 18:58:44 +00:00
Kyle Matsuda a969c194d8 fix up subst_identity vs skip_binder; add some FIXMEs as identified in review 2023-01-26 20:28:31 -07:00
Kyle Matsuda c2414dfaa4 change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add EarlyBinder to fn_sig in metadata 2023-01-26 20:28:25 -07:00
Kyle Matsuda e982971ff2 replace usages of fn_sig query with bound_fn_sig 2023-01-26 20:15:36 -07:00
Scott McMurray 7d57685682 Also remove #![feature(control_flow_enum)] where possible 2023-01-18 10:22:21 -08:00
Scott McMurray 925dc37313 Stop using BREAK & CONTINUE in compiler
Switching them to `Break(())` and `Continue(())` instead.

libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17 23:17:51 -08:00
Kyle Matsuda f29a334c90 change impl_trait_ref query to return EarlyBinder; remove bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata 2023-01-14 00:29:56 -07:00
Kyle Matsuda be130b57d4 change usages of impl_trait_ref to bound_impl_trait_ref 2023-01-14 00:23:32 -07:00
Kyle Matsuda ef58baf8b8 change const_param_default query to return EarlyBinder; remove bound_const_param_default query; add EarlyBinder to const_param_default in metadata 2023-01-14 00:13:07 -07:00
Kyle Matsuda bd6c63597b change usages of const_param_default query to bound_const_param_default 2023-01-14 00:13:07 -07:00
Albert Larsan 40ba0e84d5 Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
bors fa51fc01ca Auto merge of #106235 - compiler-errors:rework-bounds-collection, r=davidtwco
Rework `Bounds` collection

I think it's weird for the `Bounds` struct in astconv to store its predicates *almost* converted into real predicates... so we do this eagerly, instead of lazily.
2023-01-08 14:40:52 +00:00
nils fd7a159710 Fix uninlined_format_args for some compiler crates
Convert all the crates that have had their diagnostic migration
completed (except save_analysis because that will be deleted soon and
apfloat because of the licensing problem).
2023-01-05 19:01:12 +01:00
Michael Goulet a313ef05a7 rename get_parent_node to parent_id 2023-01-04 00:43:13 +00:00
Michael Goulet 520b5fac10 Rework hir Bounds collection 2022-12-28 23:40:09 +00:00
Oli Scherer 6af3638709 Prevent the creation of TraitRef without dedicated methods 2022-12-14 15:36:39 +00:00
Oli Scherer a5cd3bde95 Ensure no one constructs AliasTys themselves 2022-12-14 15:36:39 +00:00
bors 918d0ac38e Auto merge of #104986 - compiler-errors:opaques, r=oli-obk
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias`

Implements https://github.com/rust-lang/types-team/issues/79.

This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so:

```
enum AliasKind {
  Projection,
  Opaque,
}

struct AliasTy<'tcx> {
  def_id: DefId,
  substs: SubstsRef<'tcx>,
}
```

Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example:

```diff
  match ty.kind() {
-   ty::Opaque(..) =>
+   ty::Alias(ty::Opaque, ..) => {}
    _ => {}
  }
```

This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically.

r? `@ghost`
2022-12-14 01:19:24 +00: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
Oli Scherer cb26b35b12 Make some diagnostics not depend on the source of what they reference being available 2022-12-13 09:48:22 +00:00
Michael Goulet 26b24cd755 drive-by: move field_index to typeck results 2022-12-04 17:59:21 +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 2ac5d91d63 Make expand_abstract_consts infallible 2022-11-25 09:28:44 +00:00
Boxy 4833ce8673 fmt 2022-11-25 09:28:43 +00:00
kadmin 5bb1a9febc Add expand_abstract_const
Adds the ability to directly expand a const to an expr without having to deal with intermediate
steps.
2022-11-25 09:28:43 +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
Camille GILLOT 9d20aca983 Store a LocalDefId in hir::Variant & hir::Field. 2022-11-13 14:06:51 +00:00
Vadim Petrochenkov 448261a78a privacy: Check effective visibility invariants 2022-11-05 16:25:41 +04:00
Vadim Petrochenkov bb401bd04d privacy: Print effective visibilities of constructors 2022-11-05 16:22:23 +04: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
Vadim Petrochenkov 34eb73c72d privacy: Rename "accessibility levels" to "effective visibilities"
And a couple of other naming tweaks

Related to https://github.com/rust-lang/rust/issues/48054
2022-10-26 16:34:53 +04:00
Bryanskiy a9447bb9d0 Perf improvements for effective visibility calculating 2022-10-25 15:15:18 +03:00
Nilstrieb c65ebae221 Migrate all diagnostics 2022-10-23 10:09:44 +02:00
lcnr b93713fb99 manually inline and rm visit_abstract_const_expr 2022-10-19 10:15:46 +02:00
lcnr 660ca48041 change ConstEvaluatable to use ty::Const 2022-10-18 16:09:04 +02:00
bors b8b5caee04 Auto merge of #102026 - Bryanskiy:resolve_update, r=petrochenkov
Populate effective visibilities in 'rustc_resolve'

Next part of RFC https://github.com/rust-lang/rust/issues/48054.
previous: https://github.com/rust-lang/rust/pull/101713

`@rustbot` author
r? `@petrochenkov`
2022-10-16 20:34:38 +00:00