Update Rust
This commit is contained in:
parent
110930a558
commit
e01af11eaa
5 changed files with 7 additions and 9 deletions
|
@ -19,7 +19,6 @@
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! #![feature(plugin)]
|
//! #![feature(plugin)]
|
||||||
//! #![allow(unstable)]
|
|
||||||
//!
|
//!
|
||||||
//! extern crate maud;
|
//! extern crate maud;
|
||||||
//! #[plugin] #[no_link] extern crate maud_macros;
|
//! #[plugin] #[no_link] extern crate maud_macros;
|
||||||
|
@ -154,7 +153,7 @@
|
||||||
//! As with literals, expression values are escaped by default. Use a
|
//! As with literals, expression values are escaped by default. Use a
|
||||||
//! `$$` prefix to disable this behavior.
|
//! `$$` prefix to disable this behavior.
|
||||||
|
|
||||||
#![allow(unstable)]
|
#![feature(core, io)]
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::old_io::{IoError, IoErrorKind, IoResult};
|
use std::old_io::{IoError, IoErrorKind, IoResult};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![crate_type = "dylib"]
|
#![crate_type = "dylib"]
|
||||||
#![feature(plugin_registrar, quote)]
|
#![feature(plugin_registrar, quote)]
|
||||||
#![allow(unstable)]
|
#![feature(core, rustc_private)]
|
||||||
|
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
extern crate rustc;
|
extern crate rustc;
|
||||||
|
|
|
@ -109,7 +109,7 @@ impl<'cx, 's, 'i, 'r> Parser<'cx, 's, 'i, 'r> {
|
||||||
// Block
|
// Block
|
||||||
[TtDelimited(_, ref d), ..] if d.delim == token::DelimToken::Brace => {
|
[TtDelimited(_, ref d), ..] if d.delim == token::DelimToken::Brace => {
|
||||||
self.shift(1);
|
self.shift(1);
|
||||||
self.block(d.tts.as_slice())
|
self.block(&d.tts)
|
||||||
},
|
},
|
||||||
// ???
|
// ???
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -127,7 +127,7 @@ impl<'cx, 's, 'i, 'r> Parser<'cx, 's, 'i, 'r> {
|
||||||
fn literal(&mut self, tt: &TokenTree, minus: bool) {
|
fn literal(&mut self, tt: &TokenTree, minus: bool) {
|
||||||
let lit = self.new_rust_parser(vec![tt.clone()]).parse_lit();
|
let lit = self.new_rust_parser(vec![tt.clone()]).parse_lit();
|
||||||
match lit_to_string(self.render.cx, lit, minus) {
|
match lit_to_string(self.render.cx, lit, minus) {
|
||||||
Some(s) => self.render.string(s.as_slice(), Escape::Escape),
|
Some(s) => self.render.string(&s, Escape::Escape),
|
||||||
None => {},
|
None => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ fn lit_to_string(cx: &ExtCtxt, lit: Lit, minus: bool) -> Option<String> {
|
||||||
return None;
|
return None;
|
||||||
},
|
},
|
||||||
LitChar(c) => result.push(c),
|
LitChar(c) => result.push(c),
|
||||||
LitInt(x, _) => result.push_str(x.to_string().as_slice()),
|
LitInt(x, _) => result.push_str(&x.to_string()),
|
||||||
LitFloat(s, _) | LitFloatUnsuffixed(s) => result.push_str(s.get()),
|
LitFloat(s, _) | LitFloatUnsuffixed(s) => result.push_str(s.get()),
|
||||||
LitBool(b) => result.push_str(if b { "true" } else { "false" }),
|
LitBool(b) => result.push_str(if b { "true" } else { "false" }),
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ use syntax::ptr::P;
|
||||||
|
|
||||||
use maud;
|
use maud;
|
||||||
|
|
||||||
#[derive(Copy, PartialEq, Show)]
|
#[derive(Copy)]
|
||||||
pub enum Escape {
|
pub enum Escape {
|
||||||
PassThru,
|
PassThru,
|
||||||
Escape,
|
Escape,
|
||||||
|
@ -68,7 +68,7 @@ impl<'cx, 's> Renderer<'cx, 's> {
|
||||||
Escape::PassThru => s.into_cow(),
|
Escape::PassThru => s.into_cow(),
|
||||||
Escape::Escape => maud::escape(s).into_cow(),
|
Escape::Escape => maud::escape(s).into_cow(),
|
||||||
};
|
};
|
||||||
self.write(s.as_slice());
|
self.write(&s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append the result of an expression, with the specified escaping method.
|
/// Append the result of an expression, with the specified escaping method.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![allow(unstable)]
|
|
||||||
|
|
||||||
extern crate maud;
|
extern crate maud;
|
||||||
#[plugin] #[no_link] extern crate maud_macros;
|
#[plugin] #[no_link] extern crate maud_macros;
|
||||||
|
|
Loading…
Add table
Reference in a new issue