From bfc187f23a80a02135b2d76fb1e92adc7d5759ce Mon Sep 17 00:00:00 2001
From: Moritz Ulrich <moritz@tarn-vedra.de>
Date: Mon, 28 Nov 2016 11:21:12 +0100
Subject: [PATCH] rustc: Loosen bootstrapping restrictions.

Newer nightlies check a new environment variable that if set will loosen
restrictions on which compiler version can be used for bootstrapping.

Upstream issue is at https://github.com/rust-lang/rust/pull/37265
---
 pkgs/development/compilers/rust/rustc.nix | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 18f5a41e51df..04543f17ec98 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -46,6 +46,12 @@ stdenv.mkDerivation {
 
   NIX_LDFLAGS = optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
 
+  # Enable nightly features in stable compiles (used for
+  # bootstrapping, see https://github.com/rust-lang/rust/pull/37265).
+  # This loosens the hard restrictions on bootstrapping-compiler
+  # versions.
+  RUSTC_BOOTSTRAP = "1";
+
   src = fetchgit {
     url = https://github.com/rust-lang/rust;
     rev = srcRev;