about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-01-27 15:15:30 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-02-02 15:40:12 +0000
commitdc36b385261a8200f8259feddef58715549f2563 (patch)
tree0dd1d3b82f7652e389677f7dba1187a90e2fd372
parentd3b534b6b5c61246d8fd97dad9c1b7e9c8fbe3c1 (diff)
downloadrust-dc36b385261a8200f8259feddef58715549f2563.tar.gz
rust-dc36b385261a8200f8259feddef58715549f2563.zip
Make a comment more obvious
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 35818786cbb..a183a20a2fe 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -2248,8 +2248,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
     ) -> Result<Vec<PredicateObligation<'tcx>>, ()> {
         self.infcx
             .at(&obligation.cause, obligation.param_env)
-            // We don't want opaque types to just randomly match everything,
-            // they should be opaque, even in their defining scope.
+            // We don't want predicates for opaque types to just match all other types,
+            // if there is an obligation on the opaque type, then that obligation must be met
+            // opaquely. Otherwise we'd match any obligation to the opaque type and then error
+            // out later.
             .define_opaque_types(false)
             .sup(obligation.predicate.to_poly_trait_ref(), poly_trait_ref)
             .map(|InferOk { obligations, .. }| obligations)