diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 05404de1d8..d7a26d2f46 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2020 Matthew Kraai <kraai@ftbfs.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -690,6 +691,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
           "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y")))
     (package
       (inherit base-rust)
+      (outputs (cons "rustfmt" (package-outputs base-rust)))
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
@@ -701,7 +703,36 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                    ;; This test is known to fail on aarch64 and powerpc64le:
                    ;; https://github.com/rust-lang/rust/issues/45410
                    (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
-                 #t)))))))))
+                 #t))
+             (add-after 'configure 'enable-extended-build
+               (lambda* _
+                 (substitute* "config.toml"
+                   (("[[]build[]]") "[build]\nextended = true"))
+                 #t))
+             (replace 'build
+               (lambda* _
+                 (invoke "./x.py" "build")
+                 (invoke "./x.py" "build" "src/tools/cargo")
+                 (invoke "./x.py" "build" "src/tools/rustfmt")))
+             (replace 'check
+               (lambda* _
+                 (invoke "./x.py" "-j1" "test" "-vv")
+                 (invoke "./x.py" "-j1" "test" "src/tools/cargo")
+                 (invoke "./x.py" "-j1" "test" "src/tools/rustfmt")
+                 #t))
+             (replace 'install
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (invoke "./x.py" "install")
+                 (substitute* "config.toml"
+                   ;; replace prefix to specific output
+                   (("prefix = \"[^\"]*\"")
+                    (string-append "prefix = \"" (assoc-ref outputs "cargo") "\"")))
+                 (invoke "./x.py" "install" "cargo")
+                 (substitute* "config.toml"
+                   ;; replace prefix to specific output
+                   (("prefix = \"[^\"]*\"")
+                    (string-append "prefix = \"" (assoc-ref outputs "rustfmt") "\"")))
+                 (invoke "./x.py" "install" "rustfmt"))))))))))
 
 ;;; Rust 1.25 release support work with llvm 6--but build with llvm 6 is
 ;;; not determenistic due to <https://github.com/rust-lang/rust/issues/50556>.
@@ -764,6 +795,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
           `(modify-phases ,phases
              ;; binaryen was replaced with LLD project from LLVM
              (delete 'dont-build-native)
+             (delete 'enable-extended-build)
              (replace 'check
                (lambda* _
                  ;; Enable parallel execution.
@@ -773,7 +805,9 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                                                   (parallel-job-count))))))
                    (invoke "./x.py" parallel-job-spec "test" "-vv")
                    (invoke "./x.py" parallel-job-spec "test"
-                           "src/tools/cargo"))))
+                           "src/tools/cargo")
+                   (invoke "./x.py" parallel-job-spec "test"
+                           "src/tools/rustfmt"))))
              (replace 'remove-unsupported-tests
                (lambda* _
                  ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
@@ -844,6 +878,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                  ;; `prefix' directory should exist before `install' call
                  (mkdir-p (assoc-ref outputs "out"))
                  (mkdir-p (assoc-ref outputs "cargo"))
+                 (mkdir-p (assoc-ref outputs "rustfmt"))
                  #t))
              (add-after 'patch-cargo-tests 'disable-thinlto-test
                (lambda* _
