Update codegen for 2017-09-25 nightly.

This commit is contained in:
Sergio Benitez 2017-09-25 19:31:46 -07:00
parent a60c9e812e
commit 651a245bd5
3 changed files with 16 additions and 22 deletions

View File

@ -8,7 +8,7 @@ use yansi::Color::{Red, Yellow, Blue, White};
use version_check::{supports_features, is_min_version, is_min_date}; use version_check::{supports_features, is_min_version, is_min_date};
// Specifies the minimum nightly version needed to compile Rocket's codegen. // Specifies the minimum nightly version needed to compile Rocket's codegen.
const MIN_DATE: &'static str = "2017-09-19"; const MIN_DATE: &'static str = "2017-09-25";
const MIN_VERSION: &'static str = "1.22.0-nightly"; const MIN_VERSION: &'static str = "1.22.0-nightly";
fn main() { fn main() {

View File

@ -137,7 +137,7 @@ impl UriParams {
})?; })?;
// Set the end of the args_span to be the end of the args. // Set the end of the args_span to be the end of the args.
args_span.hi = parser.prev_span.hi; args_span = args_span.with_hi(parser.prev_span.hi());
// A 'colon' was used but there are no arguments. // A 'colon' was used but there are no arguments.
if arguments.is_empty() { if arguments.is_empty() {

View File

@ -24,39 +24,33 @@ pub trait SpanExt {
} }
impl SpanExt for Span { impl SpanExt for Span {
fn trim_left(mut self, length: usize) -> Span { fn trim_left(self, length: usize) -> Span {
self.lo = self.lo + BytePos(length as u32); self.with_lo(self.lo() + BytePos(length as u32))
self
} }
fn trim_right(mut self, length: usize) -> Span { fn trim_right(self, length: usize) -> Span {
self.hi = self.hi - BytePos(length as u32); self.with_hi(self.hi() - BytePos(length as u32))
self
} }
fn shorten_to(mut self, to_length: usize) -> Span { fn shorten_to(self, to_length: usize) -> Span {
self.hi = self.lo + BytePos(to_length as u32); self.with_hi(self.lo() + BytePos(to_length as u32))
self
} }
fn shorten_upto(mut self, length: usize) -> Span { fn shorten_upto(self, length: usize) -> Span {
self.lo = self.hi - BytePos(length as u32); self.with_lo(self.hi() - BytePos(length as u32))
self
} }
fn trim(mut self, length: u32) -> Span { fn trim(self, length: u32) -> Span {
self.lo = self.lo + BytePos(length); self.with_lo(self.lo() + BytePos(length))
self.hi = self.hi - BytePos(length); .with_hi(self.hi() - BytePos(length))
self
} }
fn wrap<T>(self, node: T) -> Spanned<T> { fn wrap<T>(self, node: T) -> Spanned<T> {
Spanned { node: node, span: self } Spanned { node: node, span: self }
} }
fn expand(mut self, left: usize, right: usize) -> Span { fn expand(self, left: usize, right: usize) -> Span {
self.lo = self.lo + BytePos(left as u32); self.with_lo(self.lo() + BytePos(left as u32))
self.hi = self.lo + BytePos(right as u32); .with_hi(self.lo() + BytePos(right as u32))
self
} }
} }