about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-03-27 08:46:55 +0200
committerGitHub <noreply@github.com>2023-03-27 08:46:55 +0200
commit6535e66fa545acaa3c0fe015b83a2e502c10119a (patch)
tree8d982b4a968c7447561287a1ad00324ba8f0cf1c /compiler/rustc_trait_selection/src/solve
parent2b7dc94535e2b4f922091ee1834e21a7d18ba4bf (diff)
parent1ce4b37900cf0c7f5e146b866b5a8fae2b93f9fc (diff)
downloadrust-6535e66fa545acaa3c0fe015b83a2e502c10119a.tar.gz
rust-6535e66fa545acaa3c0fe015b83a2e502c10119a.zip
Rollup merge of #109641 - compiler-errors:dont-elaborate-non-obl, r=oli-obk
Don't elaborate non-obligations into obligations

It's suspicious to elaborate a `PolyTraitRef` or `Predicate` into an `Obligation`, since the former does not have a param-env associated with it, but the latter does. This is a footgun that, while not being misused *currently* in the compiler, easily could be misused by someone less familiar with the elaborator's inner workings.

This PR just changes the API -- ideally, the elaborator wouldn't even have to deal with obligations if we're not elaborating obligations, but that would require a bit more abstraction than I could be bothered with today.
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
-rw-r--r--compiler/rustc_trait_selection/src/solve/assembly.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/assembly.rs b/compiler/rustc_trait_selection/src/solve/assembly.rs
index 995fec78c40..b2658614fd3 100644
--- a/compiler/rustc_trait_selection/src/solve/assembly.rs
+++ b/compiler/rustc_trait_selection/src/solve/assembly.rs
@@ -470,7 +470,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
         for assumption in
             elaborate_predicates(tcx, bounds.iter().map(|bound| bound.with_self_ty(tcx, self_ty)))
         {
-            match G::consider_object_bound_candidate(self, goal, assumption.predicate) {
+            match G::consider_object_bound_candidate(self, goal, assumption) {
                 Ok(result) => {
                     candidates.push(Candidate { source: CandidateSource::BuiltinImpl, result })
                 }