       (delete-file racer-tmp-file-name)
       (when (string-match "^PREFIX \\(.+\\),\\(.+\\),\\(.*\\)$" (nth 0 lines))
         (match-string 3 (nth 0 lines))))))
+
+(defun racer--company-prefix ()
+    "Returns the symbol to complete. If racer-begin-after-member-access is t,
+begins completion automatically if the cursor is followed by a dot or ::."
+  (if racer-begin-after-member-access
+    (company-grab-symbol-cons "\\.\\|::" 2)
+    (company-grab-symbol)))
+
+(defun racer--company-location (arg)
+  (let ((fname (get-text-property 0 'fname arg))
+        (linenum (get-text-property 0 'linenum arg)))
+    (cons fname (string-to-number linenum))))
 
 (defun racer--complete-at-point-fn ()
   "Run the racer complete command and process the results."

(defun racer-activate ()
  "Add Racer as the completion backend for the current buffer."
  (company-mode)
  (set (make-local-variable 'company-backends) '(racer-company-complete))
  (setq-local company-idle-delay nil))

(defun racer--syntax-highlight (str)
  "Apply font-lock properties to a string of Rust code."

                (contextstr (match-string 6 line)))
            (put-text-property 0 1 'contextstr contextstr completion)
            (put-text-property 0 1 'matchtype matchtype completion)
            (put-text-property 0 1 'fname fname completion)
            (put-text-property 0 1 'linenum linenum completion)
            (push completion racer-completion-results))))
      racer-completion-results)))

