about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
AgeCommit message (Collapse)AuthorLines
2023-07-01Put `LayoutError` behind reference to shrink resultNilstrieb-25/+42
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
2023-06-30RPITITs inherit method predicatesMichael Goulet-18/+1
2023-06-29Add bidirectional where clauses on RPITIT synthesized GATsSantiago Pastorino-12/+0
2023-06-29Do not remove previously added predicates in param_env, extend them insteadSantiago Pastorino-1/+3
2023-06-28Rollup merge of #112867 - compiler-errors:more-impl-source-nits, r=lcnrDylan DPC-3/+1
More `ImplSource` nits Even more clean-ups, I'll put this up in parallel with the `select_in_new_trait_solver` PR. r? ``@lcnr``
2023-06-27`thir`: Add `Become` expression kindMaybe Waffle-1/+3
2023-06-26TypeWellFormedInEnvMichael Goulet-10/+7
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-10/+11
2023-06-23Auto merge of #112891 - oli-obk:impl_trait_in_assoc_tys_cleanup, ↵bors-49/+85
r=compiler-errors Various impl trait in assoc tys cleanups r? `@compiler-errors` All commits except for the last are pure refactorings. 274dab5bd658c97886a8987340bf50ae57900c39 allows struct fields to participate in deciding whether a function has an opaque in its signature. best reviewed commit by commit
2023-06-23Rollup merge of #112810 - compiler-errors:dont-ice-on-bad-layout, r=wesleywiserMatthias Krüger-7/+28
Don't ICE on unnormalized struct tail in layout computation 1. We try to compute a `SizeSkeleton` even if a layout error occurs, but we really only need to do this if we get `LayoutError::Unknown`, since that means our type is too polymorphic to actually compute the full layout. If we have other errors, like `LayoutError::NormalizationError` or `LayoutError::Cycle`, then we can't really make any progress, since this represents an actual error. 2. Avoid using `normalize_erasing_regions` and `struct_tail_erasing_lifetimes` since those ICE on normalization errors, and since we may call `layout_of` in HIR typeck, we don't know for certain that we're on the happy path. Fixes #112736
2023-06-22Only walk the identity substituted version of struct fieldsOli Scherer-1/+22
2023-06-22Handle weak type aliases by immediately resolving them to their aliased typeOli Scherer-9/+14
2023-06-22ICE on types that should not be defining opaque typesOli Scherer-1/+3
2023-06-22Document what is going on in `opaque_types_defined_by`Oli Scherer-0/+3
2023-06-22Move some field extraction logic onto a method on `Node`Oli Scherer-7/+3
2023-06-22Re-use error code for duplicate errorOli Scherer-1/+1
2023-06-22Treat opaque types failing the signature defining scope check as defining, ↵Oli Scherer-2/+3
as we already errored and can hide subsequent errors this way.
2023-06-22Stop failing eagerly, and collect all opaque types even if some are erroneous.Oli Scherer-12/+6
2023-06-22Point to argument/return type instead of the whole function headerOli Scherer-6/+30
2023-06-22Only create the opaque collector once and visit it many timesOli Scherer-20/+10
2023-06-22Move `opaque_type_origin_unchecked` onto `TyCtxt` and re-use it where it was ↵Oli Scherer-1/+1
open coded
2023-06-21Don't substitute a GAT that has mismatched generics in OpaqueTypeCollectorMichael Goulet-30/+50
2023-06-21Rollup merge of #112759 - cjgillot:closure-names, r=oli-obkNilstrieb-5/+6
Make closure_saved_names_of_captured_variables a query. As we will start removing debuginfo during MIR optimizations, we need to keep them somewhere.
2023-06-20yeet ImplSource::TraitAlias tooMichael Goulet-3/+1
2023-06-19Better error messageMichael Goulet-1/+16
2023-06-19Don't ICE on unnormalized struct tail in layout computationMichael Goulet-7/+13
2023-06-19Store generator field names in GeneratorLayout.Camille GILLOT-4/+5
2023-06-19Make closure_saved_names_of_captured_variables a query.Camille GILLOT-1/+1
2023-06-19Promote unchecked_add/sub/mul/shl/shr to mir::BinOpScott McMurray-2/+3
2023-06-17Remove even more redundant builtin candidatesMichael Goulet-77/+60
2023-06-17Simplify even more candidatesMichael Goulet-21/+19
2023-06-17Simplify some impl source candidatesMichael Goulet-4/+2
2023-06-02Separate AnonConst from ConstBlock in HIR.Camille GILLOT-0/+1
2023-06-01Rename `impl_defaultness` to `defaultness`Deadbeef-8/+8
2023-05-30Rollup merge of #112060 - lcnr:early-binder, r=jackh726Nilstrieb-5/+5
`EarlyBinder::new` -> `EarlyBinder::bind` for consistency with `Binder::bind`. it may make sense to also add `EarlyBinder::dummy` in places where we know that no parameters exist, but I left that out of this PR. r? `@jackh726` `@kylematsuda`
2023-05-29Rename `tcx.mk_re_*` => `Region::new_*`Maybe Waffle-4/+5
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-5/+5
2023-05-28Make EarlyBinder's inner value private; and fix all of the resulting errorsKyle Matsuda-3/+1
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-5/+5
2023-05-20ensure !Unpin types do not get noaliasErik Desjardins-17/+19
2023-05-20improve code checking for drop_in_place lang itemErik Desjardins-4/+2
2023-05-20Apply `noalias`, `nonnull`, `dereferenceable`, and `align` attributes ↵Patrick Walton-17/+10
unconditionally. We've done measurements with Miri and have determined that `noalias` shouldn't break code. The requirements that allow us to add dereferenceable and align have been long documented in the standard library documentation.
2023-05-20[rustc_ty_utils] Add the LLVM `noalias` parameter attribute to ↵Patrick Walton-1/+35
`drop_in_place` in certain cases. LLVM can make use of the `noalias` parameter attribute on the parameter to `drop_in_place` in areas like argument promotion. Because the Rust compiler fully controls the code for `drop_in_place`, it can soundly deduce parameter attributes on it. In the case of a value that has a programmer-defined Drop implementation, we know that the first thing `drop_in_place` will do is pass a pointer to the object to `Drop::drop`. `Drop::drop` takes `&mut`, so it must be guaranteed that there are no pointers to the object upon entering that function. Therefore, it should be safe to mark `noalias` there. With this patch, we mark `noalias` only when the type is a value with a programmer-defined Drop implementation. This is possibly overly conservative, but I thought that proceeding cautiously was best in this instance.
2023-05-15Rollup merge of #111578 - Zoxc:query-macro-move, r=cjgillotMatthias Krüger-29/+33
Move expansion of query macros in rustc_middle to rustc_middle::query This moves the expansion of `define_callbacks!` and `define_feedable!` from `rustc_middle::ty::query` to `rustc_middle::query`. This means that types used in queries are both imported and used in `rustc_middle::query` instead of being split between these modules. It also decouples `rustc_middle::ty::query` further from `rustc_middle` which is helpful since we want to move `rustc_middle::ty::query` to the query system crates.
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-29/+33
2023-05-15Auto merge of #111570 - compiler-errors:ct-err, r=BoxyUwUbors-3/+1
Rename const error methods for consistency renames `ty::Const`'s methods for creating a `ConstKind::Error` to be in the same naming style as `ty::Ty`'s equivalent methods. r? `@BoxyUwU`
2023-05-14Rename const error methods for consistencyMichael Goulet-3/+1
2023-05-12Use the opaque_types_defined_by query to cheaply check for whether a hidden ↵Oli Scherer-25/+164
type may be registered for an opaque type
2023-05-12add `query opaque_types_defined_by`lcnr-0/+82
2023-05-11Rollup merge of #106038 - aliemjay:opaque-implied, r=lcnrMichael Goulet-1/+12
use implied bounds when checking opaque types During opaque type inference, we check for the well-formedness of the hidden type in the opaque type's own environment, not the one of the defining site, which are different in the case of TAIT. However in the case of associated-type-impl-trait, we don't use implied bounds from the impl header. This caused us to reject the following: ```rust trait Service<Req> { type Output; fn call(req: Req) -> Self::Output; } impl<'a, Req> Service<&'a Req> for u8 { type Output= impl Sized; // we can't prove WF of hidden type `WF(&'a Req)` although it's implied by the impl //~^ ERROR type parameter Req doesn't live long enough fn call(req: &'a Req) -> Self::Output { req } } ``` although adding an explicit bound would make it pass: ```diff - impl<'a, Req> Service<&'a Req> for u8 { + impl<'a, Req> Service<&'a Req> for u8 where Req: 'a, { ``` I believe it should pass as we already allow the concrete type to be used: ```diff impl<'a, Req> Service<&'a Req> for u8 { - type Output= impl Sized; + type Output= &'a Req; ``` Fixes #95922 Builds on #105982 cc ``@lcnr`` (because implied bounds) r? ``@oli-obk``