I suspect that you can get the same without `eval` with something like:
(defmacro xref--defstruct (name &rest fields)
(declare (indent 1))
`(cl-defstruct ,(if (>= 27 emacs-major-version) name
(remq (assq :noinline name) name))
,@fields))
(xref--defstruct (xref-item
(:noinline t)
(:constructor xref-make (summary location)))
"An xref item describes a reference to a location somewhere."
summary location)
(xref--defstruct (xref-match-item
(:noinline t)
(:include xref-item)
(:constructor xref-make-match (summary location length)))
"A match xref item describes a search result."
length))))