   compiled match_spec, nor can it be stored on disk).
   """
   @spec compile_requirement(Requirement.t()) :: Requirement.t()
-  def compile_requirement(%Requirement{matchspec: spec} = req) do
-    %{req | matchspec: :ets.match_spec_compile(spec), compiled: true}
+  def compile_requirement(requirement) do
+    Requirement.compile(requirement)
   end
 
   defp to_matchable(%Version{major: major, minor: minor, patch: patch, pre: pre}, allow_pre?) do

  def parse_requirement(string) when is_binary(string) do
    case Version.Parser.parse_requirement(string) do
      {:ok, spec} ->
        {:ok, %Requirement{source: string, matchspec: spec, compiled: false}}

      :error ->
        :error

  def parse_requirement!(string) when is_binary(string) do
    case Version.Parser.parse_requirement(string) do
      {:ok, spec} ->
        Requirement.new(string, spec)

      :error ->
        raise InvalidRequirementError, string
