 
       :error ->
         :error
+    end
+  end
+
+  @doc """
+  Parses a version requirement string into a `Version.Requirement` struct.
+
+  If `string` is an invalid requirement, a `Version.InvalidRequirementError` is raised.
+
+  ## Examples
+
+      iex> Version.parse_requirement!("== 2.0.1")
+      #Version.Requirement<== 2.0.1>
+
+      iex> Version.parse_requirement!("== == 2.0.1")
+      ** (Version.InvalidRequirementError) invalid requirement: "== == 2.0.1"
+
+  """
+  @doc since: "1.8.0"
+  @spec parse_requirement!(String.t()) :: Requirement.t()
+  def parse_requirement!(string) when is_binary(string) do
+    case Version.Parser.parse_requirement(string) do
+      {:ok, spec} ->
+        %Requirement{source: string, matchspec: spec, compiled: false}
+
+      :error ->
+        raise InvalidRequirementError, string
     end
   end
 

  @doc """
  Parses a version string into a `Version`.

  If `string` is an invalid version, an `InvalidVersionError` is raised.

  ## Examples


  def match?(version, requirement, opts \\ [])

  def match?(version, requirement, opts) when is_binary(requirement) do
    match?(version, parse_requirement!(requirement), opts)
  end

  def match?(version, %Requirement{matchspec: spec, compiled: false}, opts) do
