mirror of https://github.com/rwf2/Rocket.git
Update codegen for 2017-09-25 nightly.
This commit is contained in:
parent
805b24e60a
commit
9f4daf4474
|
@ -8,8 +8,8 @@ use yansi::Color::{Red, Yellow, Blue, White};
|
|||
use version_check::{supports_features, is_min_version, is_min_date};
|
||||
|
||||
// Specifies the minimum nightly version needed to compile Rocket's codegen.
|
||||
const MIN_DATE: &'static str = "2017-08-10";
|
||||
const MIN_VERSION: &'static str = "1.21.0-nightly";
|
||||
const MIN_DATE: &'static str = "2017-09-25";
|
||||
const MIN_VERSION: &'static str = "1.22.0-nightly";
|
||||
|
||||
fn main() {
|
||||
let ok_channel = supports_features();
|
||||
|
|
|
@ -144,10 +144,8 @@
|
|||
#![allow(deprecated)]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
extern crate rustc;
|
||||
extern crate syntax;
|
||||
extern crate syntax_ext;
|
||||
extern crate syntax_pos;
|
||||
extern crate rustc_plugin;
|
||||
extern crate rocket;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use syntax::ast::Ident;
|
||||
use syntax::ext::base::ExtCtxt;
|
||||
use syntax::codemap::{Span, Spanned, BytePos};
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
|
||||
use utils::span;
|
||||
use utils::{span, SpanExt};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Param {
|
||||
|
@ -67,13 +67,11 @@ impl<'s, 'a, 'c> Iterator for ParamIter<'s, 'a, 'c> {
|
|||
(false, full_param)
|
||||
};
|
||||
|
||||
let mut param_span = self.span;
|
||||
param_span.lo = self.span.lo + BytePos(start as u32);
|
||||
param_span.hi = self.span.lo + BytePos((end + 1) as u32);
|
||||
let param_span = self.span.trim_left(start).shorten_to(end + 1);
|
||||
|
||||
// Advance the string and span.
|
||||
self.string = &self.string[(end + 1)..];
|
||||
self.span.lo = self.span.lo + BytePos((end + 1) as u32);
|
||||
self.span = self.span.trim_left(end + 1);
|
||||
|
||||
let spanned_ident = span(Ident::from_str(param), param_span);
|
||||
if is_many {
|
||||
|
|
|
@ -18,29 +18,24 @@ pub trait SpanExt {
|
|||
}
|
||||
|
||||
impl SpanExt for Span {
|
||||
fn trim_left(mut self, length: usize) -> Span {
|
||||
self.lo = self.lo + BytePos(length as u32);
|
||||
self
|
||||
fn trim_left(self, length: usize) -> Span {
|
||||
self.with_lo(self.lo() + BytePos(length as u32))
|
||||
}
|
||||
|
||||
fn trim_right(mut self, length: usize) -> Span {
|
||||
self.hi = self.hi - BytePos(length as u32);
|
||||
self
|
||||
fn trim_right(self, length: usize) -> Span {
|
||||
self.with_hi(self.hi() - BytePos(length as u32))
|
||||
}
|
||||
|
||||
fn shorten_to(mut self, to_length: usize) -> Span {
|
||||
self.hi = self.lo + BytePos(to_length as u32);
|
||||
self
|
||||
fn shorten_to(self, to_length: usize) -> Span {
|
||||
self.with_hi(self.lo() + BytePos(to_length as u32))
|
||||
}
|
||||
|
||||
fn shorten_upto(mut self, length: usize) -> Span {
|
||||
self.lo = self.hi - BytePos(length as u32);
|
||||
self
|
||||
fn shorten_upto(self, length: usize) -> Span {
|
||||
self.with_lo(self.hi() - BytePos(length as u32))
|
||||
}
|
||||
|
||||
fn trim(mut self, length: u32) -> Span {
|
||||
self.lo = self.lo + BytePos(length);
|
||||
self.hi = self.hi - BytePos(length);
|
||||
self
|
||||
fn trim(self, length: u32) -> Span {
|
||||
self.with_lo(self.lo() + BytePos(length))
|
||||
.with_hi(self.hi() - BytePos(length))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue