about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-07-11 18:40:13 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-07-11 18:40:13 +0530
commitbb73c7a38d629261bde49dfe272c503ce7c2a43e (patch)
tree32244ff25c40cda059a7b3fd10862e33b7814a1a /src
parentf7f28c8b26af35fb495f60b43d0c6361c587045f (diff)
parent682a007d24ada56f2455b69a6977f780fca15d80 (diff)
downloadrust-bb73c7a38d629261bde49dfe272c503ce7c2a43e.tar.gz
rust-bb73c7a38d629261bde49dfe272c503ce7c2a43e.zip
Rollup merge of #26932 - tsurai:master, r=steveklabnik
Simple adjustment to auto select the nightly channel for examples using unstable feature.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/playpen.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/playpen.js b/src/librustdoc/html/static/playpen.js
index ff947d93fca..b7a5f202629 100644
--- a/src/librustdoc/html/static/playpen.js
+++ b/src/librustdoc/html/static/playpen.js
@@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
         return;
     }
 
+    var featureRegexp = new RegExp('^\s*#!\\[feature\\(\.*?\\)\\]');
     var elements = document.querySelectorAll('pre.rust');
 
     Array.prototype.forEach.call(elements, function(el) {
@@ -29,8 +30,14 @@ document.addEventListener('DOMContentLoaded', function() {
             a.setAttribute('class', 'test-arrow');
 
             var code = el.previousElementSibling.textContent;
+
+            var channel = '';
+            if (featureRegexp.test(code)) {
+                channel = '&version=nightly';
+            }
+
             a.setAttribute('href', window.playgroundUrl + '?code=' +
-                           encodeURIComponent(code));
+                           encodeURIComponent(code) + channel);
             a.setAttribute('target', '_blank');
 
             el.appendChild(a);