diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rustc/generic.nix
index 9df259cee8e2..8b3c61d52715 100644
--- a/pkgs/development/compilers/rustc/generic.nix
+++ b/pkgs/development/compilers/rustc/generic.nix
@@ -138,6 +138,10 @@ stdenv.mkDerivation {
     sed -i configure \
       -e '/probe_need CFG_CURLORWGET/d'
 
+    # Fix the use of jemalloc prefixes which our jemalloc doesn't have
+    [ -f src/liballoc_jemalloc/lib.rs ] && sed -i 's,je_,,g' src/liballoc_jemalloc/lib.rs
+    [ -f src/liballoc/heap.rs ] && sed -i 's,je_,,g' src/liballoc/heap.rs # Remove for 1.4.0+
+
     # Useful debugging parameter
     #export VERBOSE=1
   '';
diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix
index e02725299073..d40cdf75ad17 100644
--- a/pkgs/development/libraries/jemalloc/default.nix
+++ b/pkgs/development/libraries/jemalloc/default.nix
@@ -8,11 +8,6 @@ stdenv.mkDerivation rec {
     sha256 = "1wiydkp8a4adwsgfsd688hpv2z7hjv5manhckchk96v6qdsbqk91";
   };
 
-  # Rust refers to jemalloc functions directly so make sure the prefix matchs.
-  configureFlags = [
-    "--with-jemalloc-prefix=je_"
-  ];
-
   meta = with stdenv.lib; {
     homepage = http://www.canonware.com/jemalloc/index.html;
     description = "a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support";