Update signature of Lifetime::new

This commit is contained in:
David Tolnay 2018-03-31 23:46:25 +02:00
parent 8b44eb8bfc
commit ba002e1119
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 9 additions and 9 deletions

View File

@ -14,7 +14,7 @@ use syn::punctuated::Punctuated;
use internals::ast::{Data, Container}; use internals::ast::{Data, Container};
use internals::attr; use internals::attr;
use proc_macro2::{Span, Term}; use proc_macro2::Span;
// Remove the default from every type parameter because in the generated impls // Remove the default from every type parameter because in the generated impls
// they look like associated types: "error: associated type bindings are not // they look like associated types: "error: associated type bindings are not
@ -251,7 +251,7 @@ pub fn with_self_bound(
} }
pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Generics { pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Generics {
let bound = syn::Lifetime::new(Term::new(lifetime, Span::call_site())); let bound = syn::Lifetime::new(lifetime, Span::call_site());
let def = syn::LifetimeDef { let def = syn::LifetimeDef {
attrs: Vec::new(), attrs: Vec::new(),
lifetime: bound, lifetime: bound,

View File

@ -10,7 +10,7 @@ use syn::{self, Ident, Index, Member};
use syn::punctuated::Punctuated; use syn::punctuated::Punctuated;
use syn::spanned::Spanned; use syn::spanned::Spanned;
use quote::{ToTokens, Tokens}; use quote::{ToTokens, Tokens};
use proc_macro2::{Literal, Span, Term}; use proc_macro2::{Literal, Span};
use bound; use bound;
use fragment::{Expr, Fragment, Match, Stmts}; use fragment::{Expr, Fragment, Match, Stmts};
@ -181,8 +181,8 @@ enum BorrowedLifetimes {
impl BorrowedLifetimes { impl BorrowedLifetimes {
fn de_lifetime(&self) -> syn::Lifetime { fn de_lifetime(&self) -> syn::Lifetime {
match *self { match *self {
BorrowedLifetimes::Borrowed(_) => syn::Lifetime::new(Term::new("'de", Span::call_site())), BorrowedLifetimes::Borrowed(_) => syn::Lifetime::new("'de", Span::call_site()),
BorrowedLifetimes::Static => syn::Lifetime::new(Term::new("'static", Span::call_site())), BorrowedLifetimes::Static => syn::Lifetime::new("'static", Span::call_site()),
} }
} }
@ -190,7 +190,7 @@ impl BorrowedLifetimes {
match *self { match *self {
BorrowedLifetimes::Borrowed(ref bounds) => Some(syn::LifetimeDef { BorrowedLifetimes::Borrowed(ref bounds) => Some(syn::LifetimeDef {
attrs: Vec::new(), attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::new("'de", Span::call_site())), lifetime: syn::Lifetime::new("'de", Span::call_site()),
colon_token: None, colon_token: None,
bounds: bounds.iter().cloned().collect(), bounds: bounds.iter().cloned().collect(),
}), }),
@ -2721,7 +2721,7 @@ impl<'a> ToTokens for DeTypeGenerics<'a> {
if self.0.borrowed.de_lifetime_def().is_some() { if self.0.borrowed.de_lifetime_def().is_some() {
let def = syn::LifetimeDef { let def = syn::LifetimeDef {
attrs: Vec::new(), attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::new("'de", Span::call_site())), lifetime: syn::Lifetime::new("'de", Span::call_site()),
colon_token: None, colon_token: None,
bounds: Punctuated::new(), bounds: Punctuated::new(),
}; };
@ -2747,7 +2747,7 @@ impl<'a> ToTokens for InPlaceTypeGenerics<'a> {
if self.0.borrowed.de_lifetime_def().is_some() { if self.0.borrowed.de_lifetime_def().is_some() {
let def = syn::LifetimeDef { let def = syn::LifetimeDef {
attrs: Vec::new(), attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::new("'de", Span::call_site())), lifetime: syn::Lifetime::new("'de", Span::call_site()),
colon_token: None, colon_token: None,
bounds: Punctuated::new(), bounds: Punctuated::new(),
}; };
@ -2772,7 +2772,7 @@ impl<'a> DeTypeGenerics<'a> {
fn place_lifetime() -> syn::LifetimeDef { fn place_lifetime() -> syn::LifetimeDef {
syn::LifetimeDef { syn::LifetimeDef {
attrs: Vec::new(), attrs: Vec::new(),
lifetime: syn::Lifetime::new(Term::new("'place", Span::call_site())), lifetime: syn::Lifetime::new("'place", Span::call_site()),
colon_token: None, colon_token: None,
bounds: Punctuated::new(), bounds: Punctuated::new(),
} }