about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-09-29 11:42:06 +0900
committerGitHub <noreply@github.com>2022-09-29 11:42:06 +0900
commit80e009ceba290606fd0e6fa6fc2e2599e8076d7f (patch)
tree11a1a4df9ca641ff3be627809a31b27de81910ff
parent039e9e216061953b31710c1b0b900a90299cf1b5 (diff)
parent9ccb85118203d914b349e506916fe2fe0c907e86 (diff)
downloadrust-80e009ceba290606fd0e6fa6fc2e2599e8076d7f.tar.gz
rust-80e009ceba290606fd0e6fa6fc2e2599e8076d7f.zip
Rollup merge of #102416 - lcnr:specialization-fixme, r=compiler-errors
remove FIXME, improve documentation

r? types
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 5e32a27cdb1..0ed59223337 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -1737,12 +1737,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
 
             (&ImplCandidate(other_def), &ImplCandidate(victim_def)) => {
                 // See if we can toss out `victim` based on specialization.
-                // This requires us to know *for sure* that the `other` impl applies
-                // i.e., `EvaluatedToOk`.
+                // While this requires us to know *for sure* that the `other` impl applies
+                // we still use modulo regions here.
                 //
-                // FIXME(@lcnr): Using `modulo_regions` here seems kind of scary
-                // to me but is required for `std` to compile, so I didn't change it
-                // for now.
+                // This is fine as specialization currently assumes that specializing
+                // impls have to be always applicable, meaning that the only allowed
+                // region constraints may be constraints also present on the default impl.
                 let tcx = self.tcx();
                 if other.evaluation.must_apply_modulo_regions() {
                     if tcx.specializes((other_def, victim_def)) {