about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2019-01-01 23:22:37 +0200
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2019-01-04 00:34:53 +0200
commite030aa801583ec7ce250088bb180d65b760eedec (patch)
tree4e3d65101b0f3d9f0a090a2345aab05911d33bea /src
parent391a7ebd830bc8118a9d92979d2660bfc63b0315 (diff)
downloadrust-e030aa801583ec7ce250088bb180d65b760eedec.tar.gz
rust-e030aa801583ec7ce250088bb180d65b760eedec.zip
Revert "fix stupid bug"
This reverts commit 6e4b2b3ae79770c7ccfcdbfc90dc34fe47ec5f09.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/coherence/inherent_impls_overlap.rs86
1 files changed, 38 insertions, 48 deletions
diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs
index 8d27a77b29c..0fe8e0b1d1b 100644
--- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs
+++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs
@@ -88,9 +88,7 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
 
         for (i, &impl1_def_id) in impls.iter().enumerate() {
             for &impl2_def_id in &impls[(i + 1)..] {
-                // First, check if the impl was forbidden under the
-                // old rules. In that case, just have an error.
-                let used_to_be_allowed = traits::overlapping_impls(
+                let mut used_to_be_allowed = traits::overlapping_impls(
                     self.tcx,
                     impl1_def_id,
                     impl2_def_id,
@@ -101,30 +99,6 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
                             impl1_def_id,
                             impl2_def_id,
                             overlap,
-                            None,
-                        );
-                        false
-                    },
-                    || true,
-                );
-
-                if !used_to_be_allowed {
-                    continue;
-                }
-
-                // Then, check if the impl was forbidden under only
-                // #43355. In that case, emit an #43355 error.
-                let used_to_be_allowed = traits::overlapping_impls(
-                    self.tcx,
-                    impl1_def_id,
-                    impl2_def_id,
-                    IntercrateMode::Fixed,
-                    TraitObjectMode::NoSquash,
-                    |overlap| {
-                        self.check_for_common_items_in_impls(
-                            impl1_def_id,
-                            impl2_def_id,
-                            overlap,
                             Some(FutureCompatOverlapErrorKind::Issue43355),
                         );
                         false
@@ -132,29 +106,45 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
                     || true,
                 );
 
-                if !used_to_be_allowed {
-                    continue;
+                if used_to_be_allowed {
+                    used_to_be_allowed = traits::overlapping_impls(
+                        self.tcx,
+                        impl1_def_id,
+                        impl2_def_id,
+                        IntercrateMode::Fixed,
+                        TraitObjectMode::NoSquash,
+                        |overlap| {
+                            self.check_for_common_items_in_impls(
+                                impl1_def_id,
+                                impl2_def_id,
+                                overlap,
+                                None,
+                            );
+                            false
+                        },
+                        || true,
+                    );
                 }
 
-                // Then, check if the impl was forbidden under
-                // #33140. In that case, emit a #33140 error.
-                traits::overlapping_impls(
-                    self.tcx,
-                    impl1_def_id,
-                    impl2_def_id,
-                    IntercrateMode::Fixed,
-                    TraitObjectMode::SquashAutoTraitsIssue33140,
-                    |overlap| {
-                        self.check_for_common_items_in_impls(
-                            impl1_def_id,
-                            impl2_def_id,
-                            overlap,
-                            Some(FutureCompatOverlapErrorKind::Issue33140),
-                        );
-                        false
-                    },
-                    || true,
-                );
+                if used_to_be_allowed {
+                    traits::overlapping_impls(
+                        self.tcx,
+                        impl1_def_id,
+                        impl2_def_id,
+                        IntercrateMode::Fixed,
+                        TraitObjectMode::SquashAutoTraitsIssue33140,
+                        |overlap| {
+                            self.check_for_common_items_in_impls(
+                                impl1_def_id,
+                                impl2_def_id,
+                                overlap,
+                                Some(FutureCompatOverlapErrorKind::Issue33140),
+                            );
+                            false
+                        },
+                        || true,
+                    );
+                }
             }
         }
     }