         end
 
     quote do
-      timeout = unquote(timeout)
+      timeout = ExUnit.Assertions.__timeout__(unquote(timeout), :assert_receive_timeout)
 
       {received, unquote(vars)} =
         receive do

    receive_clause = refute_receive_clause(pattern, failure_message)

    quote do
      receive do
        unquote(receive_clause)
      after
        unquote(timeout) -> false
      end
    end
  end

        fn message ->
          unquote(suppress_warning(quoted_pattern))
        end
      end

    failure_message =
