about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2022-02-02Guess head span of async blocksOli Scherer-0/+1
2022-02-02Make a comment more obviousOli Scherer-2/+4
2022-02-02Eagerly merge hidden types.Oli Scherer-3/+3
2022-02-02Register member constraints on the final merged hidden typeOli Scherer-1/+1
Previously we did this per hidden type candiate, which didn't always have all the information available.
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-12/+69
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-02-01Auto merge of #93285 - JulianKnodt:const_eq_2, r=oli-obkbors-116/+128
Continue work on associated const equality This actually implements some more complex logic for assigning associated consts to values. Inside of projection candidates, it now defers to a separate function for either consts or types. To reduce amount of code, projections are now generic over T, where T is either a Type or a Const. I can add some comments back later, but this was the fastest way to implement it. It also now finds the correct type of consts in type_of. --- The current main TODO is finding the const of the def id for the LeafDef. Right now it works if the function isn't called, but once you use the trait impl with the bound it fails inside projection. I was hoping to get some help in getting the `&'tcx ty::Const<'tcx>`, in addition to a bunch of other `todo!()`s which I think may not be hit. r? `@oli-obk` Updates #92827
2022-02-01Fix w/ commentskadmin-59/+47
2022-02-01Rollup merge of #93290 - lcnr:same_type, r=jackh726Matthias Krüger-1/+1
remove `TyS::same_type` This function ignored regions and constants in adts, but didn't do so for references or any other types. cc https://github.com/rust-lang/rust/pull/93148#discussion_r791408057
2022-02-01remove `TyS::same_type`lcnr-1/+1
it ignored regions and constants in adts, but didn't do so for references or any other types. This seemed quite weird
2022-02-01add a rustc::query_stability lintlcnr-0/+1
2022-01-31Add ValuePairs::Terms & Fix compile errorkadmin-39/+25
And use correct substs.
2022-01-31Auto merge of #93348 - spastorino:fix-perf-overlap-mode2, r=nikomatsakisbors-60/+30
Move overlap_mode into trait level attribute r? `@nikomatsakis` Should fix some performance regressions noted on https://github.com/rust-lang/rust/pull/93175
2022-01-31Do not store overlap_mode, just pass it down on insertSantiago Pastorino-3/+5
2022-01-31Move overlap_mode into trait level attribute + feature flagSantiago Pastorino-59/+27
2022-01-31Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726Matthias Krüger-6/+8
Improve terminology around "after typeck" Closes #70258.
2022-01-30Rollup merge of #93358 - compiler-errors:is-not-const, r=fee1-deadMatthias Krüger-7/+25
Add note suggesting that predicate may be satisfied, but is not `const` Not sure if we should be printing this in addition to, or perhaps _instead_ of the help message: ``` help: the trait `~const Add` is not implemented for `NonConstAdd` ``` Also added `ParamEnv::is_const` and `PolyTraitPredicate::is_const_if_const` and, in a separate commit, used those in other places instead of `== hir::Constness::Const`, etc. r? ````@fee1-dead````
2022-01-28Auto merge of #93343 - lqd:attrs, r=spastorinobors-18/+25
Only traverse attrs once while checking for coherence override attributes In coherence, while checking for negative impls override attributes: only traverse the `DefId`s' attributes once. This PR is an easy way to get back some of the small perf loss in #93175
2022-01-28Remove generalization over projectionkadmin-320/+99
Instead, just use a term everywhere.
2022-01-27Continue work on assoc const eqkadmin-108/+367
2022-01-26drive-by: use is_const and is_const_if_constMichael Goulet-8/+4
2022-01-26add note suggesting that predicate is satisfied but is not constMichael Goulet-0/+22
2022-01-26Rollup merge of #92256 - fee1-dead:improve-selection-err, r=oli-obkMatthias Krüger-148/+220
Improve selection errors for `~const` trait bounds
2022-01-26Only traverse attrs once while checking for coherence overrideRémy Rakic-18/+25
2022-01-25Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillotbors-13/+20
Store a `Symbol` instead of an `Ident` in `AssocItem` This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-26Add a minimal working `append_const_msg` argumentDeadbeef-8/+50
2022-01-26Improve selection errors for `~const` trait boundsDeadbeef-144/+174
2022-01-25Rollup merge of #93175 - spastorino:negative-traits-coherence-new, ↵Matthias Krüger-61/+201
r=nikomatsakis Implement stable overlap check considering negative traits This PR implement the new disjointness rules for overlap check described in https://rust-lang.github.io/negative-impls-initiative/explainer/coherence-check.html#new-disjointness-rules r? ``@nikomatsakis``
2022-01-25Rollup merge of #93064 - Aaron1011:provisional-dep-node, r=michaelwoeristerMatthias Krüger-12/+51
Properly track `DepNode`s in trait evaluation provisional cache Fixes #92987 During evaluation of an auto trait predicate, we may encounter a cycle. This causes us to store the evaluation result in a special 'provisional cache;. If we later end up determining that the type can legitimately implement the auto trait despite the cycle, we remove the entry from the provisional cache, and insert it into the evaluation cache. Additionally, trait evaluation creates a special anonymous `DepNode`. All queries invoked during the predicate evaluation are added as outoging dependency edges from the `DepNode`. This `DepNode` is then store in the evaluation cache - if a different query ends up reading from the cache entry, it will also perform a read of the stored `DepNode`. As a result, the cached evaluation will still end up (transitively) incurring all of the same dependencies that it would if it actually performed the uncached evaluation (e.g. a call to `type_of` to determine constituent types). Previously, we did not correctly handle the interaction between the provisional cache and the created `DepNode`. Storing an evaluation result in the provisional cache would cause us to lose the `DepNode` created during the evaluation. If we later moved the entry from the provisional cache to the evaluation cache, we would use the `DepNode` associated with the evaluation that caused us to 'complete' the cycle, not the evaluatoon where we first discovered the cycle. As a result, future reads from the evaluation cache would miss some incremental compilation dependencies that would have otherwise been added if the evaluation was *not* cached. Under the right circumstances, this could lead to us trying to force a query with a no-longer-existing `DefPathHash`, since we were missing the (red) dependency edge that would have caused us to bail out before attempting forcing. This commit makes the provisional cache store the `DepNode` create during the provisional evaluation. When we move an entry from the provisional cache to the evaluation cache, we create a *new* `DepNode` that has dependencies going to *both* of the evaluation `DepNodes` we have available. This ensures that cached reads will incur all of the necessary dependency edges.
2022-01-24Auto merge of #93028 - compiler-errors:const_drop_bounds, r=fee1-deadbors-136/+194
Check `const Drop` impls considering `~const` Bounds This PR adds logic to trait selection to account for `~const` bounds in custom `impl const Drop` for types, elaborates the `const Drop` check in `rustc_const_eval` to check those bounds, and steals some drop linting fixes from #92922, thanks `@DrMeepster.` r? `@fee1-dead` `@oli-obk` <sup>(edit: guess I can't request review from two people, lol)</sup> since each of you wrote and reviewed #88558, respectively. Since the logic here is more complicated than what existed, it's possible that this is a perf regression. But it works correctly with tests, and that makes me happy. Fixes #92881
2022-01-23FIXME include regions tooSantiago Pastorino-1/+4
2022-01-23Rename strict_check to negative_impl_existsSantiago Pastorino-4/+8
2022-01-23Document OverlapModeSantiago Pastorino-0/+5
2022-01-22Restructure the code leveraging in abilities more than modesSantiago Pastorino-51/+47
2022-01-21Remove intermediate function doesn't make more senseSantiago Pastorino-28/+11
2022-01-21Make strict_disjoint use explicit_disjointSantiago Pastorino-9/+12
2022-01-21Do not pass OverlapMode down, just create a closure to properly set the ↵Santiago Pastorino-16/+33
filtering
2022-01-21Implement stable with negative coherence modeSantiago Pastorino-4/+95
2022-01-21Add overlap modeSantiago Pastorino-9/+27
2022-01-21Extract stable_disjoint fnSantiago Pastorino-21/+41
2022-01-21Rollup merge of #93046 - est31:let_else, r=davidtwcoMatthias Krüger-28/+27
Use let_else in even more places Followup of #89933, #91018, #91481.
2022-01-21Move auxiliary fns out of overlap_with_probeSantiago Pastorino-19/+19
2022-01-21Use impl1 and impl2 instead of a and b prefixesSantiago Pastorino-16/+16
2022-01-21Remove a span from hir::ExprKind::MethodCallCameron Steffen-1/+4
2022-01-19Foreign types are trivially dropMichael Goulet-2/+3
- Also rename a trivial_const_drop to match style of other functions in the util module. - Also add a test for `const Drop` that doesn't depend on a `~const` bound. - Also comment a bit why we remove the const bound during dropck impl check.
2022-01-19Store a `Symbol` instead of an `Ident` in `AssocItem`Aaron Hill-13/+20
This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-19remove `is_noop`lcnr-1/+1
2022-01-19skip some layers in const drop confirmationMichael Goulet-70/+91
2022-01-19never type is const DropMichael Goulet-3/+5
2022-01-18Properly track `DepNode`s in trait evaluation provisional cacheAaron Hill-12/+51
Fixes #92987 During evaluation of an auto trait predicate, we may encounter a cycle. This causes us to store the evaluation result in a special 'provisional cache;. If we later end up determining that the type can legitimately implement the auto trait despite the cycle, we remove the entry from the provisional cache, and insert it into the evaluation cache. Additionally, trait evaluation creates a special anonymous `DepNode`. All queries invoked during the predicate evaluation are added as outoging dependency edges from the `DepNode`. This `DepNode` is then store in the evaluation cache - if a different query ends up reading from the cache entry, it will also perform a read of the stored `DepNode`. As a result, the cached evaluation will still end up (transitively) incurring all of the same dependencies that it would if it actually performed the uncached evaluation (e.g. a call to `type_of` to determine constituent types). Previously, we did not correctly handle the interaction between the provisional cache and the created `DepNode`. Storing an evaluation result in the provisional cache would cause us to lose the `DepNode` created during the evaluation. If we later moved the entry from the provisional cache to the evaluation cache, we would use the `DepNode` associated with the evaluation that caused us to 'complete' the cycle, not the evaluatoon where we first discovered the cycle. As a result, future reads from the evaluation cache would miss some incremental compilation dependencies that would have otherwise been added if the evaluation was *not* cached. Under the right circumstances, this could lead to us trying to force a query with a no-longer-existing `DefPathHash`, since we were missing the (red) dependency edge that would have caused us to bail out before attempting forcing. This commit makes the provisional cache store the `DepNode` create during the provisional evaluation. When we move an entry from the provisional cache to the evaluation cache, we create a *new* `DepNode` that has dependencies going to *both* of the evaluation `DepNodes` we have available. This ensures that cached reads will incur all of the necessary dependency edges.
2022-01-18Rollup merge of #92780 - b-naber:postpone-const-eval-coherence, r=lcnrMatthias Krüger-8/+3
Directly use ConstValue for single literals in blocks Addresses the minimal repro in https://github.com/rust-lang/rust/issues/92186, but doesn't fix the underlying problem (which would be solved by solving the anon subst problem afaict). I do, however, think that it makes sense in general to treat single literals in anon blocks as const values directly, especially in light of the problem that the issue refers to (anon const evaluation being postponed until infer variables in substs can be resolved, which was introduced by https://github.com/rust-lang/rust/pull/90023), i.e. while we do get warnings for those unnecessary braces, we should try to avoid errors caused by those braces if possible.