@@ -275,6 +275,28 @@ fn diff_keyed_children(
275 new: &[Node],
275 new: &[Node],
276 cached_roots: &mut FxHashSet<CacheId>,
276 cached_roots: &mut FxHashSet<CacheId>,
278+ if cfg!(debug_assertions) {
279+ let mut keys = FxHashSet::default();
280+ let mut assert_unique_keys = |children: &[Node]| {
282+ for child in children {
283+ let key = child.key();
286+ "if any sibling is keyed, all siblings must be keyed"
293+ "keyed siblings must each have a unique key"
296+ assert_unique_keys(old);
297+ assert_unique_keys(new);
278 // First up, we diff all the nodes with the same key at the beginning of the
300 // First up, we diff all the nodes with the same key at the beginning of the
279 // children.
301 // children.