about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/traits/mod.rs
AgeCommit message (Collapse)AuthorLines
2023-12-14update use of feature flagslcnr-1/+1
2023-10-22use visibility to check unused imports and delete some stmtsbohan-1/+0
2023-08-09Ignore `cause` and `recursion_depth` in `Obligation::{eq,hash}`.Nicholas Nethercote-1/+23
This gives massive (~7x) compile time and memory usage reductions for the trait system stress test in https://github.com/rust-lang/rustc-perf/pull/1680.
2023-08-02Remove constness from `TraitPredicate`Deadbeef-7/+0
2023-07-27Remove `constness` from `ParamEnv`Deadbeef-9/+0
2023-07-06Separate select calls that don't need a binderMichael Goulet-0/+1
2023-07-06TraitObligation -> PolyTraitObligationMichael Goulet-3/+3
2023-06-19s/Clause/ClauseKindMichael Goulet-2/+2
2023-04-21Break up long function in trait selection error reportingBryan Garza-1/+1
- Move blocks of code into their own functions - Replace a few function argument types with their type aliases
2023-04-16use matches! macro in more placesMatthias Krüger-4/+4
2023-04-10Report overflows gracefully with new solverMichael Goulet-1/+5
2023-03-21evaluate: improve and fix recursion depth handlinglcnr-0/+10
2023-03-10Move some solver stuff to middleMichael Goulet-0/+6
2023-01-23fix: use LocalDefId instead of HirId in trait resVincenzo Palazzo-1/+2
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-11-25Introduce PredicateKind::ClauseSantiago Pastorino-2/+2
2022-11-16Convert predicates into Predicate in the Obligation constructorOli Scherer-13/+16
2022-09-22Rollup merge of #102037 - jyn514:normalize-docs, r=lcnrDylan DPC-0/+2
Make cycle errors recoverable In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation. In the past, ```@jackh726``` has said we need to be careful about overflow errors: https://github.com/rust-lang/rust/pull/91430#issuecomment-983997013 > Off the top of my head, we definitely should be careful about treating overflow errors the same as "not implemented for some reason" errors. Otherwise, you could end up with behavior that is different depending on recursion depth. But, that might be context-dependent. But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered. Helps with https://github.com/rust-lang/rust/issues/81091. r? ```@lcnr``` cc ```@matthewjasper```
2022-09-19Make cycle errors recoverableJoshua Nelson-0/+2
In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation. In the past, `@jackh726` has said we need to be careful about overflow errors: > Off the top of my head, we definitely should be careful about treating overflow errors the same as "not implemented for some reason" errors. Otherwise, you could end up with behavior that is different depending on recursion depth. But, that might be context-dependent. But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered.
2022-09-16remap ParamEnv with obligationDeadbeef-0/+8
2022-05-10Remove `clone_code` methodOli Scherer-1/+1
2022-05-10Move an extension trait method onto the type directly and reuse itOli Scherer-1/+8
2022-02-15Overhaul `Const`.Nicholas Nethercote-1/+1
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as this: ``` pub struct Const<'tcx>(&'tcx Interned<ConstS>); ``` This now matches `Ty` and `Predicate` more closely, including using pointer-based `eq` and `hash`. Notable changes: - `mk_const` now takes a `ConstS`. - `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a we need separate arena for it, because we can't use the `Dropless` one any more. - Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes - Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes. - Lots of tedious sigil fiddling.
2021-12-20Eliminate `ObligationCauseData`.Nicholas Nethercote-1/+1
This makes `Obligation` two words bigger, but avoids allocating a lot of the time. I previously tried this in #73983 and it didn't help much, but local timings look more promising now.
2021-12-13Remove `in_band_lifetimes` from `rustc_infer`LegionMammal978-2/+2
This crate actually had a typo `'ctx` in one of its functions: ```diff -pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool { +pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { ```
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-0/+10
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-03Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"Santiago Pastorino-10/+0
This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing changes made to d9baa361902b172be716f96619b909f340802dea.
2021-11-29Use the constness from the param env instead of having a separate dimension ↵Oli Scherer-0/+10
for it This breaks a ~const test that will be fixed in a follow up commit of this PR
2021-10-22Document flip polaritySantiago Pastorino-0/+3
2021-10-20Add TraitObligation::polarity() for better encapsulationSantiago Pastorino-0/+4
2021-10-20Consider negative polarity on overlap checkSantiago Pastorino-1/+12
2021-09-16Refactor `FulfillmentError` to track less dataEsteban Kuber-5/+1
Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`.
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-07-16Add initial implementation of HIR-based WF checking for diagnosticsAaron Hill-1/+6
During well-formed checking, we walk through all types 'nested' in generic arguments. For example, WF-checking `Option<MyStruct<u8>>` will cause us to check `MyStruct<u8>` and `u8`. However, this is done on a `rustc_middle::ty::Ty`, which has no span information. As a result, any errors that occur will have a very general span (e.g. the definintion of an associated item). This becomes a problem when macros are involved. In general, an associated type like `type MyType = Option<MyStruct<u8>>;` may have completely different spans for each nested type in the HIR. Using the span of the entire associated item might end up pointing to a macro invocation, even though a user-provided span is available in one of the nested types. This PR adds a framework for HIR-based well formed checking. This check is only run during error reporting, and is used to obtain a more precise span for an existing error. This is accomplished by individually checking each 'nested' type in the HIR for the type, allowing us to find the most-specific type (and span) that produces a given error. The majority of the changes are to the error-reporting code. However, some of the general trait code is modified to pass through more information. Since this has no soundness implications, I've implemented a minimal version to begin with, which can be extended over time. In particular, this only works for HIR items with a corresponding `DefId` (e.g. it will not work for WF-checking performed within function bodies).
2021-03-31Add tcx lifetime to BinderJack Huey-1/+1
2021-03-06Change x64 size checks to not apply to x32.Harald van Dijk-1/+1
Rust contains various size checks conditional on target_arch = "x86_64", but these checks were never intended to apply to x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the conditions.
2020-10-14Remove unused code from rustc_inferest31-2/+0
2020-09-26Revert "Add an unused field of type `Option<DefId>` to `ParamEnv` struct."Dylan MacKenzie-1/+1
This reverts commit ab83d372ed5b1799d418afe83c468e4c5973cc34.
2020-09-21Add an unused field of type `Option<DefId>` to `ParamEnv` struct.Bram van den Heuvel-1/+1
2020-09-09Remove def_id field from ParamEnvBram van den Heuvel-1/+1
2020-08-30mv compiler to compiler/mark-0/+136