]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_trait_selection/src/traits/select/mod.rs
make `Sized` coinductive
[rust.git] / compiler / rustc_trait_selection / src / traits / select / mod.rs
index de158a15d54b8563d1c514e287744bf5c24103f7..49bb3d03621f3379a844c8162383b5a8b0ea285a 100644 (file)
@@ -959,7 +959,10 @@ pub(crate) fn coinductive_match<I>(&mut self, mut cycle: I) -> bool
 
     fn coinductive_predicate(&self, predicate: ty::Predicate<'tcx>) -> bool {
         let result = match predicate.kind().skip_binder() {
-            ty::PredicateKind::Trait(ref data) => self.tcx().trait_is_auto(data.def_id()),
+            ty::PredicateKind::Trait(ref data) => {
+                self.tcx().trait_is_auto(data.def_id())
+                    || self.tcx().lang_items().sized_trait() == Some(data.def_id())
+            }
             ty::PredicateKind::WellFormed(_) => true,
             _ => false,
         };