From 4bbc58a3b29cfae2184a11dfb113ed11072af90c Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 30 May 2019 10:08:30 -0700 Subject: [PATCH] Support rust edition in playground. The endpoint was recently updated to support the edition param. --- src/theme/book.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/theme/book.js b/src/theme/book.js index 1aff593f14..ca73ee14d0 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -101,11 +101,15 @@ function playpen_text(playpen) { } let text = playpen_text(code_block); + let classes = code_block.querySelector('code').classList; + let has_2018 = classes.contains("edition2018"); + let edition = has_2018 ? "2018" : "2015"; var params = { version: "stable", optimize: "0", - code: text + code: text, + edition: edition }; if (text.indexOf("#![feature") !== -1) {