code: func (vis *bodySafetyVisitor) checkComprehensionSafety(tv VarSet, body Body) Body {
  	bv := body.Vars(safetyCheckVarVisitorParams)
  	bv.Update(vis.globals)
  	uv := tv.Diff(bv)
  	for v := range uv {
  		vis.unsafe.Add(vis.current, v)
  	}
  
  	// Check body for safety, reordering as necessary.
  	r, u := reorderBodyForSafety(vis.arity, vis.globals, body)
  	if len(u) == 0 {
  		return r
  	}
  
  	vis.unsafe.Update(u)
  	return body
  }
docs: // Check term for safety. This is analogous to the rule head safety check.